Browse Source

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

master
zxc 5 years ago
parent
commit
5efad797c0
  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. 1
      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. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  8. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java
  9. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  10. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java
  11. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
  12. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java
  13. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
  14. 4
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
  15. 14
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml
  16. 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
**/
@PostMapping(value = "/loginwxmp/loginbywxcode")
public Result<UserTokenResultDTO> loginByWxCode(GovWxmpFormDTO formDTO) {
public Result<UserTokenResultDTO> loginByWxCode(@RequestBody GovWxmpFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return govLoginService.loginByWxCode(formDTO);
}
@ -64,7 +64,7 @@ public class GovLoginController {
* @Date 2020/4/18 21:14
**/
@PostMapping(value = "/loginwxmp/getmyorg")
public Result<List<StaffOrgsResultDTO>> getmyorg(StaffOrgsFormDTO formDTO) {
public Result<List<StaffOrgsResultDTO>> getmyorg(@RequestBody StaffOrgsFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return govLoginService.getMyOrg(formDTO);
}
@ -77,7 +77,7 @@ public class GovLoginController {
* @Date 2020/4/20 13:07
**/
@PostMapping(value = "/loginwxmp/enterorg")
public Result<UserTokenResultDTO> enterOrg(GovWxmpEnteOrgFormDTO formDTO) {
public Result<UserTokenResultDTO> enterOrg(@RequestBody GovWxmpEnteOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(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 javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 政府端小程序根据wxCode获取上一次登录信息返回token
@ -10,7 +11,7 @@ import javax.validation.constraints.NotBlank;
* @Date 2020/4/20 11:20
*/
@Data
public class GovWxmpFormDTO extends LoginCommonFormDTO{
public class GovWxmpFormDTO extends LoginCommonFormDTO implements Serializable {
private static final long serialVersionUID = -207861963128774742L;
/**
* wxCode

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

@ -109,6 +109,7 @@ public class GovLoginServiceImpl implements GovLoginService {
//2、验证码是否正确
String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile());
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());
}
//3、查询用户所有的组织信息

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}")
private String APPID_RESI;
/*@Value("${wx.ma.appId.gov}")
@Value("${wx.ma.appId.gov}")
private String APPID_GOV;
@Value("${wx.ma.appId.oper}")
/*@Value("${wx.ma.appId.oper}")
private String APPID_OPER;*/
/**
@ -43,8 +43,7 @@ public class WxMaServiceUtils {
* @date 2020/03/13 10:44
*/
public final WxMaService govWxMaService() {
// final WxMaService wxMaService = WxMaConfig.getMaService(APPID_GOV);
final WxMaService wxMaService = WxMaConfig.getMaService(APPID_RESI);
final WxMaService wxMaService = WxMaConfig.getMaService(APPID_GOV);
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)
public Result handleRRException(RenException 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)
public Result handleRuntimeException(RuntimeException 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){
logger.error(ExceptionUtils.getErrorStackTrace(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/group/**
- /resi/partymember/**
# - /gov/mine/**
# - /gov/access/**
- /gov/mine/**
- /gov/access/**
swaggerUrls:
jwt:

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

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

@ -18,7 +18,6 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.entity.GovStaffRoleEntity;
import org.apache.ibatis.annotations.Mapper;
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);
/**
* 查询具有某角色的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;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.entity.StaffRoleEntity;
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
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
*/
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
*/
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) {
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));
}
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
@Override
public List<StaffRoleDTO> listStaffsInRole(String roleKey, String orgId) {
return baseDao.listStaffIdsByRoleKeyAndOrgId(roleKey, orgId);
}
}

4
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 * from customer_staff cs
where cs.MOBILE=#{mobile}
and cs.DEL_FLAG='1'
and cs.DEL_FLAG='0'
order by cs.ACTIVE_TIME desc,cs.CREATED_TIME asc
</select>
@ -16,7 +16,7 @@
select * from customer_staff cs
where cs.MOBILE=#{mobile}
and cs.CUSTOMER_ID=#{customerId}
and cs.DEL_FLAG='1'
and cs.DEL_FLAG='0'
</select>
<select id="selectStaffInfoByUserId" parameterType="com.epmet.dto.CustomerStaffDTO" resultType="com.epmet.dto.CustomerStaffDTO">
select * from customer_staff cs

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

@ -28,18 +28,4 @@
sr.STAFF_ID = #{staffId}
AND sr.ORG_ID = #{orgId}
</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>

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

@ -17,4 +17,15 @@
</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>
Loading…
Cancel
Save