Commit 16185060 authored by chenzhao's avatar chenzhao

Merge branch 'develop_dl' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl

parents c252f347 bf162e3a
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.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 org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
*
* 请求参数类
*
*/
@Data
@ApiModel(value="请求参数类", description="人员请求参数类")
public class OrgUserVO {
@ApiModelProperty(value = "关联应用appkey")
private List<String> appCodes;
@ApiModelProperty(value = "平台单位id")
private String companySeqs;
@ApiModelProperty(value = "平台部门id")
private String deptSeqs;
@ApiModelProperty(value = "邮箱")
private String email;
@ApiModelProperty(value = "固话号码")
private String landlinePhone;
@ApiModelProperty(value = "是否启用")
private String lockStatus;
@ApiModelProperty(value = "手机号码")
private String mobile;
@ApiModelProperty(value = "组装参数")
private Map<String,List<String>> orgRoleSeqs;
@ApiModelProperty(value = "密码")
private String password;
@ApiModelProperty(value = "二次密码")
private String rePassword;
@ApiModelProperty(value = "姓名")
private String realName;
@ApiModelProperty(value = "角色权限")
private List<String> roleSeqs;
@ApiModelProperty(value = "用户名")
private String userName;
}
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.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 org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 机构/部门/人员表
*
* @author tb
* @date 2021-06-18
*/
@Data
@ApiModel(value="OrgUsrTPDlExcelDto", description="机构/部门/人员表")
public class OrgUsrTPDlExcelDto{
@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")
@com.alibaba.excel.annotation.format.DateTimeFormat("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;
/*************************平台***********************/
@ExcelIgnore
@ApiModelProperty(value = "关联应用appkey")
private List<String> appCodes;
@ExcelIgnore
@ApiModelProperty(value = "平台单位id")
private String companySeqs;
@ExplicitConstraint(indexNum = 16, sourceClass = CommonExplicitConstraint.class, method = "getdeptSeqsList")
@ExcelProperty(value = "平台部门id", index = 16)
@ApiModelProperty(value = "平台部门id")
private String deptSeqs;
@ExcelIgnore
@ApiModelProperty(value = "邮箱")
private String email;
@ExcelIgnore
@ApiModelProperty(value = "固话号码")
private String landlinePhone;
@ExcelIgnore
@ApiModelProperty(value = "是否启用")
private String lockStatus;
@ExcelIgnore
@ApiModelProperty(value = "手机号码")
private String mobile;
@ExcelIgnore
@ApiModelProperty(value = "组装参数")
private Map<String,List<String>> orgRoleSeqs;
@ExcelProperty(value = "密码", index = 15)
@ApiModelProperty(value = "密码")
private String password;
@ExcelIgnore
@ApiModelProperty(value = "二次密码")
private String rePassword;
@ExcelIgnore
@ApiModelProperty(value = "姓名")
private String realName;
@ExcelIgnore
@ApiModelProperty(value = "角色权限")
private List<String> roleSeqs;
@ExcelProperty(value = "用户名", index = 14)
@ApiModelProperty(value = "用户名")
private String userName;
@ExcelIgnore
@ApiModelProperty(value = "关联应用appkey")
private String appCodeList;
@ExcelIgnore
@ApiModelProperty(value = "角色权限")
private String roleSeqList;
@ExcelIgnore
@ApiModelProperty(value = "平台权限组id")
private String group;
@ExplicitConstraint(indexNum = 13, source ={ "管理员","非管理员" })
@ExcelProperty(value = "平台人员类型", index = 13)
@ApiModelProperty(value = "平台人员类型")
private String userType;
}
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.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 org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 机构/部门/人员表
*
* @author tb
* @date 2021-06-18
*/
@Data
@ApiModel(value="UserVO", description="平台信息")
public class UserVO {
/*************************平台***********************/
@ExcelIgnore
@ApiModelProperty(value = "关联应用appkey")
private List<String> appCodes;
@ApiModelProperty(value = "角色权限")
private List<String> roleSeqs;
@ApiModelProperty(value = "平台权限组id")
private String group;
@ApiModelProperty(value = "类型")
private String type;
}
package com.yeejoin.amos.boot.module.common.api.feign;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUserVO;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.GroupUserModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @description:
* @author: tw
* @createDate: 2023/3/29
*/
@FeignClient(name ="${privilege.fegin.name:AMOS-API-PRIVILEGE}", path = "", configuration = {MultipartSupportConfig.class})
public interface PrivilegeFeignClient {
@RequestMapping(value = "/privilege/v1/agencyuser", method = RequestMethod.POST)
ResponseModel<Object> create(
@RequestHeader("appKey") String appKey,
@RequestHeader("product") String product,
@RequestHeader("token") String token,
@RequestBody OrgUserVO var1);
@RequestMapping(value = "/privilege/v1/groupUser", method = RequestMethod.POST)
ResponseModel<Object> groupUser(
@RequestHeader("appKey") String appKey,
@RequestHeader("product") String product,
@RequestHeader("token") String token,
@RequestParam("groupSeq") Long groupSeq, @RequestBody List<String> var2);
}
......@@ -21,6 +21,7 @@ public enum ExcelEnums {
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","机场单位")
JCDWRYTP ("单位人员同步平台", "单位人员同步平台", "com.yeejoin.amos.boot.module.common.api.dto.OrgUsrTPDlExcelDto","JCDWRYTP"),//("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
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.module.common.api.enums.ExceptionEnum;
......@@ -58,11 +59,15 @@ public class ExcelController extends BaseController {
@Autowired
Sequence sequence;
@Value("${logic}")
Boolean logic ;
@Value("${logic}")
private Boolean logic ;
private static String JCDWRY = "JCDWRY";
private static String DLDWRY = "DLDWRY";
//同步机场单位
private static String JCDWRYTP = "JCDWRYTP";
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取上传excle文件是否成功")
......@@ -108,7 +113,7 @@ public class ExcelController extends BaseController {
@ApiOperation(value = "导出公用类")
@GetMapping("/export/{type}")
public void getFireStationFile(HttpServletResponse response, @PathVariable(value = "type") String type,
@RequestParam Map par) {
@RequestParam Map<String,Object> par) {
try {
if(type.equals(JCDWRY) && logic != null &&!logic){
type = DLDWRY;
......@@ -127,7 +132,7 @@ public class ExcelController extends BaseController {
@ApiOperation(value = "导入公用")
@PostMapping("/upload/{type}")
public ResponseModel<Object> upload(@RequestPart("file") MultipartFile multipartFile,
@PathVariable(value = "type") String type) {
@PathVariable(value = "type") String type,HttpServletRequest equest) {
try {
long uuid = sequence.nextId();
String uuidString = Long.toString(uuid);
......@@ -138,7 +143,7 @@ public class ExcelController extends BaseController {
ExcelEnums excelEnums = ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(),
excelEnums.getClassUrl(), excelEnums.getType());
excelService.commonUpload(multipartFile, excelDto, uuidString);
excelService.commonUpload(multipartFile, excelDto, uuidString,equest);
return ResponseHelper.buildResponse(uuidString);
} catch (RuntimeException e) {
e.printStackTrace();
......@@ -214,4 +219,53 @@ public class ExcelController extends BaseController {
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取导入接口")
@GetMapping(value = "/getexport/{key}")
public ResponseModel<Object> getexport(@PathVariable(value = "key")String key) {
Object ob= redisUtils.get(key);
return ResponseHelper.buildResponse(ob);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入公用")
@PostMapping("/uploadNew")
public ResponseModel<Object> uploadNew(@RequestPart("file") MultipartFile multipartFile,
HttpServletRequest equest) {
try {
ExcelEnums excelEnums = ExcelEnums.getByKey(JCDWRYTP);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(),
excelEnums.getClassUrl(), excelEnums.getType());
Object ob=excelService.commonUpload(multipartFile, excelDto, null,equest);
return ResponseHelper.buildResponse(ob);
} catch (RuntimeException e) {
e.printStackTrace();
throw new BadRequest(e.getMessage());
} catch (Exception e) {
throw new BadRequest("文件格式不正确或excel 模板不匹配!");
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "下载模板")
@GetMapping("/downloadnew/template")
public void downloadnew(HttpServletResponse response) {
try {
ExcelEnums excelEnums = ExcelEnums.getByKey(JCDWRYTP);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(),
excelEnums.getClassUrl(), excelEnums.getType());
excelService.templateExport(response, excelDto);
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
}
......@@ -32,6 +32,8 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.FireTeamServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import net.sf.cglib.beans.BeanMap;
......@@ -206,12 +208,33 @@ public class DataSourcesImpl implements DataSources {
case "getListByEquipmentCode":
str = getListByEquipmentCode();
break;
case "getdeptSeqsList":
str = getdeptSeqsList();
break;
}
}
return str;
}
private String[] getdeptSeqsList() {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
Long sequenceNbr = reginParams.getCompany().getSequenceNbr();
FeignClientResult<Collection<DepartmentModel>> date=Privilege.departmentClient.queryDeptTree(null,sequenceNbr);
Collection<DepartmentModel> depts = date.getResult();
List<String> carNameList = Lists.newArrayList();
depts.forEach(dept -> {
carNameList.add(dept.getDepartmentName() + "@" + dept.getSequenceNbr());
});
String[] str = carNameList.toArray(new String[carNameList.size()]);
return str;
}
private String[] getCarList() {
ResponseModel<Object> response = equipFeignClient.getFireCarListAll();
List<Map<String, Object>> carList = (List<Map<String, Object>>) response.getResult();
......
......@@ -3,12 +3,14 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
......@@ -16,10 +18,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.feign.PrivilegeFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.*;
import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto;
import com.yeejoin.amos.feign.privilege.model.GroupUserModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.io.IOUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
......@@ -29,6 +35,7 @@ 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.context.ApplicationContext;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -36,15 +43,16 @@ import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
......@@ -101,7 +109,8 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.ExcelEnums;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.core.io.Resource;
/**
* @author tb
*/
......@@ -190,6 +199,11 @@ public class ExcelServiceImpl {
@Autowired
private IDataSyncService dataSyncService;
@Autowired
PrivilegeFeignClient privilegeFeignClient;
@Autowired
ApplicationContext applicationContext;
@Value("${logic}")
Boolean logic;
......@@ -205,6 +219,12 @@ public class ExcelServiceImpl {
private static final String JCDWRY="JCDWRY";
@Value("classpath:/json/userData.json")
private Resource areaRes;
public void templateExport(HttpServletResponse response, ExcelDto excelDto) throws ClassNotFoundException {
String url = excelDto.getClassUrl();
Class<?> clz = Class.forName(url);
......@@ -213,16 +233,6 @@ public class ExcelServiceImpl {
}
public void commonExport(HttpServletResponse response, ExcelDto excelDto, Map par) {
// ReginParams reginParams= getCurrentAllInfo();
// boolean authFalg= false;
// if(reginParams ==null) {
// authFalg=true;
// }
// String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
// if(org.apache.commons.lang3.StringUtils.isBlank(bizOrgCode)){
// authFalg=true;
// }
//效验参数
boolean authFlag = true;
if (!"QDSJ".equals(excelDto.getType())) {
......@@ -341,7 +351,6 @@ public class ExcelServiceImpl {
if(par!=null && par.size()>0) {
String date =par.containsKey("date")?par.get("date").toString():null;
// String bizOrgCode =par.containsKey("bizOrgCode")?par.get("bizOrgCode").toString():null;
String bizOrgName =par.containsKey("bizOrgName")?par.get("bizOrgName").toString():null;
String name =par.containsKey("name")?par.get("name").toString():null;
String type =par.containsKey("type")?par.get("type").toString():null;
......@@ -362,9 +371,7 @@ public class ExcelServiceImpl {
OrgUsr orgUsr1 = orgUsrMapper.queryByBizCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
fileName="【"+orgUsr1.getBizOrgName()+"】-【"+date+"】·消防人员出勤明细";
}
}
Page<SignDto> page = new Page<>();
page.setCurrent(1);
page.setSize(10000);
......@@ -476,8 +483,8 @@ public class ExcelServiceImpl {
}
}
@Transactional
public void commonUpload(MultipartFile multipartFile, ExcelDto excelDto,String uuidString) throws Exception {
public Object commonUpload(MultipartFile multipartFile, ExcelDto excelDto, String uuidString, HttpServletRequest equest) throws Exception {
switch (excelDto.getType()) {
case "WHP":
......@@ -514,13 +521,13 @@ public class ExcelServiceImpl {
excelImportKeySite(multipartFile);
break;
case JCDWRY:
case "DLDWRY":
excelImportOrgUsrExcelDtoNew(multipartFile);
break;
case "LDDW":
excelImportLinkageUnitZhDto(multipartFile);
break;
// BUG 2455 相关代码 bykongfm
case "TGRY":
excelImportLinkageUnitTGRYDto(multipartFile);
break;
......@@ -535,12 +542,14 @@ public class ExcelServiceImpl {
break;
case "JJZB":
excelImportDutyPerson(multipartFile, "JJZB",uuidString);
break;
break;
case "JCDWRYTP":
return excelImportOrgUsrTPExcelDtoNew(multipartFile,equest);
}
return;
return null;
}
private void excelImportLinkageUnitTGRYDto(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportLinkageUnitTGRYDto(MultipartFile multipartFile) throws Exception {
List<SpecialPositionStaffDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
SpecialPositionStaffDto.class, 1);
......@@ -578,8 +587,8 @@ public class ExcelServiceImpl {
}
}
}
private void excelImportLinkageUnitJYZBDto(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportLinkageUnitJYZBDto(MultipartFile multipartFile) throws Exception {
List<RescueEquipmentDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, RescueEquipmentDto.class,
1);
if (excelDtoList != null && excelDtoList.size() > 0) {
......@@ -616,8 +625,8 @@ public class ExcelServiceImpl {
}
}
private void excelImportLinkageUnitZhDto(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportLinkageUnitZhDto(MultipartFile multipartFile) throws Exception {
List<LinkageUnitDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, LinkageUnitDto.class, 1);
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String companyId = reginParams.getPersonIdentity().getCompanyId();
......@@ -778,8 +787,8 @@ public class ExcelServiceImpl {
}
}
private void excelImportOrgUsrExcelDtoNew(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportOrgUsrExcelDtoNew(MultipartFile multipartFile) throws Exception {
List<OrgUsrExcelDto> excelDtoList = new ArrayList<>();
if (!logic){
List<OrgUsrDlExcelDto> list = ExcelUtil.readFirstSheetExcel(multipartFile, OrgUsrDlExcelDto.class, 1);
......@@ -954,7 +963,380 @@ public class ExcelServiceImpl {
}
}
private void savePeopleItem(OrgUsrExcelDto item) {
//调用平台创建用户
private Map<String,Object> createUser(OrgUserVO agencyUser,List<StringBuilder> falseData,String appKey,String product,String token){
LinkedHashMap<String, Object> user=null;
try {
//同步平台
ResponseModel<Object> amosUser = privilegeFeignClient.create(
appKey,
product,
token,agencyUser);
if (!ObjectUtils.isEmpty(amosUser)) {
logger.info("添加用户结果"+(amosUser!=null?JSON.toJSONString(amosUser):""));
if(amosUser.getStatus()==200){
user = (LinkedHashMap<String, Object>) amosUser.getResult();
}else{
StringBuilder falsest=new StringBuilder();
falsest.append("用户:").append(agencyUser.getRealName()).append("同步平台失败,").append(amosUser.getMessage());
falseData.add(falsest);
}
}
}catch (Exception e){
e.printStackTrace();
}
return user;
}
//用户添加用户组
private List<Map<String, Object>> groupUser(Long group,String agencyUser,String appKey,String product,String token){
List<Map<String, Object>> user=null;
try {
//同步平台
List<String> li=new ArrayList<>();
li.add(agencyUser);
ResponseModel<Object> amosUser = privilegeFeignClient.groupUser(
appKey,
product,
token,
group,li);
logger.info("添加用户组结果"+(amosUser!=null?JSON.toJSONString(amosUser):""));
if (!ObjectUtils.isEmpty(amosUser)&&amosUser.getStatus()==200) {
user = (List<Map<String, Object>>) amosUser.getResult();
}
}catch (Exception e){
e.printStackTrace();
}
return user;
}
private boolean setcreateUser(OrgUsrTPDlExcelDto orgUsrExcelDto,List<StringBuilder> falseData,String appKey,String product,String token,List<UserVO> listUser,String companySeqs){
boolean flag=true;
try {
//创建平台用户
OrgUserVO user=new OrgUserVO();
//组装参数
Long group=null;
user.setCompanySeqs(companySeqs);
String[] split = orgUsrExcelDto.getDeptSeqs().split("@");
user.setDeptSeqs(split[1]);
user.setEmail(orgUsrExcelDto.getEmail());
user.setLockStatus("UNLOCK");
for (UserVO userVO : listUser) {
if(userVO.getType().equals(orgUsrExcelDto.getUserType())){
Map<String,List<String>> orgRoleSeqs=new HashMap<>();
orgRoleSeqs.put(split[1],userVO.getRoleSeqs());
user.setOrgRoleSeqs(orgRoleSeqs);
user.setAppCodes(userVO.getAppCodes());
user.setRoleSeqs(userVO.getRoleSeqs());
group=Long.valueOf(userVO.getGroup());
}
}
//密码效验加密,不能为空,并且必须相等
if(!orgUsrExcelDto.getPassword().isEmpty()){
user.setPassword(DesUtil.encode(orgUsrExcelDto.getPassword(), "qaz"));
user.setRePassword(DesUtil.encode(orgUsrExcelDto.getPassword(), "qaz"));
}else{
StringBuilder falsest=new StringBuilder();
falsest.append("用户:").append(orgUsrExcelDto.getBizOrgName()).append(",两次密码不能为空并且必须相等!");
falseData.add(falsest);
flag=false;
return flag;
}
user.setRealName(orgUsrExcelDto.getBizOrgName());
user.setUserName(orgUsrExcelDto.getUserName());
//平台创建用户
Map<String,Object> userModel=this.createUser(user, falseData,appKey,
product,
token);
if(userModel==null){
flag=false;
return flag;
}
//用户权限组分配
List<Map<String, Object>> groupUserModel = this.groupUser(group,userModel.get("userId").toString(),appKey,
product,
token);
if(groupUserModel==null){
StringBuilder falsest1=new StringBuilder();
falsest1.append("用户:").append(orgUsrExcelDto.getBizOrgName()).append(",分配用户组失败!");
falseData.add(falsest1);
flag=false;
return flag;
}
orgUsrExcelDto.setAmosOrgId(userModel.get("userId").toString());
orgUsrExcelDto.setAmosOrgCode(userModel.get("userName").toString());
}catch (Exception e){
StringBuilder falsest1=new StringBuilder();
falsest1.append("用户:").append(orgUsrExcelDto.getBizOrgName()).append(",请求接口异常失败!");
falseData.add(falsest1);
flag=false;
e.printStackTrace();
}
return flag;
}
private String excelImportOrgUsrTPExcelDtoNew(MultipartFile multipartFile,HttpServletRequest request) {
List<OrgUsrTPDlExcelDto> excelDtoList=null;
List<UserVO> mapList =null;
try {
//读取excel
excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, OrgUsrTPDlExcelDto.class, 1);
}catch (Exception e){
e.printStackTrace();
//捕获异常,记录失败
throw new BadRequest("解析异常!");
}
String key=UUID.randomUUID().toString();
String json = null;
try {
json = IOUtils.toString(areaRes.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
mapList = JSON.parseArray(json, UserVO.class);
//判断数据
if (ObjectUtils.isEmpty(excelDtoList)) {
throw new BadRequest("数据为空!");
}
ExcelServiceImpl bean=applicationContext.getBean(ExcelServiceImpl.class);
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String sequenceNbr = reginParams.getCompany().getSequenceNbr().toString();
//异步处理
String appKey = request.getHeader("appKey");
String product = request.getHeader("product");
String token = request.getHeader("token");
bean.syssaveuser(excelDtoList,appKey,
product,
token,key,mapList,sequenceNbr);
} catch (IOException e) {
e.printStackTrace();
throw new BadRequest("解析异常!");
}
return key;
}
//异步处理流程
@Async
public void syssaveuser(List<OrgUsrTPDlExcelDto> excelDtoList,String appKey,String product,String token,String key,List<UserVO> listUser,String sequenceNbr ){
Map<String,Object> map=new HashMap<String,Object>();
Set<String> set = new HashSet<>();
//成功数据标记
List<StringBuilder> trueData=new ArrayList<>();
//失败数据标记
List<StringBuilder> falseData=new ArrayList<>();
int num=0;
map.put("znum",excelDtoList.size());
for (OrgUsrTPDlExcelDto orgUsrExcelDto : excelDtoList) {
//成功日志
StringBuilder truest =new StringBuilder();
//失败日志
StringBuilder falsest =new StringBuilder();
//同步平台,绑定用户组
boolean fa= this.setcreateUser(orgUsrExcelDto,falseData,appKey,
product,
token,listUser,sequenceNbr);
if(!fa){
//失败跳过此条
num=num+1;
map.put("trueData",trueData);
map.put("falseData",falseData);
map.put("falsenum",falseData.size());
map.put("truenum",trueData.size());
map.put("num",num);
redisUtils.set(key,map,1200);
continue;
}
//业务用户添加
try {
//设置平台用户
this.saveuser(orgUsrExcelDto, set,appKey,
product,
token);
}catch (Exception e){
falsest.append("用户:").append(orgUsrExcelDto.getBizOrgName()).append(",添加机场单位人员失败!");
falseData.add(falsest);
e.printStackTrace();
}
truest.append("用户:").append(orgUsrExcelDto.getBizOrgName()).append(",添加成功!");
trueData.add(truest);
num=num+1;
map.put("trueData",trueData);
map.put("falseData",falseData);
map.put("falsenum",falseData.size());
map.put("truenum",trueData.size());
map.put("num",num);
redisUtils.set(key,map,1200);
logger.info("导入结果"+key+JSON.toJSONString(map));
};
}
//业务用户添加,保持原来逻辑不变
private void saveuser(OrgUsrTPDlExcelDto orgUsrExcelDto,Set<String> set,String appKey,String product,String token){
if (orgUsrExcelDto.getParentId() != null) {
String[] certificates = orgUsrExcelDto.getParentId().split("@");
orgUsrExcelDto.setParentName(certificates[0]);
orgUsrExcelDto.setParentId(certificates[1]);
}
// 动态字段填充
List<DynamicFormInitDto> dynamicFormColumn = dynamicFormColumnServiceImpl.getFormlist("246");
Map<String, Object> map = new HashMap<>();
// 获取对象属性和值
Field[] fields = orgUsrExcelDto.getClass().getDeclaredFields();
for (Field field : fields) {
try{
field.setAccessible(true);
Object value = field.get(orgUsrExcelDto);
String name = field.getName();
// 解析注解信息
ExplicitConstraint explicitConstraint = field.getAnnotation(ExplicitConstraint.class);
if (!ObjectUtils.isEmpty(explicitConstraint)) {
name = name + "@";
}
map.put(name, value);
} catch (Exception ex){
logger.error("获取{}字段值失败, {}", field.getName(), ex);
}
}
String s = JSON.toJSONString(orgUsrExcelDto);
Map<String,Object> map1 = JSON.parseObject(s, Map.class);
List<DynamicFormInstanceDto> dynamicFormValue = new ArrayList<>();
List<DynamicFormInstance> dynamicFormInstancelist = new ArrayList<>();
dynamicFormColumn.forEach(DynamicFormInitDto -> {
if ("birthdayTime".equals(DynamicFormInitDto.getKey())) {
DynamicFormInstanceDto formItemDescr = DynamicFormInitDto.getFormItemDescr();
formItemDescr.setFieldValue(null);
DynamicFormInitDto.setFormItemDescr(formItemDescr);
}
if (GENDER.equals(DynamicFormInitDto.getKey())){
DynamicFormInstanceDto formItemDescr = DynamicFormInitDto.getFormItemDescr();
formItemDescr.setFieldValue(null);
DynamicFormInitDto.setFormItemDescr(formItemDescr);
}
dynamicFormValue.add(DynamicFormInitDto.getFormItemDescr());
});
dynamicFormValue.forEach(dynamicFormInstanceDto -> {
String key = dynamicFormInstanceDto.getFieldCode();
if (map1.containsKey(key) && !ObjectUtils.isEmpty(map1.get(key))){
String value = map1.get(key).toString();
if (value.contains("@")) {
String[] certificates = value.split("@");
dynamicFormInstanceDto.setFieldValue(certificates[1]);
dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
} else {
dynamicFormInstanceDto.setFieldValue(value);
}
}
if (map.containsKey(key) && map.get(key) != null&&("birthdayTime".equals(key) || "holdingTime".equals(key) )){
Date o = (Date) map.get(key);
SimpleDateFormat dtf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String format = dtf.format(o);
try {
dynamicFormInstanceDto.setFieldValue(format);
} catch (Exception e) {
logger.error("日期转换失败");
throw new BadRequest("出生日期格式不对!");
}
}
DynamicFormInstance dynamicFormInstance = new DynamicFormInstance();
BeanUtils.copyProperties(dynamicFormInstanceDto, dynamicFormInstance);
String fieldCode = dynamicFormInstance.getFieldCode();
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())){
dynamicFormInstance.setFieldValueLabel("346".equals(String.valueOf(dynamicFormInstance.getFieldValue()))?"男":"女");
}
if ("positionType".equals(dynamicFormInstance.getFieldCode()) && !ObjectUtils.isEmpty(dynamicFormInstance.getFieldValue())){
dynamicFormInstance.setFieldValueLabel(dataDictionaryService.getById(dynamicFormInstance.getFieldValue()).getName());
}
if ("certificatesTypeCode".equals(fieldCode) && !ObjectUtils.isEmpty(map1.get(fieldCode))){
String[] split = map1.get(fieldCode).toString().split("@");
dynamicFormInstance.setFieldValue(split[1]);
dynamicFormInstance.setFieldValueLabel(split[0]);}
if ("residenceDetailsCode".equals(fieldCode) && map1.get("residenceDetails") != null) {
String[] residenceDetails = map1.get("residenceDetails").toString().split("@");
dynamicFormInstance.setFieldValue(residenceDetails[1]);
dynamicFormInstance.setFieldValueLabel(residenceDetails[0]);
}
if ("nativePlaceCode".equals(fieldCode)&& map1.get("nativePlace") != null){
String[] split = map1.get("nativePlace").toString().split("@");
dynamicFormInstance.setFieldValue(split[1]);
dynamicFormInstance.setFieldValueLabel(split[0]);}
dynamicFormInstancelist.add(dynamicFormInstance);
});
orgUsrExcelDto.setDynamicFormValue(dynamicFormInstancelist);
Bean.toPo(getCurrentInfoNew( appKey, product, token), orgUsrExcelDto);
// 保存动态表单和人员单位表
if (!ObjectUtils.isEmpty(orgUsrExcelDto.getCertificatesTypeCode())){
String[] split55 = orgUsrExcelDto.getCertificatesTypeCode().toString().split("@");
if (!ObjectUtils.isEmpty(orgUsrExcelDto.getCertificatesNumber())&&split55[1].equals("120")) {
if (!set.add(orgUsrExcelDto.getCertificatesNumber())) {
throw new BadRequest("身份证号码重复!");
} else {
boolean b = orgUsrService.checkCertificatesNumber(orgUsrExcelDto.getCertificatesNumber(), null);
if (b) {
throw new BadRequest("身份证号码重复!");
}
}
}
}
try {
OrgUsrExcelDto orgUsrnew = new OrgUsrExcelDto();
BeanUtils.copyProperties(orgUsrExcelDto, orgUsrnew);
OrgUsrDto orgUsrDto = orgUsrService.saveOrgPersonExcel(orgUsrnew);
if (!ObjectUtils.isEmpty(orgUsrDto)) {
// 保存其余项
orgUsrnew.setOrgUsrId(orgUsrDto.getSequenceNbr().toString());
savePeopleItem(orgUsrnew);
// 巡检站端与中心级数据同步
// 事物提交后业务逻辑
dataSyncService.OrgUsrSyncDtoDataSync(orgUsrDto.getSequenceNbr());
}
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("导入失败!");
}
}
private void savePeopleItem(OrgUsrExcelDto item) {
FirefightersContacts firefightersContacts = new FirefightersContacts();
// 手动添加主键,以便于给岗位、职位等实体赋值id
Long sequenceId = null;
......@@ -1113,8 +1495,8 @@ public class ExcelServiceImpl {
}
private void excelImportFirefighters(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportFirefighters(MultipartFile multipartFile) throws Exception {
List<FirefightersExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
FirefightersExcelDto.class, 1);
excelDtoList.forEach(item -> {
......@@ -1239,8 +1621,8 @@ public class ExcelServiceImpl {
firefightersService.saveFirefighters(firefightersInfo);
});
}
private void excelImportFireStation(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportFireStation(MultipartFile multipartFile) throws Exception {
List<FireStationDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireStationDto.class, 1);
Map<String, String> maps = getAllBuildingIdForParentBuilingIds(excelDtoList);
......@@ -1288,7 +1670,8 @@ public class ExcelServiceImpl {
}
return keySiteService.getNodeAllParentIds(list);
}
private void excelImportFireTeam(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportFireTeam(MultipartFile multipartFile) throws Exception {
List<FireTeamDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireTeamDto.class, 1);
List<FireTeam> excelEntityList = new ArrayList<>();
......@@ -1333,8 +1716,8 @@ public class ExcelServiceImpl {
});
fireTeamService.saveBatch(excelEntityList);
}
private void excelImportAircraft(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportAircraft(MultipartFile multipartFile) throws Exception {
List<AircraftDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, AircraftDto.class, 1);
List<Aircraft> excelEntityList = new ArrayList<>();
excelDtoList.forEach(item -> {
......@@ -1355,8 +1738,8 @@ public class ExcelServiceImpl {
});
aircraftServiceImpl.saveBatch(excelEntityList);
}
private void excelImportFireChemical(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportFireChemical(MultipartFile multipartFile) throws Exception {
List<FireChemicalDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireChemicalDto.class, 1);
List<FireChemical> excelEntityList = new ArrayList<>();
excelDtoList.forEach(item -> {
......@@ -1372,8 +1755,8 @@ public class ExcelServiceImpl {
});
fireChemicalServiceImpl.saveBatch(excelEntityList);
}
private void excelImportWaterResource(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportWaterResource(MultipartFile multipartFile) throws Exception {
List<WaterResourceDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, WaterResourceDto.class, 1);
excelDtoList.forEach(item -> {
......@@ -1508,9 +1891,9 @@ public class ExcelServiceImpl {
waterResourceServiceImpl.importByExcel(item);
});
}
private void excelImportFireExperts(MultipartFile multipartFile) throws Exception {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
@Transactional
public void excelImportFireExperts(MultipartFile multipartFile) throws Exception {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String companyId = reginParams.getPersonIdentity().getCompanyId();
String bizOrgCode = "1";
String bizOrgName = "1";
......@@ -1562,7 +1945,7 @@ public class ExcelServiceImpl {
});
fireExpertsServiceImpl.saveBatch(excelEntityList);
}
@Async
@Transactional
public void excelImportDutyPerson(MultipartFile multipartFile, String dutyType,String uuidString) {
try {
ImportDutyPerson(multipartFile,dutyType);
......@@ -1666,8 +2049,8 @@ public class ExcelServiceImpl {
}
}
private void excelImportSafeReport(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportSafeReport(MultipartFile multipartFile) throws Exception {
String fileName = multipartFile.getOriginalFilename();
if (fileName == null) {
......@@ -1871,8 +2254,8 @@ public class ExcelServiceImpl {
dataList.add(dutyPersonDtoMap);
}
}
private void excelImportMaintenancePerson(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportMaintenancePerson(MultipartFile multipartFile) throws Exception {
List<MaintenancePersonExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
MaintenancePersonExcleDto.class, 1);
List<DynamicFormColumn> columns = dynamicFormColumnService.list(
......@@ -1904,8 +2287,8 @@ public class ExcelServiceImpl {
}
maintenanceCompanyService.saveMaintenanceCompanyBatch(maintenanceCompanyList, dynamicFormInstanceList);
}
private void excelImportKeySite(MultipartFile multipartFile) throws Exception {
@Transactional
public void excelImportKeySite(MultipartFile multipartFile) throws Exception {
List<KeySiteExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, KeySiteExcleDto.class, 1);
keySiteService.saveExcel(excelDtoList);
}
......@@ -2242,6 +2625,25 @@ public class ExcelServiceImpl {
@Autowired
private RedisUtils redisUtils;
public BaseEntity getCurrentInfoNew(String appKey,String product,String token) {
BaseEntity userModel = new BaseEntity();
RequestContext.setToken(token);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme();
AgencyUserModel userModel1 = agencyUserModel.getResult();
String keyString = userModel1.getUserId();
ReginParams params = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(keyString, token)).toString(),
ReginParams.class);
userModel.setRecUserId(params.getUserModel().getUserId());
userModel.setRecUserName(params.getUserModel().getRealName());
userModel.setRecDate(new Date());
return userModel;
}
public BaseEntity getCurrentInfo() {
BaseEntity userModel = new BaseEntity();
FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme();
......@@ -2264,7 +2666,7 @@ public class ExcelServiceImpl {
ReginParams.class);
}
public boolean getFlag(Map par){
public boolean getFlag(Map<String,Object> par){
ReginParams reginParams= getCurrentAllInfo();
boolean authFalg= false;
......
......@@ -3904,7 +3904,7 @@
<select id="selectAlarmList" resultType="java.util.Map">
select
a1.*,
(a1.num - a1.alarm_equip_num) as normalEquipNum,
ABS(a1.num - a1.alarm_equip_num) as normalEquipNum,
concat(FORMAT( (abs( ( (a1.num - a1.alarm_equip_num) / IF ( a1.num = 0, 1, a1.num ) ) ) * 100
),2), '%') as normalEquipPercent,
......
## DB properties:
spring.datasource.url=jdbc:mysql://172.16.10.215:3306/dl_amos_common_biz?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.url=jdbc:mysql://172.16.11.201:3306/dl_amos_common_biz?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
## eureka properties:
eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@172.16.10.215:10001/eureka/
eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@172.16.11.201:10001/eureka/
spring.security.user.name=admin
spring.security.user.password=a1234560
## redis properties:danger/list
spring.redis.database=1
spring.redis.host=172.16.10.215
spring.redis.host=172.16.11.201
spring.redis.port=6379
spring.redis.password=yeejoin@2020
## ES properties:
biz.elasticsearch.address=172.16.10.215
biz.elasticsearch.address=172.16.11.201
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
......@@ -28,7 +28,7 @@ elasticsearch.password= Yeejoin@2020
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.215:1883
emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin
emqx.password=public
......@@ -42,9 +42,13 @@ rule.definition.default-agency=jcs
#spring.data.mongodb.uri=mongodb://172.16.6.60:27017/command_db
## file properties:
file.url=http://39.98.45.134:9000/
file.url=http://172.16.11.201:9000/
video.url=https://11.11.16.4:443/
ifc.url=http://11.11.16.17/IFCInterface
ifc.call-back.localIp=11.11.16.1
#ƽ̨Ӧ
privilege.fegin.name=AMOS-API-PRIVILEGE
feign.client.config.default.connect-timeout=20000
feign.client.config.default.read-timeout=20000
\ No newline at end of file
[
{
"type": "管理员",
"group": "1476527581793099777",
"roleSeqs": [
"1242292537276882946",
"1262313307763683330",
"1262313395743404033",
"1232939411144667138"
],
"appCodes": [
"studio_normalapp_3056965",
"studio_normalapp_3532826",
"studio_normalapp_3143547",
"AMOS_STUDIO",
"AMOS_ADMIN"
]
},
{
"type": "非管理员",
"group": "1476527581793099777",
"roleSeqs": [
"1242292537276882946",
"1262313307763683330",
"1262313395743404033",
"1232939411144667138"
],
"appCodes": [
"studio_normalapp_3056965",
"studio_normalapp_3532826",
"studio_normalapp_3143547",
"AMOS_STUDIO",
"AMOS_ADMIN"
]
}
]
\ No newline at end of file
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