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.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<PageData> 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<PageData> 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);

View File

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

View File

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

View File

@ -35,4 +35,6 @@ public interface TrafficSecurityCustomerManagementService {
PageData findByContactId(String 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) {
customerContactMapper.deleteContactById(pd);
}
@Override
public void editContactPhone(PageData pd) {
customerContactMapper.editContactPhone(pd);
}
}

View File

@ -110,6 +110,18 @@
f.CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID}
</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">
update
<include refid="tableName"></include>