From 7551b694b58eeea1dae15a4c2806a7b1a6933aff Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期一, 26 二月 2024 13:36:04 +0800
Subject: [PATCH] 优化代码
---
java110-db/src/main/resources/mapper/store/ComplaintEventV1ServiceDaoImplMapper.xml | 188 +++++++++++++++++++++++-----------------------
service-store/src/main/java/com/java110/store/cmd/complaintAppraise/ReplyComplaintAppraiseCmd.java | 33 ++++++-
2 files changed, 120 insertions(+), 101 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/store/ComplaintEventV1ServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/store/ComplaintEventV1ServiceDaoImplMapper.xml
index 6279c5f..71987f8 100644
--- a/java110-db/src/main/resources/mapper/store/ComplaintEventV1ServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/store/ComplaintEventV1ServiceDaoImplMapper.xml
@@ -5,120 +5,118 @@
<mapper namespace="complaintEventV1ServiceDaoImpl">
-
-
-
<!-- 淇濆瓨鎶曡瘔浜嬩欢淇℃伅 add by wuxw 2018-07-03 -->
<insert id="saveComplaintEventInfo" parameterType="Map">
insert into complaint_event(
-event_id,create_user_id,complaint_id,create_user_name,remark,event_type,community_id
-) values (
-#{eventId},#{createUserId},#{complaintId},#{createUserName},#{remark},#{eventType},#{communityId}
-)
+ event_id,create_user_id,complaint_id,create_user_name,remark,event_type,community_id
+ ) values (
+ #{eventId},#{createUserId},#{complaintId},#{createUserName},#{remark},#{eventType},#{communityId}
+ )
</insert>
-
<!-- 鏌ヨ鎶曡瘔浜嬩欢淇℃伅 add by wuxw 2018-07-03 -->
<select id="getComplaintEventInfo" parameterType="Map" resultType="Map">
- select t.event_id,t.event_id eventId,t.create_user_id,t.create_user_id createUserId,t.complaint_id,t.complaint_id complaintId,t.create_user_name,t.create_user_name createUserName,t.remark,t.status_cd,t.status_cd statusCd,t.event_type,t.event_type eventType,t.community_id,t.community_id communityId
-from complaint_event t
-where 1 =1
-<if test="eventId !=null and eventId != ''">
- and t.event_id= #{eventId}
-</if>
-<if test="createUserId !=null and createUserId != ''">
- and t.create_user_id= #{createUserId}
-</if>
-<if test="complaintId !=null and complaintId != ''">
- and t.complaint_id= #{complaintId}
-</if>
-<if test="createUserName !=null and createUserName != ''">
- and t.create_user_name= #{createUserName}
-</if>
-<if test="remark !=null and remark != ''">
- and t.remark= #{remark}
-</if>
-<if test="statusCd !=null and statusCd != ''">
- and t.status_cd= #{statusCd}
-</if>
-<if test="eventType !=null and eventType != ''">
- and t.event_type= #{eventType}
-</if>
-<if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
-</if>
-order by t.create_time desc
-<if test="page != -1 and page != null ">
- limit #{page}, #{row}
-</if>
+ select t.event_id,t.event_id eventId,t.create_user_id,t.create_user_id
+ createUserId,t.complaint_id,t.complaint_id complaintId,t.create_user_name,t.create_user_name
+ createUserName,t.remark,t.status_cd,t.status_cd statusCd,t.event_type,t.event_type
+ eventType,t.community_id,t.community_id communityId,t.create_time createTime
+ from complaint_event t
+ where 1 =1
+ <if test="eventId !=null and eventId != ''">
+ and t.event_id= #{eventId}
+ </if>
+ <if test="createUserId !=null and createUserId != ''">
+ and t.create_user_id= #{createUserId}
+ </if>
+ <if test="complaintId !=null and complaintId != ''">
+ and t.complaint_id= #{complaintId}
+ </if>
+ <if test="createUserName !=null and createUserName != ''">
+ and t.create_user_name= #{createUserName}
+ </if>
+ <if test="remark !=null and remark != ''">
+ and t.remark= #{remark}
+ </if>
+ <if test="statusCd !=null and statusCd != ''">
+ and t.status_cd= #{statusCd}
+ </if>
+ <if test="eventType !=null and eventType != ''">
+ and t.event_type= #{eventType}
+ </if>
+ <if test="communityId !=null and communityId != ''">
+ and t.community_id= #{communityId}
+ </if>
+ order by t.create_time desc
+ <if test="page != -1 and page != null ">
+ limit #{page}, #{row}
+ </if>
</select>
-
-
<!-- 淇敼鎶曡瘔浜嬩欢淇℃伅 add by wuxw 2018-07-03 -->
<update id="updateComplaintEventInfo" parameterType="Map">
- update complaint_event t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if>
-<if test="createUserId !=null and createUserId != ''">
-, t.create_user_id= #{createUserId}
-</if>
-<if test="complaintId !=null and complaintId != ''">
-, t.complaint_id= #{complaintId}
-</if>
-<if test="createUserName !=null and createUserName != ''">
-, t.create_user_name= #{createUserName}
-</if>
-<if test="remark !=null and remark != ''">
-, t.remark= #{remark}
-</if>
-<if test="eventType !=null and eventType != ''">
-, t.event_type= #{eventType}
-</if>
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if>
- where 1=1 <if test="eventId !=null and eventId != ''">
-and t.event_id= #{eventId}
-</if>
+ update complaint_event t set t.status_cd = #{statusCd}
+ <if test="newBId != null and newBId != ''">
+ ,t.b_id = #{newBId}
+ </if>
+ <if test="createUserId !=null and createUserId != ''">
+ , t.create_user_id= #{createUserId}
+ </if>
+ <if test="complaintId !=null and complaintId != ''">
+ , t.complaint_id= #{complaintId}
+ </if>
+ <if test="createUserName !=null and createUserName != ''">
+ , t.create_user_name= #{createUserName}
+ </if>
+ <if test="remark !=null and remark != ''">
+ , t.remark= #{remark}
+ </if>
+ <if test="eventType !=null and eventType != ''">
+ , t.event_type= #{eventType}
+ </if>
+ <if test="communityId !=null and communityId != ''">
+ , t.community_id= #{communityId}
+ </if>
+ where 1=1
+ <if test="eventId !=null and eventId != ''">
+ and t.event_id= #{eventId}
+ </if>
</update>
<!-- 鏌ヨ鎶曡瘔浜嬩欢鏁伴噺 add by wuxw 2018-07-03 -->
- <select id="queryComplaintEventsCount" parameterType="Map" resultType="Map">
- select count(1) count
-from complaint_event t
-where 1 =1
-<if test="eventId !=null and eventId != ''">
- and t.event_id= #{eventId}
-</if>
-<if test="createUserId !=null and createUserId != ''">
- and t.create_user_id= #{createUserId}
-</if>
-<if test="complaintId !=null and complaintId != ''">
- and t.complaint_id= #{complaintId}
-</if>
-<if test="createUserName !=null and createUserName != ''">
- and t.create_user_name= #{createUserName}
-</if>
-<if test="remark !=null and remark != ''">
- and t.remark= #{remark}
-</if>
-<if test="statusCd !=null and statusCd != ''">
- and t.status_cd= #{statusCd}
-</if>
-<if test="eventType !=null and eventType != ''">
- and t.event_type= #{eventType}
-</if>
-<if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
-</if>
+ <select id="queryComplaintEventsCount" parameterType="Map" resultType="Map">
+ select count(1) count
+ from complaint_event t
+ where 1 =1
+ <if test="eventId !=null and eventId != ''">
+ and t.event_id= #{eventId}
+ </if>
+ <if test="createUserId !=null and createUserId != ''">
+ and t.create_user_id= #{createUserId}
+ </if>
+ <if test="complaintId !=null and complaintId != ''">
+ and t.complaint_id= #{complaintId}
+ </if>
+ <if test="createUserName !=null and createUserName != ''">
+ and t.create_user_name= #{createUserName}
+ </if>
+ <if test="remark !=null and remark != ''">
+ and t.remark= #{remark}
+ </if>
+ <if test="statusCd !=null and statusCd != ''">
+ and t.status_cd= #{statusCd}
+ </if>
+ <if test="eventType !=null and eventType != ''">
+ and t.event_type= #{eventType}
+ </if>
+ <if test="communityId !=null and communityId != ''">
+ and t.community_id= #{communityId}
+ </if>
- </select>
+ </select>
</mapper>
diff --git a/service-store/src/main/java/com/java110/store/cmd/complaintAppraise/UpdateComplaintAppraiseCmd.java b/service-store/src/main/java/com/java110/store/cmd/complaintAppraise/ReplyComplaintAppraiseCmd.java
similarity index 68%
rename from service-store/src/main/java/com/java110/store/cmd/complaintAppraise/UpdateComplaintAppraiseCmd.java
rename to service-store/src/main/java/com/java110/store/cmd/complaintAppraise/ReplyComplaintAppraiseCmd.java
index 50305d6..6d9af83 100644
--- a/service-store/src/main/java/com/java110/store/cmd/complaintAppraise/UpdateComplaintAppraiseCmd.java
+++ b/service-store/src/main/java/com/java110/store/cmd/complaintAppraise/ReplyComplaintAppraiseCmd.java
@@ -18,11 +18,14 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.CmdContextUtils;
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
-import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.complaintAppraise.ComplaintAppraiseDto;
+import com.java110.dto.user.UserDto;
import com.java110.intf.store.IComplaintAppraiseV1InnerServiceSMO;
+import com.java110.intf.user.IUserV1InnerServiceSMO;
import com.java110.po.complaintAppraise.ComplaintAppraisePo;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
@@ -31,6 +34,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
+import java.util.List;
/**
@@ -43,19 +48,23 @@
* 娓╅Θ鎻愮ず锛氬鏋滄偍瀵规鏂囦欢杩涜淇敼 璇蜂笉瑕佸垹闄ゅ師鏈変綔鑰呭強娉ㄩ噴淇℃伅锛岃琛ュ厖鎮ㄧ殑 淇敼鐨勫師鍥犱互鍙婅仈绯婚偖绠卞涓�
* // modify by 寮犱笁 at 2021-09-12 绗�10琛屽湪鏌愮鍦烘櫙涓嬪瓨鍦ㄦ煇绉峛ug 闇�瑕佷慨澶嶏紝娉ㄩ噴10鑷�20琛� 鍔犲叆 20琛岃嚦30琛�
*/
-@Java110Cmd(serviceCode = "complaintAppraise.updateComplaintAppraise")
-public class UpdateComplaintAppraiseCmd extends Cmd {
+@Java110Cmd(serviceCode = "complaintAppraise.replyComplaintAppraise")
+public class ReplyComplaintAppraiseCmd extends Cmd {
- private static Logger logger = LoggerFactory.getLogger(UpdateComplaintAppraiseCmd.class);
+ private static Logger logger = LoggerFactory.getLogger(ReplyComplaintAppraiseCmd.class);
@Autowired
private IComplaintAppraiseV1InnerServiceSMO complaintAppraiseV1InnerServiceSMOImpl;
+ @Autowired
+ private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
+
@Override
public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
Assert.hasKeyAndValue(reqJson, "appraiseId", "appraiseId涓嶈兘涓虹┖");
-Assert.hasKeyAndValue(reqJson, "communityId", "communityId涓嶈兘涓虹┖");
+ Assert.hasKeyAndValue(reqJson, "communityId", "communityId涓嶈兘涓虹┖");
+ Assert.hasKeyAndValue(reqJson, "replyContext", "鍥炲鍐呭涓嶈兘涓虹┖");
}
@@ -63,7 +72,19 @@
@Java110Transactional
public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
- ComplaintAppraisePo complaintAppraisePo = BeanConvertUtil.covertBean(reqJson, ComplaintAppraisePo.class);
+ String userId = CmdContextUtils.getUserId(cmdDataFlowContext);
+
+ UserDto userDto = new UserDto();
+ userDto.setUserId(userId);
+ List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto);
+
+ Assert.listOnlyOne(userDtos, "鐢ㄦ埛鏈櫥褰�");
+
+
+ ComplaintAppraisePo complaintAppraisePo = BeanConvertUtil.covertBean(reqJson, ComplaintAppraisePo.class);
+ complaintAppraisePo.setState("C");
+ complaintAppraisePo.setReplyUserId(userDtos.get(0).getUserId());
+ complaintAppraisePo.setReplyUserName(userDtos.get(0).getName());
int flag = complaintAppraiseV1InnerServiceSMOImpl.updateComplaintAppraise(complaintAppraisePo);
if (flag < 1) {
--
Gitblit v1.8.0