diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 579f8ee9cf..97dfa853b7 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/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); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceRecordV2ListFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceRecordV2ListFormDTO.java new file mode 100644 index 0000000000..675bd575b4 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/ServiceRecordV2ListResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/ServiceRecordV2ListResultDTO.java new file mode 100644 index 0000000000..d4c591a469 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/IcCommunitySelfOrganizationConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/IcCommunitySelfOrganizationConstant.java index ffd87124bf..a94b3304b1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/IcCommunitySelfOrganizationConstant.java +++ b/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"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceRecordV2Controller.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceRecordV2Controller.java index dc1ea6ce52..aa8b978b4c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceRecordV2Controller.java +++ b/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 serviceRecordV2List(@LoginUser TokenDto tokenDto, @RequestBody ServiceRecordV2ListFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result().ok(icServiceRecordV2Service.serviceRecordV2List(formDTO)); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java index 3ba576777b..e97091463e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java @@ -75,4 +75,7 @@ public interface IcCommunitySelfOrganizationDao extends BaseDao queryCoordinateList(CategorySelfOrgFormDTO formDTO); List selectByIds(@Param("communityOrgIds") List communityOrgIds); + + String getCommunityOrgName(@Param("id") String id); + String getPartyUnitName(@Param("id") String id); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceRecordV2Dao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceRecordV2Dao.java index 340747b8a0..55ae94e6aa 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceRecordV2Dao.java +++ b/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; + /** * 服务记录表 * @@ -12,5 +16,13 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcServiceRecordV2Dao extends BaseDao { - + + /** + * Desc:【服务管理】列表 + * @param formDTO + * @author zxc + * @date 2022/7/19 10:24 + */ + List serviceRecordV2List(ServiceRecordV2ListFormDTO formDTO); + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/IcPartyUnitRedis.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/IcPartyUnitRedis.java index 83113e7903..8ce4a285ce 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/IcPartyUnitRedis.java +++ b/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 = 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; + } + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceRecordV2Service.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceRecordV2Service.java index c2065d0107..f10012c762 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceRecordV2Service.java +++ b/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 implements IcServiceRecordV2Service { + @Autowired + private IcPartyUnitRedis partyUnitRedis; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -79,4 +94,29 @@ public class IcServiceRecordV2ServiceImpl extends BaseServiceImpl 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 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; + } + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml index fd457a3628..872caf9999 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml @@ -196,4 +196,11 @@ ) + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml index 38033e4e4a..7c8a86b911 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml @@ -3,26 +3,44 @@ - - - - - - - - - - - - - - - - - - - - + + \ No newline at end of file