Browse Source

Merge remote-tracking branch 'origin/dev_govorg' into dev_govorg

# Conflicts:
#	epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
dev_shibei_match
sunyuchao 5 years ago
parent
commit
e204bdbde3
  1. 6
      epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java
  2. 3
      epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java
  3. 9
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  4. 7
      epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/utils/WxMaServiceUtils.java
  5. 15
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java
  6. 4
      epmet-gateway/src/main/resources/bootstrap.yml
  7. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  8. 0
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  9. 14
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  10. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  11. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java
  12. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  13. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  14. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java
  15. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  16. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java
  17. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
  18. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java
  19. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
  20. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffWechatServiceImpl.java
  21. 15
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
  22. 14
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml
  23. 11
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

6
epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java

@ -38,7 +38,7 @@ public class GovLoginController {
* @Date 2020/4/20 11:22 * @Date 2020/4/20 11:22
**/ **/
@PostMapping(value = "/loginwxmp/loginbywxcode") @PostMapping(value = "/loginwxmp/loginbywxcode")
public Result<UserTokenResultDTO> loginByWxCode(GovWxmpFormDTO formDTO) { public Result<UserTokenResultDTO> loginByWxCode(@RequestBody GovWxmpFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
return govLoginService.loginByWxCode(formDTO); return govLoginService.loginByWxCode(formDTO);
} }
@ -64,7 +64,7 @@ public class GovLoginController {
* @Date 2020/4/18 21:14 * @Date 2020/4/18 21:14
**/ **/
@PostMapping(value = "/loginwxmp/getmyorg") @PostMapping(value = "/loginwxmp/getmyorg")
public Result<List<StaffOrgsResultDTO>> getmyorg(StaffOrgsFormDTO formDTO) { public Result<List<StaffOrgsResultDTO>> getmyorg(@RequestBody StaffOrgsFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
return govLoginService.getMyOrg(formDTO); return govLoginService.getMyOrg(formDTO);
} }
@ -77,7 +77,7 @@ public class GovLoginController {
* @Date 2020/4/20 13:07 * @Date 2020/4/20 13:07
**/ **/
@PostMapping(value = "/loginwxmp/enterorg") @PostMapping(value = "/loginwxmp/enterorg")
public Result<UserTokenResultDTO> enterOrg(GovWxmpEnteOrgFormDTO formDTO) { public Result<UserTokenResultDTO> enterOrg(@RequestBody GovWxmpEnteOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
return govLoginService.enterOrg(formDTO); return govLoginService.enterOrg(formDTO);
} }

3
epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.form;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/** /**
* @Description 政府端小程序根据wxCode获取上一次登录信息返回token * @Description 政府端小程序根据wxCode获取上一次登录信息返回token
@ -10,7 +11,7 @@ import javax.validation.constraints.NotBlank;
* @Date 2020/4/20 11:20 * @Date 2020/4/20 11:20
*/ */
@Data @Data
public class GovWxmpFormDTO extends LoginCommonFormDTO{ public class GovWxmpFormDTO extends LoginCommonFormDTO implements Serializable {
private static final long serialVersionUID = -207861963128774742L; private static final long serialVersionUID = -207861963128774742L;
/** /**
* wxCode * wxCode

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

@ -109,6 +109,7 @@ public class GovLoginServiceImpl implements GovLoginService {
//2、验证码是否正确 //2、验证码是否正确
String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile()); String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile());
if (!formDTO.getSmsCode().equals(rightSmsCode)) { if (!formDTO.getSmsCode().equals(rightSmsCode)) {
logger.error(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg()));
return new Result<List<StaffOrgsResultDTO>>().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); return new Result<List<StaffOrgsResultDTO>>().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
} }
//3、查询用户所有的组织信息 //3、查询用户所有的组织信息
@ -192,13 +193,13 @@ public class GovLoginServiceImpl implements GovLoginService {
CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); CustomerStaffDTO customerStaff = customerStaffDTOResult.getData();
//2、解析微信用户 //2、解析微信用户
WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode()); WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode());
//3、记录staff_wechat //3、记录staff_wechat,并记录用户激活状态,激活时间
this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
//5、记录登录日志 //4、记录登录日志
this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
//1、获取用户token //5.1、获取用户token
String token = this.generateGovWxmpToken(customerStaff.getUserId()); String token = this.generateGovWxmpToken(customerStaff.getUserId());
//2、保存到redis //5.2、保存到redis
this.saveGovTokenDto(formDTO.getAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); this.saveGovTokenDto(formDTO.getAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token); userTokenResultDTO.setToken(token);

7
epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/utils/WxMaServiceUtils.java

@ -17,10 +17,10 @@ public class WxMaServiceUtils {
@Value("${wx.ma.appId.resi}") @Value("${wx.ma.appId.resi}")
private String APPID_RESI; private String APPID_RESI;
/*@Value("${wx.ma.appId.gov}") @Value("${wx.ma.appId.gov}")
private String APPID_GOV; private String APPID_GOV;
@Value("${wx.ma.appId.oper}") /*@Value("${wx.ma.appId.oper}")
private String APPID_OPER;*/ private String APPID_OPER;*/
/** /**
@ -43,8 +43,7 @@ public class WxMaServiceUtils {
* @date 2020/03/13 10:44 * @date 2020/03/13 10:44
*/ */
public final WxMaService govWxMaService() { public final WxMaService govWxMaService() {
// final WxMaService wxMaService = WxMaConfig.getMaService(APPID_GOV); final WxMaService wxMaService = WxMaConfig.getMaService(APPID_GOV);
final WxMaService wxMaService = WxMaConfig.getMaService(APPID_RESI);
return wxMaService; return wxMaService;
} }

15
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java

@ -53,7 +53,10 @@ public class RenExceptionHandler {
@ExceptionHandler(RenException.class) @ExceptionHandler(RenException.class)
public Result handleRRException(RenException ex){ public Result handleRRException(RenException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex)); logger.error(ExceptionUtils.getErrorStackTrace(ex));
return new Result().error(); Result result=new Result().error();
result.setData(ex.getMsg());
return result;
// return new Result().error();
} }
/** /**
@ -64,7 +67,10 @@ public class RenExceptionHandler {
@ExceptionHandler(RuntimeException.class) @ExceptionHandler(RuntimeException.class)
public Result handleRuntimeException(RuntimeException ex){ public Result handleRuntimeException(RuntimeException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex)); logger.error(ExceptionUtils.getErrorStackTrace(ex));
return new Result().error(); Result result=new Result().error();
result.setData(ex.getMessage());
return result;
// return new Result().error();
} }
/** /**
@ -87,7 +93,10 @@ public class RenExceptionHandler {
public Result handleException(Exception ex){ public Result handleException(Exception ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex)); logger.error(ExceptionUtils.getErrorStackTrace(ex));
// saveLog(ex); // saveLog(ex);
return new Result().error(); Result result=new Result().error();
result.setData(ex.getMessage());
return result;
// return new Result().error();
} }
/** /**

4
epmet-gateway/src/main/resources/bootstrap.yml

@ -293,8 +293,8 @@ epmet:
- /resi/mine/** - /resi/mine/**
- /resi/group/** - /resi/group/**
- /resi/partymember/** - /resi/partymember/**
# - /gov/mine/** - /gov/mine/**
# - /gov/access/** - /gov/access/**
swaggerUrls: swaggerUrls:
jwt: jwt:

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

@ -132,7 +132,7 @@ public class CustomerGridController {
* @Description 根据userId查询该用户涉及的所有网格列表 * @Description 根据userId查询该用户涉及的所有网格列表
* @Author sun * @Author sun
*/ */
@PostMapping("getmygrids/{userId}") @GetMapping("getmygrids/{userId}")
public Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(@PathVariable("userId") String userId) { public Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(@PathVariable("userId") String userId) {
return customerGridService.getMyGrids(userId); return customerGridService.getMyGrids(userId);
} }

0
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

14
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -24,15 +24,15 @@
<!-- 查询客户对应的根级组织 --> <!-- 查询客户对应的根级组织 -->
<select id="selectStaffOrgList" parameterType="map" resultType="com.epmet.dto.result.StaffOrgsResultDTO"> <select id="selectStaffOrgList" parameterType="map" resultType="com.epmet.dto.result.StaffOrgsResultDTO">
SELECT SELECT
cta.pid AS orgId, ca.pid AS orgId,
cta.CUSTOMER_ID AS customerId, ca.CUSTOMER_ID AS customerId,
cta.ORGANIZATION_NAME AS orgName ca.ORGANIZATION_NAME AS orgName
FROM FROM
customer_staff_agency cta customer_agency ca
WHERE WHERE
cta.DEL_FLAG = '0' ca.DEL_FLAG = '0'
AND co.PID = '0' AND ca.PID = '0'
and cta.CUSTOMER_ID IN and ca.CUSTOMER_ID IN
<foreach item="customerId" collection="customerIdList" open="(" separator="," close=")"> <foreach item="customerId" collection="customerIdList" open="(" separator="," close=")">
#{customerId} #{customerId}
</foreach> </foreach>

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

@ -105,8 +105,7 @@
cg.del_flag = '0' cg.del_flag = '0'
AND csg.del_flag = '0' AND csg.del_flag = '0'
AND csg.user_id = #{userId} AND csg.user_id = #{userId}
ORDER BY ORDER BY cg.GRID_NAME ASC
cg.created_time DESC
</select> </select>
<!-- 根据gridId获取网格详情 --> <!-- 根据gridId获取网格详情 -->

10
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java

@ -57,4 +57,14 @@ public interface UserConstant {
* 未禁用enable,已禁用diabled * 未禁用enable,已禁用diabled
*/ */
String DISABLED="disabled"; String DISABLED="disabled";
/**
* inactive未激活active已激活
*/
String INACTIVE="inactive";
/**
* inactive未激活active已激活
*/
String ACTIVE="active";
} }

11
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java

@ -3,9 +3,11 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.entity.GovStaffRoleEntity; import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.service.GovStaffRoleService; import com.epmet.service.GovStaffRoleService;
import com.epmet.service.StaffRoleService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -30,6 +32,9 @@ public class StaffRoleController {
@Autowired @Autowired
private GovStaffRoleService govStaffRoleService; private GovStaffRoleService govStaffRoleService;
@Autowired
private StaffRoleService staffRoleService;
/** /**
* 查询工作人员具有的角色列表 * 查询工作人员具有的角色列表
* @return * @return
@ -55,12 +60,12 @@ public class StaffRoleController {
* @return * @return
*/ */
@PostMapping("staffsinrole") @PostMapping("staffsinrole")
public Result<List<GovStaffRoleDTO>> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { public Result<List<StaffRoleDTO>> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) {
ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class); ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class);
String roleKey = staffRoleFormDTO.getRoleKey(); String roleKey = staffRoleFormDTO.getRoleKey();
String orgId = staffRoleFormDTO.getOrgId(); String orgId = staffRoleFormDTO.getOrgId();
List<GovStaffRoleDTO> roleDTOS = govStaffRoleService.listStaffsInRole(roleKey, orgId); List<StaffRoleDTO> staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId);
return new Result<List<GovStaffRoleDTO>>().ok(roleDTOS); return new Result<List<StaffRoleDTO>>().ok(staffRoleDTOS);
} }
} }

