|
@@ -84,6 +84,8 @@ public class EnrollmentRegistrationService extends ServiceImpl<EnrollmentRegistr
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public EnrollmentRegistration add(EnrollmentRegistration reportData) throws Exception{
|
|
|
|
|
|
+ String currentToken = TokenProvider.getCurrentToken();
|
|
|
+
|
|
|
UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken ( ));
|
|
|
|
|
|
EnrollmentRegistration report = new EnrollmentRegistration();
|
|
@@ -112,11 +114,59 @@ public class EnrollmentRegistrationService extends ServiceImpl<EnrollmentRegistr
|
|
|
socialSecurityCardMapper.insert(securityCard);
|
|
|
}
|
|
|
|
|
|
- mapper.insert(report);
|
|
|
+ if (null == currentToken) {
|
|
|
+ //发起员工入职流程
|
|
|
+ Map map = SpringUtil.getBean(IFlowableApi.class).getByNameForFen("员工入职");
|
|
|
+ String procDefId = map.get("id")+"";
|
|
|
+
|
|
|
+ report.setProcessDefinitionId(procDefId);
|
|
|
+ mapper.insert(report);
|
|
|
+
|
|
|
+ Map<String ,Map<String,String >> allMap = new HashMap<>();
|
|
|
+
|
|
|
+ String procDefKey = map.get("key")+"";
|
|
|
+ String businessTable = "human_resources_enrollment_registration";
|
|
|
+
|
|
|
+ String businessId = id;
|
|
|
+ String title = "管理员发起了- [" + report.getName() + "员工入职]";
|
|
|
+
|
|
|
+ //获取实习信息审核员信息
|
|
|
+ RoleDTO roleDTO = SpringUtil.getBean(IRoleApi.class).getRoleDTOByName2("实习信息审核员");
|
|
|
+ String assignee = getAssignee(roleDTO.getId());
|
|
|
+ String recordType = "";
|
|
|
+
|
|
|
+ Map<String, String> newMap = pingMap(procDefId, procDefKey, businessTable, businessId, title, assignee, recordType);
|
|
|
+ allMap.put("入职",newMap);
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).startForFenNew(allMap);
|
|
|
+ } else {
|
|
|
+ mapper.insert(report);
|
|
|
+ }
|
|
|
|
|
|
return report;
|
|
|
}
|
|
|
|
|
|
+ public String getAssignee(String roleId){
|
|
|
+ List<UserDTO> userDTOS = SpringUtil.getBean(IUserApi.class).findListByRoleId(roleId);
|
|
|
+ StringJoiner idJoiner = new StringJoiner(",");
|
|
|
+ for (UserDTO user : userDTOS) {
|
|
|
+ idJoiner.add(String.valueOf(user.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ return idJoiner.toString();
|
|
|
+ }
|
|
|
+ public Map<String,String> pingMap(String procDefId,String procDefKey,String businessTable,
|
|
|
+ String businessId,String title,String assignee,String recordType){
|
|
|
+ Map<String,String> map = new HashMap();
|
|
|
+ map.put("procDefId", procDefId);
|
|
|
+ map.put("procDefKey", procDefKey);
|
|
|
+ map.put("businessTable", businessTable);
|
|
|
+ map.put("businessId", businessId);
|
|
|
+ map.put("title", title);
|
|
|
+ map.put("assignee", assignee);
|
|
|
+ map.put("recordType", recordType);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改
|
|
|
*/
|
|
@@ -135,7 +185,7 @@ public class EnrollmentRegistrationService extends ServiceImpl<EnrollmentRegistr
|
|
|
String amountId = UUID.randomUUID().toString().replace("-", "");
|
|
|
report.setUserId(amountId);
|
|
|
|
|
|
- if (StringUtils.isNotBlank(report.getType())){
|
|
|
+ if (StringUtils.isNotBlank(report.getType()) && !userDTO.isAdmin()){
|
|
|
if (report.getType().equals("5")){
|
|
|
//获取当前的用户,审核的人
|
|
|
UserDTO dto = new UserDTO();
|
|
@@ -154,27 +204,36 @@ public class EnrollmentRegistrationService extends ServiceImpl<EnrollmentRegistr
|
|
|
OfficeDTO office = SpringUtil.getBean(IOfficeApi.class).getOfficeById(report.getDepartment());
|
|
|
|
|
|
String name = "兴光会计员工";
|
|
|
- RoleDTO roleInfo = SpringUtil.getBean(IRoleApi.class).getRoleDTOByNameAndTenantId(name,office.getTenantId());
|
|
|
List <RoleDTO> roleIdList = new ArrayList<>();
|
|
|
- roleIdList.add(roleInfo);
|
|
|
- dto.setRoleDTOList(roleIdList);
|
|
|
- dto.setOfficeDTO(officeDTO);
|
|
|
+
|
|
|
+// roleIdList.add(roleInfo);
|
|
|
+
|
|
|
|
|
|
String officeName = "";
|
|
|
String networkAddress = "";
|
|
|
if (null != office) {
|
|
|
+ Map<String,String> keyMap = new HashMap<>();
|
|
|
TenantDTO tenantDTO = new TenantDTO();
|
|
|
tenantDTO.setId(office.getTenantId());
|
|
|
dto.setTenantDTO(tenantDTO);
|
|
|
if (office.getTenantId().equals("10003")){
|
|
|
officeName = "会计业务管理公司";
|
|
|
networkAddress = "cpapmis.xgccpm.com";
|
|
|
+ keyMap.put("name", "兴光会计员工,共有权限(会计)");
|
|
|
+ keyMap.put("tenantId", office.getTenantId());
|
|
|
+ roleIdList = SpringUtil.getBean(IRoleApi.class).getRoleDTOByNameAndTenantId(keyMap);
|
|
|
}else if (office.getTenantId().equals("10004")) {
|
|
|
officeName = "中审管理公司";
|
|
|
networkAddress = "zs.xgccpm.com";
|
|
|
+ keyMap.put("name", "中审员工,共有权限(中审)");
|
|
|
+ keyMap.put("tenantId", office.getTenantId());
|
|
|
+ roleIdList = SpringUtil.getBean(IRoleApi.class).getRoleDTOByNameAndTenantId(keyMap);
|
|
|
}else if (office.getTenantId().equals("10001")) {
|
|
|
officeName = "评估管理公司";
|
|
|
networkAddress = "http://amc.xgccpm.com";
|
|
|
+ keyMap.put("name", "评估员工,共有权限(评估)");
|
|
|
+ keyMap.put("tenantId", office.getTenantId());
|
|
|
+ roleIdList = SpringUtil.getBean(IRoleApi.class).getRoleDTOByNameAndTenantId(keyMap);
|
|
|
}
|
|
|
} else {
|
|
|
TenantDTO tenantDTO = new TenantDTO();
|
|
@@ -182,6 +241,8 @@ public class EnrollmentRegistrationService extends ServiceImpl<EnrollmentRegistr
|
|
|
dto.setTenantDTO(tenantDTO);
|
|
|
officeName = "综合管理公司";
|
|
|
}
|
|
|
+ dto.setRoleDTOList(roleIdList);
|
|
|
+ dto.setOfficeDTO(officeDTO);
|
|
|
|
|
|
SpringUtil.getBean ( IUserApi.class ).saveOrUpdate(dto);
|
|
|
|