zxc 3 years ago
parent
commit
05baa8c94f
  1. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 55
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceRecordV2ListFormDTO.java
  3. 66
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/ServiceRecordV2ListResultDTO.java
  4. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/IcCommunitySelfOrganizationConstant.java
  5. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceRecordV2Controller.java
  6. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java
  7. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceRecordV2Dao.java
  8. 33
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/IcPartyUnitRedis.java
  9. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceRecordV2Service.java
  10. 40
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordV2ServiceImpl.java
  11. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml
  12. 58
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -817,4 +817,16 @@ public class RedisKeys {
}
return rootPrefix.concat("datasync:").concat(bizType);
}
/**
* Desc: 服务组织名称
* @param customerId
* @param serviceOrgType
* @param serviceOrgId
* @author zxc
* @date 2022/7/19 14:08
*/
public static String getServiceOrgNameKey(String customerId,String serviceOrgType,String serviceOrgId){
return rootPrefix.concat("serviceOrgName:").concat(serviceOrgType).concat(":").concat(customerId).concat(":").concat(serviceOrgId);
}
}

55
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceRecordV2ListFormDTO.java

@ -0,0 +1,55 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/7/19 10:10
* @DESC
*/
@Data
public class ServiceRecordV2ListFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = 88592831607216246L;
/**
* 服务名称
*/
private String serviceName;
/**
* 服务组织ID
*/
private String serviceOrgId;
/**
* 起始服务时间yyyy-MM-dd
*/
private String serviceTimeStart;
/**
* 终止服务时间yyyy-MM-dd
*/
private String serviceTimeEnd;
/**
* in_service服务中completed:已完成cancel取消
*/
private String serviceStatus;
/**
* 满意度 0不满意1基本满意2非常满意
*/
private String satisfaction;
private String customerId;
private String userId;
/**
* 当前工作人员所属组织ID
*/
private String orgId;
}

66
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/ServiceRecordV2ListResultDTO.java

@ -0,0 +1,66 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/7/19 10:16
* @DESC
*/
@Data
public class ServiceRecordV2ListResultDTO implements Serializable {
private static final long serialVersionUID = -7486208970876756573L;
/**
* 服务ID
*/
private String serviceRecordId;
/**
* 政策ID
*/
private String policyId;
/**
* 服务组织类别
*/
private String serviceOrgType;
/**
* 服务组织ID
*/
private String serviceOrgId;
/**
* 服务组织名字
*/
private String serviceOrgName;
/**
* 服务名字
*/
private String serviceName;
/**
* 起始服务时间yyyy-MM-dd
*/
private String serviceTimeStart;
/**
* 终止服务时间yyyy-MM-dd
*/
private String serviceTimeEnd;
/**
* 服务状态
*/
private String serviceStatus;
/**
* 服务人数
*/
private Integer servicePeopleNumber;
}

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/IcCommunitySelfOrganizationConstant.java

@ -8,4 +8,8 @@ package com.epmet.constant;
public interface IcCommunitySelfOrganizationConstant {
String ORG_TYPE_AGENCY = "agency";
String SERVICE_ORG_TYPE_COMMUNITY_ORG = "community_org";
String SERVICE_ORG_TYPE_IC_USER_VOLUNTEEr = "ic_user_volunteer";
String SERVICE_ORG_TYPE_PARTY_UNIT = "party_unit";
}

17
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceRecordV2Controller.java

@ -1,7 +1,9 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -9,6 +11,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.IcServiceRecordV2DTO;
import com.epmet.dto.form.ServiceRecordV2ListFormDTO;
import com.epmet.service.IcServiceRecordV2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -67,4 +70,18 @@ public class IcServiceRecordV2Controller {
return new Result();
}
/**
* Desc:服务管理列表
* @param tokenDto
* @param formDTO
* @author zxc
* @date 2022/7/19 10:24
*/
@PostMapping("list")
public Result<PageData> serviceRecordV2List(@LoginUser TokenDto tokenDto, @RequestBody ServiceRecordV2ListFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<PageData>().ok(icServiceRecordV2Service.serviceRecordV2List(formDTO));
}
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java

@ -75,4 +75,7 @@ public interface IcCommunitySelfOrganizationDao extends BaseDao<IcCommunitySelfO
List<CommunitySelfOrganizationListDTO> queryCoordinateList(CategorySelfOrgFormDTO formDTO);
List<IcCommunitySelfOrganizationEntity> selectByIds(@Param("communityOrgIds") List<String> communityOrgIds);
String getCommunityOrgName(@Param("id") String id);
String getPartyUnitName(@Param("id") String id);
}

