Commit b97b703f authored by chenzhao's avatar chenzhao

机场人员 导出 导入 下载模板 部门级用户可查看本单位人员

parent c55931b6
package com.yeejoin.amos.boot.module.common.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.excel.CommonExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* 机构/部门/人员表
*
* @author tb
* @date 2021-06-18
*/
@Data
@ApiModel(value="OrgUsrDlExcelDto", description="机构/部门/人员表")
public class OrgUsrDlExcelDto {
@ExcelProperty(value = "姓名", index = 0)
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ExcelIgnore
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ExcelIgnore
@ApiModelProperty(value = "amos中公司/部门ID")
private String amosOrgId;
@ExcelIgnore
@ApiModelProperty(value = "amos中公司/部门编码")
private String amosOrgCode;
@ExcelIgnore
@ApiModelProperty(value = "机构类型(部门:DEPARTMENT,单位:COMPANY,人员:PERSON)")
private String bizOrgType;
@ExcelIgnore
@ApiModelProperty(value = "所属建筑名称")
private String buildName;
@ExcelIgnore
@ApiModelProperty(value = "所属建筑ID")
private String buildId;
@ExcelProperty(value = "所属单位部门", index = 1)
@ExplicitConstraint(indexNum = 1, sourceClass = CommonExplicitConstraint.class, method = "getparent") //固定下拉内容
@ApiModelProperty(value = "归属机构/部门/人员")
private String parentId;
@ExcelIgnore
@ApiModelProperty(value = "机构名称")
private String parentName;
@ExcelIgnore
@ApiModelProperty(value = "扩展属性1")
private String orgExpandAttr1;
@ExcelIgnore
@ApiModelProperty(value = "扩展属性2")
private String orgExpandAttr2;
@ExcelIgnore
@ApiModelProperty(value = "扩展属性3")
private String orgExpandAttr3;
@ExcelIgnore
@ApiModelProperty(value = "扩展属性4")
private String orgExpandAttr4;
@ExcelIgnore
private String orgExpandAttr5;
@ExcelIgnore
private String orgExpandAttr6;
@ExcelIgnore
private String orgExpandAttr7;
@ExcelIgnore
private String orgExpandAttr8;
@ExcelIgnore
@ApiModelProperty(value = "更新人")
@TableField(fill= FieldFill.INSERT_UPDATE)
private String recUserName;
@ExcelIgnore
@ApiModelProperty(value = "动态表单值")
private List<DynamicFormInstance> dynamicFormValue;
@ExcelIgnore
//@ExplicitConstraint(type = "XZZW", indexNum =2, sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String administrativePositionCode;// 行政职务
@ExcelIgnore
// @ExplicitConstraint(type = "SHZQ", indexNum =3, sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String auditCycle; //审核周期
@ExcelProperty(value = "证件类型", index = 2)
@ExplicitConstraint(type = "RYZJLX", indexNum =2, sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String certificatesTypeCode; //证件类型
@ExcelProperty(value = "证件号码", index = 3)
private String certificatesNumber;// 证件号码
@ExcelIgnore
// @ExplicitConstraint(type = "CZLB", indexNum =6, sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String certificateType; //持证类别
@ExcelProperty(value = "消防管理岗位", index = 4)
@ExplicitConstraint(type = "XFGLGW", indexNum =4, sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String fireManagementPostCode; //消防管理岗位
@ExcelProperty(value = "性别", index = 5)
@ExplicitConstraint(type = "XB", indexNum =5, sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String gender; //性别
@ExcelIgnore
// @ExplicitConstraint(type = "JGNBZW", indexNum =9, sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String internalPositionCode; //消防管理组织机构内部职务
@ExcelProperty(value = "员工编号", index = 6)
private String personNumber; //员工编号
@ExcelProperty(value = "岗位类型", index = 7)
@ExplicitConstraint(type = "GWMC", indexNum =7, sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String positionType; //岗位类型
@ExcelProperty(value = "是否进行安全培训", index = 8)
@ExplicitConstraint(type = "AQPX", indexNum =8, sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String safetyTraining; //是否进行安全培训
@ExcelIgnore
//@ExplicitConstraint(type = "RYZT", indexNum =13, sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String stateCode; //人员状态
@ExcelProperty(value = "联系电话", index = 9)
private String telephone; //联系电话
@ExcelProperty(value = "人员类型", index = 10)
@ExplicitConstraint( indexNum =10, type = "DLRYLX", sourceClass = CommonExplicitConstraint.class) //动态下拉内
private String peopleType; //人员类型
//@ExplicitConstraint(indexNum = 16, sourceClass = CommonExplicitConstraint.class, method = "getNations") //固定下拉内容
@ExcelIgnore
@ApiModelProperty(value = "民族")
private String nation;
@ExcelProperty(value = "出生日期", index = 11)
@ApiModelProperty(value = "出生日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date birthdayTime;
//@ExplicitConstraint(indexNum = 18, sourceClass = CommonExplicitConstraint.class, method = "getMaritalStatus") //固定下拉内容
@ExcelIgnore
@ApiModelProperty(value = "婚姻状况")
private String maritalStatus;
//@ExplicitConstraint(indexNum = 19, sourceClass = CommonExplicitConstraint.class,method="getCitys") //动态下拉内容
@ExcelIgnore
@ApiModelProperty(value = "籍贯/户口所在地的值")
private String nativePlace;
@ExcelIgnore
@ApiModelProperty(value = "籍贯/户口所在地详细地址")
private String nativePlaceVal;
// @ExplicitConstraint(indexNum = 21, sourceClass = CommonExplicitConstraint.class, method = "getPoliticalOutlook") //固定下拉内容
@ExcelIgnore
@ApiModelProperty(value = "政治面貌代码")
private String politicalOutlook;
// @ExplicitConstraint(indexNum = 22, sourceClass = CommonExplicitConstraint.class,method="getCitys") //动态下拉内容// BUG 2760 修改消防人员导出模板和 导入问题 bykongfm
@ExcelIgnore
@ApiModelProperty(value = "现居住地")
private String residenceDetails;
@ExcelIgnore
@ApiModelProperty(value = "现居住地详细地址")
private String residenceDetailVal;
@ExcelIgnore
@ApiModelProperty(value = "住宿情况")
private String airportAccommodation;
@ExcelIgnore
@ApiModelProperty(value = "紧急联系人")
private String emergencyContact;
//@ExplicitConstraint(type = "RJGX", indexNum = 26, sourceClass = CommonExplicitConstraint.class) //动态下拉内容
@ExcelIgnore
@ApiModelProperty(value = "紧急联系人与本人所属关系")
private String relationship;
@ExcelIgnore
@ApiModelProperty(value = "紧急联系人电话")
private String emergencyContactPhone;
@ApiModelProperty(value = "员工层级")
@ExcelIgnore
// @ExplicitConstraint(type = "YGCJ", indexNum = 28, sourceClass = CommonExplicitConstraint.class) //动态下拉内容
private String employeeHierarchy;
@ApiModelProperty(value = "岗位资质")
@ExplicitConstraint(type = "GWZZ", indexNum = 12, sourceClass = CommonExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "岗位资质", index = 12)
private String postQualification;
@ApiModelProperty(value = "持证时间")
@ExcelIgnore
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date holdingTime;
/*************************学历教育***********************/
@ApiModelProperty(value = "第一学历")
// @ExplicitConstraint(type = "XLLX", indexNum = 31, sourceClass = CommonExplicitConstraint.class) //动态下拉内容
@ExcelIgnore
private String firstDegree;
@ApiModelProperty(value = "最高学历")
// @ExplicitConstraint(type = "XLLX", indexNum = 32, sourceClass = CommonExplicitConstraint.class) //动态下拉内容
@ExcelIgnore
private String highestEducation;
@ApiModelProperty(value = "学位")
// @ExplicitConstraint(type = "XWLX", indexNum = 33, sourceClass = CommonExplicitConstraint.class) //动态下拉内容
@ExcelIgnore
private String academicDegree;
@ApiModelProperty(value = "毕业院校")
@ExcelIgnore
private String school;
@ApiModelProperty(value = "毕业专业名称")
@ExcelIgnore
private String professionalName;
/*************************工作履历岗***********************/
@ApiModelProperty(value = "参加工作时间")
@ExcelIgnore
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date workingHours;
@ApiModelProperty(value = "参加消防部门工作时间")
@ExcelIgnore
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date fireWorkingHours;
@ExcelIgnore
@ApiModelProperty(value = "单位人员id")
private String orgUsrId;
@ExcelIgnore
@ApiModelProperty(value = "消防人员id")
private Long firefightersId;
}
......@@ -20,6 +20,7 @@ public enum ExcelEnums {
KEYSITE ("重点部位", "重点部位", "com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto","KEYSITE"),//{"KEYSITE":}
CLZQ ("车辆执勤", "车辆执勤", "com.yeejoin.amos.boot.module.common.api.dto.DutyCarExcelDto","CLZQ"),//("CLZQ","车辆执勤")
JCDWRY ("单位人员", "单位人员", "com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto","JCDWRY"),//("JCDW","机场单位")
DLDWRY ("单位人员", "单位人员", "com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDlExcelDto","DLDWRY"),//("JCDW","机场单位")
LDDW ("联动单位", "联动单位", "com.yeejoin.amos.boot.module.common.api.dto.LinkageUnitDto","LDDW"),//("JCDW","机场单位")
RYZB ("人员值班", "人员值班", "com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto","RYZB"),//("RYZB","人员值班")
// BUG 2455 相关代码 bykongfm
......
......@@ -80,6 +80,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
private static final String COMPANY_FIELD_CODE = "companyLocation,longitude,latitude";
private static final String COMPANY_VALUE = "COMPANY";
@Value("${logic}")
Boolean logic;
@Autowired
DynamicFormInstanceServiceImpl alertFormValueServiceImpl;
@Autowired
......@@ -2859,9 +2862,18 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override
public List<OrgMenuDto> companyTreeByUserNumber(ReginParams reginParams) {
Map<String, Object> param = new HashMap<>();
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
// 权限处理
if (!logic){
OrgUsr orgUsr = orgUsrMapper.selectById(reginParams.getPersonIdentity().getCompanyId());
//判断登陆人是否已经是顶级节点单位
if (!ObjectUtils.isEmpty(orgUsr) && orgUsr.getParentId() != null) {
orgUsr = this.selectParentOrgUsr(orgUsr);
bizOrgCode = orgUsr.getBizOrgCode() != null? orgUsr.getBizOrgCode():bizOrgCode;
}
}
PermissionInterceptorContext.setDataAuthRule(authKey);
param.put("bizOrgCode", reginParams.getPersonIdentity().getBizOrgCode());
param.put("bizOrgCode",bizOrgCode);
List<OrgUsr> list = orgUsrMapper.companyDeptListWithPersonCount(param);
return buildTreeParallel(list);
}
......
......@@ -5,6 +5,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -55,6 +56,9 @@ public class ExcelController extends BaseController {
@Autowired
Sequence sequence;
@Value("${logic}")
Boolean logic ;
private static final String NOT_DUTY = "休班";
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......@@ -74,6 +78,9 @@ public class ExcelController extends BaseController {
@GetMapping("/download/template/{type}")
public void downloadTemplate(HttpServletResponse response, @PathVariable(value = "type") String type) {
try {
if(type.equals("JCDWRY") && !logic){
type = "DLDWRY";
}
ExcelEnums excelEnums = ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(),
excelEnums.getClassUrl(), excelEnums.getType());
......@@ -100,6 +107,9 @@ public class ExcelController extends BaseController {
public void getFireStationFile(HttpServletResponse response, @PathVariable(value = "type") String type,
@RequestParam Map par) {
try {
if(type.equals("JCDWRY") && !logic){
type = "DLDWRY";
}
ExcelEnums excelEnums = ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(),
excelEnums.getClassUrl(), excelEnums.getType());
......@@ -119,6 +129,9 @@ public class ExcelController extends BaseController {
long uuid = sequence.nextId();
String uuidString = Long.toString(uuid);
redisUtils.set(uuidString, 0);
if(type.equals("JCDWRY") && !logic){
type = "DLDWRY";
}
ExcelEnums excelEnums = ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(),
excelEnums.getClassUrl(), excelEnums.getType());
......
......@@ -30,6 +30,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -192,6 +193,9 @@ public class ExcelServiceImpl {
@Autowired
private OrgUsrMapper orgUsrMapper;
@Value("${logic}")
Boolean logic;
@Autowired
SignServiceImpl signServiceImpl;
......@@ -391,6 +395,19 @@ public class ExcelServiceImpl {
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), orgUsrList,
OrgUsrExcelDto.class, null, false);
break;
case "DLDWRY":
if(!authFlag) {
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), null,
OrgUsrDlExcelDto.class, null, false);
break;
}
List<OrgUsrExcelDto> orgUsrDlList = orgUsrService.exportToExcel(par);
String content = JSONObject.toJSONString(orgUsrDlList);
List<OrgUsrDlExcelDto> dtoList = JSONObject.parseArray(content, OrgUsrDlExcelDto.class);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), dtoList,
OrgUsrDlExcelDto.class, null, false);
break;
case "LDDW":
List<LinkageUnitDto> LinkageUnitDtoList = null;
String inAgreement = par.containsKey("inAgreement")&&!(par.get("inAgreement").toString()).equals("null")?par.get("inAgreement").toString():"";
......@@ -489,6 +506,7 @@ public class ExcelServiceImpl {
excelImportKeySite(multipartFile);
break;
case "JCDWRY":
case "DLDWRY":
// excelImportOrgUsrExcelDto(multipartFile);
excelImportOrgUsrExcelDtoNew(multipartFile);
break;
......@@ -755,7 +773,20 @@ public class ExcelServiceImpl {
}
private void excelImportOrgUsrExcelDtoNew(MultipartFile multipartFile) throws Exception {
List<OrgUsrExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, OrgUsrExcelDto.class, 1);
List<OrgUsrExcelDto> excelDtoList = new ArrayList<>();
if (!logic){
List<OrgUsrDlExcelDto> list = ExcelUtil.readFirstSheetExcel(multipartFile, OrgUsrDlExcelDto.class, 1);
if (list.size() > 0) {
String s = JSONObject.toJSONString(list);
List<OrgUsrExcelDto> list1 = JSONObject.parseArray(s, OrgUsrExcelDto.class);
excelDtoList.addAll(list1);
}
}else {
List<OrgUsrExcelDto> list = ExcelUtil.readFirstSheetExcel(multipartFile, OrgUsrExcelDto.class, 1);
if (list.size() > 0){
excelDtoList.addAll(list);
}
}
if (!ObjectUtils.isEmpty(excelDtoList)) {
Set<String> set = new HashSet<>();
Set<String> set1 = new HashSet<>();
......@@ -811,7 +842,7 @@ public class ExcelServiceImpl {
dynamicFormValue.forEach(dynamicFormInstanceDto -> {
String key = dynamicFormInstanceDto.getFieldCode();
if (map1.containsKey(key)){
if (map1.containsKey(key) && !ObjectUtils.isEmpty(map1.get(key))){
String value = map1.get(key).toString();
if (value.contains("@")) {
String[] certificates = value.split("@");
......@@ -839,7 +870,7 @@ public class ExcelServiceImpl {
DynamicFormInstance dynamicFormInstance = new DynamicFormInstance();
BeanUtils.copyProperties(dynamicFormInstanceDto, dynamicFormInstance);
String fieldCode = dynamicFormInstance.getFieldCode();
if (map1.containsKey(fieldCode.substring(0,fieldCode.length()-4))){
if (map1.containsKey(fieldCode.substring(0,fieldCode.length()-4)) && map1.get(fieldCode.substring(0,fieldCode.length()-4)) != null){
dynamicFormInstance.setFieldValueLabel(map1.get(fieldCode.substring(0,fieldCode.length()-4)).toString());
}
if ("gender".equals(dynamicFormInstance.getFieldCode()) && !ObjectUtils.isEmpty(dynamicFormInstance.getFieldValue())){
......
......@@ -136,4 +136,7 @@ mqtt.topic.command.car.jw=carCoordinates
management.security.enabled=true
spring.security.user.name=admin
spring.security.user.password=a1234560
\ No newline at end of file
spring.security.user.password=a1234560
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
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