Commit 54c4ee3e authored by kongfm's avatar kongfm

更新FLC 企业人员添加相关接口

parent 95a17425
...@@ -256,5 +256,26 @@ public interface IOrgUsrService { ...@@ -256,5 +256,26 @@ public interface IOrgUsrService {
List<OrgUsrFormDto> getUnSyncOrgCompanyList(List<Long> companyIdList); List<OrgUsrFormDto> getUnSyncOrgCompanyList(List<Long> companyIdList);
public OrgUsr getDetailById( Long id); public OrgUsr getDetailById( Long id);
/**
* 获取父级
*
* @param topId
* @param entityList
* @param packageURL
* @param IDMethodName
* @param IDHierarchy
* @param NAMEMethodName
* @param PARENTIDMethodName
* @param OrgTypeMethodName
* @return
* @throws Exception
*/
List<OrgMenuDto> getTreeFlc(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy,
String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception;
OrgUsrDto saveOrgPersonFlc(OrgPersonDto OrgPersonDto) throws Exception;
} }
...@@ -194,7 +194,8 @@ ...@@ -194,7 +194,8 @@
biz_org_name, biz_org_name,
biz_org_code, biz_org_code,
biz_org_type, biz_org_type,
parent_id parent_id,
amos_org_id
FROM `cb_org_usr` FROM `cb_org_usr`
WHERE is_delete = 0 WHERE is_delete = 0
and (biz_org_type = "COMPANY" and (biz_org_type = "COMPANY"
......
...@@ -42,6 +42,9 @@ public class TzsCommonParam { ...@@ -42,6 +42,9 @@ public class TzsCommonParam {
public static final String ADMIN_LICENSE_PIC = "adminLicensePic"; public static final String ADMIN_LICENSE_PIC = "adminLicensePic";
public static final String QR_CODE = "qrCode"; public static final String QR_CODE = "qrCode";
public static final String UNIT_TYPE = "UNIT_TYPE"; public static final String UNIT_TYPE = "UNIT_TYPE";
public static final String HEAD_SHOT = "headShot";
public static final String LICENCE_INFO = "licenceInfo";
public static final String ATTACHMENT = "attachment";
} }
package com.yeejoin.amos.boot.module.tzs.flc.api.dto; package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 企业人员资质信息表 * 企业人员教育信息表
* *
* @author system_generator * @author system_generator
* @date 2021-11-22 * @date 2021-11-22
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value="PersonEducationDto", description="企业人员资质信息表") @ApiModel(value="PersonEducationDto", description="企业人员教育信息表")
public class PersonEducationDto extends BaseDto { public class PersonEducationDto extends BaseDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -30,4 +32,7 @@ public class PersonEducationDto extends BaseDto { ...@@ -30,4 +32,7 @@ public class PersonEducationDto extends BaseDto {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ApiModelProperty(value = "附件信息")
private List<AttachmentDto> attachment;
} }
package com.yeejoin.amos.boot.module.tzs.flc.api.dto; package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 企业人员资质信息表 * 企业人员资质信息表
...@@ -51,4 +53,7 @@ public class PersonQualityDto extends BaseDto { ...@@ -51,4 +53,7 @@ public class PersonQualityDto extends BaseDto {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ApiModelProperty(value = "证书信息")
private List<AttachmentDto> licenceInfo;
} }
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 企业人员信息表
*
* @author system_generator
* @date 2021-11-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="UnitPersonInfoDto", description="企业人员信息表")
public class UnitPersonInfoDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "人员名称")
private String bizOrgName;
@ApiModelProperty(value = "人员编码")
private String bizOrgCode;
@ApiModelProperty(value = "amos中公司/部门ID")
private String amosOrgId;
@ApiModelProperty(value = "amos中公司/部门编码")
private String amosOrgCode;
@ApiModelProperty(value = "机构类型(部门:DEPARTMENT,单位:COMPANY,人员:PERSON)")
private String bizOrgType = CommonConstant.BIZ_ORG_TYPE_PERSON;
@ApiModelProperty(value = "所在单位")
private String parentId;
@ApiModelProperty(value = "所在单位名称")
private String parentName;
@ApiModelProperty(value = "用户名")
private String org_expand_attr1;
@ApiModelProperty(value = "用户密码")
private String org_expand_attr2;
@ApiModelProperty(value = "所属组织id")
private String org_expand_attr3;
@ApiModelProperty(value = "管理应用")
private String org_expand_attr4;
@ApiModelProperty(value = "角色")
private String org_expand_attr5;
@ApiModelProperty(value = "更新人")
@TableField(fill= FieldFill.INSERT_UPDATE)
private String recUserName;
@ApiModelProperty(value = "动态表单值")
private List<DynamicFormInstance> dynamicFormValue;
@ApiModelProperty(value = "资质信息")
private PersonQualityDto personQualityDto;
@ApiModelProperty(value = "培训教育信息")
private PersonEducationDto personEducationDto;
@ApiModelProperty(value = "证照图片")
private List<AttachmentDto> licencePic;
@ApiModelProperty(value = "头像")
private List<AttachmentDto> headshot;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitPersonInfoDto;
/**
* 企业人员服务类
*/
public interface IUnitPersonService {
UnitPersonInfoDto saveUser(UnitPersonInfoDto unitPersonInfoDto);
}
...@@ -1931,4 +1931,98 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1931,4 +1931,98 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
wrapper.likeRight(OrgUsr::getBizOrgCode, company.getBizOrgCode()); wrapper.likeRight(OrgUsr::getBizOrgCode, company.getBizOrgCode());
return this.baseMapper.selectList(wrapper); return this.baseMapper.selectList(wrapper);
} }
@Override
public List<OrgMenuDto> getTreeFlc(Long topId, Collection entityList, String packageURL, String IDMethodName,
int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName)
throws Exception {
List<OrgMenuDto> resultList = new ArrayList<>();
Class<?> clazz = Class.forName(packageURL);
Method IDMethodNameme = null;
switch (IDHierarchy) {
case 1:
IDMethodNameme = clazz.getDeclaredMethod(IDMethodName);
break;
case 2:
IDMethodNameme = clazz.getSuperclass().getDeclaredMethod(IDMethodName);
break;
case 3:
IDMethodNameme = clazz.getSuperclass().getSuperclass().getDeclaredMethod(IDMethodName);
break;
default:
IDMethodNameme = clazz.getDeclaredMethod(IDMethodName);
break;
}
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
Method OrgTypeMethodNameme = clazz.getDeclaredMethod(OrgTypeMethodName);
// 获取顶层元素集合
Long parentId;
for (Object ob : entityList) {
Object entity = clazz.cast(ob);
parentId = !ObjectUtils.isEmpty(PARENTIDMethodNameme.invoke(entity))
? Long.valueOf(String.valueOf(PARENTIDMethodNameme.invoke(entity)))
: null;
// if (parentId == null || topId ==parentId ) {
// OrgMenuDto menu = new OrgMenuDto(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))),
// String.valueOf(NAMEMethodNameme.invoke(entity)), parentId,
// String.valueOf(OrgTypeMethodNameme.invoke(entity)), false);
// resultList.add(menu);
// }
/*
* *******************topId与parentId的等值判断,修改人陈浩 on 2021/07/21---start
******************************/
if (parentId == null) {// topId与parentId的等值判断,修改人陈浩 on 2021/07/21
// OrgMenuDto menu = new OrgMenuDto(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))),
// String.valueOf(NAMEMethodNameme.invoke(entity)), parentId,
// String.valueOf(OrgTypeMethodNameme.invoke(entity)), false);
// resultList.add(menu);
} else if (topId != null && topId.longValue() == parentId.longValue()) {
OrgMenuDto menu = new OrgMenuDto(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))),
String.valueOf(NAMEMethodNameme.invoke(entity)), parentId,
String.valueOf(OrgTypeMethodNameme.invoke(entity)), false);
resultList.add(menu);
}
/*
* *******************topId与parentId的等值判断,修改人陈浩 on 2021/07/21---end
******************************/
}
// 获取每个顶层元素的子数据集合
for (OrgMenuDto entity : resultList) {
entity.setChildren(getSub(entity.getKey(), entityList, packageURL, IDMethodName, IDHierarchy,
NAMEMethodName, "getParentId", OrgTypeMethodName));
}
return resultList;
}
@Override
public OrgUsrDto saveOrgPersonFlc(OrgPersonDto OrgPersonVo) throws Exception {
OrgUsr orgUsr = new OrgUsr();
BeanUtils.copyProperties(OrgPersonVo, orgUsr);
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
// orgCode 前端调用接口生成 不再后台生成orgCode
/*
if (OrgPersonVo.getParentId() != null) {OrgUsrMapper
OrgUsr parent = getById(OrgPersonVo.getParentId());
if (parent != null && ObjectUtils.isEmpty(OrgPersonVo.getBizOrgCode())) {
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
}
} else {
orgUsr.setBizOrgCode(getOrgCodeStr());
}*/
OrgUsrDto result = new OrgUsrDto();
if(orgUsr.getSequenceNbr() != null) { // 走更新方法
this.updateById(orgUsr);
BeanUtils.copyProperties(orgUsr, result);
} else {
result = saveOrgUsrDynamicFormInstance(orgUsr, OrgPersonVo.getDynamicFormValue());
}
return result;
}
} }
...@@ -403,7 +403,7 @@ public class UnitInfoController extends BaseController { ...@@ -403,7 +403,7 @@ public class UnitInfoController extends BaseController {
result = unitInfoServiceImpl.getDtoByOrgId(temp.getSequenceNbr()); result = unitInfoServiceImpl.getDtoByOrgId(temp.getSequenceNbr());
if(result.getIsChange() && result.getUnitStatus() == 0) { if(result.getIsChange() && result.getUnitStatus() == 0) {
result = unitInfoChangeServiceImpl.findLastChangInfo(temp.getSequenceNbr()); result = unitInfoChangeServiceImpl.findLastChangInfo(result.getSequenceNbr());
} }
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonDto;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitPersonInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IUnitPersonService;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.UnitInfoChangeServiceImpl;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
* 企业人员
*
* @author system_generator
* @date 2021-11-11
*/
@RestController
@Api(tags = "企业人员Api")
@RequestMapping(value = "/flc-unit-person")
public class UnitPersonController extends BaseController {
@Autowired
RedisUtils redisUtils;
@Autowired
IUnitPersonService iUnitPersonService;
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Autowired
UnitInfoChangeServiceImpl unitInfoChangeServiceImpl;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
/**
* 新增人员信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增人员信息", notes = "新增人员信息")
public ResponseModel<?> saveOrgUsr(@RequestBody UnitPersonInfoDto unitPersonInfoDto) {
if (ValidationUtil.isEmpty(unitPersonInfoDto.getParentId()) || ValidationUtil.isEmpty(unitPersonInfoDto.getParentName()) ) {
throw new BadRequest("参数校验失败.");
}
return ResponseHelper.buildResponse( iUnitPersonService.saveUser(unitPersonInfoDto));
}
/**
* 根据当前登录人获取企业信息列表 所在单位 以及 所属组织
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/companyTree")
@ApiOperation(httpMethod = "GET",value = "根据当前登录人获取企业树(所在单位以及所属组织)", notes = "根据当前登录人获取企业树(所在单位以及所属组织)")
public ResponseModel<List<OrgMenuDto>> getUserUnit() throws Exception {
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys();
List<OrgMenuDto> menus = new ArrayList<>();
for(CompanyModel c : companys) {
OrgUsr temp = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getAmosOrgId,c.getSequenceNbr()));
if(temp != null) {
menus = iOrgUsrService.getTreeFlc(Long.parseLong(temp.getAmosOrgId()), iOrgUsrService.selectCompanyDepartmentMsg(), OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getAmosOrgId", "getBizOrgType");
}
}
return ResponseHelper.buildResponse(menus);
}
/**
* 根据所在单位生成人员code
* @param companyId
* @return
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getOrgCode/{companyId}")
@ApiOperation(httpMethod = "GET",value = "根据当前登录人获取企业树", notes = "根据当前登录人获取企业树")
public ResponseModel<String> getOrgCode(@PathVariable Long companyId) throws Exception {
OrgUsr company = iOrgUsrService.getById(companyId);
String code = company.getBizOrgCode() + iOrgUsrService.getOrgCodeStr();
return ResponseHelper.buildResponse(code);
}
/**
* 获取资质证书种类
* @return
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getLicenceType")
@ApiOperation(httpMethod = "GET",value = "获取资质证书种类", notes = "获取资质证书种类")
public ResponseModel<List<DataDictionary>> getLicenceType() {
List<DataDictionary> list = iDataDictionaryService.list(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getIsDelete,false).eq(DataDictionary::getType,"PERSON_QUALITY_TYPE").isNull(DataDictionary::getParent));
return ResponseHelper.buildResponse(list);
}
/**
* 根据证书种类编号获取相关项目及代号
* @return
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getProjectInfo/{licenceTypes}")
@ApiOperation(httpMethod = "GET",value = "根据证书种类编号获取相关项目及代号", notes = "根据证书种类编号获取相关项目及代号")
public ResponseModel<List<DataDictionary>> getProjectInfo(@PathVariable String licenceTypes) {
String[] licenceType = licenceTypes.split(",");
List<DataDictionary> list = iDataDictionaryService.list(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getIsDelete,false).eq(DataDictionary::getType,"PERSON_QUALITY_TYPE").in(DataDictionary::getParent,licenceType));
return ResponseHelper.buildResponse(list);
}
}
...@@ -162,7 +162,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -162,7 +162,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
content = "通过"; content = "通过";
} }
sourceUnit.setUnitStatus(1); sourceUnit.setUnitStatus(1);
if(changeFlag) { // 如果是变更单 需要把 变更数据覆盖到原单子 预留(确定字段) if(changeFlag) { // 如果是变更单 需要把 变更数据覆盖到原单子
changeUnit.setUnitStatus(1); changeUnit.setUnitStatus(1);
// 变更单全覆盖原单 // 变更单全覆盖原单
Long sourceId = sourceUnit.getSequenceNbr(); Long sourceId = sourceUnit.getSequenceNbr();
...@@ -497,9 +497,9 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -497,9 +497,9 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
// 变更之前判断是否可以变更 // 变更之前判断是否可以变更
UnitInfo sourceInfo = this.getById(model.getSequenceNbr()); UnitInfo sourceInfo = this.getById(model.getSequenceNbr());
if(sourceInfo == null) { if(sourceInfo == null) {
throw new BadRequest("未找到原单"); throw new BadRequest("该企业处于变更审批状态无法继续变更");
} }
if(sourceInfo.getUnitStatus() != 1) { if(sourceInfo.getUnitStatus() == 0) {
throw new BadRequest("该企业状态无法变更"); throw new BadRequest("该企业状态无法变更");
} }
// 原表单变为 变更审核状态 // 原表单变为 变更审核状态
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.PersonEducationDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.PersonQualityDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitPersonInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IUnitPersonService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 企业人员服务实现类
*/
@Service
public class UnitPersonServiceImpl implements IUnitPersonService {
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Autowired
PersonQualityServiceImpl flcPersonQualityServiceImpl;
@Autowired
PersonEducationServiceImpl personEducationServiceImpl;
@Autowired
ISourceFileService iSourceFileService;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
@Transactional
@Override
public UnitPersonInfoDto saveUser(UnitPersonInfoDto unitPersonInfoDto) {
unitPersonInfoDto.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
OrgPersonDto orgPersonVo = new OrgPersonDto();
BeanUtils.copyProperties(unitPersonInfoDto,orgPersonVo);
try {
OrgUsrDto result = iOrgUsrService.saveOrgPersonFlc(orgPersonVo);
PersonQualityDto personQualityDto = unitPersonInfoDto.getPersonQualityDto();
PersonEducationDto personEducationDto = unitPersonInfoDto.getPersonEducationDto();
// 处理图片信息 -- 证照和图片
Map<String, List<AttachmentDto>> userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.LICENCE_PIC,unitPersonInfoDto.getLicencePic());
userAttach.put(TzsCommonParam.HEAD_SHOT,unitPersonInfoDto.getHeadshot());
iSourceFileService.saveAttachments(result.getSequenceNbr(),userAttach);
if(personQualityDto != null) {
String[] licenceTypeCode = personQualityDto.getLicenceTypeCode().split(",");
List<DataDictionary> list = iDataDictionaryService.list(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getIsDelete,false).in(DataDictionary::getCode,licenceTypeCode));
String licenceType = "";
for(DataDictionary temp : list) {
licenceType += "," + temp.getName();
}
if(licenceType.length() > 0) {
licenceType.substring(1);
personQualityDto.setLicenceType(licenceType);
}
// 创建人员资质信息
personQualityDto.setPsersonId(result.getSequenceNbr());
personQualityDto = flcPersonQualityServiceImpl.createWithModel(personQualityDto);
userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.LICENCE_INFO,personQualityDto.getLicenceInfo());
iSourceFileService.saveAttachments(personQualityDto.getSequenceNbr(),userAttach);
}
if(personEducationDto != null) {
// 创建人员教育信息
personEducationDto.setPsersonId(result.getSequenceNbr());
personEducationDto = personEducationServiceImpl.createWithModel(personEducationDto);
userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.ATTACHMENT,personEducationDto.getAttachment());
iSourceFileService.saveAttachments(personEducationDto.getSequenceNbr(),userAttach);
}
// 创建账号信息
if(StringUtils.isNotEmpty(unitPersonInfoDto.getOrg_expand_attr1()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrg_expand_attr2())
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrg_expand_attr3()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrg_expand_attr4())
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrg_expand_attr5() )) {
String roleName = unitPersonInfoDto.getOrg_expand_attr5();
String orgId = unitPersonInfoDto.getOrg_expand_attr3();// 拿到的是 org_user的id 需要转换成amosid
OrgUsr temp = iOrgUsrService.getById(Long.parseLong(orgId));
Long companyId = Long.parseLong(temp.getAmosOrgId());
String appcode = unitPersonInfoDto.getOrg_expand_attr4();
// 创建人员账户信息
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
String pwd = DesUtil.encode(unitPersonInfoDto.getOrg_expand_attr2(), "qaz");
AgencyUserModel agencyUserModel = new AgencyUserModel();
agencyUserModel.setUserName(unitPersonInfoDto.getOrg_expand_attr1());
agencyUserModel.setRealName(unitPersonInfoDto.getBizOrgName());
agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(pwd);
agencyUserModel.setRePassword(pwd);
agencyUserModel.setAgencyCode("tzs");
// agencyUserModel.setMobile(adminTel); 不存储电话信息
// 所属组织
Map<Long, List<Long>> roleSeqsMap = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>();
allRoleList.stream().forEach(t -> {
if(t.getRoleName().equals(roleName)) {
userRoleList.add(t);
}
});
userRoleList.stream().forEach(r -> {
roleIds.add(r.getSequenceNbr());
});
roleSeqsMap.put(companyId,roleIds);
List<String> appCodes = new ArrayList<>();
appCodes.add(appcode);
agencyUserModel.setAppCodes(appCodes);
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
orgRoles.put(companyId,userRoleList);
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqsMap);
FeignClientResult<AgencyUserModel> userResult = Privilege.agencyUserClient.create(agencyUserModel);
agencyUserModel = userResult.getResult();
orgPersonVo.setSequenceNbr(result.getSequenceNbr());
orgPersonVo.setAmosOrgId(agencyUserModel.getUserId() + "");
result = iOrgUsrService.saveOrgPersonFlc(orgPersonVo);
BeanUtils.copyProperties(result,unitPersonInfoDto);
}
} catch (Exception e) {
e.printStackTrace();
}
return unitPersonInfoDto;
}
}
\ No newline at end of file
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
<changeSet author="kongfm" id="2021-11-17-01"> <changeSet author="kongfm" id="2021-11-17-01">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/> <sqlCheck expectedResult="0">select count(*) from cb_data_dictionary where sequence_nbr = 1043</sqlCheck>
</preConditions> </preConditions>
<comment>add data_dictionary </comment> <comment>add data_dictionary </comment>
<sql> <sql>
...@@ -275,9 +275,7 @@ ...@@ -275,9 +275,7 @@
<changeSet author="kongfm" id="2021-11-17-05"> <changeSet author="kongfm" id="2021-11-17-05">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <sqlCheck expectedResult="1">select count(*) from cb_data_dictionary where sequence_nbr = 1043</sqlCheck>
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</not>
</preConditions> </preConditions>
<comment>update cb_data_dictionary UNIT_TYPE</comment> <comment>update cb_data_dictionary UNIT_TYPE</comment>
<sql> <sql>
...@@ -367,7 +365,7 @@ ...@@ -367,7 +365,7 @@
`rec_date` datetime NULL DEFAULT NULL COMMENT '审批日期', `rec_date` datetime NULL DEFAULT NULL COMMENT '审批日期',
`is_delete` bit(1) NULL DEFAULT b'0' COMMENT '是否删除(0:未删除,1:已删除)', `is_delete` bit(1) NULL DEFAULT b'0' COMMENT '是否删除(0:未删除,1:已删除)',
PRIMARY KEY (`sequence_nbr`) USING BTREE PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1462605642928455682 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '企业人员资质信息表' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 1462605642928455682 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '企业人员教育信息表' ROW_FORMAT = Dynamic;
</sql> </sql>
</changeSet> </changeSet>
...@@ -383,8 +381,8 @@ ...@@ -383,8 +381,8 @@
`sequence_nbr` bigint(30) NOT NULL AUTO_INCREMENT COMMENT '自增主键', `sequence_nbr` bigint(30) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`pserson_id` bigint(30) NULL DEFAULT NULL COMMENT 'org_user_id', `pserson_id` bigint(30) NULL DEFAULT NULL COMMENT 'org_user_id',
`record_num` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '档案编号', `record_num` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '档案编号',
`licence_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '证书类型', `licence_type` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '证书类型',
`licence_type_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '证书类型编码', `licence_type_code` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '证书类型编码',
`licence_issue_org_id` bigint(30) NULL DEFAULT NULL COMMENT '发证机关id', `licence_issue_org_id` bigint(30) NULL DEFAULT NULL COMMENT '发证机关id',
`licence_issue_org` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发证机关', `licence_issue_org` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发证机关',
`project_work` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '作业项目', `project_work` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '作业项目',
...@@ -419,6 +417,7 @@ ...@@ -419,6 +417,7 @@
INSERT INTO `tz_alert_form` (`sequence_nbr`, `alert_type_code`, `field_value_code`, `field_name`, `field_code`, `field_type`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `block`, `sort_num`, `url`, `hide`) VALUES (53, '1106', NULL, '省', 'province', 'string', NULL, NULL, NULL, b'0', b'0', 1, NULL, b'0'); INSERT INTO `tz_alert_form` (`sequence_nbr`, `alert_type_code`, `field_value_code`, `field_name`, `field_code`, `field_type`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `block`, `sort_num`, `url`, `hide`) VALUES (53, '1106', NULL, '省', 'province', 'string', NULL, NULL, NULL, b'0', b'0', 1, NULL, b'0');
INSERT INTO `tz_alert_form` (`sequence_nbr`, `alert_type_code`, `field_value_code`, `field_name`, `field_code`, `field_type`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `block`, `sort_num`, `url`, `hide`) VALUES (54, '1106', NULL, '市', 'city', 'string', NULL, NULL, NULL, b'0', b'0', 1, NULL, b'0'); INSERT INTO `tz_alert_form` (`sequence_nbr`, `alert_type_code`, `field_value_code`, `field_name`, `field_code`, `field_type`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `block`, `sort_num`, `url`, `hide`) VALUES (54, '1106', NULL, '市', 'city', 'string', NULL, NULL, NULL, b'0', b'0', 1, NULL, b'0');
INSERT INTO `tz_alert_form` (`sequence_nbr`, `alert_type_code`, `field_value_code`, `field_name`, `field_code`, `field_type`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `block`, `sort_num`, `url`, `hide`) VALUES (55, '1106', NULL, '区县', 'district', 'string', NULL, NULL, NULL, b'0', b'0', 1, NULL, b'0'); INSERT INTO `tz_alert_form` (`sequence_nbr`, `alert_type_code`, `field_value_code`, `field_name`, `field_code`, `field_type`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `block`, `sort_num`, `url`, `hide`) VALUES (55, '1106', NULL, '区县', 'district', 'string', NULL, NULL, NULL, b'0', b'0', 1, NULL, b'0');
INSERT INTO `tz_alert_form` (`sequence_nbr`, `alert_type_code`, `field_value_code`, `field_name`, `field_code`, `field_type`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `block`, `sort_num`, `url`, `hide`) VALUES (56, '1106', NULL, '详细地址', 'address', 'string', NULL, NULL, NULL, b'0', b'0', 1, NULL, b'0');
</sql> </sql>
</changeSet> </changeSet>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment