电子合同模块

This commit is contained in:
linjiabin 2024-04-08 14:02:17 +08:00
parent 834501b8ae
commit fc149fe345
30 changed files with 1640 additions and 5 deletions

View File

@ -0,0 +1,114 @@
package com.ruoyi.crm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.crm.domain.Contract;
import com.ruoyi.crm.service.IContractService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 合同列表Controller
*
* @author lin
* @date 2024-04-07
*/
@RestController
@RequestMapping("/crm/contract")
public class ContractController extends BaseController
{
@Autowired
private IContractService contractService;
/**
* 查询合同列表列表
*/
@PreAuthorize("@ss.hasPermi('crm:contract:list')")
@GetMapping("/list")
public TableDataInfo list(Contract contract)
{
startPage();
List<Contract> list = contractService.selectContractList(contract);
return getDataTable(list);
}
/**
* 导出合同列表列表
*/
@PreAuthorize("@ss.hasPermi('crm:contract:export')")
@Log(title = "合同列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Contract contract)
{
List<Contract> list = contractService.selectContractList(contract);
ExcelUtil<Contract> util = new ExcelUtil<Contract>(Contract.class);
util.exportExcel(response, list, "合同列表数据");
}
/**
* 获取合同列表详细信息
*/
@PreAuthorize("@ss.hasPermi('crm:contract:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(contractService.selectContractById(id));
}
/**
* 新增合同列表
*/
@PreAuthorize("@ss.hasPermi('crm:contract:add')")
@Log(title = "合同列表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Contract contract)
{
contract.setHandledBy(getUsername());
contract.setStatus("0");
return toAjax(contractService.insertContract(contract));
}
/**
* 修改合同列表
*/
@PreAuthorize("@ss.hasPermi('crm:contract:edit')")
@Log(title = "合同列表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Contract contract)
{
return toAjax(contractService.updateContract(contract));
}
/**
* 删除合同列表
*/
@PreAuthorize("@ss.hasPermi('crm:contract:remove')")
@Log(title = "合同列表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(contractService.deleteContractByIds(ids));
}
/** 审批订单 */
@PreAuthorize("@ss.hasPermi('crm:contract:approve')")
@Log(title = "订单", businessType = BusinessType.UPDATE)
@PutMapping("/approve/{id}")
public AjaxResult approve(@PathVariable Long id){
return toAjax(contractService.approve(id));
}
}

View File

@ -0,0 +1,68 @@
package com.ruoyi.crm.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.crm.domain.Contract;
import com.ruoyi.crm.domain.ElectronicContract;
import com.ruoyi.crm.service.IElectronicContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@RestController
@RequestMapping("/crm/electronicContract")
public class ElectronicContractController extends BaseController {
// private String basePath="D:\\CompanyProject\\img\\";
private String basePath = "/home/ruoyi/uploadPath";
@Autowired
private IElectronicContractService electronicContractService;
@GetMapping("/list")
public TableDataInfo list()
{
startPage();
List<ElectronicContract> list = electronicContractService.selectElectronicContractList();
return getDataTable(list);
}
@PostMapping()
public AjaxResult add(@RequestBody ElectronicContract electronicContract){
electronicContract.setFounder(getUsername());
electronicContract.setCreateTime(new Date());
System.out.println(electronicContract.getUrl());
return toAjax(electronicContractService.add(electronicContract));
}
@PostMapping("/upload")
public AjaxResult uploadpdf(MultipartFile file){
String originalFilename = file.getOriginalFilename();
String suffix = originalFilename.substring(originalFilename.lastIndexOf("."));//后缀.jpg等类型
//使用uuid随机生成文件名防止文件名重复造成文件覆盖
String fileName = UUID.randomUUID().toString()+suffix;
//创建一个目录对象
File dir=new File(basePath);
//判断目录是否存在
if(!dir.exists())
{
dir.mkdirs();
}
try {
file.transferTo(new File(basePath+fileName));
} catch (IOException e) {
e.printStackTrace();
}
return AjaxResult.success(fileName);
}
}

View File

@ -99,6 +99,12 @@ public class QuotationController extends BaseController
return toAjax(quotationService.updateQuotation(quotation)); return toAjax(quotationService.updateQuotation(quotation));
} }
@GetMapping("/quotationlist")
public AjaxResult quotationList(){
List<Quotation> quotationList = quotationService.selectAll();
return AjaxResult.success(quotationList);
}
/** /**
* 删除产品报价 * 删除产品报价
*/ */

View File

@ -0,0 +1,168 @@
package com.ruoyi.crm.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 合同列表对象 contract
*
* @author lin
* @date 2024-04-07
*/
public class Contract extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 合同名称 */
@Excel(name = "合同名称")
private String title;
/** 客户名称 */
@Excel(name = "客户名称")
private String customerName;
/** 客户编号 */
@Excel(name = "客户编号")
private String customerId;
/** 订单编号 */
@Excel(name = "订单编号")
private String orderNo;
/** 发起人 */
@Excel(name = "发起人")
private String handledBy;
/** 合同状态 */
@Excel(name = "合同状态")
private String status;
/** 合同金额 */
@Excel(name = "合同金额")
private BigDecimal contractPrice;
/** 发起时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发起时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setCustomerName(String customerName)
{
this.customerName = customerName;
}
public String getCustomerName()
{
return customerName;
}
public void setCustomerId(String customerId)
{
this.customerId = customerId;
}
public String getCustomerId()
{
return customerId;
}
public void setOrderNo(String orderNo)
{
this.orderNo = orderNo;
}
public String getOrderNo()
{
return orderNo;
}
public void setHandledBy(String handledBy)
{
this.handledBy = handledBy;
}
public String getHandledBy()
{
return handledBy;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setContractPrice(BigDecimal contractPrice)
{
this.contractPrice = contractPrice;
}
public BigDecimal getContractPrice()
{
return contractPrice;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("customerName", getCustomerName())
.append("customerId", getCustomerId())
.append("orderNo", getOrderNo())
.append("handledBy", getHandledBy())
.append("status", getStatus())
.append("contractPrice", getContractPrice())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.toString();
}
}

View File

@ -0,0 +1,75 @@
package com.ruoyi.crm.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
public class ElectronicContract extends BaseEntity {
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
@Excel(name = "模板地址")
private String url;
@Excel(name = "合同名称")
private String title;
@Excel(name = "创建人")
private String founder;
@Excel(name = "创建时间")
private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getFounder() {
return founder;
}
public void setFounder(String founder) {
this.founder = founder;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "ElectronicContract{" +
"id=" + id +
", url='" + url + '\'' +
", title='" + title + '\'' +
", founder='" + founder + '\'' +
", createTime=" + createTime +
'}';
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.crm.mapper;
import java.util.List;
import com.ruoyi.crm.domain.Contract;
/**
* 合同列表Mapper接口
*
* @author lin
* @date 2024-04-07
*/
public interface ContractMapper
{
/**
* 查询合同列表
*
* @param id 合同列表主键
* @return 合同列表
*/
public Contract selectContractById(Long id);
/**
* 查询合同列表列表
*
* @param contract 合同列表
* @return 合同列表集合
*/
public List<Contract> selectContractList(Contract contract);
/**
* 新增合同列表
*
* @param contract 合同列表
* @return 结果
*/
public int insertContract(Contract contract);
/**
* 修改合同列表
*
* @param contract 合同列表
* @return 结果
*/
public int updateContract(Contract contract);
/**
* 删除合同列表
*
* @param id 合同列表主键
* @return 结果
*/
public int deleteContractById(Long id);
/**
* 批量删除合同列表
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteContractByIds(Long[] ids);
}

View File

@ -0,0 +1,12 @@
package com.ruoyi.crm.mapper;
import com.ruoyi.crm.domain.ElectronicContract;
import java.util.List;
public interface ElectronicContractMapper {
List<ElectronicContract> selectElectronicContractList();
int add(ElectronicContract electronicContract);
}

View File

@ -58,4 +58,6 @@ public interface QuotationMapper
* @return 结果 * @return 结果
*/ */
public int deleteQuotationByIds(Long[] ids); public int deleteQuotationByIds(Long[] ids);
List<Quotation> selectList();
} }