9
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -62,4 +62,13 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @return * @return
*/ */
List<StaffGridListDTO> selectStaffGridListByUserId(List<CustomerStaffGridDTO> customerStaffGridDTOS); List<StaffGridListDTO> selectStaffGridListByUserId(List<CustomerStaffGridDTO> customerStaffGridDTOS);
/**
* @return com.epmet.entity.CustomerStaffEntity
* @param userId
* @Author yinzuomei
* @Description 根据staffid查询用户基本信息
* @Date 2020/4/23 16:46
**/
CustomerStaffEntity selectByUserId(String userId);
} }

8
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java

@ -18,7 +18,6 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.entity.GovStaffRoleEntity; import com.epmet.entity.GovStaffRoleEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -42,11 +41,4 @@ public interface GovStaffRoleDao extends BaseDao<GovStaffRoleEntity> {
*/ */
List<GovStaffRoleEntity> listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); List<GovStaffRoleEntity> listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId);
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
List<GovStaffRoleDTO> listStaffsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId);
} }

12
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java

@ -18,8 +18,12 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.entity.StaffRoleEntity; import com.epmet.entity.StaffRoleEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 工作人员-角色关系表 * 工作人员-角色关系表
@ -29,5 +33,11 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface StaffRoleDao extends BaseDao<StaffRoleEntity> { public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
List<StaffRoleDTO> listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId);
} }

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java

