From da30f04dbed1e91e8979f51e3ba6e88119446c6b Mon Sep 17 00:00:00 2001 From: xiepeng Date: Wed, 8 May 2024 17:57:23 +0800 Subject: [PATCH] =?UTF-8?q?BUG=E4=BC=98=E5=8C=96=20=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E8=BF=90=E5=8D=95=20=E6=B7=BB=E5=8A=A0=E8=AF=A6=E6=83=85=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=88=A4=E6=96=AD=20=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=9A=84=E6=96=B0=E5=A2=9E=E8=BF=90=E5=8D=95?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E8=81=94=E7=B3=BB=E4=BA=BA=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=88=A0=E9=99=A4=20=E5=9C=B0=E7=82=B9=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=9A=84=E6=96=B0=E5=A2=9E=E8=BF=90=E5=8D=95=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=E8=81=94=E7=B3=BB=E4=BA=BA=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...cSecurityCustomerManagementController.java | 40 ++++++++++++++----- ...cSecurityLocationManagementController.java | 22 +++++----- ...SecurityWaybillRegistrationController.java | 27 ++++++++++++- .../TrafficSecurityCustomerContactMapper.java | 2 + ...fficSecurityCustomerManagementService.java | 2 +- ...SecurityCustomerManagementServiceImpl.java | 4 +- .../TrafficSecurityCustomerContactMapper.xml | 13 +++++- ...afficSecurityWaybillRegistrationMapper.xml | 6 ++- 8 files changed, 91 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java index edef176..df88e60 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java @@ -17,6 +17,7 @@ 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.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -46,7 +47,6 @@ public class TrafficSecurityCustomerManagementController extends BaseController Map map = new HashMap<>(); String errInfo = "success"; PageData pd = this.getPageData(); // 获取页面提交的数据 - String customermanagement_id = this.get32UUID(); // 生成主键ID pd.put("CUSTOMERMANAGEMENT_ID", customermanagement_id); // 设置客户管理ID pd.put("CUSTOMERNAME_ID", this.get32UUID()); @@ -55,9 +55,7 @@ public class TrafficSecurityCustomerManagementController extends BaseController pd.put("CREATORNAME", Jurisdiction.getName()); // 设置创建人姓名 pd.put("CREATETIME", DateUtil.date2Str(new Date())); // 设置创建时间 pd.put("ISDELETE", "0"); // 设置删除标志 - customerManagementService.save(pd); - if (pd.getString("contacts") != null && !pd.getString("contacts").isEmpty()) { List contacts = JSON.parseArray(pd.getString("contacts"), PageData.class); for (PageData contact : contacts) { @@ -73,7 +71,6 @@ public class TrafficSecurityCustomerManagementController extends BaseController contactPd.put("CONTACTPHONE", contact.get("CONTACTPHONE")); contactPd.put("CUSTOMERADDRESS", contact.get("CUSTOMERADDRESS")); contactPd.put("ISDELETE", "0"); // 设置删除标志 - customerManagementService.saveContact(contactPd); } } @@ -93,7 +90,6 @@ public class TrafficSecurityCustomerManagementController extends BaseController pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID page.setPd(pd); List varList = customerManagementService.listForSecurityCustomerManagement(page); - map.put("varList", varList); map.put("page", page); map.put("result", errInfo); @@ -108,7 +104,7 @@ public class TrafficSecurityCustomerManagementController extends BaseController */ @RequestMapping(value = "/delete") @ResponseBody - public Object delete() throws Exception { + public Object delete(Page page) throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); @@ -117,6 +113,21 @@ public class TrafficSecurityCustomerManagementController extends BaseController pd.put("DELETORNAME", Jurisdiction.getName());//删除人姓名 pd.put("DELETETIME", DateUtil.date2Str(new Date()));//删除时间 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + // 获取当前客户下的所有联系人 + List customers = customerManagementService.findByCustomerManagementId(pd); + // 获取所有订单 + PageData pageData = new PageData(); + pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + page.setPd(pageData); + List waybillRegistrations = trafficSecurityWaybillRegistrationService.listForSecurityWaybill(page); + for (PageData customer : customers) { + if(waybillRegistrations.stream() + .filter(waybillRegistration -> waybillRegistration.containsValue(customer.getString("CONTACT_ID"))).findAny().isPresent()) { + map.put("pd", "1"); + map.put("result", errInfo); + return map; + } + } customerManagementService.delete(pd); map.put("result", errInfo); return map; @@ -162,7 +173,6 @@ public class TrafficSecurityCustomerManagementController extends BaseController Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); - pd.put("OPERATOR", Jurisdiction.getUSER_ID()); // 修改人id pd.put("OPERATORNAME", Jurisdiction.getName()); // 修改人姓名 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 @@ -180,9 +190,9 @@ public class TrafficSecurityCustomerManagementController extends BaseController pageData.put("CUSTOMERCONTACT_ID", this.get32UUID()); pageData.put("CREATOR", Jurisdiction.getUSER_ID()); pageData.put("CREATORNAME", Jurisdiction.getName()); - pageData.put("CUSTOMERMANAGEMENT_ID", pd.getString("CUSTOMERMANAGEMENT_ID")); pageData.put("CONTACT_ID", this.get32UUID()); pageData.put("CREATETIME", DateUtil.date2Str(new Date())); + pageData.put("CUSTOMERMANAGEMENT_ID", pd.getString("CUSTOMERMANAGEMENT_ID")); pageData.put("CONTACT", contact.getString("CONTACT")); pageData.put("CUSTOMERADDRESS", contact.getString("CUSTOMERADDRESS")); pageData.put("CONTACTPHONE", contact.getString("CONTACTPHONE")); @@ -206,7 +216,7 @@ public class TrafficSecurityCustomerManagementController extends BaseController @RequestMapping(value = "/deleteContactInfo") @ResponseBody - public Object deleteContactInfo() throws Exception { + public Object deleteContactInfo(Page page) throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); @@ -215,6 +225,18 @@ public class TrafficSecurityCustomerManagementController extends BaseController pd.put("DELETORNAME", Jurisdiction.getName());//删除人姓名 pd.put("DELETETIME", DateUtil.date2Str(new Date()));//删除时间 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + PageData contact = customerManagementService.findByContactId(pd.getString("CUSTOMERCONTACT_ID")); + String contactId = contact.getString("CONTACT_ID"); + PageData pageData = new PageData(); + pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + page.setPd(pageData); + List orderList = trafficSecurityWaybillRegistrationService.listForSecurityWaybill(page); + if (orderList.stream().parallel() + .filter(order -> order.containsValue(contactId)).findAny().isPresent()) { + map.put("pd", "1"); + map.put("result", errInfo); + return map; + } customerManagementService.deleteContactById(pd); map.put("result", errInfo); return map; diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLocationManagementController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLocationManagementController.java index 9bd15cd..ae851b0 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLocationManagementController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLocationManagementController.java @@ -86,7 +86,7 @@ public class TrafficSecurityLocationManagementController extends BaseController */ @RequestMapping(value="/delete") @ResponseBody - public Object delete() throws Exception{ + public Object delete(Page page) throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); @@ -95,16 +95,20 @@ public class TrafficSecurityLocationManagementController extends BaseController pd.put("DELETORNAME", Jurisdiction.getUsername());//删除人姓名 pd.put("DELETETIME", DateUtil.date2Str(new Date()));//删除时间 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); - /*PageData locationInfo = locationManagementService.getTrafficLocationInfo(pd); + PageData locationInfo = locationManagementService.getTrafficLocationInfo(pd); + // 获取地点Id + String locationId = locationInfo.getString("LOCATIONNAME_ID"); + // 获取所有运单 PageData pageData = new PageData(); - pageData.put("ORIGIN", locationInfo.getString("LOCATIONNAME_ID")); pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); - List pageDataList = trafficSecurityWaybillRegistrationService.getWaybillRegistrationInfo(pageData); - pageDataList.stream() - .forEach(data -> { - data.put("ORIGIN", ""); - trafficSecurityWaybillRegistrationService.edit(data); - });*/ + page.setPd(pageData); + List waybillRegistrationList = trafficSecurityWaybillRegistrationService.listForSecurityWaybill(page); + // 判断所有运单中是否有此地点 + if(waybillRegistrationList.stream().parallel().filter(data -> data.containsValue(locationId)).findAny().isPresent()) { + map.put("pd", "1"); + map.put("result", errInfo); + return map; + } locationManagementService.delete(pd); map.put("result", errInfo); return map; diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java index b868051..309fdc0 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java @@ -12,6 +12,7 @@ import com.zcloud.service.system.UsersService; import com.zcloud.util.*; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; +import org.jose4j.lang.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -186,7 +187,7 @@ public class TrafficSecurityWaybillRegistrationController extends BaseController PageData pd = new PageData(); pd = this.getPageData(); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); - pd = trafficSecurityWaybillRegistrationService.findById(pd);//根据ID读= + pd = trafficSecurityWaybillRegistrationService.findById(pd);//根据ID读 pd.put("ENTRUST_PERSON", pd.getString("CLIENTCONTACTPERSON")); pd.put("CONFIRM_PERSON", pd.getString("CONFIRMINGPERSON")); List dispatchers = Arrays.stream(pd.getString("DISPATCHER").split(",")).collect(Collectors.toList()); @@ -236,11 +237,33 @@ public class TrafficSecurityWaybillRegistrationController extends BaseController pd.put("OPERATOR", Jurisdiction.getUSER_ID()); // 修改人id pd.put("OPERATORNAME", Jurisdiction.getName()); // 修改人姓名 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 + PageData pd2 = new PageData(); + // 修改委托方手机号 + if(!StringUtils.isEmpty(pd.getString("ENTRUST_PERSON"))) { + pd2.put("CONTACT_ID",pd.getString("ENTRUST_PERSON")); + PageData client = trafficSecurityCustomerManagementService.findContactByContactId(pd2); + if(!ObjectUtil.isEmpty(client)) { + if(!StringUtils.equals(client.getString("CONTACTPHONE"), pd.getString("CLIENTCONTACTPHONE"))) { + client.put("CONTACTPHONE",pd.getString("CLIENTCONTACTPHONE")); + trafficSecurityCustomerManagementService.editContactInfo(client); + } + } + } + // 修改确认方手机号 + if(!StringUtils.isEmpty(pd.getString("CONFIRM_PERSON"))) { + pd2.put("CONTACT_ID", pd.getString("CONFIRM_PERSON")); + PageData confirmed = trafficSecurityCustomerManagementService.findContactByContactId(pd2); + if(!ObjectUtil.isEmpty(confirmed)) { + if(!StringUtils.equals(confirmed.getString("CONTACTPHONE"), pd.getString("CONFIRMINGPHONE"))) { + confirmed.put("CONTACTPHONE",pd.getString("CONFIRMINGPHONE")); + trafficSecurityCustomerManagementService.editContactInfo(confirmed); + } + } + } trafficSecurityWaybillRegistrationService.edit(pd); map.put("result", errInfo); map.put("pd", pd); 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 4cab824..8262786 100644 --- a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCustomerContactMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCustomerContactMapper.java @@ -22,4 +22,6 @@ public interface TrafficSecurityCustomerContactMapper { void deleteContactById(PageData pd); void editContactPhone(PageData pd); + + PageData findContactByContactId(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 9c66316..cf1e130 100644 --- a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCustomerManagementService.java +++ b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCustomerManagementService.java @@ -36,5 +36,5 @@ public interface TrafficSecurityCustomerManagementService { void deleteContactById(PageData pd); - void editContactPhone(PageData entrust); + PageData findContactByContactId(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 0fa60eb..2c70b15 100644 --- a/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityCustomerManagementServiceImpl.java +++ b/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityCustomerManagementServiceImpl.java @@ -92,7 +92,7 @@ public class TrafficSecurityCustomerManagementServiceImpl implements TrafficSecu } @Override - public void editContactPhone(PageData pd) { - customerContactMapper.editContactPhone(pd); + public PageData findContactByContactId(PageData pd) { + return customerContactMapper.findContactByContactId(pd); } } diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml index d03dea4..f6ef835 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCustomerContactMapper.xml @@ -141,7 +141,7 @@ DELETOR = #{DELETOR}, DELETETIME = #{DELETETIME} where - CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID } + CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID} + + diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityWaybillRegistrationMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityWaybillRegistrationMapper.xml index cb8e8cb..32ac66a 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityWaybillRegistrationMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityWaybillRegistrationMapper.xml @@ -257,7 +257,10 @@ btcc.CONTACTPHONE AS ENTRUST_PHONE, btcc2.CONTACTPHONE AS CONFIRM_PHONE, b.ADMINISTRATIVEREGIONS AS DEPARTURE_ADDR, - b2.ADMINISTRATIVEREGIONS AS GOAL_ADDR + b2.ADMINISTRATIVEREGIONS AS GOAL_ADDR, + oa.NAME AS DEPARTMENTNAME, + btcc.CONTACT AS ENTRUSTPERSON, + btcc2.CONTACT AS CONFIRMPERSON from f left join bus_traffic_operatingvehicle e on f.TRANSPORTVEHICLE = e.PLATE_NUMBER @@ -271,6 +274,7 @@ left join bus_traffic_customer_management c2 on f.CONFIRMER = c2.CUSTOMERNAME_ID left join bus_traffic_customer_contact btcc on btcc.CONTACT_ID = f.CLIENTCONTACTPERSON left join bus_traffic_customer_contact btcc2 on btcc2.CONTACT_ID = f.CONFIRMINGPERSON + left join oa_department oa on oa.DEPARTMENT_ID = f.DEPARTMENT_ID where f.WAYBILLREGISTRATION_ID = #{WAYBILLREGISTRATION_ID} AND