View File

@ -0,0 +1,63 @@
package com.ruoyi.crm.service;
import java.util.List;
import com.ruoyi.crm.domain.Contract;
/**
* 合同列表Service接口
*
* @author lin
* @date 2024-04-07
*/
public interface IContractService
{
/**
* 查询合同列表
*
* @param id 合同列表主键
* @return 合同列表
*/
public Contract selectContractById(Long id);
/**
* 查询合同列表列表
*
* @param contract 合同列表
* @return 合同列表集合
*/
public List<Contract> selectContractList(Contract contract);
/**
* 新增合同列表
*
* @param contract 合同列表
* @return 结果
*/
public int insertContract(Contract contract);
/**
* 修改合同列表
*
* @param contract 合同列表
* @return 结果
*/
public int updateContract(Contract contract);
/**
* 批量删除合同列表
*
* @param ids 需要删除的合同列表主键集合
* @return 结果
*/
public int deleteContractByIds(Long[] ids);
/**
* 删除合同列表信息
*
* @param id 合同列表主键
* @return 结果
*/
public int deleteContractById(Long id);
int approve(Long id);
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.crm.service;
import com.ruoyi.crm.domain.ElectronicContract;
import java.util.List;
public interface IElectronicContractService {
List<ElectronicContract> selectElectronicContractList();
int add(ElectronicContract electronicContract);
}

View File

@ -58,4 +58,7 @@ public interface IQuotationService
* @return 结果 * @return 结果
*/ */
public int deleteQuotationById(Long id); public int deleteQuotationById(Long id);
List<Quotation> selectAll();
} }

