wuxw 2 vuotta sitten
vanhempi
commit
c76febb564

+ 10 - 0
java110-bean/src/main/java/com/java110/dto/complaint/ComplaintDto.java

@@ -51,6 +51,8 @@ public class ComplaintDto extends PageDto implements Serializable {
     private String startTime;
     private String endTime;
 
+    private String staffId;
+
     private List<PhotoVo> photos;
 
 
@@ -283,4 +285,12 @@ public class ComplaintDto extends PageDto implements Serializable {
     public void setStateName(String stateName) {
         this.stateName = stateName;
     }
+
+    public String getStaffId() {
+        return staffId;
+    }
+
+    public void setStaffId(String staffId) {
+        this.staffId = staffId;
+    }
 }

+ 119 - 0
java110-db/src/main/resources/mapper/store/ComplaintV1ServiceDaoImplMapper.xml

@@ -197,4 +197,123 @@
         group by t.tel
     </select>
 
+    <select id="queryStaffComplaintCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from complaint t
+        left join complaint_type ct on t.type_cd = ct.type_cd and ct.status_cd = '0'
+        left join complaint_type_user ctu on ct.type_cd = ctu.type_cd and ctu.status_cd = '0'
+        left join t_dict td on t.state = td.status_cd and td.table_name = 'complaint' and td.table_columns = 'state'
+        where 1 =1
+        and ctu.staff_id = #{staffId}
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="ownerId !=null and ownerId != ''">
+            and t.owner_id= #{ownerId}
+        </if>
+        <if test="roomId !=null and roomId != ''">
+            and t.room_id= #{roomId}
+        </if>
+        <if test="roomName !=null and roomName != ''">
+            and t.room_name= #{roomName}
+        </if>
+        <if test="startUserId !=null and startUserId != ''">
+            and t.start_user_id= #{startUserId}
+        </if>
+        <if test="complaintId !=null and complaintId != ''">
+            and t.complaint_id= #{complaintId}
+        </if>
+        <if test="typeCd !=null and typeCd != ''">
+            and t.type_cd= #{typeCd}
+        </if>
+        <if test="ownerName !=null and ownerName != ''">
+            and t.owner_name= #{ownerName}
+        </if>
+        <if test="context !=null and context != ''">
+            and t.context= #{context}
+        </if>
+        <if test="complaintName !=null and complaintName != ''">
+            and t.complaint_name= #{complaintName}
+        </if>
+        <if test="tel !=null and tel != ''">
+            and t.tel= #{tel}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.create_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.create_time &lt;= #{endTime}
+        </if>
+    </select>
+
+    <select id="queryStaffComplaints" parameterType="Map" resultType="Map">
+        select t.store_id storeId,t.owner_id ownerId,t.room_id roomId,t.room_name roomName,t.start_user_id
+        startUserId,t.complaint_id complaintId,t.type_cd typeCd,t.owner_name ownerName,t.context,t.complaint_name complaintName,
+        t.tel,t.state,t.community_id communityId,td.`name` stateName,ct.type_name typeName,t.create_time createTime
+        from complaint t
+        left join complaint_type ct on t.type_cd = ct.type_cd and ct.status_cd = '0'
+        left join complaint_type_user ctu on ct.type_cd = ctu.type_cd and ctu.status_cd = '0'
+        left join t_dict td on t.state = td.status_cd and td.table_name = 'complaint' and td.table_columns = 'state'
+        where 1 =1
+        and ctu.staff_id = #{staffId}
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="ownerId !=null and ownerId != ''">
+            and t.owner_id= #{ownerId}
+        </if>
+        <if test="roomId !=null and roomId != ''">
+            and t.room_id= #{roomId}
+        </if>
+        <if test="roomName !=null and roomName != ''">
+            and t.room_name= #{roomName}
+        </if>
+        <if test="startUserId !=null and startUserId != ''">
+            and t.start_user_id= #{startUserId}
+        </if>
+        <if test="complaintId !=null and complaintId != ''">
+            and t.complaint_id= #{complaintId}
+        </if>
+        <if test="typeCd !=null and typeCd != ''">
+            and t.type_cd= #{typeCd}
+        </if>
+        <if test="ownerName !=null and ownerName != ''">
+            and t.owner_name= #{ownerName}
+        </if>
+        <if test="complaintName !=null and complaintName != ''">
+            and t.complaint_name= #{complaintName}
+        </if>
+        <if test="tel !=null and tel != ''">
+            and t.tel= #{tel}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.create_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.create_time &lt;= #{endTime}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+
+    </select>
 </mapper>

+ 7 - 0
java110-interface/src/main/java/com/java110/intf/store/IComplaintV1InnerServiceSMO.java

@@ -69,4 +69,11 @@ public interface IComplaintV1InnerServiceSMO {
 
     @RequestMapping(value = "/queryComplaintCountByOwnerTels", method = RequestMethod.POST)
     List<Map> queryComplaintCountByOwnerTels(@RequestBody Map info);
+
+
+    @RequestMapping(value = "/queryStaffComplaintCount", method = RequestMethod.POST)
+    int queryStaffComplaintCount(@RequestBody ComplaintDto complaintDto);
+
+    @RequestMapping(value = "/queryStaffComplaints", method = RequestMethod.POST)
+    List<ComplaintDto> queryStaffComplaints(@RequestBody ComplaintDto complaintDto);
 }

+ 20 - 20
service-common/src/main/java/com/java110/common/cmd/auditUser/ListAuditComplaintsCmd.java

@@ -2,14 +2,18 @@ package com.java110.common.cmd.auditUser;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
+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.dto.audit.AuditUser;
+import com.java110.dto.complaint.ComplaintDto;
 import com.java110.intf.common.IComplaintUserInnerServiceSMO;
+import com.java110.intf.store.IComplaintV1InnerServiceSMO;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
 import com.java110.vo.api.complaint.ApiComplaintDataVo;
 import com.java110.vo.api.complaint.ApiComplaintVo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,46 +27,42 @@ import java.util.List;
 public class ListAuditComplaintsCmd extends Cmd {
 
     @Autowired
-    private IComplaintUserInnerServiceSMO complaintUserInnerServiceSMOImpl;
+    private IComplaintV1InnerServiceSMO complaintV1InnerServiceSMOImpl;
 
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
-        Assert.hasKeyAndValue(reqJson, "storeId", "必填,请填写商户ID");
-        Assert.hasKeyAndValue(reqJson, "userId", "必填,请填写用户ID");
         Assert.hasKeyAndValue(reqJson, "communityId", "必填,请填写小区ID");
         Assert.hasKeyAndValue(reqJson, "row", "必填,请填写每页显示数");
         Assert.hasKeyAndValue(reqJson, "page", "必填,请填写页数");
-
         super.validatePageInfo(reqJson);
     }
 
     @Override
     public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
-        AuditUser auditUser = new AuditUser();
-        auditUser.setUserId(reqJson.getString("userId"));
-        auditUser.setStoreId(reqJson.getString("storeId"));
-        auditUser.setCommunityId(reqJson.getString("communityId"));
-        auditUser.setPage(reqJson.getInteger("page"));
-        auditUser.setRow(reqJson.getInteger("row"));
 
+        String userId = CmdContextUtils.getUserId(context);
+
+        ComplaintDto complaintDto = new ComplaintDto();
+        complaintDto.setStaffId(userId);
+        complaintDto.setStoreId(reqJson.getString("storeId"));
+        complaintDto.setCommunityId(reqJson.getString("communityId"));
+        complaintDto.setPage(reqJson.getInteger("page"));
+        complaintDto.setRow(reqJson.getInteger("row"));
+        complaintDto.setState(ComplaintDto.STATE_WAIT);
 
-        long count = complaintUserInnerServiceSMOImpl.getUserTaskCount(auditUser);
+        long count = complaintV1InnerServiceSMOImpl.queryStaffComplaintCount(complaintDto);
 
-        List<ApiComplaintDataVo> auditComplaints = null;
+        List<ComplaintDto> complaintDtos = null;
 
         if (count > 0) {
-            auditComplaints = BeanConvertUtil.covertBeanList(complaintUserInnerServiceSMOImpl.getUserTasks(auditUser), ApiComplaintDataVo.class);
+            complaintDtos = complaintV1InnerServiceSMOImpl.queryStaffComplaints(complaintDto);
         } else {
-            auditComplaints = new ArrayList<>();
+            complaintDtos = new ArrayList<>();
         }
 
-        ApiComplaintVo apiComplaintVo = new ApiComplaintVo();
-
-        apiComplaintVo.setTotal((int) count);
-        apiComplaintVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row")));
-        apiComplaintVo.setComplaints(auditComplaints);
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, complaintDtos);
 
