BUG优化

电子运单 添加详情 删除判断
客户管理的新增运单存在的联系人无法删除
地点管理的新增运单存在的联系人无法删除
dev
xiepeng 2024-05-08 17:57:23 +08:00
parent 691cbf33c5
commit da30f04dbe
8 changed files with 91 additions and 25 deletions

View File

@ -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<String, Object> 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<PageData> 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<PageData> 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<String, String> map = new HashMap<String, String>();
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<PageData> customers = customerManagementService.findByCustomerManagementId(pd);
// 获取所有订单
PageData pageData = new PageData();
pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
page.setPd(pageData);
List<PageData> 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<String, Object> map = new HashMap<String, Object>();
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<String, String> map = new HashMap<String, String>();
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<PageData> 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;

View File

@ -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<String,String> map = new HashMap<String,String>();
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<PageData> pageDataList = trafficSecurityWaybillRegistrationService.getWaybillRegistrationInfo(pageData);
pageDataList.stream()
.forEach(data -> {
data.put("ORIGIN", "");
trafficSecurityWaybillRegistrationService.edit(data);
});*/
page.setPd(pageData);
List<PageData> 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;

View File

@ -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<String> 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;
}
}

View File

@ -22,4 +22,6 @@ public interface TrafficSecurityCustomerContactMapper {
void deleteContactById(PageData pd);
void editContactPhone(PageData pd);
PageData findContactByContactId(PageData pd);
}

View File

@ -36,5 +36,5 @@ public interface TrafficSecurityCustomerManagementService {
void deleteContactById(PageData pd);
void editContactPhone(PageData entrust);
PageData findContactByContactId(PageData pd);
}

View File

@ -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);
}
}

View File

@ -141,7 +141,7 @@
DELETOR = #{DELETOR},
DELETETIME = #{DELETETIME}
where
CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID }
CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID}
</delete>
<select id="findByCustomerManagementId" resultType="com.zcloud.entity.PageData" parameterType="pd">
@ -174,5 +174,16 @@
AND f.CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID}
</select>
<select id="findContactByContactId" resultType="com.zcloud.entity.PageData">
select
*
from
<include refid="tableName"></include> f
where
f.ISDELETE = '0'
AND
f.CONTACT_ID = #{CONTACT_ID}
</select>
</mapper>

View File

@ -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
<include refid="tableName"></include> 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