View File

@ -0,0 +1,102 @@
package com.ruoyi.crm.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.crm.mapper.ContractMapper;
import com.ruoyi.crm.domain.Contract;
import com.ruoyi.crm.service.IContractService;
import javax.annotation.Resource;
/**
* 合同列表Service业务层处理
*
* @author lin
* @date 2024-04-07
*/
@Service
public class ContractServiceImpl implements IContractService
{
@Resource
private ContractMapper contractMapper;
/**
* 查询合同列表
*
* @param id 合同列表主键
* @return 合同列表
*/
@Override
public Contract selectContractById(Long id)
{
return contractMapper.selectContractById(id);
}
/**
* 查询合同列表列表
*
* @param contract 合同列表
* @return 合同列表
*/
@Override
public List<Contract> selectContractList(Contract contract)
{
return contractMapper.selectContractList(contract);
}
/**
* 新增合同列表
*
* @param contract 合同列表
* @return 结果
*/
@Override
public int insertContract(Contract contract)
{
return contractMapper.insertContract(contract);
}
/**
* 修改合同列表
*
* @param contract 合同列表
* @return 结果
*/
@Override
public int updateContract(Contract contract)
{
return contractMapper.updateContract(contract);
}
/**
* 批量删除合同列表
*
* @param ids 需要删除的合同列表主键
* @return 结果
*/
@Override
public int deleteContractByIds(Long[] ids)
{
return contractMapper.deleteContractByIds(ids);
}
/**
* 删除合同列表信息
*
* @param id 合同列表主键
* @return 结果
*/
@Override
public int deleteContractById(Long id)
{
return contractMapper.deleteContractById(id);
}
@Override
public int approve(Long id) {
Contract contract = contractMapper.selectContractById(id);
contract.setStatus("1");
return contractMapper.updateContract(contract);
}
}

View File

@ -146,6 +146,9 @@ public class CrmOrderServiceImpl implements ICrmOrderService
crmCustomer.setStatus(CustomerFolder.CUSTOMER.getCode()); crmCustomer.setStatus(CustomerFolder.CUSTOMER.getCode());
crmCustomer.setDealStatus("1"); crmCustomer.setDealStatus("1");
customerService.updateCrmCustomer(crmCustomer); customerService.updateCrmCustomer(crmCustomer);
return crmOrderMapper.updateCrmOrder(crmOrder); return crmOrderMapper.updateCrmOrder(crmOrder);
} }

View File

