Browse Source

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

dev_shibei_match
yinzuomei 5 years ago
parent
commit
c61ba9a930
  1. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java
  3. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  4. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  5. 52
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java
  6. 70
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  7. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  8. 32
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  9. 4
      epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql
  10. 26
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

6
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -34,8 +34,10 @@ public enum EpmetErrorCode {
REQUIRE_PERMISSION(8301, "没有足够的操作权限"), REQUIRE_PERMISSION(8301, "没有足够的操作权限"),
NOT_ADD_GRID(8401,"您当前的网格名称已存在,请重新修改"); NOT_ADD_GRID(8401,"您当前的网格名称已存在,请重新修改"),
MOBILE_USED(8402,"该手机号已注册"),
STAFF_ADD_FAILED(8403,"人员添加失败"),
STAFF_EDIT_FAILED(8404,"人员编辑失败");
private int code; private int code;
private String msg; private String msg;

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java

@ -16,6 +16,10 @@ import java.util.List;
@Data @Data
public class StaffSubmitFromDTO implements Serializable { public class StaffSubmitFromDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/** /**
* 机关ID * 机关ID
*/ */

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -96,7 +96,7 @@ public interface EpmetUserFeignClient {
* @return Result * @return Result
*/ */
@PostMapping("/epmetuser/customerstaff/addstaff") @PostMapping("/epmetuser/customerstaff/addstaff")
Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO); Result<CustomerStaffDTO> addStaff(@RequestBody StaffSubmitFromDTO fromDTO);
/** /**
* 人员编辑 * 人员编辑

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

@ -68,7 +68,7 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
} }
@Override @Override
public Result addStaff(StaffSubmitFromDTO fromDTO) { public Result<CustomerStaffDTO> addStaff(StaffSubmitFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "addStaff", fromDTO); return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "addStaff", fromDTO);
} }

52
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java

@ -1,8 +1,10 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.dto.CustomerStaffAgencyDTO;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.StaffInfoFromDTO; import com.epmet.dto.form.StaffInfoFromDTO;
import com.epmet.dto.form.StaffSubmitFromDTO; import com.epmet.dto.form.StaffSubmitFromDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO;
@ -11,6 +13,7 @@ import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.dto.result.StaffInitResultDTO; import com.epmet.dto.result.StaffInitResultDTO;
import com.epmet.dto.result.StaffsInAgencyResultDTO; import com.epmet.dto.result.StaffsInAgencyResultDTO;
import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.CustomerStaffAgencyEntity;
import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.OperCrmFeignClient; import com.epmet.feign.OperCrmFeignClient;
import com.epmet.service.CustomerAgencyService; import com.epmet.service.CustomerAgencyService;
@ -18,7 +21,9 @@ import com.epmet.service.CustomerStaffAgencyService;
import com.epmet.service.StaffService; import com.epmet.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -43,11 +48,17 @@ public class StaffServiceImpl implements StaffService {
StaffsInAgencyResultDTO resultDTO = new StaffsInAgencyResultDTO(); StaffsInAgencyResultDTO resultDTO = new StaffsInAgencyResultDTO();
//获取机关所在客户ID和人员总数 //获取机关所在客户ID和人员总数
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
if (null == customerAgencyEntity) {
resultDTO.setStaffList(new ArrayList<>());
resultDTO.setStaffCount(0);
return new Result<StaffsInAgencyResultDTO>().ok(resultDTO);
}
resultDTO.setStaffCount(customerAgencyEntity.getTotalUser()); resultDTO.setStaffCount(customerAgencyEntity.getTotalUser());
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
List<CustomerStaffAgencyDTO> customerStaffAgencyList = customerStaffAgencyService.getCustomerStaffAgencyList(fromDTO).getData(); List<CustomerStaffAgencyDTO> customerStaffAgencyList = customerStaffAgencyService.getCustomerStaffAgencyList(fromDTO).getData();
if (null == customerStaffAgencyList || customerStaffAgencyList.size() == 0) { if (null == customerStaffAgencyList || customerStaffAgencyList.size() == 0) {
return new Result<StaffsInAgencyResultDTO>().ok(null); resultDTO.setStaffList(new ArrayList<>());
return new Result<StaffsInAgencyResultDTO>().ok(resultDTO);
} }
//提取所有userID //提取所有userID
List<String> staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList()); List<String> staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList());
@ -62,6 +73,9 @@ public class StaffServiceImpl implements StaffService {
public Result<List<StaffInfoResultDTO>> getStaffList(StaffsInAgencyFromDTO fromDTO) { public Result<List<StaffInfoResultDTO>> getStaffList(StaffsInAgencyFromDTO fromDTO) {
//获取机关所在客户ID //获取机关所在客户ID
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
if (null == customerAgencyEntity) {
return new Result<List<StaffInfoResultDTO>>().ok(new ArrayList<>());
}
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
List<CustomerStaffAgencyDTO> customerStaffAgencyList = customerStaffAgencyService.getCustomerStaffAgencyList(fromDTO).getData(); List<CustomerStaffAgencyDTO> customerStaffAgencyList = customerStaffAgencyService.getCustomerStaffAgencyList(fromDTO).getData();
if (null == customerStaffAgencyList || customerStaffAgencyList.size() == 0) { if (null == customerStaffAgencyList || customerStaffAgencyList.size() == 0) {
@ -71,8 +85,7 @@ public class StaffServiceImpl implements StaffService {
List<String> staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList()); List<String> staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList());
fromDTO.setStaffList(staffIds); fromDTO.setStaffList(staffIds);
//获取用户列表 //获取用户列表
Result<List<StaffInfoResultDTO>> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); return epmetUserFeignClient.getStaffList(fromDTO);
return null;
} }
@Override @Override
@ -90,24 +103,47 @@ public class StaffServiceImpl implements StaffService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Result addStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO) { public Result addStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
fromDTO.setApp(tokenDto.getApp()); fromDTO.setApp(tokenDto.getApp());
fromDTO.setClient(tokenDto.getClient()); fromDTO.setClient(tokenDto.getClient());
Result result = epmetUserFeignClient.addStaff(fromDTO); fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
Result<CustomerStaffDTO> result = epmetUserFeignClient.addStaff(fromDTO);
if (!result.success()) {
if (result.getCode() != EpmetErrorCode.SERVER_ERROR.getCode()) {
return new Result().error(result.getCode(), result.getMsg());
}
return new Result().error(EpmetErrorCode.STAFF_ADD_FAILED.getCode(), EpmetErrorCode.STAFF_ADD_FAILED.getMsg());
}
//人员机关关系表
CustomerStaffAgencyEntity customerStaffAgencyEntity = new CustomerStaffAgencyEntity();
customerStaffAgencyEntity.setCustomerId(customerAgencyEntity.getCustomerId());
customerStaffAgencyEntity.setUserId(result.getData().getUserId());
customerStaffAgencyEntity.setAgencyId(customerAgencyEntity.getId());
customerStaffAgencyService.insert(customerStaffAgencyEntity);
//机关总人数加一 //机关总人数加一
if (result.success()) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
customerAgencyEntity.setTotalUser(customerAgencyEntity.getTotalUser() + 1); customerAgencyEntity.setTotalUser(customerAgencyEntity.getTotalUser() + 1);
customerAgencyService.updateById(customerAgencyEntity); customerAgencyService.updateById(customerAgencyEntity);
}
return new Result(); return new Result();
} }
@Override @Override
public Result editStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO) { public Result editStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
fromDTO.setApp(tokenDto.getApp()); fromDTO.setApp(tokenDto.getApp());
fromDTO.setClient(tokenDto.getClient()); fromDTO.setClient(tokenDto.getClient());
return epmetUserFeignClient.editStaff(fromDTO); Result result = epmetUserFeignClient.editStaff(fromDTO);
if (!result.success()) {
if (result.getCode() != EpmetErrorCode.SERVER_ERROR.getCode()) {
return new Result().error(result.getCode(), result.getMsg());
}
return new Result().error(EpmetErrorCode.STAFF_EDIT_FAILED.getCode(), EpmetErrorCode.STAFF_EDIT_FAILED.getMsg());
}
return result;
} }
@Override @Override

70
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -155,7 +155,7 @@ public class CustomerStaffController {
* @return * @return
*/ */
@PostMapping("staffsinagency") @PostMapping("staffsinagency")
public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(@RequestBody StaffsInAgencyFromDTO fromDTO) {
return customerStaffService.getStaffInfoForHome(fromDTO); return customerStaffService.getStaffInfoForHome(fromDTO);
} }
@ -165,7 +165,7 @@ public class CustomerStaffController {
* @return * @return
*/ */
@PostMapping("stafflist") @PostMapping("stafflist")
public Result<List<StaffInfoResultDTO>> getStaffList(StaffsInAgencyFromDTO fromDTO) { public Result<List<StaffInfoResultDTO>> getStaffList(@RequestBody StaffsInAgencyFromDTO fromDTO) {
return customerStaffService.getStaffList(fromDTO); return customerStaffService.getStaffList(fromDTO);
} }
@ -194,4 +194,70 @@ public class CustomerStaffController {
public Result<List<CustomerIdDTO>> selectCustomerIdByUserId(@RequestBody AddDepartmentStaffFormDTO addDepartmentStaffFormDTO){ public Result<List<CustomerIdDTO>> selectCustomerIdByUserId(@RequestBody AddDepartmentStaffFormDTO addDepartmentStaffFormDTO){
return customerStaffService.selectCustomerIdByUserId(addDepartmentStaffFormDTO); return customerStaffService.selectCustomerIdByUserId(addDepartmentStaffFormDTO);
} }
/**
* 人员添加页面初始化
*
* @param fromDTO 参数
* @return Result<StaffInitResultDTO>
*/
@PostMapping("rolelist")
public Result<StaffInitResultDTO> addStaffInit(@RequestBody StaffInfoFromDTO fromDTO){
return customerStaffService.addStaffInit(fromDTO);
}
/**
* 人员编辑页面初始化
*
* @param fromDTO 参数
* @return Result<StaffInitResultDTO>
*/
@PostMapping("editstaffinit")
public Result<StaffInitResultDTO> editStaffInit(@RequestBody StaffInfoFromDTO fromDTO){
return customerStaffService.editStaffInit(fromDTO);
}
/**
* 人员添加
*
* @param fromDTO 参数
* @return Result
*/
@PostMapping("addstaff")
public Result<CustomerStaffDTO> addStaff(@RequestBody StaffSubmitFromDTO fromDTO){
return customerStaffService.addStaff(fromDTO);
}
/**
* 人员编辑
*
* @param fromDTO 参数
* @return Result
*/
@PostMapping("editstaff")
public Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO){
return customerStaffService.editStaff(fromDTO);
}
/**
* 人员详情
*
* @param fromDTO 参数
* @return Result<StaffDetailResultDTO>
*/
@PostMapping("staffdetail")
public Result<StaffDetailResultDTO> getStaffDetail(@RequestBody StaffInfoFromDTO fromDTO){
return customerStaffService.getStaffDetail(fromDTO);
}
/**
* 人员禁用
*
* @param fromDTO 参数
* @return Result
*/
@PostMapping("disabledstaff")
public Result disabledStaff(@RequestBody StaffInfoFromDTO fromDTO){
return customerStaffService.disabledStaff(fromDTO);
}
} }

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -173,7 +173,7 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @param fromDTO 参数 * @param fromDTO 参数
* @return Result * @return Result
*/ */
Result addStaff(StaffSubmitFromDTO fromDTO); Result<CustomerStaffDTO> addStaff(StaffSubmitFromDTO fromDTO);
/** /**
* 人员编辑 * 人员编辑

32
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -61,6 +61,7 @@ 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.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -84,6 +85,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
private UserService userService; private UserService userService;
@Autowired @Autowired
private StaffRoleService staffRoleService; private StaffRoleService staffRoleService;
@Override @Override
public PageData<CustomerStaffDTO> page(Map<String, Object> params) { public PageData<CustomerStaffDTO> page(Map<String, Object> params) {
IPage<CustomerStaffEntity> page = baseDao.selectPage( IPage<CustomerStaffEntity> page = baseDao.selectPage(
@ -178,12 +180,18 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
@Override @Override
public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
List<StaffInfoResultDTO> list = baseDao.selectCustomerStaffList(fromDTO); List<StaffInfoResultDTO> list = baseDao.selectCustomerStaffList(fromDTO);
if (null == list) {
list = new ArrayList<>();
}
return new Result<List<StaffInfoResultDTO>>().ok(list); return new Result<List<StaffInfoResultDTO>>().ok(list);
} }
@Override @Override
public Result<List<StaffInfoResultDTO>> getStaffList(StaffsInAgencyFromDTO fromDTO) { public Result<List<StaffInfoResultDTO>> getStaffList(StaffsInAgencyFromDTO fromDTO) {
List<StaffInfoResultDTO> list = baseDao.selectStaffList(fromDTO); List<StaffInfoResultDTO> list = baseDao.selectStaffList(fromDTO);
if (null == list) {
list = new ArrayList<>();
}
return new Result<List<StaffInfoResultDTO>>().ok(list); return new Result<List<StaffInfoResultDTO>>().ok(list);
} }
@ -194,7 +202,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
govStaffRoleDTO.setCustomerId(fromDTO.getCustomerId()); govStaffRoleDTO.setCustomerId(fromDTO.getCustomerId());
List<GovStaffRoleDTO> roleList = govStaffRoleService.getGovStaffRoleList(govStaffRoleDTO); List<GovStaffRoleDTO> roleList = govStaffRoleService.getGovStaffRoleList(govStaffRoleDTO);
if (null == roleList || roleList.size() == 0) { if (null == roleList || roleList.size() == 0) {
return new Result<StaffInitResultDTO>().ok(null); return new Result<StaffInitResultDTO>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
} }
List<StaffRoleResultDTO> staffRoleList = roleList.stream().map(p -> { List<StaffRoleResultDTO> staffRoleList = roleList.stream().map(p -> {
StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO();
@ -245,7 +253,14 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result addStaff(StaffSubmitFromDTO fromDTO) { public Result<CustomerStaffDTO> addStaff(StaffSubmitFromDTO fromDTO) {
CustomerStaffFormDTO customerStaffFormDTO = new CustomerStaffFormDTO();
customerStaffFormDTO.setCustomerId(fromDTO.getCustomerId());
customerStaffFormDTO.setMobile(fromDTO.getMobile());
CustomerStaffDTO customerStaffDTO = baseDao.selectListCustomerStaffInfo(customerStaffFormDTO);
if (null != customerStaffDTO) {
return new Result<CustomerStaffDTO>().error(EpmetErrorCode.MOBILE_USED.getCode(), EpmetErrorCode.MOBILE_USED.getMsg());
}
//USER表插入数据 //USER表插入数据
UserEntity userEntity = new UserEntity(); UserEntity userEntity = new UserEntity();
userEntity.setFromApp(fromDTO.getApp()); userEntity.setFromApp(fromDTO.getApp());
@ -253,6 +268,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
userService.insert(userEntity); userService.insert(userEntity);
//Customer_Staff表插入数据 //Customer_Staff表插入数据
CustomerStaffEntity staffEntity = new CustomerStaffEntity(); CustomerStaffEntity staffEntity = new CustomerStaffEntity();
staffEntity.setCustomerId(fromDTO.getCustomerId());
staffEntity.setUserId(userEntity.getId()); staffEntity.setUserId(userEntity.getId());
staffEntity.setRealName(fromDTO.getName()); staffEntity.setRealName(fromDTO.getName());
staffEntity.setMobile(fromDTO.getMobile()); staffEntity.setMobile(fromDTO.getMobile());
@ -271,12 +287,20 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
staffRoleService.insert(staffRoleEntity); staffRoleService.insert(staffRoleEntity);
}); });
return new Result(); return new Result<CustomerStaffDTO>().ok(ConvertUtils.sourceToTarget(staffEntity, CustomerStaffDTO.class));
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result editStaff(StaffSubmitFromDTO fromDTO) { public Result editStaff(StaffSubmitFromDTO fromDTO) {
CustomerStaffFormDTO customerStaffFormDTO = new CustomerStaffFormDTO();
customerStaffFormDTO.setCustomerId(fromDTO.getCustomerId());
customerStaffFormDTO.setMobile(fromDTO.getMobile());
CustomerStaffDTO customerStaffDTO = baseDao.selectListCustomerStaffInfo(customerStaffFormDTO);
if (!fromDTO.getStaffId().equals(customerStaffDTO.getUserId())) {
return new Result<CustomerStaffDTO>().error(EpmetErrorCode.MOBILE_USED.getCode(), EpmetErrorCode.MOBILE_USED.getMsg());
}
CustomerStaffEntity customerStaffEntity = baseDao.selectByUserId(fromDTO.getStaffId()); CustomerStaffEntity customerStaffEntity = baseDao.selectByUserId(fromDTO.getStaffId());
//Customer_Staff表插入数据 //Customer_Staff表插入数据
CustomerStaffEntity staffEntity = new CustomerStaffEntity(); CustomerStaffEntity staffEntity = new CustomerStaffEntity();
@ -336,6 +360,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
/** /**
* 根据userId查询网格下未被禁用的人员数量 * 根据userId查询网格下未被禁用的人员数量
*
* @param userIdDTO * @param userIdDTO
* @return * @return
*/ */
@ -365,7 +390,6 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
} }
/** /**
*
* @param: addDepartmentStaffFormDTO * @param: addDepartmentStaffFormDTO
* @auther: zxc * @auther: zxc
*/ */