@ -99,12 +99,4 @@ public interface GovStaffRoleService extends BaseService<GovStaffRoleEntity> {
* @return * @return
*/ */
List<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId); List<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId);
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
List<GovStaffRoleDTO> listStaffsInRole(String roleKey, String orgId);
} }

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java

@ -92,4 +92,12 @@ public interface StaffRoleService extends BaseService<StaffRoleEntity> {
* @date 2020-04-22 * @date 2020-04-22
*/ */
void delete(String[] ids); void delete(String[] ids);
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
List<StaffRoleDTO> listStaffsInRole(String roleKey, String orgId);
} }

12
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java

@ -110,16 +110,4 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl<GovStaffRoleDao, Go
public List<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId) { public List<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId) {
return baseDao.listRolesByStaffId(staffId, orgId); return baseDao.listRolesByStaffId(staffId, orgId);
} }
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
@Override
public List<GovStaffRoleDTO> listStaffsInRole(String roleKey, String orgId) {
return baseDao.listStaffsByRoleKeyAndOrgId(roleKey, orgId);
}
} }

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java

@ -101,4 +101,15 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
baseDao.deleteBatchIds(Arrays.asList(ids)); baseDao.deleteBatchIds(Arrays.asList(ids));
} }
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
@Override
public List<StaffRoleDTO> listStaffsInRole(String roleKey, String orgId) {
return baseDao.listStaffIdsByRoleKeyAndOrgId(roleKey, orgId);
}
} }

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffWechatServiceImpl.java