@ -0,0 +1,27 @@
package com.ruoyi.crm.service.impl;
import com.ruoyi.crm.domain.ElectronicContract;
import com.ruoyi.crm.mapper.ElectronicContractMapper;
import com.ruoyi.crm.service.IElectronicContractService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class ElectronicContractServiceImpl implements IElectronicContractService {
@Resource
private ElectronicContractMapper electronicContractMapper;
@Override
public List<ElectronicContract> selectElectronicContractList() {
return electronicContractMapper.selectElectronicContractList();
}
@Override
public int add(ElectronicContract electronicContract) {
return electronicContractMapper.add(electronicContract);
}
}

View File

@ -92,4 +92,9 @@ public class QuotationServiceImpl implements IQuotationService
{ {
return quotationMapper.deleteQuotationById(id); return quotationMapper.deleteQuotationById(id);
} }
@Override
public List<Quotation> selectAll() {
return quotationMapper.selectList();
}
} }

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.crm.mapper.ContractMapper">
<resultMap type="Contract" id="ContractResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="customerName" column="customer_name" />
<result property="customerId" column="customer_id" />
<result property="orderNo" column="order_no" />
<result property="handledBy" column="handled_by" />
<result property="status" column="status" />
<result property="contractPrice" column="contract_price" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
</resultMap>
<sql id="selectContractVo">
select id, title, customer_name, customer_id, order_no, handled_by, status, contract_price, start_time, end_time from contract
</sql>
<select id="selectContractList" parameterType="Contract" resultMap="ContractResult">
<include refid="selectContractVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>
<if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
<if test="handledBy != null and handledBy != ''"> and handled_by = #{handledBy}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="contractPrice != null "> and contract_price = #{contractPrice}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
</where>
</select>
<select id="selectContractById" parameterType="Long" resultMap="ContractResult">
<include refid="selectContractVo"/>
where id = #{id}
</select>
<insert id="insertContract" parameterType="Contract" useGeneratedKeys="true" keyProperty="id">
insert into contract
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">title,</if>
<if test="customerName != null">customer_name,</if>
<if test="customerId != null">customer_id,</if>
<if test="orderNo != null">order_no,</if>
<if test="handledBy != null">handled_by,</if>
<if test="status != null">status,</if>
<if test="contractPrice != null">contract_price,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">#{title},</if>
<if test="customerName != null">#{customerName},</if>
<if test="customerId != null">#{customerId},</if>
<if test="orderNo != null">#{orderNo},</if>
<if test="handledBy != null">#{handledBy},</if>
<if test="status != null">#{status},</if>
<if test="contractPrice != null">#{contractPrice},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
</trim>
</insert>
<update id="updateContract" parameterType="Contract">
update contract
<trim prefix="SET" suffixOverrides=",">
<if test="title != null">title = #{title},</if>
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="orderNo != null">order_no = #{orderNo},</if>
<if test="handledBy != null">handled_by = #{handledBy},</if>
<if test="status != null">status = #{status},</if>
<if test="contractPrice != null">contract_price = #{contractPrice},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteContractById" parameterType="Long">
delete from contract where id = #{id}
</delete>
<delete id="deleteContractByIds" parameterType="String">
delete from contract where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.crm.mapper.ElectronicContractMapper">
<resultMap type="ElectronicContract" id="ElectronicContractResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="url" column="url" />
<result property="founder" column="founder" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectElectronicContractVo">
select id, title, url, founder, create_time from electronic_contract
</sql>
<insert id="add" parameterType="ElectronicContract" useGeneratedKeys="true" keyProperty="id">
insert into electronic_contract
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">title,</if>
<if test="url != null">url,</if>
<if test="founder != null">founder,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">#{title},</if>
<if test="url != null">#{url},</if>
<if test="founder != null">#{founder},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<select id="selectElectronicContractList" resultMap="ElectronicContractResult">
<include refid="selectElectronicContractVo"/>
</select>
</mapper>

View File

@ -78,6 +78,9 @@
<include refid="selectQuotationVo"/> <include refid="selectQuotationVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="selectList" resultMap="QuotationResult">
<include refid="selectQuotationVo"/>
</select>
<insert id="insertQuotation" parameterType="Quotation" useGeneratedKeys="true" keyProperty="id"> <insert id="insertQuotation" parameterType="Quotation" useGeneratedKeys="true" keyProperty="id">
insert into quotation insert into quotation

View File

