|
|
@ -31,13 +31,22 @@ import com.epmet.dto.*; |
|
|
|
import com.epmet.dto.form.CustomerGridFormDTO; |
|
|
|
import com.epmet.dto.CustomerStaffDTO; |
|
|
|
import com.epmet.dto.CustomerStaffGridDTO; |
|
|
|
import com.epmet.dto.GovStaffRoleDTO; |
|
|
|
import com.epmet.dto.StaffGridListDTO; |
|
|
|
import com.epmet.dto.form.CustomerStaffFormDTO; |
|
|
|
import com.epmet.dto.form.StaffInfoFromDTO; |
|
|
|
import com.epmet.dto.form.StaffSubmitFromDTO; |
|
|
|
import com.epmet.dto.form.StaffsInAgencyFromDTO; |
|
|
|
import com.epmet.dto.result.StaffDetailResultDTO; |
|
|
|
import com.epmet.dto.result.StaffInfoResultDTO; |
|
|
|
import com.epmet.dto.result.StaffInitResultDTO; |
|
|
|
import com.epmet.dto.result.StaffRoleResultDTO; |
|
|
|
import com.epmet.entity.CustomerStaffEntity; |
|
|
|
import com.epmet.entity.GovStaffRoleEntity; |
|
|
|
import com.epmet.redis.CustomerStaffRedis; |
|
|
|
import com.epmet.service.CustomerStaffService; |
|
|
|
import com.epmet.service.GovStaffRoleService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
import org.apache.logging.log4j.Logger; |
|
|
@ -48,6 +57,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 政府工作人员表 |
|
|
@ -55,11 +65,14 @@ import java.util.Map; |
|
|
|
* @author generator generator@elink-cn.com |
|
|
|
* @since v1.0.0 2020-04-18 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, CustomerStaffEntity> implements CustomerStaffService { |
|
|
|
private Logger logger = LogManager.getLogger(getClass()); |
|
|
|
@Autowired |
|
|
|
private CustomerStaffRedis customerStaffRedis; |
|
|
|
@Autowired |
|
|
|
private GovStaffRoleService govStaffRoleService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<CustomerStaffDTO> page(Map<String, Object> params) { |
|
|
@ -158,6 +171,88 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, |
|
|
|
return new Result<List<StaffInfoResultDTO>>().ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<List<StaffInfoResultDTO>> getStaffList(StaffsInAgencyFromDTO fromDTO) { |
|
|
|
List<StaffInfoResultDTO> list = baseDao.selectStaffList(fromDTO); |
|
|
|
return new Result<List<StaffInfoResultDTO>>().ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<StaffInitResultDTO> addStaffInit(StaffInfoFromDTO fromDTO) { |
|
|
|
StaffInitResultDTO resultDTO = new StaffInitResultDTO(); |
|
|
|
GovStaffRoleDTO govStaffRoleDTO = new GovStaffRoleDTO(); |
|
|
|
govStaffRoleDTO.setCustomerId(fromDTO.getCustomerId()); |
|
|
|
List<GovStaffRoleDTO> roleList = govStaffRoleService.getGovStaffRoleList(govStaffRoleDTO); |
|
|
|
if (null == roleList || roleList.size() == 0) { |
|
|
|
return new Result<StaffInitResultDTO>().ok(null); |
|
|
|
} |
|
|
|
List<StaffRoleResultDTO> staffRoleList = roleList.stream().map(p -> { |
|
|
|
StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); |
|
|
|
staffRoleResultDTO.setRoleId(p.getId()); |
|
|
|
staffRoleResultDTO.setRoleName(p.getRoleName()); |
|
|
|
return staffRoleResultDTO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
resultDTO.setRoleList(staffRoleList); |
|
|
|
return new Result<StaffInitResultDTO>().ok(resultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<StaffInitResultDTO> editStaffInit(StaffInfoFromDTO fromDTO) { |
|
|
|
StaffInitResultDTO resultDTO = new StaffInitResultDTO(); |
|
|
|
//获取工作人员信息
|
|
|
|
CustomerStaffDTO customerStaffDTO = baseDao.selectStaffInfo(fromDTO); |
|
|
|
if (null == customerStaffDTO) { |
|
|
|
log.error("工作人员不存在"); |
|
|
|
} |
|
|
|
resultDTO.setStaffId(customerStaffDTO.getUserId()); |
|
|
|
resultDTO.setName(customerStaffDTO.getRealName()); |
|
|
|
resultDTO.setGender(customerStaffDTO.getGender()); |
|
|
|
resultDTO.setMobile(customerStaffDTO.getMobile()); |
|
|
|
resultDTO.setWorkType(customerStaffDTO.getWorkType()); |
|
|
|
//获取角色列表
|
|
|
|
GovStaffRoleDTO govStaffRoleDTO = new GovStaffRoleDTO(); |
|
|
|
govStaffRoleDTO.setCustomerId(fromDTO.getCustomerId()); |
|
|
|
List<GovStaffRoleDTO> roleList = govStaffRoleService.getGovStaffRoleList(govStaffRoleDTO); |
|
|
|
//获取工作人员角色
|
|
|
|
List<GovStaffRoleEntity> staffRoles = govStaffRoleService.listRolesByStaffId(fromDTO.getStaffId(), fromDTO.getAgencyId()); |
|
|
|
List<StaffRoleResultDTO> staffRoleList = roleList.stream().map(p -> { |
|
|
|
StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); |
|
|
|
staffRoleResultDTO.setRoleId(p.getId()); |
|
|
|
staffRoleResultDTO.setRoleName(p.getRoleName()); |
|
|
|
staffRoleResultDTO.setSelected(false); |
|
|
|
return staffRoleResultDTO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
staffRoleList.forEach(role -> staffRoles.forEach(staffRole -> { |
|
|
|
if (role.getRoleId().equals(staffRole.getId())) { |
|
|
|
role.setSelected(true); |
|
|
|
} |
|
|
|
})); |
|
|
|
resultDTO.setRoleList(staffRoleList); |
|
|
|
|
|
|
|
return new Result<StaffInitResultDTO>().ok(resultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result addStaff(StaffSubmitFromDTO fromDTO) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result editStaff(StaffSubmitFromDTO fromDTO) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<StaffDetailResultDTO> getStaffDetail(StaffInfoFromDTO fromDTO) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result disabledStaff(StaffInfoFromDTO fromDTO) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据userId查询网格下未被禁用的人员数量 |
|
|
|
* @param userIdDTO |
|
|
|