BUG优化

dev
xiepeng 2024-04-16 09:46:52 +08:00
parent 9105864b91
commit c3b5ed3417
5 changed files with 74 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package com.zcloud.controller.comprehensive;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -157,18 +158,44 @@ public class TrafficSecurityCustomerManagementController extends BaseController
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间
// 修改 客户管理表
customerManagementService.edit(pd);
String[] customercontactIds = pd.getString("CUSTOMERCONTACT_ID").split(",");
for (String customercontactId : customercontactIds) {
List<PageData> contacts = JSONObject.parseArray(pd.getString("contacts"), PageData.class);
List<PageData> contacts = JSONArray.parseArray(pd.getString("contacts"), PageData.class);
for (PageData contact : contacts) {
if(StringUtils.equals(contact.getString("CUSTOMERCONTACT_ID"), customercontactId)) {
customerManagementService.editUserInfo(contact);
}
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);
}
}
map.put("result", errInfo);
map.put("pd", pd);
return map;
}
@RequestMapping(value = "/deleteContactInfo")
@ResponseBody
public Object deleteContactInfo() throws Exception {
Map<String, String> map = new HashMap<String, String>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("DELETOR", Jurisdiction.getUSER_ID());//删除人id
pd.put("DELETORNAME", Jurisdiction.getUsername());//删除人姓名
pd.put("DELETETIME", DateUtil.date2Str(new Date()));//删除时间
customerManagementService.deleteContactById(pd);
map.put("result", errInfo);
return map;
}
}

View File

@ -16,4 +16,8 @@ public interface TrafficSecurityCustomerContactMapper {
void deleteContact(PageData pd2);
PageData findByContactName(PageData pd);
PageData findByContactId(String pd);
void deleteContactById(PageData pd);
}

View File

@ -31,4 +31,8 @@ public interface TrafficSecurityCustomerManagementService {
void editUserInfo(PageData pd);
PageData findByContactName(PageData pd2);
PageData findByContactId(String pd);
void deleteContactById(PageData pd);
}

View File

@ -80,4 +80,14 @@ public class TrafficSecurityCustomerManagementServiceImpl implements TrafficSecu
public PageData findByContactName(PageData pd) {
return customerContactMapper.findByContactName(pd);
}
@Override
public PageData findByContactId(String pd) {
return customerContactMapper.findByContactId(pd);
}
@Override
public void deleteContactById(PageData pd) {
customerContactMapper.deleteContactById(pd);
}
}

View File

@ -121,6 +121,17 @@
CUSTOMERMANAGEMENT_ID = #{CUSTOMERMANAGEMENT_ID}
</delete>
<delete id="deleteContactById">
update
<include refid="tableName"></include>
set
ISDELETE = '1',
DELETOR = #{DELETOR},
DELETETIME = #{DELETETIME}
where
CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID }
</delete>
<select id="findByCustomerManagementId" resultType="com.zcloud.entity.PageData" parameterType="pd">
select
<include refid="Field"></include>
@ -128,7 +139,7 @@
<include refid="tableName"></include> f
where f.ISDELETE = 0
AND f.CUSTOMERMANAGEMENT_ID = #{CUSTOMERMANAGEMENT_ID}
ORDER BY f.OPERATTIME asc
ORDER BY f.CREATETIME ASC
</select>
<select id="findByContactName" resultType="com.zcloud.entity.PageData" parameterType="pd">
@ -142,5 +153,14 @@
f.ISDELETE = 0
</select>
<select id="findByContactId" resultType="com.zcloud.entity.PageData" parameterType="pd">
select
f.*
from
<include refid="tableName"/> f
where f.ISDELETE = 0
AND f.CUSTOMERCONTACT_ID = #{CUSTOMERCONTACT_ID}
</select>
</mapper>