From c322e56b04d89e10869fcef733ef08ed7f62df38 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 22 Nov 2021 16:34:28 +0800 Subject: [PATCH] test --- .../dto/form/demand/ServiceQueryFormDTO.java | 21 +++++++++++------ ...IcCommunitySelfOrganizationController.java | 3 ++- .../controller/IcPartyUnitController.java | 3 ++- .../controller/IcSocietyOrgController.java | 3 ++- .../dao/IcCommunitySelfOrganizationDao.java | 2 +- .../java/com/epmet/dao/IcSocietyOrgDao.java | 5 +++- ...cCommunitySelfOrganizationServiceImpl.java | 17 ++++++++++---- .../service/impl/IcSocietyOrgServiceImpl.java | 20 ++++++++-------- .../mapper/IcCommunitySelfOrganizationDao.xml | 23 ++++++++++--------- .../main/resources/mapper/IcSocietyOrgDao.xml | 10 +++++--- .../epmet/dto/result/DemandUserResDTO.java | 7 +++--- .../epmet/feign/EpmetUserOpenFeignClient.java | 4 ++-- .../main/resources/mapper/IcResiUserDao.xml | 9 ++++---- 13 files changed, 77 insertions(+), 50 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceQueryFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceQueryFormDTO.java index 472d78f58c..1b581426e2 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceQueryFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceQueryFormDTO.java @@ -8,17 +8,24 @@ import java.io.Serializable; @Data public class ServiceQueryFormDTO implements Serializable { private static final long serialVersionUID = -2738313255838176318L; + public interface AddUserInternalGroup {} - public interface DemandId { - } - - + public interface SocietyOrgInternalGroup {} + /** + * 前端入参 + */ private String serviceName; + // 社会组织的:query_demand 新增需求:add_demand + @NotBlank(message = "新增需求:add_demand;列表查询:query_demand",groups = SocietyOrgInternalGroup.class) + private String queryPurpose; - @NotBlank(message = "需求id不能为空", groups = DemandId.class) - private String demandRecId; + // 以下参数从token中获取 + @NotBlank(message = "userId不能为空",groups = AddUserInternalGroup.class) + private String staffId; + @NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class) + private String customerId; + private String demandRecId; - private String customerId; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java index 07850adb8f..0a52e569ff 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java @@ -165,7 +165,8 @@ public class IcCommunitySelfOrganizationController { @PostMapping("servicelist") public Result> queryServiceList(@LoginUser TokenDto tokenDto, @RequestBody ServiceQueryFormDTO formDTO){ formDTO.setCustomerId(tokenDto.getCustomerId()); - ValidatorUtils.validateEntity(formDTO,ServiceQueryFormDTO.DemandId.class); + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,ServiceQueryFormDTO.AddUserInternalGroup.class); return new Result>().ok(icCommunitySelfOrganizationService.queryServiceList(formDTO)); } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java index 4b7f3aa7a0..8184cbbe09 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java @@ -107,7 +107,8 @@ public class IcPartyUnitController { @PostMapping("servicelist") public Result> queryServiceList(@LoginUser TokenDto tokenDto, @RequestBody ServiceQueryFormDTO formDTO){ formDTO.setCustomerId(tokenDto.getCustomerId()); - ValidatorUtils.validateEntity(formDTO,ServiceQueryFormDTO.DemandId.class); + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,ServiceQueryFormDTO.AddUserInternalGroup.class); return new Result>().ok(icPartyUnitService.queryServiceList(formDTO)); } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java index 909f961b56..e34a042862 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java @@ -104,7 +104,8 @@ public class IcSocietyOrgController { @PostMapping("servicelist") public Result> queryServiceList(@LoginUser TokenDto tokenDto,@RequestBody ServiceQueryFormDTO formDTO){ formDTO.setCustomerId(tokenDto.getCustomerId()); - ValidatorUtils.validateEntity(formDTO,ServiceQueryFormDTO.DemandId.class); + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,ServiceQueryFormDTO.AddUserInternalGroup.class,ServiceQueryFormDTO.SocietyOrgInternalGroup.class); return new Result>().ok(societyOrgService.queryServiceList(formDTO)); } } \ No newline at end of file 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 4f9eaafc16..3fee0e0a71 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 @@ -53,6 +53,6 @@ public interface IcCommunitySelfOrganizationDao extends BaseDao selectCommunitySelfOrganizationList(CommunitySelfOrganizationListFormDTO formDTO); List selectListByAgencyId(@Param("customerId") String customerId, - @Param("agencyId") String agencyId, + @Param("agencyIds") List agencyIds, @Param("orgName") String orgName); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java index f86799747a..0772af28de 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java @@ -48,5 +48,8 @@ public interface IcSocietyOrgDao extends BaseDao { * @param agencyIds * @return */ - List selectListByAgencyId(@Param("agencyIds")List agencyIds,@Param("societyName")String societyName,@Param("customerId")String customerId); + List selectListByAgencyId(@Param("agencyIds")List agencyIds, + @Param("societyName")String societyName, + @Param("customerId")String customerId, + @Param("queryPurpose")String queryPurpose); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java index 8187ca6fd2..402d184668 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java @@ -7,6 +7,7 @@ import com.epmet.commons.mybatis.entity.BaseEpmetEntity; 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.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; @@ -20,7 +21,6 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.IcCommunitySelfOrganizationConstant; import com.epmet.dao.IcCommunitySelfOrganizationDao; import com.epmet.dto.IcCommunitySelfOrganizationDTO; -import com.epmet.dto.IcUserDemandRecDTO; import com.epmet.dto.form.AddCommunitySelfOrganizationFormDTO; import com.epmet.dto.form.CommunitySelfOrganizationListFormDTO; import com.epmet.dto.form.DelCommunitySelfOrganizationFormDTO; @@ -248,11 +248,18 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl queryServiceList(ServiceQueryFormDTO formDTO) { List resultList=new ArrayList<>(); - IcUserDemandRecDTO icUserDemandRecDTO=icUserDemandRecService.get(formDTO.getDemandRecId()); - if(null==icUserDemandRecDTO|| org.springframework.util.StringUtils.isEmpty(icUserDemandRecDTO.getAgencyId())){ - return resultList; + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfoCacheResult || StringUtils.isBlank(staffInfoCacheResult.getAgencyId())) { + throw new RenException("工作人员所属组织信息查询异常"); } - resultList=baseDao.selectListByAgencyId(formDTO.getCustomerId(),icUserDemandRecDTO.getAgencyId(),formDTO.getServiceName()); + List agencyIds=new ArrayList<>(); + if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { + if(staffInfoCacheResult.getAgencyPIds().contains(StrConstant.COLON)){ + agencyIds.addAll(Arrays.asList(staffInfoCacheResult.getAgencyPIds().split(StrConstant.COLON))); + } + } + agencyIds.add(staffInfoCacheResult.getAgencyId()); + resultList=baseDao.selectListByAgencyId(formDTO.getCustomerId(),agencyIds,formDTO.getServiceName()); return resultList; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java index d96c09ea5c..1acdcba831 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java @@ -26,7 +26,6 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcSocietyOrgDao; -import com.epmet.dto.IcUserDemandRecDTO; import com.epmet.dto.form.AddSocietyOrgFormDTO; import com.epmet.dto.form.EditSocietyOrgFormDTO; import com.epmet.dto.form.GetListSocietyOrgFormDTO; @@ -41,13 +40,13 @@ import com.epmet.service.IcSocietyOrgService; import com.epmet.service.IcUserDemandRecService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.Arrays; @@ -145,17 +144,18 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl queryServiceList(ServiceQueryFormDTO formDTO) { List resultList=new ArrayList<>(); - IcUserDemandRecDTO icUserDemandRecDTO=icUserDemandRecService.get(formDTO.getDemandRecId()); - if(null==icUserDemandRecDTO|| StringUtils.isEmpty(icUserDemandRecDTO.getGridPids())){ - return resultList; + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfoCacheResult || StringUtils.isBlank(staffInfoCacheResult.getAgencyId())) { + throw new RenException("工作人员所属组织信息查询异常"); } List agencyIds=new ArrayList<>(); - if(icUserDemandRecDTO.getGridPids().contains(StrConstant.COLON)){ - agencyIds.addAll(Arrays.asList(icUserDemandRecDTO.getGridPids().split(StrConstant.COLON))); - }else{ - agencyIds.add(icUserDemandRecDTO.getGridPids()); + if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { + if(staffInfoCacheResult.getAgencyPIds().contains(StrConstant.COLON)){ + agencyIds.addAll(Arrays.asList(staffInfoCacheResult.getAgencyPIds().split(StrConstant.COLON))); + } } - resultList=baseDao.selectListByAgencyId(agencyIds,formDTO.getServiceName(),formDTO.getCustomerId()); + agencyIds.add(staffInfoCacheResult.getAgencyId()); + resultList=baseDao.selectListByAgencyId(agencyIds,formDTO.getServiceName(),formDTO.getCustomerId(),formDTO.getQueryPurpose()); return resultList; } 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 bcbaf62616..b893795104 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 @@ -72,16 +72,17 @@ \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml index c487fbcccd..51e42c8402 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml @@ -53,9 +53,13 @@ del_flag = '0' and CUSTOMER_ID=#{customerId} and AGENCY_ID=#{agencyId} - - and society_name concat('%',#{societyName},'%') - + + and SERVICE_START_TIME <= NOW() + and SERVICE_END_TIME >= NOW() + + + and society_name like concat('%',#{societyName},'%') + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DemandUserResDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DemandUserResDTO.java index f2bad106a8..da8e6cfd07 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DemandUserResDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DemandUserResDTO.java @@ -6,9 +6,10 @@ import java.io.Serializable; @Data public class DemandUserResDTO implements Serializable { - private String icResiUserId; - private String name; - private String mobile; + private String demandUserId; + private String demandUserName; + private String demandUserMobile; private String label; private String gridId; + private String idCard; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 5637b6b765..3dcf542b80 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -23,8 +23,8 @@ import java.util.Set; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:09 */ -//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") -@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") +//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) public interface EpmetUserOpenFeignClient { /** diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 1b41be654f..311a451e20 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -275,11 +275,12 @@