4
epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql

@ -140,3 +140,7 @@ INSERT INTO `gov_staff_role_template` VALUES ('5', 'staff', '工作人员', NULL
INSERT INTO `gov_staff_role_template` VALUES ('6', 'grid_manager', '网格长', NULL, 0, NULL, NULL, NULL, NULL, NULL); INSERT INTO `gov_staff_role_template` VALUES ('6', 'grid_manager', '网格长', NULL, 0, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `gov_staff_role_template` VALUES ('7', 'grid_party_director', '网格党建指导员', NULL, 0, NULL, NULL, NULL, NULL, NULL); INSERT INTO `gov_staff_role_template` VALUES ('7', 'grid_party_director', '网格党建指导员', NULL, 0, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `gov_staff_role_template` VALUES ('8', 'grid_member', '网格员', NULL, 0, NULL, NULL, NULL, NULL, NULL); INSERT INTO `gov_staff_role_template` VALUES ('8', 'grid_member', '网格员', NULL, 0, NULL, NULL, NULL, NULL, NULL);
-- --2020-04-26
ALTER TABLE customer_staff MODIFY COLUMN `EMAIL` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱' ;
ALTER TABLE customer_staff MODIFY COLUMN `ADDRESS` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址';

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

@ -62,26 +62,36 @@
cs.USER_ID AS "staffId", cs.USER_ID AS "staffId",
cs.REAL_NAME AS "staffName", cs.REAL_NAME AS "staffName",
cs.GENDER AS "gender", cs.GENDER AS "gender",
IFNULL(cs.HEAD_PHOTO, "") AS "staffHeadPhoto", IFNULL( cs.HEAD_PHOTO, "" ) AS "staffHeadPhoto",
cs.ENABLE_FLAG AS "enableFlag", cs.ENABLE_FLAG AS "enableFlag",
gsr.ROLE_NAME AS "roleName" role.ROLE_NAME AS "roleName"
FROM FROM
customer_staff cs customer_staff cs
LEFT JOIN staff_role sr ON cs.USER_ID = sr.STAFF_ID LEFT JOIN (
AND sr.DEL_FLAG = '0' SELECT
AND sr.ORG_ID = #{agencyId} sr.STAFF_ID,
sr.ROLE_ID,
gsr.ROLE_NAME
FROM
staff_role sr
LEFT JOIN gov_staff_role gsr ON sr.ROLE_ID = gsr.ID LEFT JOIN gov_staff_role gsr ON sr.ROLE_ID = gsr.ID
AND gsr.DEL_FLAG = '0' AND gsr.DEL_FLAG = '0'
AND gsr.CUSTOMER_ID = #{customerId} AND gsr.CUSTOMER_ID = #{customerId}
WHERE
sr.DEL_FLAG = '0'
AND sr.ORG_ID = #{agencyId}
AND gsr.ROLE_KEY = 'agency_leader' AND gsr.ROLE_KEY = 'agency_leader'
) role ON cs.USER_ID = role.STAFF_ID
WHERE WHERE
cs.DEL_FLAG = '0' cs.DEL_FLAG = '0'
AND cs.CUSTOMER_ID = #{customerId} AND cs.CUSTOMER_ID = #{customerId}
AND cs.USER_ID in AND cs.USER_ID IN
<foreach item="userId" collection="staffList" separator="," open="(" close=")" index=""> <foreach item="userId" collection="staffList" separator="," open="(" close=")" index="">
#{userId} #{userId}
</foreach> </foreach>
ORDER BY gsr.ROLE_NAME DESC, cs.CREATED_TIME DESC ORDER BY
role.ROLE_NAME DESC,
cs.CREATED_TIME DESC
LIMIT 12 LIMIT 12
</select> </select>
@ -111,7 +121,7 @@
<foreach item="userId" collection="staffList" separator="," open="(" close=")" index=""> <foreach item="userId" collection="staffList" separator="," open="(" close=")" index="">
#{userId} #{userId}
</foreach> </foreach>
ORDER BY convert(cs.REAL_NAME using gbk) asc ASC ORDER BY convert(cs.REAL_NAME using gbk) ASC
</select> </select>
<select id="selectStaffInfo" resultType="com.epmet.dto.CustomerStaffDTO" parameterType="com.epmet.dto.form.StaffInfoFromDTO"> <select id="selectStaffInfo" resultType="com.epmet.dto.CustomerStaffDTO" parameterType="com.epmet.dto.form.StaffInfoFromDTO">
SELECT SELECT

Loading…
Cancel
Save