@ -24,18 +24,23 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant;
import com.epmet.dao.CustomerStaffDao;
import com.epmet.dao.StaffWechatDao; import com.epmet.dao.StaffWechatDao;
import com.epmet.dto.StaffWechatDTO; import com.epmet.dto.StaffWechatDTO;
import com.epmet.dto.form.StaffWechatFormDTO; import com.epmet.dto.form.StaffWechatFormDTO;
import com.epmet.entity.CustomerStaffEntity;
import com.epmet.entity.StaffWechatEntity; import com.epmet.entity.StaffWechatEntity;
import com.epmet.service.StaffWechatService; import com.epmet.service.StaffWechatService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -48,7 +53,8 @@ import java.util.Map;
@Service @Service
public class StaffWechatServiceImpl extends BaseServiceImpl<StaffWechatDao, StaffWechatEntity> implements StaffWechatService { public class StaffWechatServiceImpl extends BaseServiceImpl<StaffWechatDao, StaffWechatEntity> implements StaffWechatService {
private Logger logger = LogManager.getLogger(getClass()); private Logger logger = LogManager.getLogger(getClass());
@Autowired
private CustomerStaffDao customerStaffDao;
@Override @Override
public PageData<StaffWechatDTO> page(Map<String, Object> params) { public PageData<StaffWechatDTO> page(Map<String, Object> params) {
IPage<StaffWechatEntity> page = baseDao.selectPage( IPage<StaffWechatEntity> page = baseDao.selectPage(
@ -119,6 +125,14 @@ public class StaffWechatServiceImpl extends BaseServiceImpl<StaffWechatDao, Staf
logger.info(String.format("staff_Wechat记录已存在,userId[%s],wxOpenId[%s]", formDTO.getUserId(), formDTO.getWxOpenId())); logger.info(String.format("staff_Wechat记录已存在,userId[%s],wxOpenId[%s]", formDTO.getUserId(), formDTO.getWxOpenId()));
this.update(staffWechatDTO); this.update(staffWechatDTO);
} }
//记录用户激活状态,激活时间
CustomerStaffEntity customerStaffEntity=customerStaffDao.selectByUserId(formDTO.getUserId());
if(null!=customerStaffEntity&&null==customerStaffEntity.getActiveTime()){
customerStaffEntity.setActiveTime(new Date());
//inactive未激活,active已激活
customerStaffEntity.setActiveFlag(UserConstant.ACTIVE);
customerStaffDao.updateById(customerStaffEntity);
}
return new Result(); return new Result();
} }

15
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -7,7 +7,7 @@
<select id="selectListCustomerStaffDTO" parameterType="java.lang.String" resultType="com.epmet.dto.CustomerStaffDTO"> <select id="selectListCustomerStaffDTO" parameterType="java.lang.String" resultType="com.epmet.dto.CustomerStaffDTO">
select * from customer_staff cs select * from customer_staff cs
where cs.MOBILE=#{mobile} where cs.MOBILE=#{mobile}
and cs.DEL_FLAG='1' and cs.DEL_FLAG='0'
order by cs.ACTIVE_TIME desc,cs.CREATED_TIME asc order by cs.ACTIVE_TIME desc,cs.CREATED_TIME asc
</select> </select>
@ -16,7 +16,7 @@
select * from customer_staff cs select * from customer_staff cs
where cs.MOBILE=#{mobile} where cs.MOBILE=#{mobile}
and cs.CUSTOMER_ID=#{customerId} and cs.CUSTOMER_ID=#{customerId}
and cs.DEL_FLAG='1' and cs.DEL_FLAG='0'
</select> </select>
<select id="selectStaffInfoByUserId" parameterType="com.epmet.dto.CustomerStaffDTO" resultType="com.epmet.dto.CustomerStaffDTO"> <select id="selectStaffInfoByUserId" parameterType="com.epmet.dto.CustomerStaffDTO" resultType="com.epmet.dto.CustomerStaffDTO">
select * from customer_staff cs select * from customer_staff cs
@ -41,4 +41,15 @@
</foreach> </foreach>
AND cs.del_flag = 0 AND cs.del_flag = 0
</select> </select>
<!-- 根据staffid查询用户基本信息 -->
<select id="selectByUserId" parameterType="java.lang.String" resultType="com.epmet.entity.CustomerStaffEntity">
SELECT
*
FROM
customer_staff CS
WHERE
cs.DEL_FLAG = '0'
AND CS.USER_ID =#{userId}
</select>
</mapper> </mapper>

14
epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml

@ -28,18 +28,4 @@
sr.STAFF_ID = #{staffId} sr.STAFF_ID = #{staffId}
AND sr.ORG_ID = #{orgId} AND sr.ORG_ID = #{orgId}
</select> </select>
<!--查询具有某角色的staff列表-->
<select id="listStaffsByRoleKeyAndOrgId" resultType="com.epmet.dto.GovStaffRoleDTO">
SELECT
r.*
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID )
WHERE
r.ROLE_KEY = #{roleKey}
AND sr.ORG_ID = #{orgId}
</select>
</mapper> </mapper>

11
epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

@ -17,4 +17,15 @@
</resultMap> </resultMap>
<!--查询具有某角色的staff列表-->
<select id="listStaffIdsByRoleKeyAndOrgId" resultType="com.epmet.dto.StaffRoleDTO">
SELECT
sr.*
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID )
WHERE
r.ROLE_KEY = #{roleKey}
AND sr.ORG_ID = #{orgId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save