Commit fa7c814a authored by kongfm's avatar kongfm

企业人员列表 带分页搜索

parent 7a3f199b
...@@ -55,6 +55,26 @@ public class OrgPersonFormDto extends BaseEntity{ ...@@ -55,6 +55,26 @@ public class OrgPersonFormDto extends BaseEntity{
@ApiModelProperty(value = "动态表单值") @ApiModelProperty(value = "动态表单值")
private List<FormValue> dynamicFormAlert; private List<FormValue> dynamicFormAlert;
@ApiModelProperty(value = "扩展属性1")
private String orgExpandAttr1;
@ApiModelProperty(value = "扩展属性2")
private String orgExpandAttr2;
@ApiModelProperty(value = "扩展属性3")
private String orgExpandAttr3;
@ApiModelProperty(value = "扩展属性4")
private String orgExpandAttr4;
private String orgExpandAttr5;
private String orgExpandAttr6;
private String orgExpandAttr7;
private String orgExpandAttr8;
public OrgPersonFormDto() { public OrgPersonFormDto() {
} }
......
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant; import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; 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.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -49,21 +50,29 @@ public class UnitPersonInfoDto extends BaseDto { ...@@ -49,21 +50,29 @@ public class UnitPersonInfoDto extends BaseDto {
private String parentName; private String parentName;
@ApiModelProperty(value = "用户名") @ApiModelProperty(value = "用户名")
private String org_expand_attr1; private String orgExpandAttr1;
@ApiModelProperty(value = "用户密码") @ApiModelProperty(value = "用户密码")
private String org_expand_attr2; private String orgExpandAttr2;
@ApiModelProperty(value = "所属组织id") @ApiModelProperty(value = "所属组织id")
private String org_expand_attr3; private String orgExpandAttr3;
@ApiModelProperty(value = "管理应用") @ApiModelProperty(value = "管理应用")
private String org_expand_attr4; private String orgExpandAttr4;
@ApiModelProperty(value = "角色") @ApiModelProperty(value = "角色")
private String org_expand_attr5; private String orgExpandAttr5;
@ApiModelProperty(value = "更新人") private String orgExpandAttr6;
private String orgExpandAttr7;
private String orgExpandAttr8;
@ApiModelProperty(value = "更新人")
@TableField(fill= FieldFill.INSERT_UPDATE) @TableField(fill= FieldFill.INSERT_UPDATE)
private String recUserName; private String recUserName;
...@@ -82,5 +91,14 @@ public class UnitPersonInfoDto extends BaseDto { ...@@ -82,5 +91,14 @@ public class UnitPersonInfoDto extends BaseDto {
@ApiModelProperty(value = "头像") @ApiModelProperty(value = "头像")
private List<AttachmentDto> headshot; private List<AttachmentDto> headshot;
@ApiModelProperty(value = "动态表单值")
private List<FormValue> dynamicFormAlert;
@ApiModelProperty(value = "二维码")
private List<AttachmentDto> qrcode;
} }
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 企业人员Mapper
*/
public interface UnitPersonMapper {
int selectPersonListCount(@Param("map")Map<String, Object> map);
List<Map<String, Object>> selectPersonList(@Param("map")Map<String, Object> map);
}
...@@ -23,7 +23,7 @@ public interface IUnitInfoService { ...@@ -23,7 +23,7 @@ public interface IUnitInfoService {
UnitInfoDto getDtoById(Long sequenceNbr); UnitInfoDto getDtoById(Long sequenceNbr);
UnitInfoDto getUnItDtoById(Long sequenceNbr); UnitInfoDto getUnitDtoById(Long sequenceNbr);
UnitInfoDto unitInfoToDto(UnitInfo source); UnitInfoDto unitInfoToDto(UnitInfo source);
......
...@@ -3,10 +3,16 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service; ...@@ -3,10 +3,16 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitPersonInfoDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitPersonInfoDto;
import java.util.Map;
/** /**
* 企业人员服务类 * 企业人员服务类
*/ */
public interface IUnitPersonService { public interface IUnitPersonService {
UnitPersonInfoDto saveUser(UnitPersonInfoDto unitPersonInfoDto); UnitPersonInfoDto saveUser(UnitPersonInfoDto unitPersonInfoDto);
UnitPersonInfoDto getPersonById(Long sequenceNbr);
Object pagePerson(Long parentId, String pageNum, String pageSize, Map<String, Object> requestBody);
} }
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.UnitPersonMapper">
<select id="selectPersonListCount" resultType="Integer">
select count(1) from (
SELECT
DISTINCT
u.*,
g.*,
TIMESTAMPDIFF(YEAR, g.birthday, CURDATE()) as ages ,
case
when count(q.sequence_nbr) > 0 then '有'
else '无' end hasLicence
FROM
cb_org_usr u
LEFT JOIN
( SELECT
v.`instance_id`,
max(case v.field_code when 'person_type' then IFNULL(v.field_value_label,v.field_value) end) personType,
max(case v.field_code when 'sex' then IFNULL(v.field_value_label,v.field_value) end) sex,
max(case v.field_code when 'birthday' then IFNULL(v.field_value_label,v.field_value) end) birthday,
max(case v.field_code when 'licence_type' then IFNULL(v.field_value_label,v.field_value) end) licenceType,
max(case v.field_code when 'licence_code' then IFNULL(v.field_value_label,v.field_value) end) licenceCode,
max(case v.field_code when 'education' then IFNULL(v.field_value_label,v.field_value) end) education,
max(case v.field_code when 'major' then IFNULL(v.field_value_label,v.field_value) end) major,
max(case v.field_code when 'phone' then IFNULL(v.field_value_label,v.field_value) end) phone,
max(case v.field_code when 'email' then IFNULL(v.field_value_label,v.field_value) end) email,
max(case v.field_code when 'province' then IFNULL(v.field_value_label,v.field_value) end) province,
max(case v.field_code when 'city' then IFNULL(v.field_value_label,v.field_value) end) city,
max(case v.field_code when 'district' then IFNULL(v.field_value_label,v.field_value) end) district,
max(case v.field_code when 'address' then IFNULL(v.field_value_label,v.field_value) end) address
FROM
`cb_dynamic_form_instance` v
WHERE
v.group_code = 1106
GROUP BY
v.`instance_id`
) g
on u.sequence_nbr = g.instance_id
LEFT JOIN tz_flc_person_quality q on q.sequence_nbr = u.sequence_nbr
where
u.biz_org_type = 'person'
AND
u.is_delete = 0
AND u.parent_id = #{map.parentId}
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
order by u.rec_date desc
)a where a.sequence_nbr is not null
<if test="map.ages != null">
<choose>
<when test="map.ages == 0">
AND a.ages <![CDATA[ >= ]]> 60
</when>
<when test="map.ages == 1">
AND a.ages <![CDATA[ <= ]]> 59 and a.ages <![CDATA[ >= ]]> 50
</when>
<when test="map.ages == 2">
AND a.ages <![CDATA[ <= ]]> 49 and a.ages <![CDATA[ >= ]]> 40
</when>
<when test="map.ages == 3">
AND a.ages <![CDATA[ <= ]]> 39 and a.ages <![CDATA[ >= ]]> 30
</when>
<when test="map.ages == 4">
AND a.ages <![CDATA[ <= ]]> 29 and a.ages <![CDATA[ >= ]]> 20
</when>
<when test="map.ages == 5">
AND a.ages <![CDATA[ < ]]> 20
</when>
</choose>
</if>
<if test="map.sql != null">
<foreach collection="map.sql" item="item"> ${item} </foreach>
</if>
</select>
<select id="selectPersonList" resultType="Map">
select * from (
SELECT
DISTINCT
u.*,
g.*,
TIMESTAMPDIFF(YEAR, g.birthday, CURDATE()) as ages ,
case
when count(q.sequence_nbr) > 0 then '有'
else '无' end hasLicence
FROM
cb_org_usr u
LEFT JOIN
( SELECT
v.`instance_id`,
max(case v.field_code when 'person_type' then IFNULL(v.field_value_label,v.field_value) end) personType,
max(case v.field_code when 'sex' then IFNULL(v.field_value_label,v.field_value) end) sex,
max(case v.field_code when 'birthday' then IFNULL(v.field_value_label,v.field_value) end) birthday,
max(case v.field_code when 'licence_type' then IFNULL(v.field_value_label,v.field_value) end) licenceType,
max(case v.field_code when 'licence_code' then IFNULL(v.field_value_label,v.field_value) end) licenceCode,
max(case v.field_code when 'education' then IFNULL(v.field_value_label,v.field_value) end) education,
max(case v.field_code when 'major' then IFNULL(v.field_value_label,v.field_value) end) major,
max(case v.field_code when 'phone' then IFNULL(v.field_value_label,v.field_value) end) phone,
max(case v.field_code when 'email' then IFNULL(v.field_value_label,v.field_value) end) email,
max(case v.field_code when 'province' then IFNULL(v.field_value_label,v.field_value) end) province,
max(case v.field_code when 'city' then IFNULL(v.field_value_label,v.field_value) end) city,
max(case v.field_code when 'district' then IFNULL(v.field_value_label,v.field_value) end) district,
max(case v.field_code when 'address' then IFNULL(v.field_value_label,v.field_value) end) address
FROM
`cb_dynamic_form_instance` v
WHERE
v.group_code = 1106
GROUP BY
v.`instance_id`
) g
on u.sequence_nbr = g.instance_id
LEFT JOIN tz_flc_person_quality q on q.sequence_nbr = u.sequence_nbr
where
u.biz_org_type = 'person'
AND
u.is_delete = 0
AND u.parent_id = #{map.parentId}
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
order by u.rec_date desc
)a where a.sequence_nbr is not null
<if test="map.ages != null">
<choose>
<when test="map.ages == 0">
AND a.ages <![CDATA[ >= ]]> 60
</when>
<when test="map.ages == 1">
AND a.ages <![CDATA[ <= ]]> 59 and a.ages <![CDATA[ >= ]]> 50
</when>
<when test="map.ages == 2">
AND a.ages <![CDATA[ <= ]]> 49 and a.ages <![CDATA[ >= ]]> 40
</when>
<when test="map.ages == 3">
AND a.ages <![CDATA[ <= ]]> 39 and a.ages <![CDATA[ >= ]]> 30
</when>
<when test="map.ages == 4">
AND a.ages <![CDATA[ <= ]]> 29 and a.ages <![CDATA[ >= ]]> 20
</when>
<when test="map.ages == 5">
AND a.ages <![CDATA[ < ]]> 20
</when>
</choose>
</if>
<if test="map.sql != null">
<foreach collection="map.sql" item="item"> ${item} </foreach>
</if>
LIMIT #{map.pageNum}, #{map.pageSize}
</select>
</mapper>
...@@ -260,7 +260,7 @@ public class UnitInfoController extends BaseController { ...@@ -260,7 +260,7 @@ public class UnitInfoController extends BaseController {
if (ValidationUtil.isEmpty(sequenceNbr) ) { if (ValidationUtil.isEmpty(sequenceNbr) ) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
return ResponseHelper.buildResponse(unitInfoServiceImpl.getUnItDtoById(sequenceNbr)); return ResponseHelper.buildResponse(unitInfoServiceImpl.getUnitDtoById(sequenceNbr));
} }
......
...@@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.PathVariable; ...@@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -37,6 +38,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -37,6 +38,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 企业人员 * 企业人员
...@@ -143,6 +145,38 @@ public class UnitPersonController extends BaseController { ...@@ -143,6 +145,38 @@ public class UnitPersonController extends BaseController {
return ResponseHelper.buildResponse(list); return ResponseHelper.buildResponse(list);
} }
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个用户信息", notes = "根据sequenceNbr查询单个用户信息")
public ResponseModel<UnitPersonInfoDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse( iUnitPersonService.getPersonById(sequenceNbr));
}
/**
* 根据当前登录人获取人员信息 带分页搜索
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/listMyUnitPerson")
@ApiOperation(httpMethod = "GET",value = "根据当前登录人获取人员信息 带分页搜索", notes = "根据当前登录人获取人员信息 带分页搜索")
public ResponseModel<Object> listMyUnitPerson(@RequestParam(required = false) Map<String, Object> requestBody) throws Exception {
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys();
List<OrgMenuDto> menus = new ArrayList<>();
Long parentId = -1l;
for(CompanyModel c : companys) {
OrgUsr temp = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getAmosOrgId,c.getSequenceNbr()));
parentId = temp.getSequenceNbr();
}
return ResponseHelper.buildResponse(iUnitPersonService.pagePerson(parentId,requestBody.get("pageNum").toString(),requestBody.get("pageSize").toString(), requestBody));
}
} }
...@@ -373,7 +373,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -373,7 +373,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
} }
@Override @Override
public UnitInfoDto getUnItDtoById(Long sequenceNbr) { public UnitInfoDto getUnitDtoById(Long sequenceNbr) {
UnitInfo unitInfo = this.getById(sequenceNbr); UnitInfo unitInfo = this.getById(sequenceNbr);
return unitInfoToDto(unitInfo); return unitInfoToDto(unitInfo);
} }
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant; 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.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto; import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormColumnDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonDto; import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto; 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.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService; import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DynamicFormColumnServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam; 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.PersonEducationDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.PersonQualityDto; 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.dto.UnitPersonInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.PersonEducation;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.PersonQuality;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.UnitPersonMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IUnitPersonService; import com.yeejoin.amos.boot.module.tzs.flc.api.service.IUnitPersonService;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil; import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -38,6 +62,8 @@ import java.util.Map; ...@@ -38,6 +62,8 @@ import java.util.Map;
public class UnitPersonServiceImpl implements IUnitPersonService { public class UnitPersonServiceImpl implements IUnitPersonService {
private final Logger logger = LogManager.getLogger(UnitPersonServiceImpl.class);
@Autowired @Autowired
OrgUsrServiceImpl iOrgUsrService; OrgUsrServiceImpl iOrgUsrService;
...@@ -56,12 +82,26 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -56,12 +82,26 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
@Autowired @Autowired
DataDictionaryServiceImpl iDataDictionaryService; DataDictionaryServiceImpl iDataDictionaryService;
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
DynamicFormColumnServiceImpl alertFormServiceImpl;
@Resource
UnitPersonMapper unitPersonMapper;
@Transactional @Transactional
@Override @Override
public UnitPersonInfoDto saveUser(UnitPersonInfoDto unitPersonInfoDto) { public UnitPersonInfoDto saveUser(UnitPersonInfoDto unitPersonInfoDto) {
unitPersonInfoDto.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON); unitPersonInfoDto.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
OrgPersonDto orgPersonVo = new OrgPersonDto(); OrgPersonDto orgPersonVo = new OrgPersonDto();
if(StringUtils.isNotBlank(unitPersonInfoDto.getOrgExpandAttr2())) {
String pwd = DesUtil.encode(unitPersonInfoDto.getOrgExpandAttr2(), "qaz");
unitPersonInfoDto.setOrgExpandAttr2(pwd);
}
BeanUtils.copyProperties(unitPersonInfoDto,orgPersonVo); BeanUtils.copyProperties(unitPersonInfoDto,orgPersonVo);
try { try {
OrgUsrDto result = iOrgUsrService.saveOrgPersonFlc(orgPersonVo); OrgUsrDto result = iOrgUsrService.saveOrgPersonFlc(orgPersonVo);
PersonQualityDto personQualityDto = unitPersonInfoDto.getPersonQualityDto(); PersonQualityDto personQualityDto = unitPersonInfoDto.getPersonQualityDto();
...@@ -83,7 +123,7 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -83,7 +123,7 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
licenceType += "," + temp.getName(); licenceType += "," + temp.getName();
} }
if(licenceType.length() > 0) { if(licenceType.length() > 0) {
licenceType.substring(1); licenceType = licenceType.substring(1);
personQualityDto.setLicenceType(licenceType); personQualityDto.setLicenceType(licenceType);
} }
...@@ -109,28 +149,26 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -109,28 +149,26 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
// 创建账号信息 // 创建账号信息
if(StringUtils.isNotEmpty(unitPersonInfoDto.getOrg_expand_attr1()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrg_expand_attr2()) if(StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr1()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr2())
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrg_expand_attr3()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrg_expand_attr4()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr3()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr4())
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrg_expand_attr5() )) { && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr5() )) {
String roleName = unitPersonInfoDto.getOrg_expand_attr5(); String roleName = unitPersonInfoDto.getOrgExpandAttr5();
String orgId = unitPersonInfoDto.getOrg_expand_attr3();// 拿到的是 org_user的id 需要转换成amosid String orgId = unitPersonInfoDto.getOrgExpandAttr3();// 拿到的是 org_user的id 需要转换成amosid
OrgUsr temp = iOrgUsrService.getById(Long.parseLong(orgId)); OrgUsr temp = iOrgUsrService.getById(Long.parseLong(orgId));
Long companyId = Long.parseLong(temp.getAmosOrgId()); Long companyId = Long.parseLong(temp.getAmosOrgId());
String appcode = unitPersonInfoDto.getOrg_expand_attr4(); String appcode = unitPersonInfoDto.getOrgExpandAttr4();
// 创建人员账户信息 // 创建人员账户信息
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null); FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
String pwd = DesUtil.encode(unitPersonInfoDto.getOrg_expand_attr2(), "qaz");
AgencyUserModel agencyUserModel = new AgencyUserModel(); AgencyUserModel agencyUserModel = new AgencyUserModel();
agencyUserModel.setUserName(unitPersonInfoDto.getOrg_expand_attr1()); agencyUserModel.setUserName(unitPersonInfoDto.getOrgExpandAttr1());
agencyUserModel.setRealName(unitPersonInfoDto.getBizOrgName()); agencyUserModel.setRealName(unitPersonInfoDto.getBizOrgName());
agencyUserModel.setLockStatus("UNLOCK"); agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(pwd); agencyUserModel.setPassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setRePassword(pwd); agencyUserModel.setRePassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setAgencyCode("tzs"); agencyUserModel.setAgencyCode("tzs");
// agencyUserModel.setMobile(adminTel); 不存储电话信息 // agencyUserModel.setMobile(adminTel); 不存储电话信息
// 所属组织 // 所属组织
...@@ -168,4 +206,160 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -168,4 +206,160 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
} }
return unitPersonInfoDto; return unitPersonInfoDto;
} }
@Override
@Transactional
public UnitPersonInfoDto getPersonById(Long sequenceNbr) {
// 首先获取orguer信息
UnitPersonInfoDto temp = new UnitPersonInfoDto();
try {
OrgPersonFormDto orgPerson = iOrgUsrService.selectPersonById(sequenceNbr);
temp = new UnitPersonInfoDto();
BeanUtils.copyProperties(orgPerson,temp);
// 查询附件
Map<String, List<AttachmentDto>> attachmentMap = sourceFileService.getAttachments(sequenceNbr);
// 获取企业二维码
if(attachmentMap != null) {
// 判断是否有二维码信息 没有则添加
if(attachmentMap.get(TzsCommonParam.QR_CODE) != null) {
temp.setQrcode(attachmentMap.get(TzsCommonParam.QR_CODE));
} else {
this.saveQrCode(orgPerson);
attachmentMap = sourceFileService.getAttachments(sequenceNbr);
temp.setQrcode(attachmentMap.get(TzsCommonParam.QR_CODE));
}
if(attachmentMap.get(TzsCommonParam.LICENCE_PIC) != null) {
temp.setLicencePic(attachmentMap.get(TzsCommonParam.LICENCE_PIC));
}
if(attachmentMap.get(TzsCommonParam.HEAD_SHOT) != null) {
temp.setHeadshot(attachmentMap.get(TzsCommonParam.HEAD_SHOT));
}
}
PersonQuality quality = flcPersonQualityServiceImpl.getOne(new LambdaQueryWrapper<PersonQuality>().eq(PersonQuality::getIsDelete,false).eq(PersonQuality::getPsersonId,sequenceNbr));
PersonQualityDto qualityDto = new PersonQualityDto();
attachmentMap = sourceFileService.getAttachments(quality.getSequenceNbr());
if(attachmentMap != null) {
if(attachmentMap.get(TzsCommonParam.LICENCE_INFO) != null) {
qualityDto.setLicenceInfo(attachmentMap.get(TzsCommonParam.LICENCE_INFO));
}
}
BeanUtils.copyProperties(quality,qualityDto);
temp.setPersonQualityDto(qualityDto);
PersonEducation personEducation = personEducationServiceImpl.getOne(new LambdaQueryWrapper<PersonEducation>().eq(PersonEducation::getIsDelete,false).eq(PersonEducation::getPsersonId,sequenceNbr));
PersonEducationDto personEducationDto = new PersonEducationDto();
attachmentMap = sourceFileService.getAttachments(personEducation.getSequenceNbr());
if(attachmentMap != null) {
if(attachmentMap.get(TzsCommonParam.ATTACHMENT) != null) {
personEducationDto.setAttachment(attachmentMap.get(TzsCommonParam.ATTACHMENT));
}
}
BeanUtils.copyProperties(personEducation,personEducationDto);
temp.setPersonEducationDto(personEducationDto);
} catch (Exception e) {
e.printStackTrace();
}
return temp;
}
@Override
public IPage<Map<String, Object>> pagePerson(Long parentId , String pageNum, String pageSize, Map<String, Object> req) {
IPage<Map<String, Object>> pageBean = null;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
Map<String, Object> map = new HashMap<>();
map.put("parentId", parentId);
req.remove("pageSize");
req.remove("pageNum");
req.remove("parentId");
// 处理动态字段
List<String> sql = new ArrayList<>();
List<DynamicFormColumnDto> dynamicList = alertFormServiceImpl.queryListByTypeCode("1106");
dynamicList.stream().forEach(t -> {
if(req.get(t.getFieldCode()) != null) { // 存在动态字段
StringBuffer tempsql = new StringBuffer();
tempsql.append("AND " + t.getFieldCode() );
if("eq".equals(t.getQueryStrategy())) {
tempsql.append(" = '" + req.get(t.getFieldCode()) + "'");
} else if("like".equals(t.getQueryStrategy())) {
tempsql.append(" like '%" + req.get(t.getFieldCode()) +"%'");
}
sql.add(tempsql.toString());
}
});
if(req.get("birthdayStart") != null) {
sql.add(" AND birthday >= '" + req.get("birthdayStart")+ "'");
}
if(req.get("birthdayEnd") != null) {
sql.add(" AND birthday <= '" + req.get("birthdayEnd")+ "'");
}
if(req.get("hasLicence") != null) {
sql.add(" AND hasLicence = '" + req.get("birthdayEnd")+ "'");
}
if(req.get("account") != null) {
sql.add(" AND org_expand_attr1 like '%" + req.get("account")+ "%'");
}
if(req.get("role") != null) {
sql.add(" AND org_expand_attr5 like '%" + req.get("role")+ "%'");
}
if(req.get("bizOrgCode") != null) {
sql.add(" AND biz_org_code like '%" + req.get("bizOrgCode")+ "%'");
}
if(req.get("bizOrgName") != null) {
sql.add(" AND biz_org_name like '%" + req.get("bizOrgName")+ "%'");
}
map.put("sql", sql);
pageBean.setTotal(unitPersonMapper.selectPersonListCount(map));
map.put("pageNum", (pageBean.getCurrent() - 1) * pageBean.getSize());
map.put("pageSize", pageBean.getSize());
List<Map<String, Object>> list = unitPersonMapper.selectPersonList(map);
pageBean.setRecords(list);
return pageBean;
}
public String saveQrCode(OrgPersonFormDto orgPerson) {
// 二维码生成规则 人员类型 企业编码 人员编号
List<FormValue> dynamicFormAlert = orgPerson.getDynamicFormAlert();
String personType = "";
for(FormValue t : dynamicFormAlert) {
if("person_type".equals(t.getKey())) {
personType = t.getValueName();
break;
}
}
OrgUsr company = iOrgUsrService.getById(orgPerson.getParentId());
String qrString = "人员类型: " +personType +"\n\r";
qrString += "企业编码: " +company.getBizOrgCode() +"\n\r";
qrString += "人员编号: " +orgPerson.getBizOrgCode() +"\n\r";
byte[] bytes = QRCodeUtil.generateQRCodeImageByteData(qrString, 480);
MultipartFile file = new MockMultipartFile("person_" + orgPerson.getSequenceNbr() + ".png","person_" + orgPerson.getSequenceNbr() + ".png","application/octet-stream" ,bytes);
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(file);
Map<String, String> map = result.getResult();
if(map.isEmpty()) {
logger.error("未生成二维码文件");
throw new BadRequest("未生成二维码文件");
}
String filePath = "";
for(Map.Entry<String,String> fileResult : map.entrySet()) {
filePath = fileResult.getKey();
}
// 保存qrCode
List<AttachmentDto> qrCode = new ArrayList<>();
AttachmentDto temp = new AttachmentDto();
temp.setName("person_" + orgPerson.getSequenceNbr() + ".png");
temp.setType("image");
temp.setUrl(filePath);
qrCode.add(temp);
Map<String, List<AttachmentDto>> attachmentMap = sourceFileService.getAttachments(orgPerson.getSequenceNbr());
attachmentMap.put(TzsCommonParam.QR_CODE,qrCode);
sourceFileService.saveAttachments(orgPerson.getSequenceNbr(),attachmentMap);
return filePath;
}
} }
\ No newline at end of file
...@@ -421,6 +421,29 @@ ...@@ -421,6 +421,29 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="kongfm" id="2021-11-24-01">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from cb_dynamic_form_column where sequence_nbr = 1</sqlCheck>
</preConditions>
<comment>INSERT person info </comment>
<sql>
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (1, 'person_type', '人员类型', 'select', 7, 'eq', b'0', b'0', '1106', '{\"url\": \"\", \"data\": [], \"dict\": \"PERSON_TYPE\", \"type\": \"dict\"}', NULL, NULL, '2021-11-24 13:50:47', b'0', NULL, 1, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (2, 'sex', '人员性别', 'radio', 7, 'eq', b'0', b'0', '1106', '{\"url\": \"\", \"data\": [], \"dict\": \"XB\", \"type\": \"dict\"}', NULL, NULL, '2021-11-24 13:51:29', b'0', NULL, 2, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (3, 'birthday', '出生日期', 'datetime', 7, 'eq', b'0', b'0', '1106', NULL, NULL, NULL, '2021-11-24 13:53:12', b'0', NULL, 3, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (4, 'licence_type', '证件类型', 'radio', 7, 'eq', b'0', b'0', '1106', '{\"url\": \"\", \"data\": [], \"dict\": \"PERSON_LICENCE_TYPE\", \"type\": \"dict\"}', NULL, NULL, '2021-11-24 13:53:48', b'0', NULL, 4, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (5, 'licence_code', '证件编号', 'input', 7, 'like', b'0', b'0', '1106', NULL, NULL, NULL, NULL, b'0', NULL, 5, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (6, 'education', '学历', 'radio', 7, 'eq', b'0', b'0', '1106', '{\"url\": \"\", \"data\": [], \"dict\": \"XLLX\", \"type\": \"dict\"}', NULL, NULL, '2021-11-24 13:55:02', b'0', NULL, 6, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (7, 'major', '专业', 'input', 7, 'like', b'0', b'0', '1106', NULL, NULL, NULL, NULL, b'0', NULL, 7, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (8, 'phone', '电话', 'input', 7, 'like', b'0', b'0', '1106', NULL, NULL, NULL, NULL, b'0', NULL, 8, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (9, 'email', '邮箱', 'input', 7, 'like', b'0', b'0', '1106', NULL, NULL, NULL, NULL, b'0', NULL, 9, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (10, 'province', '省', 'provinceSelect', 7, 'like', b'0', b'0', '1106', NULL, NULL, NULL, NULL, b'0', NULL, 10, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (11, 'city', '市', 'citySelect', 7, 'like', b'0', b'0', '1106', NULL, NULL, NULL, NULL, b'0', NULL, 11, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (12, 'district', '区县', 'districtSelect', 7, 'like', b'0', b'0', '1106', NULL, NULL, NULL, NULL, b'0', NULL, 12, NULL);
INSERT INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES (13, 'address', '详细地址', 'input', 7, 'like', b'0', b'0', '1106', NULL, NULL, NULL, NULL, b'0', NULL, 13, NULL);
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
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