12
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceRecordV2Dao.java

@ -1,9 +1,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.ServiceRecordV2ListFormDTO;
import com.epmet.dto.result.ServiceRecordV2ListResultDTO;
import com.epmet.entity.IcServiceRecordV2Entity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 服务记录表
*
@ -13,4 +17,12 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface IcServiceRecordV2Dao extends BaseDao<IcServiceRecordV2Entity> {
/**
* Desc:服务管理列表
* @param formDTO
* @author zxc
* @date 2022/7/19 10:24
*/
List<ServiceRecordV2ListResultDTO> serviceRecordV2List(ServiceRecordV2ListFormDTO formDTO);
}

33
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/IcPartyUnitRedis.java

@ -17,7 +17,14 @@
package com.epmet.redis;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.IcCommunitySelfOrganizationConstant;
import com.epmet.dao.IcCommunitySelfOrganizationDao;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -31,6 +38,10 @@ import org.springframework.stereotype.Component;
public class IcPartyUnitRedis {
@Autowired
private RedisUtils redisUtils;
@Autowired
private IcCommunitySelfOrganizationDao communitySelfOrganizationDao;
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
public void delete(Object[] ids) {
@ -44,4 +55,26 @@ public class IcPartyUnitRedis {
return null;
}
public String getServiceOrgName(String customerId,String serviceOrgType,String serviceOrgId){
String serviceOrgNameKey = RedisKeys.getServiceOrgNameKey(customerId, serviceOrgType, serviceOrgId);
Object o = redisUtils.get(serviceOrgNameKey);
if (null != o){
return o.toString();
}
String name = "";
if (serviceOrgType.equals(IcCommunitySelfOrganizationConstant.SERVICE_ORG_TYPE_COMMUNITY_ORG)){
name = communitySelfOrganizationDao.getCommunityOrgName(serviceOrgId);
}else if (serviceOrgType.equals(IcCommunitySelfOrganizationConstant.SERVICE_ORG_TYPE_PARTY_UNIT)){
name = communitySelfOrganizationDao.getPartyUnitName(serviceOrgId);
}else if (serviceOrgType.equals(IcCommunitySelfOrganizationConstant.SERVICE_ORG_TYPE_IC_USER_VOLUNTEEr)){
Result<IcResiUserDTO> icResiUserDTO = userOpenFeignClient.getIcResiUserDTO(serviceOrgId);
if (!icResiUserDTO.success()){
throw new EpmetException("getIcResiUserDTO method is failure");
}
name = icResiUserDTO.getData().getName();
}
redisUtils.set(serviceOrgNameKey,name,RedisUtils.DEFAULT_EXPIRE);
return name;
}
}

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceRecordV2Service.java

@ -3,6 +3,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcServiceRecordV2DTO;
import com.epmet.dto.form.ServiceRecordV2ListFormDTO;
import com.epmet.entity.IcServiceRecordV2Entity;
import java.util.List;
@ -75,4 +76,12 @@ public interface IcServiceRecordV2Service extends BaseService<IcServiceRecordV2E
* @date 2022-07-18
*/
void delete(String[] ids);
/**
* Desc:服务管理列表
* @param formDTO
* @author zxc
* @date 2022/7/19 10:24
*/
PageData serviceRecordV2List(ServiceRecordV2ListFormDTO formDTO);
}

40
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordV2ServiceImpl.java

@ -4,16 +4,28 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcServiceRecordV2Dao;
import com.epmet.dto.IcServiceRecordV2DTO;
import com.epmet.dto.form.ServiceRecordV2ListFormDTO;
import com.epmet.dto.result.ServiceRecordV2ListResultDTO;
import com.epmet.entity.IcServiceRecordV2Entity;
import com.epmet.redis.IcPartyUnitRedis;
import com.epmet.service.IcServiceRecordV2Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -27,6 +39,9 @@ import java.util.Map;
@Service
public class IcServiceRecordV2ServiceImpl extends BaseServiceImpl<IcServiceRecordV2Dao, IcServiceRecordV2Entity> implements IcServiceRecordV2Service {
@Autowired
private IcPartyUnitRedis partyUnitRedis;
@Override
public PageData<IcServiceRecordV2DTO> page(Map<String, Object> params) {
IPage<IcServiceRecordV2Entity> page = baseDao.selectPage(
@ -79,4 +94,29 @@ public class IcServiceRecordV2ServiceImpl extends BaseServiceImpl<IcServiceRecor
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* Desc:服务管理列表
* @param formDTO
* @author zxc
* @date 2022/7/19 10:24
*/
@Override
public PageData serviceRecordV2List(ServiceRecordV2ListFormDTO formDTO) {
PageData<ServiceRecordV2ListResultDTO> result = new PageData<>(new ArrayList<>(), NumConstant.ZERO_L);
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo){
throw new EpmetException("未查询到工作人员信息+"+formDTO.getUserId());
}
formDTO.setOrgId(staffInfo.getAgencyId());
PageInfo<ServiceRecordV2ListResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.serviceRecordV2List(formDTO));
result.setList(pageInfo.getList());
result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal())));
if (CollectionUtils.isNotEmpty(result.getList())){
result.getList().forEach(r -> {
r.setServiceOrgName(partyUnitRedis.getServiceOrgName(formDTO.getCustomerId(), r.getServiceOrgType(),r.getServiceOrgId()));
});
}
return result;
}
}

