diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java index 94a626a..7a64ce9 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java @@ -14,12 +14,14 @@ import com.zcloud.util.DateUtil; import com.zcloud.util.Jurisdiction; import com.zcloud.util.Tools; import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.util.CollectionUtils; import org.apache.tomcat.util.json.JSONParser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import java.util.*; @@ -158,25 +160,34 @@ public class TrafficSecurityCustomerManagementController extends BaseController pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 // 修改 客户管理表 customerManagementService.edit(pd); - 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); + if (pd.getString("contacts") != null && !pd.getString("contacts").isEmpty()) { + 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 { + if (!StringUtils.equals(contact.getString("CONTACT"), contactInfo.getString("CONTACT")) + || !StringUtils.equals(contact.getString("CONTACTPHONE"), contactInfo.getString("CONTACTPHONE")) + || !StringUtils.equals(contact.getString("CUSTOMERADDRESS"), contactInfo.getString("CUSTOMERADDRESS"))) { + contact.put("OPERATOR", Jurisdiction.getUSER_ID()); // 修改人id + contact.put("OPERATORNAME", Jurisdiction.getName()); // 修改人姓名 + contact.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 + customerManagementService.editContactInfo(contact); + } + } } } map.put("result", errInfo); diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java index 7ad7c2d..8433e48 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java @@ -233,12 +233,30 @@ public class TrafficSecurityWaybillRegistrationController extends BaseController if(!ObjectUtil.isEmpty(contactInfo)) { pd.put("ENTRUST_PERSON", contactInfo.getString("CONTACT_ID")); } + if(!contactInfo.getString("CONTACTPHONE").equals(pd.getString("CLIENTCONTACTPHONE"))) { + PageData entrust = new PageData(); + entrust.put("CONTACTPHONE", pd.getString("CLIENTCONTACTPHONE")); + entrust.put("CUSTOMERCONTACT_ID",contactInfo.getString("CUSTOMERCONTACT_ID")); + entrust.put("OPERATOR", Jurisdiction.getUSER_ID()); // 修改人id + entrust.put("OPERATORNAME", Jurisdiction.getName()); // 修改人姓名 + entrust.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 + trafficSecurityCustomerManagementService.editContactPhone(entrust); + } PageData pd3 = new PageData(); pd3.put("CONTACT", pd.getString("CONFIRM_PERSON")); PageData pageData = trafficSecurityCustomerManagementService.findByContactName(pd3); if(!ObjectUtil.isEmpty(pageData)) { pd.put("CONFIRM_PERSON", pageData.getString("CONTACT_ID")); } + if(!pageData.getString("CONTACTPHONE").equals(pd.getString("CONFIRMINGPHONE"))) { + PageData entrust = new PageData(); + entrust.put("CONTACTPHONE", pd.getString("CONFIRMINGPHONE")); + entrust.put("CUSTOMERCONTACT_ID",pageData.getString("CUSTOMERCONTACT_ID")); + entrust.put("OPERATOR", Jurisdiction.getUSER_ID()); // 修改人id + entrust.put("OPERATORNAME", Jurisdiction.getName()); // 修改人姓名 + entrust.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 + trafficSecurityCustomerManagementService.editContactPhone(entrust); + } trafficSecurityWaybillRegistrationService.edit(pd); map.put("result", errInfo); 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 1eaaa44..4cab824 100644 --- a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCustomerContactMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCustomerContactMapper.java @@ -20,4 +20,6 @@ public interface TrafficSecurityCustomerContactMapper { PageData findByContactId(String pd); void deleteContactById(PageData pd); + + void editContactPhone(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 b895da2..9c66316 100644 --- a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCustomerManagementService.java +++ b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCustomerManagementService.java @@ -35,4 +35,6 @@ public interface TrafficSecurityCustomerManagementService { PageData findByContactId(String pd); void deleteContactById(PageData pd); + + void editContactPhone(PageData entrust); } 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 a52639d..0fa60eb 100644 --- a/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityCustomerManagementServiceImpl.java +++ b/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityCustomerManagementServiceImpl.java @@ -90,4 +90,9 @@ public class TrafficSecurityCustomerManagementServiceImpl implements TrafficSecu public void deleteContactById(PageData pd) { customerContactMapper.deleteContactById(pd); } + + @Override + public void editContactPhone(PageData pd) { + customerContactMapper.editContactPhone(pd); + } } diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml index 9bc2524..8908fec 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml @@ -110,6 +110,18 @@ f.CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID} + + update + f + set + f.CONTACTPHONE = #{CONTACTPHONE}, + f.OPERATOR = #{OPERATOR}, + f.OPERATORNAME = #{OPERATORNAME}, + f.OPERATTIME = #{OPERATTIME} + where + f.CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID} + + update