diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java index 42920853ee..855313c695 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java @@ -34,6 +34,6 @@ public class GovWxmpEnteOrgFormDTO implements Serializable { * 选择的要进入的组织(根组织id) */ @NotBlank(message = "组织id不能为空") - private String agencyId; + private String rootAgencyId; } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index f77b7747ef..35ce90b25c 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -127,6 +127,9 @@ public class GovLoginServiceImpl implements GovLoginService { public Result loginByWxCode(GovWxmpFormDTO formDTO) { //1、解析微信用户 WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode()); + if(null!=wxMaJscode2SessionResult){ + logger.info(String.format("app=%s,wxCode=%s,openId=%s",formDTO.getApp(),formDTO.getWxCode(),wxMaJscode2SessionResult.getOpenid())); + } Result latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid()); if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) { logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg())); @@ -200,7 +203,7 @@ public class GovLoginServiceImpl implements GovLoginService { //5.1、获取用户token String token = this.generateGovWxmpToken(customerStaff.getUserId()); //5.2、保存到redis - this.saveGovTokenDto(formDTO.getAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); + this.saveGovTokenDto(formDTO.getRootAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); userTokenResultDTO.setToken(token); return new Result().ok(userTokenResultDTO); @@ -223,7 +226,7 @@ public class GovLoginServiceImpl implements GovLoginService { staffLoginAgencyRecordFormDTO.setStaffId(staffId); staffLoginAgencyRecordFormDTO.setWxOpenId(openId); staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile()); - staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getAgencyId()); + staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getRootAgencyId()); Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); return staffLoginRecordResult; } @@ -252,9 +255,9 @@ public class GovLoginServiceImpl implements GovLoginService { Map map = new HashMap<>(); map.put("app", LoginConstant.APP_GOV); map.put("client", LoginConstant.CLIENT_WXMP); - map.put("staffId", staffId); + map.put("userId", staffId); String token = jwtTokenUtils.createToken(map); - logger.info("app:" + LoginConstant.APP_GOV + ";client:" + LoginConstant.CLIENT_WXMP + ";staffId:" + staffId + ";生成token[" + token + "]"); + logger.info("app:" + LoginConstant.APP_GOV + ";client:" + LoginConstant.CLIENT_WXMP + ";userId:" + staffId + ";生成token[" + token + "]"); return token; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java index 2a8fd7c05b..bfb7e6dc67 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -4,6 +4,7 @@ import lombok.Data; import java.io.Serializable; import java.util.List; +import java.util.Set; /** * @Description 政府端登录信息 @@ -62,5 +63,10 @@ public class GovTokenDto extends BaseTokenDto implements Serializable { * 最后一次更新时间 */ private long updateTime; + + /** + * 功能权限列表,实际上是gov_staff => staff_role => role_operation查询到的operationKey + */ + private List permissions; } diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java new file mode 100644 index 0000000000..b800d6bc1a --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +@Data +public class StaffPermCacheFormDTO { + + /** + * 更新权限缓存分组 + */ + public interface UpdatePermissionCache {} + + /** + * 工作人员 id + */ + @NotBlank(message = "工作人员ID不能为空", groups = {UpdatePermissionCache.class}) + private String staffId; + + /** + * 登录头信息app + */ + @NotBlank(message = "登录头信息app不能为空", groups = {UpdatePermissionCache.class}) + private String app; + + /** + * 登录头信息client + */ + @NotBlank(message = "登录头信息client不能为空", groups = {UpdatePermissionCache.class}) + private String client; + + /** + * 权限列表 + */ + private List permissions; + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java new file mode 100644 index 0000000000..0f7eaf4920 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java @@ -0,0 +1,43 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.StaffPermCacheFormDTO; +import com.epmet.service.AccessService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 权限相关Api + * @Author wxz + * @Description + * @Date 2020/4/23 17:54 + **/ +@RestController +@RequestMapping("access") +public class AccessController { + + @Autowired + private AccessService accessService; + + /** + * 更新工作人员权限缓存 + * @param staffPermCacheFormDTO + * @return + */ + @PostMapping("updatepermissioncache") + public Result updatePermissionCache(@RequestBody StaffPermCacheFormDTO staffPermCacheFormDTO) { + ValidatorUtils.validateEntity(staffPermCacheFormDTO, StaffPermCacheFormDTO.UpdatePermissionCache.class); + String staffId = staffPermCacheFormDTO.getStaffId(); + String app = staffPermCacheFormDTO.getApp(); + String client = staffPermCacheFormDTO.getClient(); + List permissions = staffPermCacheFormDTO.getPermissions(); + accessService.updatePermissionCache(staffId, app, client, permissions); + return new Result(); + } +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java new file mode 100644 index 0000000000..cbf51355d1 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java @@ -0,0 +1,12 @@ +package com.epmet.service; + +import java.util.List; + +public interface AccessService { + /** + * 更新权限缓存 + * @param staffId + * @param permissions + */ + void updatePermissionCache(String staffId, String app, String client, List permissions); +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java new file mode 100644 index 0000000000..e391283e94 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -0,0 +1,40 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.security.dto.GovTokenDto; +import com.epmet.commons.tools.utils.CpUserDetailRedis; +import com.epmet.service.AccessService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class AccessServiceImpl implements AccessService { + + private static Logger logger = LoggerFactory.getLogger(AccessServiceImpl.class); + + @Autowired + private CpUserDetailRedis cpUserDetailRedis; + + /** + * 更新权限缓存 + * @param staffId + * @param permissions + */ + @Override + public void updatePermissionCache(String staffId, String app, String client, List permissions) { + GovTokenDto govTokenDto = cpUserDetailRedis.get(app, client, staffId, GovTokenDto.class); + if (govTokenDto == null) { + logger.warn("更新[{}]用户缓存:Redis中不存在该用户TokenDto缓存信息", staffId); + return ; + } + govTokenDto.setPermissions(permissions); + + // 将新的TokenDto更新到redis中 + long expire = cpUserDetailRedis.getExpire(app, client, staffId); + cpUserDetailRedis.set(govTokenDto, expire); + logger.warn("更新[{}]用户缓存成功。", staffId); + } +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java index 6a9c00fe60..7cde40d997 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java @@ -34,7 +34,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List; -import java.util.Set; /** * 机关单位信息表 @@ -78,7 +77,7 @@ public class StaffAgencyController { * @Date 2020/4/23 10:34 **/ @PostMapping("switchgrid") - public Result> switchGrid(@LoginUser TokenDto tokenDto, @RequestBody @Valid SwitchGridFormDTO switchGridFormDTO) { + public Result switchGrid(@LoginUser TokenDto tokenDto, @RequestBody @Valid SwitchGridFormDTO switchGridFormDTO) { switchGridFormDTO.setStaffId(tokenDto.getUserId()); return staffAgencyService.switchGrid(switchGridFormDTO); } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java index fb87fd96ec..2530c956a4 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java @@ -25,7 +25,6 @@ import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import java.util.List; -import java.util.Set; /** * 机关单位信息表 @@ -57,7 +56,7 @@ public interface StaffAgencyService { * @Description 切换网格 * @Date 2020/4/23 10:49 **/ - Result> switchGrid(SwitchGridFormDTO switchGridFormDTO); + Result switchGrid(SwitchGridFormDTO switchGridFormDTO); /** * @Description 得到工作人员最后一次登录的网格 diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index 1be3e976c2..adc8807690 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -37,7 +37,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; -import java.util.Set; /** * 机关单位信息表 @@ -94,17 +93,17 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { @Override - public Result> switchGrid(SwitchGridFormDTO switchGridFormDTO) { + public Result switchGrid(SwitchGridFormDTO switchGridFormDTO) { //记录网格访问记录 StaffGridVisitedFormDTO staffGridVisitedFormDTO = ConvertUtils.sourceToTarget(switchGridFormDTO, StaffGridVisitedFormDTO.class); Result saveStaffGridVisitedRecord = epmetUserFeignClient.saveStaffGridVisitedRecord(staffGridVisitedFormDTO); if (!saveStaffGridVisitedRecord.success()) { logger.error("保存网格访问记录失败"); - return new Result>().error(); } - //查询网格的权限 + /* //查询网格的权限 Set opeKeys = accessService.listOpeKeysByStaffId(switchGridFormDTO.getStaffId(), null, switchGridFormDTO.getGridId()); - return new Result>().ok(opeKeys); + return new Result>().ok(opeKeys);*/ + return new Result(); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffsInAgencyFromDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffsInAgencyFromDTO.java new file mode 100644 index 0000000000..dc0deddc9d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffsInAgencyFromDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/23 15:45 + */ +@Data +public class StaffsInAgencyFromDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 客户ID + */ + private String customerId; + /** + * 机关ID + */ + private String agencyId; + /** + * 用户ID + */ + private List staffList; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java index 1979096f1a..8a5249c6ae 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java @@ -21,7 +21,7 @@ public class LatestCustomerResultDTO implements Serializable { */ private String customerName; /** - * 客户顶级名称 + * 用户所属组织id(任意一条) */ private String agencyId; /** @@ -29,7 +29,7 @@ public class LatestCustomerResultDTO implements Serializable { */ private String staffHeadPhoto; /** - * 性别 + * 性别0未知1男2女 */ private Integer gender; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java new file mode 100644 index 0000000000..2859c1171a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/23 16:08 + */ +@Data +public class StaffInfoResultDTO implements Serializable { + /** + * 用户ID + */ + private String staffId; + /** + * 用户姓名 + */ + private String staffName; + /** + * 头像 + */ + private String staffHeadPhoto; + /** + * 性别 + */ + private Integer gender; + /** + * 是否禁用(未禁用enable,已禁用disabled) + */ + private String enableFlag; + /** + * 权限名 + */ + private String roleName; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java index 58955cc634..e929739841 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java @@ -14,9 +14,14 @@ public class StaffOrgsResultDTO implements Serializable { private static final long serialVersionUID = -9148184731135509803L; /** - * 组织id + * 根级根级组织id */ - private String orgId; + private String rootAgencyId; + + /** + * 根级组织名称 + */ + private String rootAgencyName; /** * 客户id @@ -24,8 +29,8 @@ public class StaffOrgsResultDTO implements Serializable { private String customerId; /** - * 组织名称 + * 客户名称 */ - private String orgName; + private String customerName; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffsInAgencyResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffsInAgencyResultDTO.java new file mode 100644 index 0000000000..4c9352466b --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffsInAgencyResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/23 15:58 + */ +@NoArgsConstructor +@Data +public class StaffsInAgencyResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 人员总数 + */ + private Integer staffCount; + /** + * 人员列表 + */ + private List staffList; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java index fa1976bf6d..3bfc887aec 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java @@ -26,7 +26,9 @@ 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.CustomerStaffAgencyDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.excel.CustomerStaffAgencyExcel; import com.epmet.service.CustomerStaffAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -104,4 +106,7 @@ public class CustomerStaffAgencyController { return customerStaffAgencyService.getLatestCustomer(userId); } + + + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java new file mode 100644 index 0000000000..7d57bb3a71 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java @@ -0,0 +1,36 @@ +package com.epmet.controller; + + + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; +import com.epmet.dto.result.StaffsInAgencyResultDTO; +import com.epmet.service.StaffService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 组织结构-工作人员 + * @author zhaoqifeng + * @date 2020/4/23 17:59 + */ +@RestController +@RequestMapping("staff") +public class StaffController { + @Autowired + private StaffService staffService; + /** + * 组织首页-工作人员列表 + * @param fromDTO + * @return + */ + @PostMapping("staffsinagency") + public Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + return staffService.getStaffInfoForHome(fromDTO); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java index 828c6cdd98..533c97b2a5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java @@ -22,6 +22,8 @@ import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 人员-机关单位关系表 * @@ -37,5 +39,12 @@ public interface CustomerStaffAgencyDao extends BaseDao selectCustomerStaffAgencyList(String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 1774a21c15..217d37c0bb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -5,6 +5,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -33,4 +35,12 @@ public interface EpmetUserFeignClient { @PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid") Result> getStaffGridList(@RequestBody List customerStaffGridDTOS); + /** + * 组织首页-工作人员列表 + * @param fromDTO + * @return + */ + @PostMapping("/epmetuser/customerstaff/staffsinagency") + Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java index 9cd6369f4f..fe0bf224ab 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java @@ -3,11 +3,14 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.feign.fallback.OperCrmFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import java.util.List; + /** * @author zhaoqifeng * @dscription @@ -22,4 +25,14 @@ public interface OperCrmFeignClient { */ @PostMapping("/oper/crm/customer/getcostomerInfo") Result getCustomerInfo(@RequestBody CustomerDTO dto); + + /** + * @param customerFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author yinzuomei + * @Description 根据客户id查询客户信息 + * @Date 2020/4/24 9:07 + **/ + @PostMapping("/oper/crm/customer/queryCustomerList") + Result> queryCustomerList(CustomerFormDTO customerFormDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java index 05b26449b3..a4cf20b805 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -6,6 +6,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -25,4 +27,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result> getStaffGridList(List customerStaffGridDTOS) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); } + + @Override + public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoForHome", fromDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java index d40619a04c..9f405caca4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java @@ -4,9 +4,12 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.feign.OperCrmFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * @author zhaoqifeng * @dscription @@ -18,4 +21,9 @@ public class OperCrmFeignClientFallBack implements OperCrmFeignClient { public Result getCustomerInfo(CustomerDTO dto) { return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto); } + + @Override + public Result> queryCustomerList(CustomerFormDTO customerFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "queryCustomerList", customerFormDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 24a4e17b35..7076fe6d2d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -107,4 +107,44 @@ public interface CustomerAgencyService extends BaseService * @Date 2020/4/20 21:45 **/ Result> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加组织 + */ + Result addAgency(AddAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织名称编辑 + */ + Result editAgency(EditAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除组织机关 + */ + Result removeAgency(RemoveAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取组织机构信息 + */ + Result agencyDetail(AgencydetailFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + */ + Result subAgencyList(SubAgencyFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java index 2aaee92578..c713dbde52 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffAgencyDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.entity.CustomerStaffAgencyEntity; @@ -102,4 +103,13 @@ public interface CustomerStaffAgencyService extends BaseService getLatestCustomer(String userId); + + /** + * 获取组织下关联人员 + * @param fromDTO + * @return + */ + Result> getCustomerStaffAgencyList(StaffsInAgencyFromDTO fromDTO); + + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java new file mode 100644 index 0000000000..6d5b37c11f --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java @@ -0,0 +1,22 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffsInAgencyResultDTO; + +/** + * 组织结构-工作人员 + * + * @author zhaoqifeng + * @date 2020/4/23 18:00 + */ +public interface StaffService { + /** + * 组织首页-工作人员列表 + * + * @param fromDTO 参数 + * @return Result + * @author zhaoqifeng + */ + Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index c9b963b20d..eb1d83a8ae 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -30,9 +30,11 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerAgencyConstant; import com.epmet.dao.CustomerAgencyDao; import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.feign.OperCrmFeignClient; import com.epmet.redis.CustomerAgencyRedis; import com.epmet.service.CustomerAgencyService; import org.apache.commons.lang3.StringUtils; @@ -55,9 +57,11 @@ import java.util.Map; @Service public class CustomerAgencyServiceImpl extends BaseServiceImpl implements CustomerAgencyService { + private static final Logger logger = LoggerFactory.getLogger(CustomerAgencyServiceImpl.class); @Autowired private CustomerAgencyRedis customerAgencyRedis; - + @Autowired + private OperCrmFeignClient operCrmFeignClient; @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -116,6 +120,146 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl(); } List list = baseDao.selectStaffOrgList(staffOrgsFormDTO.getCustomerIdList()); + CustomerFormDTO customerFormDTO = new CustomerFormDTO(); + customerFormDTO.setCustomerIdList(staffOrgsFormDTO.getCustomerIdList()); + Result> customerDTOResult = operCrmFeignClient.queryCustomerList(customerFormDTO); + List customerDTOList = customerDTOResult.getData(); + if (customerDTOResult.success() && customerDTOList.size() > 0) { + for (CustomerDTO customer : customerDTOList) { + for (StaffOrgsResultDTO staffOrgsResultDTO : list) { + if (customer.getId().equals(staffOrgsResultDTO.getCustomerId())) { + staffOrgsResultDTO.setCustomerName(customer.getCustomerName()); + break; + } + } + } + } else { + logger.error("获取客户名称失败"); + } return new Result>().ok(list); } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加组织 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result addAgency(AddAgencyFormDTO formDTO) { + Result result = new Result(); + AddAgencyResultDTO addAgencyResultDTO = new AddAgencyResultDTO(); + //0:属性映射赋值 + CustomerAgencyEntity entity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class); + entity.setOrganizationName(formDTO.getAgencyName()); + entity.setTotalUser(NumConstant.ZERO); + //1:查询上级机关信息 + CustomerAgencyEntity parentEntity = baseDao.selectById(formDTO.getPid()); + entity.setCustomerId(parentEntity.getCustomerId()); + if (null == parentEntity.getPid()) { + entity.setPids(parentEntity.getId()); + entity.setAllParentName(parentEntity.getOrganizationName()); + } else { + entity.setPids(":" + parentEntity.getId()); + entity.setAllParentName("-" + parentEntity.getOrganizationName()); + } + //2:保存组织信息 + if (baseDao.insert(entity) < NumConstant.ONE) { + logger.error(CustomerAgencyConstant.SAVE_EXCEPTION); + throw new RenException(CustomerAgencyConstant.SAVE_EXCEPTION); + } + //3:返回新组织Id + addAgencyResultDTO.setAgencyId(entity.getId()); + return result.ok(addAgencyResultDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织名称编辑 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result editAgency(EditAgencyFormDTO formDTO) { + Result result = new Result(); + CustomerAgencyEntity entity = new CustomerAgencyEntity(); + entity.setId(formDTO.getAgencyId()); + entity.setOrganizationName(formDTO.getAgencyName()); + if (baseDao.updateById(entity) < NumConstant.ONE) { + logger.error(CustomerAgencyConstant.UPDATE_EXCEPTION); + throw new RenException(CustomerAgencyConstant.UPDATE_EXCEPTION); + } + return result; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除组织机关 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result removeAgency(RemoveAgencyFormDTO formDTO) { + Result result = new Result(); + //1:查询当前机关是否存在所属下级机关,存在下级的不能删除 + List agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId()); + if (null != agencyList && agencyList.size() > NumConstant.ZERO) { + result.setCode(EpmetErrorCode.NOT_DEL_AGENCY.getCode()); + result.setMsg(EpmetErrorCode.NOT_DEL_AGENCY.getMsg()); + return result; + } + //2:删除当前机关组织(逻辑删) + if (baseDao.deleteById(formDTO.getAgencyId()) < NumConstant.ONE) { + logger.error(CustomerAgencyConstant.DEL_EXCEPTION); + throw new RenException(CustomerAgencyConstant.DEL_EXCEPTION); + } + return result; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取组织机构信息 + */ + @Override + public Result agencyDetail(AgencydetailFormDTO formDTO) { + AgencydetailResultDTO agencydetailResultDTO = new AgencydetailResultDTO(); + //1:查询本机关详细信息 + CustomerAgencyEntity entity = baseDao.selectById(formDTO.getAgencyId()); + if (null == entity) { + return new Result().ok(agencydetailResultDTO); + } + agencydetailResultDTO = ConvertUtils.sourceToTarget(entity, AgencydetailResultDTO.class); + agencydetailResultDTO.setAgencyId(entity.getId()); + agencydetailResultDTO.setAgencyName(entity.getOrganizationName()); + //2:查询本机关的所有上级机关,按自上而下层级顺序 + if (null == entity.getPids()) { + return new Result().ok(agencydetailResultDTO); + } + List listStr = Arrays.asList(entity.getPids().split(":")); + List parentList = baseDao.selectPAgencyById(listStr); + agencydetailResultDTO.setParentList(parentList); + return new Result().ok(agencydetailResultDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + */ + @Override + public Result subAgencyList(SubAgencyFormDTO formDTO) { + SubAgencyResultDTO subAgencyResultDTO = new SubAgencyResultDTO(); + //1:根据当前机关Id查询直属下一级机关列表 + List agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId()); + subAgencyResultDTO.setAgencyList(agencyList); + //2:统计下一级机关数 + subAgencyResultDTO.setSubAgencyCount(agencyList.size()); + return new Result().ok(subAgencyResultDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java index 212e5246a1..77292f2710 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java @@ -28,11 +28,16 @@ import com.epmet.dao.CustomerStaffAgencyDao; import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.dto.result.StaffInfoResultDTO; +import com.epmet.dto.result.StaffsInAgencyResultDTO; +import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerStaffAgencyEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.OperCrmFeignClient; import com.epmet.redis.CustomerStaffAgencyRedis; +import com.epmet.service.CustomerAgencyService; import com.epmet.service.CustomerStaffAgencyService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -42,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 人员-机关单位关系表 @@ -58,6 +64,8 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl page(Map params) { @@ -121,8 +129,7 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl staffInfo = - epmetUserFeignClient.getCustomerStaffInfoByUserId(customerStaffParam); + Result staffInfo = epmetUserFeignClient.getCustomerStaffInfoByUserId(customerStaffParam); resultDTO.setStaffHeadPhoto(staffInfo.getData().getHeadPhoto()); resultDTO.setGender(staffInfo.getData().getGender()); //获取客户名称 @@ -133,4 +140,12 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl().ok(resultDTO); } + @Override + public Result> getCustomerStaffAgencyList(StaffsInAgencyFromDTO fromDTO) { + + List customerStaffAgencyList = baseDao.selectCustomerStaffAgencyList(fromDTO.getAgencyId()); + + return new Result>().ok(customerStaffAgencyList); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java new file mode 100644 index 0000000000..6f3108abd7 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java @@ -0,0 +1,54 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerStaffAgencyDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; +import com.epmet.dto.result.StaffsInAgencyResultDTO; +import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.OperCrmFeignClient; +import com.epmet.service.CustomerAgencyService; +import com.epmet.service.CustomerStaffAgencyService; +import com.epmet.service.StaffService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/23 18:05 + */ +@Service +public class StaffServiceImpl implements StaffService { + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + @Autowired + private OperCrmFeignClient operCrmFeignClient; + @Autowired + private CustomerAgencyService customerAgencyService; + @Autowired + private CustomerStaffAgencyService customerStaffAgencyService; + @Override + public Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + StaffsInAgencyResultDTO resultDTO = new StaffsInAgencyResultDTO(); + //获取机关所在客户ID和人员总数 + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + resultDTO.setStaffCount(customerAgencyEntity.getTotalUser()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + List customerStaffAgencyList = customerStaffAgencyService.getCustomerStaffAgencyList(fromDTO).getData(); + if (null == customerStaffAgencyList || customerStaffAgencyList.size() == 0) { + return new Result().ok(null); + } + //提取所有userID + List staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList()); + fromDTO.setStaffList(staffIds); + //获取用户信息 + Result> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); + resultDTO.setStaffList(staffInfoListResult.getData()); + return new Result().ok(resultDTO); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index bd75d3e7f2..50ff491aa3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -24,9 +24,9 @@ + \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java new file mode 100644 index 0000000000..b4fbbeff49 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 根据客户id查询客户信息 + * @Author yinzuomei + * @Date 2020/4/24 9:09 + */ +@Data +public class CustomerFormDTO implements Serializable { + /** + * 客户id集合 + * */ + private List customerIdList; +} + diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index 4e683e3ffc..1605fd6c80 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.excel.CustomerExcel; import com.epmet.service.CustomerService; @@ -144,4 +145,15 @@ public class CustomerController { return customerService.getCustomerInfo(dto); } + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据客户id查询客户信息 + * @Date 2020/4/24 9:13 + **/ + @PostMapping("queryCustomerList") + public Result> queryCustomerList(@RequestBody CustomerFormDTO formDTO) { + return customerService.queryCustomerList(formDTO); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java index 661cc151c4..6a958cc6d2 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java @@ -18,9 +18,11 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.entity.CustomerEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -40,4 +42,13 @@ public interface CustomerDao extends BaseDao { * @date 2020-03-11 */ List selectListValidCustomerResultDTO(); + + /** + * @return java.util.List + * @param customerIdList + * @Author yinzuomei + * @Description 根据客户id查询客户信息 + * @Date 2020/4/24 9:21 + **/ + List selectListByIds(@Param("customerIdList") List customerIdList); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java index b36bd6f5b2..a50c87a138 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.entity.CustomerEntity; @@ -120,4 +121,13 @@ public interface CustomerService extends BaseService { * @return */ Result getCustomerInfo(CustomerDTO dto); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据客户id查询客户信息 + * @Date 2020/4/24 9:13 + **/ + Result> queryCustomerList(CustomerFormDTO formDTO); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 5384193128..89bab2936a 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerDao; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.entity.CustomerEntity; import com.epmet.redis.CustomerRedis; @@ -135,4 +136,10 @@ public class CustomerServiceImpl extends BaseServiceImpl().ok(ConvertUtils.sourceToTarget(entity, CustomerDTO.class)); } + @Override + public Result> queryCustomerList(CustomerFormDTO formDTO) { + List customerDTOList = baseDao.selectListByIds(formDTO.getCustomerIdList()); + return new Result>().ok(customerDTOList); + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml index 2a7e3c22ab..340883f472 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml @@ -34,4 +34,18 @@ ORDER BY CONVERT ( c.CUSTOMER_NAME USING gbk ) ASC + + + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java index 6fbd80dd49..a247d4e450 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java @@ -128,4 +128,9 @@ public class CustomerStaffDTO implements Serializable { * 客户id */ private String customerId; + + /** + * 角色名称 + */ + private String roleName; } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index 103d4163fc..42c39a6022 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -30,6 +30,8 @@ import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.excel.CustomerStaffExcel; import com.epmet.service.CustomerStaffService; import org.springframework.beans.factory.annotation.Autowired; @@ -143,4 +145,14 @@ public class CustomerStaffController { public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { return customerStaffService.getCustomerStaffInfoByUserId(formDTO); } + + /** + * 组织首页-工作人员列表 + * @param fromDTO + * @return + */ + @PostMapping("staffsinagency") + public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + return customerStaffService.getStaffInfoForHome(fromDTO); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index ef1a5955eb..b552832c2d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -22,6 +22,8 @@ import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; @@ -54,14 +56,23 @@ public interface CustomerStaffDao extends BaseDao { **/ CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO); - CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); + CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); - /** - * 根据userId查询查询网格下的用户信息 - * @param customerStaffGridDTOS - * @return - */ - List selectStaffGridListByUserId(List customerStaffGridDTOS); + /** + * 根据userId查询查询网格下的用户信息 + * + * @param customerStaffGridDTOS + * @return + */ + List selectStaffGridListByUserId(List customerStaffGridDTOS); + + /** + * 根据用户ID列表获取用户信息 + * + * @param fromDTO + * @return + */ + List selectCustomerStaffList(StaffsInAgencyFromDTO fromDTO); /** * @return com.epmet.entity.CustomerStaffEntity diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index 3775510742..4a7ceb335f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -23,8 +23,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; -import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import java.util.List; @@ -132,4 +133,11 @@ public interface CustomerStaffService extends BaseService { * @return */ Result> selectStaffGridListByUserId(List customerStaffGridDTOS); + + /** + * 组织首页-工作人员列表 + * @param fromDTO + * @return + */ + Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 4ac6f5a529..560fe0008c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -30,8 +30,9 @@ import com.epmet.dao.CustomerStaffDao; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; -import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import com.epmet.redis.CustomerStaffRedis; import com.epmet.service.CustomerStaffService; @@ -149,4 +150,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(staffGridListDTOS); } + @Override + public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + List list = baseDao.selectCustomerStaffList(fromDTO); + return new Result>().ok(list); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java index 126dfd728c..11fb4702ca 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java @@ -112,7 +112,7 @@ public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl getLatestStaffWechatLoginRecord(String openId) { - if (StringUtils.isNotBlank(openId)) { + if (StringUtils.isBlank(openId)) { logger.error("openId 不能为空"); return new Result(); } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 8528391aac..ab8ad974a5 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -41,6 +41,33 @@ AND cs.del_flag = 0 +