diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java index 728b4184..7b73d17d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java @@ -530,18 +530,33 @@ public class SysCustomerController extends BaseController } return new SysCustomerVo(); } + + /** - * 作废物料信息 + * 加载作废客户信息弹窗 + */ + @GetMapping("/cancel/{id}") + public String cancel(@PathVariable("id") Long id, ModelMap mmap) { + SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(id); + mmap.put("sysCustomer", sysCustomer); + return prefix + "/cancel"; + } + + + /** + * 作废客户信息 */ @RequiresPermissions("system:customer:cancel") @Log(title = "客户信息", businessType = BusinessType.CANCEL) - @GetMapping( "/cancel/{id}") + @PostMapping( "/cancel") @ResponseBody - public AjaxResult cancel(@PathVariable("id") Long id){ - sysCustomerService.cancelSysCustomerById(id); - return AjaxResult.success(); + public AjaxResult cancel(SysCustomer sysCustomer){ + return toAjax(sysCustomerService.cancelSysCustomerByObject(sysCustomer)); + } + + /** * 恢复物料信息 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java index 2c5352db..ea8c5197 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java @@ -759,6 +759,7 @@ public class SysCustomer extends BaseEntity .append("customerId",getCustomerId()) .append("customerName",getCustomerName()) .append("createTime", getCreateTime()) + .append("cancelRemark",getCancelRemark()) .toString(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java index 3760c194..6530d657 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java @@ -79,6 +79,11 @@ public interface SysCustomerMapper int deleteSysCustomerByIds(String[] ids); + /** + * 根据客户资料对象作废客户资料 + * */ + int cancelSysCustomerByObject(SysCustomer sysCustomer); + List selectSysCustomerBycode(); SysCustomerVo selectSysCustomerByEnterpriseCode(String enterpriseCode); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java index 11073831..b60804a3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java @@ -110,4 +110,9 @@ public interface ISysCustomerService * 通过开票公司名称查询开票公司信息 * */ SysInvoice getSysInvoiceInfoByName(String invoiceCompanyName); + + /** + * 根据客户资料对象作废客户资料 + * */ + int cancelSysCustomerByObject(SysCustomer sysCustomer); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java index 14fc4b51..58b5f2cb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java @@ -516,4 +516,37 @@ public class SysCustomerServiceImpl implements ISysCustomerService } + /** + * 根据客户资料对象作废客户资料 + * */ + @Transactional(rollbackFor = Exception.class) + @Override + public int cancelSysCustomerByObject(SysCustomer sysCustomer) { + + SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerById(sysCustomer.getId()); + // 审核状态-待审核 + sysCustomerVo.setAuditStatus("0"); + SysUser user = ShiroUtils.getSysUser(); + // 启动流程 + String applyTitle = user.getUserName()+"发起了客户信息作废审批-"+ DateUtils.dateTimeNow(); + String instanceType = "cancel"; + SysCustomer tempSysCustomer = new SysCustomer(); + BeanUtils.copyProperties(sysCustomerVo,tempSysCustomer); + ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,tempSysCustomer, user); + String processInstanceId = processInstance.getProcessInstanceId(); + // 作废实例id + tempSysCustomer.setCancelInstanceId(processInstanceId); + // 存在提交完就流程结束的情况 + boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); + if(processIsFinish){ + // 审核状态-审核通过 + tempSysCustomer.setAuditStatus("1"); + // 使用状态-已作废 + tempSysCustomer.setUseStatus("2"); + } + + tempSysCustomer.setCancelRemark(sysCustomer.getCancelRemark()); + + return sysCustomerMapper.updateSysCustomer(tempSysCustomer); + } } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml index 641783ee..1130948c 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml @@ -62,6 +62,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + select id,enterprise_code,enterprise_name,english_name,customer_abbreviation ,customer_purser , @@ -71,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" customer_contact_id,customer_contact,customer_office,contact_number,customer_email,customer_fax, delivery_address_id,delivery_customer_person,delivery_customer_phone, delivery_address,delivery_customer_postal,delivery_customer_fax,business_members, - identifying_people,first_add_time,update_info_time, create_time ,audit_status,use_status,update_by,rmb_flag,usd_flag, + identifying_people,first_add_time,update_info_time, create_time ,audit_status,use_status,update_by,rmb_flag,usd_flag, cancel_remark, apply_user,apply_time , instance_id , instance_type from sys_customer @@ -220,6 +222,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, rmb_flag, usd_flag + cancel_remark, #{enterpriseCode}, @@ -274,6 +277,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, #{rmbFlag}, #{usdFlag} + #{cancelRemark}, @@ -323,6 +327,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" customer_remarks = #{customerRemarks}, customer_sign = #{customer_sign}, update_by = #{updateBy}, + update_time = #{updateTime}, instance_id = #{instanceId}, instance_type = #{instanceType}, submit_instance_id = #{submitInstanceId}, @@ -332,7 +337,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" apply_user = #{applyUser}, apply_time = #{applyTime}, rmb_flag = #{rmbFlag}, - usd_flag = #{usdFlag} + usd_flag = #{usdFlag}, + cancel_remark = #{cancelRemark}, where id = #{id} @@ -346,6 +352,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + update sys_customer set del_flag = '1', use_status = '2',cancel_remark = #{cancelRemark} + where enterprise_code = #{enterpriseCode} + + + update sys_customer set del_flag = '1' where id = #{id} diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/cancel.html b/ruoyi-admin/src/main/resources/templates/system/customer/cancel.html new file mode 100644 index 00000000..baa06c43 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/customer/cancel.html @@ -0,0 +1,32 @@ + + + + + + +
+
+ +
+ +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/customer.html b/ruoyi-admin/src/main/resources/templates/system/customer/customer.html index c7f3a1e0..d46c1720 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customer/customer.html +++ b/ruoyi-admin/src/main/resources/templates/system/customer/customer.html @@ -546,14 +546,14 @@ if (value == null) {return " ";} else { return value;} } }, - {title: '上次修改时间',field: 'updateInfoTime',}, + {title: '上次修改时间',field: 'updateTime',}, {title: '操作',align: 'center', formatter: function(value, row, index) { var actions = []; // 审核状态-审核通过 使用状态-是 未发起作废流程 if((row.auditStatus=="1" || row.auditStatus=="2") && !row.cancelInstanceId){ // 作废 - actions.push(' 作废'); + actions.push(' 作废'); // 编辑 actions.push(' 编辑 '); }else{ @@ -638,6 +638,16 @@ }); }); + + //作废 + function cancel(id) { + $.modal.confirm("确认要作废该客户资料吗?", function () { + var url = prefix + '/cancel/' + id; + $.modal.open("作废", url); + }) + } + + //导出 function exportCustomerInfo() { // rows为选中行的id diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/taskModifyApply.html b/ruoyi-admin/src/main/resources/templates/system/customer/taskModifyApply.html index 95eceb4d..01f512f5 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customer/taskModifyApply.html +++ b/ruoyi-admin/src/main/resources/templates/system/customer/taskModifyApply.html @@ -262,27 +262,27 @@ shiro:haspermission="customer:selectBusinessMembers"> -
- -
- - -
-
+
+
- + +
+
+
+ +
+
-
diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/taskYwjlVerify.html b/ruoyi-admin/src/main/resources/templates/system/customer/taskYwjlVerify.html index e06deacc..83d03a2e 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customer/taskYwjlVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/customer/taskYwjlVerify.html @@ -270,28 +270,29 @@
- -
- - + +
+
+ + +
+
- -
- - + +
+
- +
- +
-
- +
+
diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/taskYwzgVerify.html b/ruoyi-admin/src/main/resources/templates/system/customer/taskYwzgVerify.html index 42745cf2..ae9b18e1 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customer/taskYwzgVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/customer/taskYwzgVerify.html @@ -269,27 +269,27 @@
-
- -
- - -
-
+
+
- + +
+
+
+ +
+
-
diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/taskZozjVerify.html b/ruoyi-admin/src/main/resources/templates/system/customer/taskZozjVerify.html index 6fc47c7c..e903e0cf 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customer/taskZozjVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/customer/taskZozjVerify.html @@ -268,24 +268,25 @@
-
- -
- - -
-
+
+
- + +
+
+
+ +
+
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java index f7d5bf46..fd5c45e0 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -35,6 +35,9 @@ public class BaseEntity implements Serializable /** 备注 */ private String remark; + /** 作废理由*/ + private String cancelRemark; + /** 请求参数 */ private Map params; @@ -98,6 +101,14 @@ public class BaseEntity implements Serializable this.remark = remark; } + public String getCancelRemark() { + return cancelRemark; + } + + public void setCancelRemark(String cancelRemark) { + this.cancelRemark = cancelRemark; + } + public Map getParams() { if (params == null)