BUG优化

dev
xiepeng 2024-04-16 11:22:38 +08:00
parent c3b5ed3417
commit 6544fe9706
6 changed files with 69 additions and 19 deletions

View File

@ -14,12 +14,14 @@ import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction; import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Tools; import com.zcloud.util.Tools;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.util.CollectionUtils;
import org.apache.tomcat.util.json.JSONParser; import org.apache.tomcat.util.json.JSONParser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.*; import java.util.*;
@ -158,25 +160,34 @@ public class TrafficSecurityCustomerManagementController extends BaseController
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间
// 修改 客户管理表 // 修改 客户管理表
customerManagementService.edit(pd); customerManagementService.edit(pd);
List<PageData> contacts = JSONArray.parseArray(pd.getString("contacts"), PageData.class); if (pd.getString("contacts") != null && !pd.getString("contacts").isEmpty()) {
for (PageData contact : contacts) { List<PageData> contacts = JSONArray.parseArray(pd.getString("contacts"), PageData.class);
PageData contactInfo = customerManagementService.findByContactId(contact.getString("CUSTOMERCONTACT_ID")); for (PageData contact : contacts) {
if(ObjectUtil.isEmpty(contactInfo)) { PageData contactInfo = customerManagementService.findByContactId(contact.getString("CUSTOMERCONTACT_ID"));
PageData pageData = new PageData(); if (ObjectUtil.isEmpty(contactInfo)) {
pageData.put("CUSTOMERADDRESS_ID", this.get32UUID()); PageData pageData = new PageData();
pageData.put("ISDELETE", 0); pageData.put("CUSTOMERADDRESS_ID", this.get32UUID());
pageData.put("CUSTOMERCONTACT_ID", this.get32UUID()); pageData.put("ISDELETE", "0");
pageData.put("CREATOR", Jurisdiction.getUSER_ID()); pageData.put("CUSTOMERCONTACT_ID", this.get32UUID());
pageData.put("CREATORNAME", Jurisdiction.getUsername()); pageData.put("CREATOR", Jurisdiction.getUSER_ID());
pageData.put("CUSTOMERMANAGEMENT_ID",pd.getString("CUSTOMERMANAGEMENT_ID")); pageData.put("CREATORNAME", Jurisdiction.getUsername());
pageData.put("CONTACT_ID", this.get32UUID()); pageData.put("CUSTOMERMANAGEMENT_ID", pd.getString("CUSTOMERMANAGEMENT_ID"));
pageData.put("CREATETIME", DateUtil.date2Str(new Date())); pageData.put("CONTACT_ID", this.get32UUID());
pageData.put("CONTACT", contact.getString("CONTACT")); pageData.put("CREATETIME", DateUtil.date2Str(new Date()));
pageData.put("CUSTOMERADDRESS", contact.getString("CUSTOMERADDRESS")); pageData.put("CONTACT", contact.getString("CONTACT"));
pageData.put("CONTACTPHONE", contact.getString("CONTACTPHONE")); pageData.put("CUSTOMERADDRESS", contact.getString("CUSTOMERADDRESS"));
customerManagementService.saveContact(pageData); pageData.put("CONTACTPHONE", contact.getString("CONTACTPHONE"));
}else{ customerManagementService.saveContact(pageData);
customerManagementService.editContactInfo(contact); } 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); map.put("result", errInfo);

View File

@ -233,12 +233,30 @@ public class TrafficSecurityWaybillRegistrationController extends BaseController
if(!ObjectUtil.isEmpty(contactInfo)) { if(!ObjectUtil.isEmpty(contactInfo)) {
pd.put("ENTRUST_PERSON", contactInfo.getString("CONTACT_ID")); 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(); PageData pd3 = new PageData();
pd3.put("CONTACT", pd.getString("CONFIRM_PERSON")); pd3.put("CONTACT", pd.getString("CONFIRM_PERSON"));
PageData pageData = trafficSecurityCustomerManagementService.findByContactName(pd3); PageData pageData = trafficSecurityCustomerManagementService.findByContactName(pd3);
if(!ObjectUtil.isEmpty(pageData)) { if(!ObjectUtil.isEmpty(pageData)) {
pd.put("CONFIRM_PERSON", pageData.getString("CONTACT_ID")); 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); trafficSecurityWaybillRegistrationService.edit(pd);
map.put("result", errInfo); map.put("result", errInfo);

View File

@ -20,4 +20,6 @@ public interface TrafficSecurityCustomerContactMapper {
PageData findByContactId(String pd); PageData findByContactId(String pd);
void deleteContactById(PageData pd); void deleteContactById(PageData pd);
void editContactPhone(PageData pd);
} }

View File

@ -35,4 +35,6 @@ public interface TrafficSecurityCustomerManagementService {
PageData findByContactId(String pd); PageData findByContactId(String pd);
void deleteContactById(PageData pd); void deleteContactById(PageData pd);
void editContactPhone(PageData entrust);
} }

View File

@ -90,4 +90,9 @@ public class TrafficSecurityCustomerManagementServiceImpl implements TrafficSecu
public void deleteContactById(PageData pd) { public void deleteContactById(PageData pd) {
customerContactMapper.deleteContactById(pd); customerContactMapper.deleteContactById(pd);
} }
@Override
public void editContactPhone(PageData pd) {
customerContactMapper.editContactPhone(pd);
}
} }

View File

@ -110,6 +110,18 @@
f.CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID} f.CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID}
</update> </update>
<update id="editContactPhone">
update
<include refid="tableName"/> f
set
f.CONTACTPHONE = #{CONTACTPHONE},
f.OPERATOR = #{OPERATOR},
f.OPERATORNAME = #{OPERATORNAME},
f.OPERATTIME = #{OPERATTIME}
where
f.CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID}
</update>
<delete id="deleteContact"> <delete id="deleteContact">
update update
<include refid="tableName"></include> <include refid="tableName"></include>