From c3b5ed3417a31b8048c26c6ef3b8a4fd456dee8f Mon Sep 17 00:00:00 2001 From: xiepeng Date: Tue, 16 Apr 2024 09:46:52 +0800 Subject: [PATCH] =?UTF-8?q?BUG=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...cSecurityCustomerManagementController.java | 43 +++++++++++++++---- .../TrafficSecurityCustomerContactMapper.java | 4 ++ ...fficSecurityCustomerManagementService.java | 4 ++ ...SecurityCustomerManagementServiceImpl.java | 10 +++++ .../TrafficSecurityCustomerContactMapper.xml | 22 +++++++++- 5 files changed, 74 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java index 19fa184..94a626a 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java @@ -1,5 +1,6 @@ package com.zcloud.controller.comprehensive; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -157,18 +158,44 @@ public class TrafficSecurityCustomerManagementController extends BaseController pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 // 修改 客户管理表 customerManagementService.edit(pd); - - String[] customercontactIds = pd.getString("CUSTOMERCONTACT_ID").split(","); - for (String customercontactId : customercontactIds) { - List contacts = JSONObject.parseArray(pd.getString("contacts"), PageData.class); - for (PageData contact : contacts) { - if(StringUtils.equals(contact.getString("CUSTOMERCONTACT_ID"), customercontactId)) { - customerManagementService.editUserInfo(contact); - } + List contacts = JSONArray.parseArray(pd.getString("contacts"), PageData.class); + for (PageData contact : contacts) { + PageData contactInfo = customerManagementService.findByContactId(contact.getString("CUSTOMERCONTACT_ID")); + if(ObjectUtil.isEmpty(contactInfo)) { + PageData pageData = new PageData(); + pageData.put("CUSTOMERADDRESS_ID", this.get32UUID()); + pageData.put("ISDELETE", 0); + pageData.put("CUSTOMERCONTACT_ID", this.get32UUID()); + pageData.put("CREATOR", Jurisdiction.getUSER_ID()); + pageData.put("CREATORNAME", Jurisdiction.getUsername()); + pageData.put("CUSTOMERMANAGEMENT_ID",pd.getString("CUSTOMERMANAGEMENT_ID")); + pageData.put("CONTACT_ID", this.get32UUID()); + pageData.put("CREATETIME", DateUtil.date2Str(new Date())); + pageData.put("CONTACT", contact.getString("CONTACT")); + pageData.put("CUSTOMERADDRESS", contact.getString("CUSTOMERADDRESS")); + pageData.put("CONTACTPHONE", contact.getString("CONTACTPHONE")); + customerManagementService.saveContact(pageData); + }else{ + customerManagementService.editContactInfo(contact); } } map.put("result", errInfo); map.put("pd", pd); return map; } + + @RequestMapping(value = "/deleteContactInfo") + @ResponseBody + public Object deleteContactInfo() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("DELETOR", Jurisdiction.getUSER_ID());//删除人id + pd.put("DELETORNAME", Jurisdiction.getUsername());//删除人姓名 + pd.put("DELETETIME", DateUtil.date2Str(new Date()));//删除时间 + customerManagementService.deleteContactById(pd); + map.put("result", errInfo); + return map; + } } diff --git a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCustomerContactMapper.java b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCustomerContactMapper.java index c737707..1eaaa44 100644 --- a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCustomerContactMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCustomerContactMapper.java @@ -16,4 +16,8 @@ public interface TrafficSecurityCustomerContactMapper { void deleteContact(PageData pd2); PageData findByContactName(PageData pd); + + PageData findByContactId(String pd); + + void deleteContactById(PageData pd); } diff --git a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCustomerManagementService.java b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCustomerManagementService.java index d577c07..b895da2 100644 --- a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCustomerManagementService.java +++ b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCustomerManagementService.java @@ -31,4 +31,8 @@ public interface TrafficSecurityCustomerManagementService { void editUserInfo(PageData pd); PageData findByContactName(PageData pd2); + + PageData findByContactId(String pd); + + void deleteContactById(PageData pd); } diff --git a/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityCustomerManagementServiceImpl.java b/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityCustomerManagementServiceImpl.java index 73fc72d..a52639d 100644 --- a/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityCustomerManagementServiceImpl.java +++ b/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityCustomerManagementServiceImpl.java @@ -80,4 +80,14 @@ public class TrafficSecurityCustomerManagementServiceImpl implements TrafficSecu public PageData findByContactName(PageData pd) { return customerContactMapper.findByContactName(pd); } + + @Override + public PageData findByContactId(String pd) { + return customerContactMapper.findByContactId(pd); + } + + @Override + public void deleteContactById(PageData pd) { + customerContactMapper.deleteContactById(pd); + } } diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml index 2e4c86d..9bc2524 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml @@ -121,6 +121,17 @@ CUSTOMERMANAGEMENT_ID = #{CUSTOMERMANAGEMENT_ID} + + update + + set + ISDELETE = '1', + DELETOR = #{DELETOR}, + DELETETIME = #{DELETETIME} + where + CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID } + + + +