Browse Source

/loginwxmp/getmyorg接口开发

master
yinzuomei 5 years ago
parent
commit
0919eb7a45
  1. 12
      epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  2. 6
      epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java
  3. 20
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  4. 33
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java
  5. 39
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java
  6. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  7. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  8. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  9. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  10. 19
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  11. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java

12
epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java

@ -2,9 +2,7 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
import com.epmet.dto.form.StaffOrgFormDTO;
import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.feign.fallback.GovOrgFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
@ -20,16 +18,6 @@ import java.util.List;
*/
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallback.class)
public interface GovOrgFeignClient {
/**
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.StaffGridInfoResultDTO>>
* @param staffGridInfoFormDTO
* @Author yinzuomei
* @Description
* @Date 2020/4/20 21:36
**/
@PostMapping(value = "gov/org/customergrid/getStaffGridInfo",consumes = MediaType.APPLICATION_JSON_VALUE)
Result<StaffLatestLoginGridResultDTO> getStaffLatestLoginGrid(StaffLatestLoginGridFormDTO staffGridInfoFormDTO);
/**
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.StaffOrgsResultDTO>>
* @param staffOrgFormDTO

6
epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java

@ -3,9 +3,7 @@ package com.epmet.feign.fallback;
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.form.StaffLatestLoginGridFormDTO;
import com.epmet.dto.form.StaffOrgFormDTO;
import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
@ -19,10 +17,6 @@ import java.util.List;
*/
@Component
public class GovOrgFeignClientFallback implements GovOrgFeignClient {
@Override
public Result<StaffLatestLoginGridResultDTO> getStaffLatestLoginGrid(StaffLatestLoginGridFormDTO staffLatestLoginGridFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffLatestLoginGrid", staffLatestLoginGridFormDTO);
}
@Override
public Result<List<StaffOrgsResultDTO>> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO) {

20
epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java

@ -190,10 +190,8 @@ public class GovLoginServiceImpl implements GovLoginService {
WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode());
//3、记录staff_wechat
this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
//4、查询用户绑定的网格
StaffLatestLoginGridResultDTO latestGridInfo = this.getLatestGridInfo(formDTO, customerStaff.getUserId());
//5、记录登录日志
this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid(), latestGridInfo.getGridId());
this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
//1、获取用户token
String token = this.generateGovWxmpToken(customerStaff.getUserId());
//2、保存到redis
@ -203,28 +201,14 @@ public class GovLoginServiceImpl implements GovLoginService {
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
}
//查询用户绑定的网格
private StaffLatestLoginGridResultDTO getLatestGridInfo(GovWxmpEnteOrgFormDTO formDTO, String userId) {
StaffLatestLoginGridFormDTO staffGridInfoFormDTO = new StaffLatestLoginGridFormDTO();
staffGridInfoFormDTO.setCustomerId(formDTO.getCustomerId());
staffGridInfoFormDTO.setOrgId(formDTO.getOrgId());
staffGridInfoFormDTO.setStaffId(userId);
Result<StaffLatestLoginGridResultDTO> staffGridInfoListResult = govOrgFeignClient.getStaffLatestLoginGrid(staffGridInfoFormDTO);
if (staffGridInfoListResult.success() && null != staffGridInfoListResult.getData()) {
return staffGridInfoListResult.getData();
}
return new StaffLatestLoginGridResultDTO();
}
//保存登录日志
private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId, String grid) {
private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId) {
StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO();
staffLoginAgencyRecordFormDTO.setCustomerId(formDTO.getCustomerId());
staffLoginAgencyRecordFormDTO.setStaffId(staffId);
staffLoginAgencyRecordFormDTO.setWxOpenId(openId);
staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile());
staffLoginAgencyRecordFormDTO.setOrgId(formDTO.getOrgId());
staffLoginAgencyRecordFormDTO.setGridId(grid);
Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO);
return staffLoginRecordResult;
}

33
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java

@ -1,33 +0,0 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 根据用户选择的组织查询用户与网格的关系列表
* @Author yinzuomei
* @Date 2020/4/20 15:29
*/
@Data
public class StaffLatestLoginGridFormDTO implements Serializable {
/**
* 用户选择的组织所属的id
*/
@NotBlank(message = "客户id不能为空")
private String customerId;
/**
* 用户选择的要进入的组织(根组织id)
*/
@NotBlank(message = "组织id不能为空")
private String orgId;
/**
* 工作人员id
*/
@NotBlank(message = "staffId不能为空")
private String staffId;
}

39
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java

@ -1,39 +0,0 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 根据用户选择的组织查询用户与网格的关系列表
* @Author yinzuomei
* @Date 2020/4/20 15:22
*/
@Data
public class StaffLatestLoginGridResultDTO implements Serializable {
/**
* ID 唯一标识
*/
private String gridId;
/**
* 客户ID
*/
private String customerId;
/**
* 网格名称
*/
private String gridName;
/**
* 所属组织机构IDcustomer_organization.id
*/
private String pid;
/**
* 所有上级组织ID
*/
private String pids;
}

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -28,9 +28,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
import com.epmet.excel.CustomerGridExcel;
import com.epmet.service.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
@ -127,16 +125,4 @@ public class CustomerGridController {
return new Result<CustomerGridDTO>().ok(data);
}
/**
* @param staffGridInfoFormDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.StaffGridInfoResultDTO>>
* @Author yinzuomei
* @Description 根据用户选择的组织查询用户与网格的关系列表
* @Date 2020/4/20 15:34
**/
@PostMapping(value = "getStaffGridInfo")
public Result<StaffLatestLoginGridResultDTO> getStaffGridInfo(@RequestBody StaffLatestLoginGridFormDTO staffGridInfoFormDTO) {
ValidatorUtils.validateEntity(staffGridInfoFormDTO);
return customerGridService.listStaffGridInfo(staffGridInfoFormDTO);
}
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -21,9 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
import com.epmet.entity.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper;
@ -63,12 +61,4 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO);
/**
* @param staffGridInfoFormDTO
* @return java.util.List<com.epmet.dto.result.StaffGridInfoResultDTO>
* @Author yinzuomei
* @Description 查询工作人员绑定的网格列表
* @Date 2020/4/20 15:36
**/
List<StaffLatestLoginGridResultDTO> selectListStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO);
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -23,9 +23,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
import com.epmet.entity.CustomerGridEntity;
import java.util.List;
@ -116,12 +114,4 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
*/
Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO);
/**
* @param staffGridInfoFormDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.StaffGridInfoResultDTO>>
* @Author yinzuomei
* @Description 根据用户选择的组织查询用户与网格的关系列表
* @Date 2020/4/20 15:35
**/
Result<StaffLatestLoginGridResultDTO> listStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO);
}

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -28,9 +28,7 @@ import com.epmet.dao.CustomerGridDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
import com.epmet.entity.CustomerGridEntity;
import com.epmet.redis.CustomerGridRedis;
import com.epmet.service.CustomerGridService;
@ -151,15 +149,6 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
@Override
public Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO) {
return new Result<CustomerGridDTO>().ok(baseDao.getCustomerGridByGridId(customerGridFormDTO));
}
@Override
public Result<StaffLatestLoginGridResultDTO> listStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO) {
List<StaffLatestLoginGridResultDTO> list = baseDao.selectListStaffGridInfo(staffGridInfoFormDTO);
if(null!=list&&list.size()>0){
return new Result<StaffLatestLoginGridResultDTO>().ok(list.get(0));
}
return new Result<>();
}
}

19
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -93,23 +93,4 @@
</select>
<!-- 查询工作人员绑定的网格列表 -->
<select id="selectListStaffGridInfo" parameterType="com.epmet.dto.form.StaffLatestLoginGridFormDTO" resultType="com.epmet.dto.result.StaffLatestLoginGridResultDTO">
SELECT
csg.GRID_ID,
cg.CUSTOMER_ID,
cg.GRID_NAME,
cg.PID,
cg.PIDS
FROM
customer_staff_grid csg
LEFT JOIN customer_grid cg ON ( csg.GRID_ID = cg.id )
WHERE
csg.DEL_FLAG = '0'
AND cg.DEL_FLAG = '0'
AND csg.USER_ID=#{staffId}
and cg.PID like concat(#{orgId},'%')
and cg.CUSTOMER_ID=#{customerId}
order by csg.CREATED_TIME desc
</select>
</mapper>

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java

@ -36,9 +36,5 @@ public class StaffLoginAgencyRecordFormDTO implements Serializable {
*/
private String orgId;
/**
* 网格表Id (CUSTOMER_GRID.id)
*/
private String gridId;
}

Loading…
Cancel
Save