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..0928771668 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; } 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/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/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-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/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/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 3bbd8631c0..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,10 +57,11 @@ import java.util.Map; @Service public class CustomerAgencyServiceImpl extends BaseServiceImpl implements CustomerAgencyService { - private static final Logger log = LoggerFactory.getLogger(CustomerAgencyServiceImpl.class); + 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( @@ -117,6 +120,22 @@ 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); } @@ -147,7 +166,7 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl + + + 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(); }