7
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml

@ -196,4 +196,11 @@
</foreach>
)
</select>
<select id="getCommunityOrgName" resultType="java.lang.String">
SELECT ORGANIZATION_NAME FROM ic_community_self_organization WHERE ID = #{id}
</select>
<select id="getPartyUnitName" resultType="java.lang.String">
SELECT UNIT_NAME FROM ic_party_unit WHERE ID = #{id}
</select>
</mapper>

58
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml

@ -3,26 +3,44 @@
<mapper namespace="com.epmet.dao.IcServiceRecordV2Dao">
<resultMap type="com.epmet.entity.IcServiceRecordV2Entity" id="icServiceRecordV2Map">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="serviceOrgType" column="SERVICE_ORG_TYPE"/>
<result property="serviceOrgId" column="SERVICE_ORG_ID"/>
<result property="principalName" column="PRINCIPAL_NAME"/>
<result property="principalContact" column="PRINCIPAL_CONTACT"/>
<result property="serviceTimeStart" column="SERVICE_TIME_START"/>
<result property="serviceTimeEnd" column="SERVICE_TIME_END"/>
<result property="serviceStatus" column="SERVICE_STATUS"/>
<result property="remark" column="REMARK"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="serviceName" column="SERVICE_NAME"/>
<result property="policyId" column="POLICY_ID"/>
</resultMap>
<!-- 【服务管理】列表 -->
<select id="serviceRecordV2List" resultType="com.epmet.dto.result.ServiceRecordV2ListResultDTO">
SELECT
sr.ID AS serviceRecordId,
sr.POLICY_ID,
sr.SERVICE_NAME,
sr.SERVICE_ORG_TYPE,
sr.SERVICE_ORG_ID,
sr.SERVICE_TIME_START,
sr.SERVICE_TIME_END,
sr.SERVICE_STATUS,
IFNULL(sf.SERVICE_PEOPLE_NUMBER,0) AS servicePeopleNumber
FROM ic_service_record_v2 sr
INNER JOIN ic_service_feedback_v2 sf ON sf.SERVICE_RECORD_ID = sr.ID AND sf.DEL_FLAG = 0
INNER JOIN ic_service_scope_v2 ss ON ss.SERVICE_RECORD_ID = sr.ID AND ss.DEL_FLAG = '0'
WHERE sr.DEL_FLAG = '0'
AND ss.OBJECT_ID_PATH LIKE concat('%',#{orgId},'%')
AND sr.CUSTOMER_ID = #{customerId}
<if test='serviceName != null and serviceName != ""'>
AND sr.SERVICE_NAME LIKE CONCAT('%',#{serviceName},'%')
</if>
<if test='serviceOrgId != null and serviceOrgId != ""'>
AND sr.SERVICE_ORG_ID = #{serviceOrgId}
</if>
<if test='serviceStatus != null and serviceStatus != ""'>
AND sr.SERVICE_STATUS = #{serviceStatus}
</if>
<if test='satisfaction != null and satisfaction != ""'>
AND sf.SATISFACTION = #{satisfaction}
</if>
<if test='serviceTimeStart != null and serviceTimeStart != ""'>
AND sr.SERVICE_TIME_START >= #{serviceTimeStart}
</if>
<if test='serviceTimeEnd != null and serviceTimeEnd != ""'>
AND sr.SERVICE_TIME_END <![CDATA[ <= ]]> #{serviceTimeEnd}
</if>
ORDER BY sr.CREATED_TIME DESC
</select>
</mapper>
Loading…
Cancel
Save