-        ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiComplaintVo), HttpStatus.OK);
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
 
         context.setResponseEntity(responseEntity);
     }

+ 4 - 0
service-store/src/main/java/com/java110/store/dao/IComplaintV1ServiceDao.java

@@ -71,4 +71,8 @@ public interface IComplaintV1ServiceDao {
     int queryComplaintsCount(Map info);
 
     List<Map> queryComplaintCountByOwnerTels(Map info);
+
+    int queryStaffComplaintCount(Map info);
+
+    List<Map> queryStaffComplaints(Map info);
 }

+ 20 - 0
service-store/src/main/java/com/java110/store/dao/impl/ComplaintV1ServiceDaoImpl.java

@@ -117,5 +117,25 @@ public class ComplaintV1ServiceDaoImpl extends BaseServiceDao implements ICompla
         return result;
     }
 
+    @Override
+    public int queryStaffComplaintCount(Map info) {
+        logger.debug("查询 queryStaffComplaintCount 入参 info : {}",info);
+
+        List<Map> infos = sqlSessionTemplate.selectList("complaintV1ServiceDaoImpl.queryStaffComplaintCount", info);
+        if (ListUtil.isNull(infos)) {
+            return 0;
+        }
+
+        return Integer.parseInt(infos.get(0).get("count").toString());
+    }
+
+    @Override
+    public List<Map> queryStaffComplaints(Map info) {
+        logger.debug("查询 queryStaffComplaints 入参 info : {}",info);
+
+        List<Map> result = sqlSessionTemplate.selectList("complaintV1ServiceDaoImpl.queryStaffComplaints", info);
+        return result;
+    }
+
 
 }

+ 20 - 0
service-store/src/main/java/com/java110/store/smo/impl/ComplaintV1InnerServiceSMOImpl.java

@@ -92,4 +92,24 @@ public class ComplaintV1InnerServiceSMOImpl extends BaseServiceSMO implements IC
         return complaintV1ServiceDaoImpl.queryComplaintCountByOwnerTels(info);
     }
 
+    @Override
+    public int queryStaffComplaintCount(@RequestBody ComplaintDto complaintDto) {
+        return complaintV1ServiceDaoImpl.queryStaffComplaintCount(BeanConvertUtil.beanCovertMap(complaintDto));
+    }
+
+    @Override
+    public List<ComplaintDto> queryStaffComplaints(@RequestBody ComplaintDto complaintDto) {
+        //校验是否传了 分页信息
+
+        int page = complaintDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            complaintDto.setPage((page - 1) * complaintDto.getRow());
+        }
+
+        List<ComplaintDto> complaints = BeanConvertUtil.covertBeanList(complaintV1ServiceDaoImpl.queryStaffComplaints(BeanConvertUtil.beanCovertMap(complaintDto)), ComplaintDto.class);
+
+        return complaints;
+    }
+
 }