@ -0,0 +1,20 @@
package com.ruoyi.framework.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
// private String basePath="D:\\CompanyProject\\img\\";
private String basePath = "/home/ruoyi/uploadPath";
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
String filePath = "file:"+basePath;
//图片资源映射     //其中/images是访问图片资源的前缀比如要访问test1.png则全路径为http://localhost:端口号/images/test1.png
registry.addResourceHandler("/pdf/**")
.addResourceLocations(filePath);//此处为设置服务端存储图片的路径前段上传到后台的图片保存位置
}
}

View File

@ -99,7 +99,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage", .antMatchers("/login", "/register", "/captchaImage",
"/intelligentForm/selectDynamicDataById","/intelligentForm/collectData", "/intelligentForm/selectDynamicDataById","/intelligentForm/collectData",
"/h5/login/wxLogin","/h5/login/h5Login").anonymous() "/h5/login/wxLogin","/h5/login/h5Login","/crm/electronicContract/upload","/pdf/**").anonymous()
.antMatchers( .antMatchers(
HttpMethod.GET, HttpMethod.GET,
"/", "/",

View File

@ -50,10 +50,14 @@ public class TenantInterceptor implements HandlerInterceptor {
Pattern pattern = Pattern.compile("^/profile.*"); Pattern pattern = Pattern.compile("^/profile.*");
Pattern patterns = Pattern.compile("^/intelligentForm.*"); Pattern patterns = Pattern.compile("^/intelligentForm.*");
Pattern patternByWx = Pattern.compile("^/h5/login.*"); Pattern patternByWx = Pattern.compile("^/h5/login.*");
Pattern compile = Pattern.compile("/crm/electronicContract/upload");
Pattern compile1 = Pattern.compile("^/pdf.*");
Matcher matcher = pattern.matcher(url); Matcher matcher = pattern.matcher(url);
Matcher matchers = patterns.matcher(url); Matcher matchers = patterns.matcher(url);
Matcher matcherByWx = patternByWx.matcher(url); Matcher matcherByWx = patternByWx.matcher(url);
if (matcher.find() || matchers.find() || matcherByWx.find()){ Matcher matcher1 = compile.matcher(url);
Matcher matcher2 = compile1.matcher(url);
if (matcher.find() || matchers.find() || matcherByWx.find() || matcher1.find() || matcher2.find()){
//使用正则表达式过滤以"/profile","/intelligentForm"开头的请求路径直接放行 //使用正则表达式过滤以"/profile","/intelligentForm"开头的请求路径直接放行
return true; return true;
} }

View File

@ -36,6 +36,8 @@
}, },
"dependencies": { "dependencies": {
"@riophae/vue-treeselect": "0.4.0", "@riophae/vue-treeselect": "0.4.0",
"@vue-office/pdf": "^1.6.5",
"@vue/composition-api": "^1.7.2",
"axios": "0.24.0", "axios": "0.24.0",
"clipboard": "2.0.8", "clipboard": "2.0.8",
"core-js": "3.19.1", "core-js": "3.19.1",
@ -56,6 +58,7 @@
"vue-clipboard2": "^0.3.3", "vue-clipboard2": "^0.3.3",
"vue-count-to": "1.0.13", "vue-count-to": "1.0.13",
"vue-cropper": "0.5.5", "vue-cropper": "0.5.5",
"vue-demi": "^0.14.7",
"vue-meta": "2.4.0", "vue-meta": "2.4.0",
"vue-router": "3.4.9", "vue-router": "3.4.9",
"vuedraggable": "2.24.3", "vuedraggable": "2.24.3",

View File

@ -0,0 +1,51 @@
import request from '@/utils/request'
// 查询合同列表列表
export function listContract(query) {
return request({
url: '/crm/contract/list',
method: 'get',
params: query
})
}
// 查询合同列表详细
export function getContract(id) {
return request({
url: '/crm/contract/' + id,
method: 'get'
})
}
// 新增合同列表
export function addContract(data) {
return request({
url: '/crm/contract',
method: 'post',
data: data
})
}
// 修改合同列表
export function updateContract(data) {
return request({
url: '/crm/contract',
method: 'put',
data: data
})
}
// 删除合同列表
export function delContract(id) {
return request({
url: '/crm/contract/' + id,
method: 'delete'
})
}
//审批合同
export function approveContract(id){
return request({
url: '/crm/contract/approve/'+id,
method: 'put'
})
}

View File

@ -34,7 +34,14 @@ export function updateQuotation(data) {
data: data data: data
}) })
} }
//查询报价单列表
export function listquotation(query){
return request({
url: '/crm/quotation/quotationlist',
method: 'get',
params: query
})
}
// 删除产品报价 // 删除产品报价
export function delQuotation(id) { export function delQuotation(id) {
return request({ return request({

View File

@ -0,0 +1,18 @@
import request from '@/utils/request'
export function getelectronicContract() {
return request({
url: '/crm/electronicContract/list',
method: 'get'
})
}
// 新增合同模板
export function addelectronicContract(data) {
return request({
url: '/crm/electronicContract',
method: 'post',
data: data
})
}

View File

@ -0,0 +1,461 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="合同名称" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入合同名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户名称" prop="customerName">
<el-input
v-model="queryParams.customerName"
placeholder="请输入客户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户编号" prop="customerId">
<el-input
v-model="queryParams.customerId"
placeholder="请输入客户编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="报价单编号" prop="orderNo">
<el-input
v-model="queryParams.orderNo"
placeholder="请输入报价单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="发起人" prop="handledBy">
<el-input
v-model="queryParams.handledBy"
placeholder="请输入发起人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="合同金额" prop="contractPrice">
<el-input
v-model="queryParams.contractPrice"
placeholder="请输入合同金额"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="发起时间" prop="startTime">
<el-date-picker clearable
v-model="queryParams.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择发起时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker clearable
v-model="queryParams.endTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择结束时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['crm:contract:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['crm:contract:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['crm:contract:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['crm:contract:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="合同id" align="center" prop="id" />
<el-table-column label="合同名称" align="center" prop="title" />
<el-table-column label="客户名称" align="center" prop="customerName" />
<el-table-column label="客户编号" align="center" prop="customerId" />
<el-table-column label="报价单编号" align="center" prop="orderNo" />
<el-table-column label="发起人" align="center" prop="handledBy" />
<el-table-column label="合同金额" align="center" prop="contractPrice" />
<el-table-column label="报价单详情" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.row)"
v-hasPermi="['crm:quotation:details']"
>详情</el-button>
</template>
</el-table-column>
<el-table-column label="合同状态" align="center" prop="status" :formatter="statusFormatter"/>
<el-table-column label="发起时间" align="center" prop="startTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="结束时间" align="center" prop="endTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-if="scope.row.status==0"
size="mini" type="text"
icon="el-icon-edit"
@click="handleApprove(scope.row)"
v-hasPermi="['crm:contract:approve']"
>审核通过</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['crm:contract:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['crm:contract:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改合同列表对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="合同名称" prop="title">
<el-input v-model="form.title" placeholder="请输入合同名称" />
</el-form-item>
<el-form-item label="报价单编号" prop="orderNo">
<!-- <el-input v-model="form.orderNo" placeholder="请输入订单编号" /> -->
<el-select v-model="form.orderNo" placeholder="请选择报价单" @change="idchange(form.orderNo)">
<el-option v-for=" quotation in quotationList" :key="quotation.id" :label="quotation.id" :value="quotation.id" >
</el-option>
</el-select>
</el-form-item>
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="form.customerName" readonly />
</el-form-item>
<el-form-item label="客户编号" prop="customerId">
<el-input v-model="form.customerId" readonly />
</el-form-item>
<!-- <el-form-item label="发起人" prop="handledBy">
<el-input v-model="form.handledBy" placeholder="请输入发起人" />
</el-form-item> -->
<el-form-item label="合同金额" prop="contractPrice">
<el-input v-model="form.contractPrice" readonly />
</el-form-item>
<el-form-item label="发起时间" prop="startTime">
<el-date-picker clearable
v-model="form.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择发起时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker clearable
v-model="form.endTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择结束时间">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- // -->
<el-dialog :close-on-click-modal="false" title="详情" :visible.sync="open1" width="680px" append-to-body>
<el-form ref="form" :model="quotations" :rules="rules" label-width="80px">
<el-form-item label="客户名称" prop="customName">
<el-input v-model="quotations.customName" />
</el-form-item>
<el-form-item label="客户编号" prop="customCode">
<el-input v-model="quotations.customCode" />
</el-form-item>
<el-form-item label="产品名称" prop="productName">
<el-input v-model="quotations.productName" />
</el-form-item>
<el-form-item label="品牌" prop="brand">
<el-input v-model="quotations.brand" />
</el-form-item>
<el-form-item label="折扣" prop="discount">
<el-input v-model="quotations.discount" />
</el-form-item>
<el-form-item label="价格" prop="standardPrice">
<el-input v-model="quotations.standardPrice" />
</el-form-item>
<el-form-item label="数量" prop="num">
<el-input v-model="quotations.num" />
</el-form-item>
<el-form-item label="单位" prop="unit">
<el-input v-model="quotations.unit" />
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import { listContract, getContract, delContract, addContract, updateContract,approveContract } from "@/api/crm/contract";
import { listquotation,getQuotation} from "@/api/crm/quotation";
export default {
name: "Contract",
data() {
return {
quotationList:[],
quotations:[],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
contractList: [],
//
title: "",
//
open: false,
open1:false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
title: null,
customerName: null,
customerId: null,
orderNo: null,
handledBy: null,
status: null,
contractPrice: null,
startTime: null,
endTime: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
this.getquotationList ();
},
methods: {
/** 查询合同列表列表 */
idchange(id){
getQuotation(id).then(response => {
// this.form = response.data
this.form.customerId = response.data.customCode;
this.form.customerName = response.data.customName;
this.form.contractPrice = response.data.totalPrice;
console.log("1212",response.data);
})
},
getList() {
this.loading = true;
listContract(this.queryParams).then(response => {
this.contractList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
title: null,
customerName: null,
customerId: null,
orderNo: null,
handledBy: null,
status: null,
contractPrice: null,
startTime: null,
endTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
handleEdit(row){
const orderNo = row.orderNo
console.log(orderNo,'121');
getQuotation(orderNo).then(response => {
this.quotations = response.data;
console.log(response.data,21);
this.open1 = true;
})
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 查询报价单列表 */
getquotationList () {
this.loading = true
listquotation().then((response) => {
this.quotationList = response.data
this.loading = false
console.log(this.quotationList)
})
},
handleApprove (row) {
const id = row.id
this.$modal.confirm('确认金额和客户信息,确认审核业绩吗?').then(function () {
return approveContract(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("审核成功");
}).catch(() => { });
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加合同列表";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getContract(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改合同列表";
});
},
statusFormatter(row, column, cellValue) {
const statusDict = { 0: "等待审核", 1: "审核通过", 2: "审核未通过" };
return statusDict[cellValue] || "未知状态";
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateContract(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addContract(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除合同列表编号为"' + ids + '"的数据项?').then(function() {
return delContract(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('crm/contract/export', {
...this.queryParams
}, `contract_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,214 @@
<template>
<div class="app-container" style="display: flex;flex-wrap: wrap">
<el-card class="box-card">
<div class="container">
<el-button type="primary" plain @click="handleAdd" style="border: none;">
+ 新建合同模板
</el-button>
</div>
</el-card>
<el-card class="box-card" v-for="o in cardList" :key="o" >
<div class="pdf-template">
<vue-office-pdf
style="height: 200px;"
:src="o.url"
@rendered="renderedHandler"
@error="errorHandler"
/>
</div>
<div style="margin-top: 20px;">
<span style="font-size: 24px;
color: black;
background-color:#ffffff;
border-color: #fdfdff;">{{o.title}}</span>
</div>
<div style="margin-top: 20px;">
<button @click="downloadFile(o.url)">下载</button>
</div>
<div style="display: flex;justify-content: space-between;margin-top: 50px;">
<div>
<span style="font-size: 16px;
color: #999595;
background-color:#ffffff;
border-color: #fdfdff;">创建人{{o.founder}}</span>
</div>
<div style="font-size: 16px;
color: #999595;
background-color:#ffffff;
border-color: #fdfdff;">创建时间{{formatDate(o.createTime)}}</div>
</div>
</el-card>
<!-- 添加表单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body @closed="cancel">
<div style="text-align: center">
<div><span>上传合同模板</span>
<!-- <input type="file" @change="changeHandle"/> -->
<el-upload
ref="upload"
class="upload-demo"
action="http://101.43.112.107:8080/api/crm/electronicContract/upload"
:on-success="changeHandle"
multiple
>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<vue-office-pdf :src="this.src" style="height: 300px;"/>
</div>
<div>
<span>标题</span>
<el-input style="border-bottom: 1px solid skyblue;margin-bottom: 10px" v-model="addParams.title" placeholder="请输入合同标题" />
</div>
<!-- <div v-for="(item,index) in inputarr" key="index" style="margin-bottom: 10px;">
<span>字段</span> <el-input style="border: 1px solid #DCDFE6;border-radius: 3px; " v-model="inputarr[index]" placeholder="请输入字段"></el-input>
</div> -->
<!-- <div>
<el-button @click="adinput" style="text-align: center;width: 90%;background-color: rgb(232,244,255);color:#1890ff">添加字段</el-button>
</div> -->
</div>
<br>
<div class="el-input-foot">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
//VueOfficePdf
import VueOfficePdf from '@vue-office/pdf'
import axios from 'axios';
import {getelectronicContract,addelectronicContract} from "@/api/crm/template";
export default {
components: {
VueOfficePdf
},
data() {
return {
cardList:[],
src: '',
title:'',
// inputarr:[''],
open:false,
addParams: {
title:'',
url:'',
},
}
},
mounted() {
this.getList();
},
methods: {
//
downloadFile(fileName) {
const fileUrl = fileName; // URL
axios.get(fileUrl, { responseType: 'blob' })
.then(response => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', fileName);
document.body.appendChild(link);
link.click();
})
.catch(error => {
console.error(error);
});
},
formatDate(dateString) {
const date = new Date(dateString);
const year = date.getFullYear();
const month = ('0' + (date.getMonth() + 1)).slice(-2);
const day = ('0' + date.getDate()).slice(-2);
return `${year}-${month}-${day}`;
},
//
changeHandle(response, file, fileList){
let url = response.msg;
let pdfurl= "http://101.43.112.107:8080/api/pdf/"+url;
this.addParams.url = pdfurl
this.src = pdfurl;
},
renderedHandler() {
console.log("渲染完成")
},
errorHandler() {
console.log("渲染失败")
},
/** 新增按钮操作 */
handleAdd() {
// this.inputarr = []
this.addParams = {
title:'',
// inputarr: []
}
this.open = true;
this.title = "添加合同模板";
},
//
cancel() {
this.addParams = '';
this.$refs.upload.clearFiles();
this.open = false;
this.src = '';
},
getList(){
console.log(11)
getelectronicContract().then(response => {
this.cardList = response.rows;
})
},
//
submitForm(){
addelectronicContract(this.addParams).then(response => {
// this.cardList = response.data;
// this.total = response.total;
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
},
}
}
</script>
<style scoped>
.el-input-foot{
padding: 20px;
padding-top: 10px;
text-align: center;
box-sizing: border-box;
}
::v-deep.el-input--medium{
width: 80%;
}
::v-deep.el-input--medium .el-input__inner{
border: none;
/* border-bottom:1px solid blue; */
}
.box-card {
width:30%;
margin-bottom: 10px;
margin-right:10px;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100px; /* 可根据需要调整高度 */
color: #ccc; /* 灰白色 */
}
/* .template{
width: 100%;
} */
</style>

View File

@ -332,7 +332,6 @@ export default {
}, },
handleEdit(row){ handleEdit(row){
const orderNo = row.orderNo const orderNo = row.orderNo
console.log(orderNo,'121'); console.log(orderNo,'121');
getCustomerOrder(orderNo).then(response => { getCustomerOrder(orderNo).then(response => {

View File

@ -582,6 +582,7 @@ export default {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加产品报价"; this.title = "添加产品报价";
// console.log(this.form)
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {

View File

@ -35,7 +35,8 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `http://127.0.0.1:8080/api`, // target: `http://127.0.0.1:8080/api`,
target: `http://101.43.112.107:8080/api`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''