Commit df0f86f1 authored by 韩桐桐's avatar 韩桐桐

导出功能能:个人

parent 855dc7c6
package com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.module.jg.api.annotation.DictCode2DictName;
import lombok.Data;
import java.util.Date;
/**
* 人员列表
*/
@Data
public class UserInfoVo {
@ExcelProperty("姓名")
private String name;
@ExcelProperty("证件类型")
@DictCode2DictName(type = "ZJLX", typeHandler = "cbDataDictTypeHandler")
private String certificateType;
@ExcelProperty("证件编号")
private String certificateNum;
@ExcelProperty("性别")
private String gender;
@ExcelProperty("岗位名称")
private String postName;
@ExcelProperty(value = "岗位子类型名称")
private String subPostName;
@ExcelProperty("联系电话")
private String phone;
@ExcelProperty("出生日期")
private Date birthday;
@ExcelProperty("学历")
@DictCode2DictName(type = "QYRYXL", typeHandler = "cbDataDictTypeHandler")
private String education;
@ExcelProperty("专业")
private String speciality;
@ExcelProperty("邮箱")
private String email;
@ExcelProperty("住址")
private String address;
@ExcelProperty(value = "执业注册")
private String practiceRegistration;
@ExcelProperty("平台账户名")
private String amosUserName;
@ExcelProperty("单位名称")
private String unitName;
@ExcelProperty("企业编码")
private String unitCode;
@ExcelProperty("平台账号id")
private String amosUserId;
@ExcelProperty("平台账号锁定状态")
private String lockStatus;
@ExcelProperty(value = "检验检测-资质数据")
private String permissionData;
@ExcelProperty(value = "职称")
private String jobTitle;
@ExcelProperty(value = "人员是否转出")
protected String transferOut;
@ExcelProperty(value = "人员转出时间")
protected Date transferOutTime;
@ExcelProperty("检验检测-级别")
private String permissionLevel;
@ExcelProperty("检验检测-资质项目")
private String permissionItem;
@ExcelProperty("证书编号")
private String certNo;
@ExcelProperty("有效期至")
private Date expiryDate;
@ExcelProperty("发证机关")
private String approvedOrgan;
@ExcelProperty("发证日期")
private Date issueDate;
@ExcelProperty("证书类型")
private String certType;
@ExcelProperty("作业项目")
private String jobItem;
@ExcelProperty("其他作业项目")
private String otherItem;
@ExcelProperty("备注")
private String remark;
}
...@@ -14,10 +14,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -14,10 +14,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
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.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -27,6 +24,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -27,6 +24,7 @@ import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.UUID;
/** /**
* JG表格数据导出 * JG表格数据导出
...@@ -58,10 +56,12 @@ public class JgTableDataExportController extends BaseController { ...@@ -58,10 +56,12 @@ public class JgTableDataExportController extends BaseController {
public ResponseModel<String> certificateExport(JgUseRegistrationManageDto dto, public ResponseModel<String> certificateExport(JgUseRegistrationManageDto dto,
@RequestParam(value = "ids", required = false) String ids, @RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "sort", required = false) String sort) { @RequestParam(value = "sort", required = false) String sort) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> { new Thread(() -> {
contextWrapper.apply(); contextWrapper.apply();
iJgTableDataExportService.certificate(getSelectedOrgInfo(), dto, ids == null ? new ArrayList<>() : Arrays.asList(ids.split(",")), sort); iJgTableDataExportService.certificate(uuid, getSelectedOrgInfo(), dto, ids == null ? new ArrayList<>() : Arrays.asList(ids.split(",")), sort);
}).start(); }).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!"); return ResponseHelper.buildResponse("后台处理中,请注意下载!");
} }
...@@ -196,9 +196,11 @@ public class JgTableDataExportController extends BaseController { ...@@ -196,9 +196,11 @@ public class JgTableDataExportController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "未纳管设备列表数据导出", notes = "未纳管设备列表数据导出") @ApiOperation(httpMethod = "GET", value = "未纳管设备列表数据导出", notes = "未纳管设备列表数据导出")
public ResponseModel<String> unregulatedEquipExport(@RequestParam Map<String, Object> map) { public ResponseModel<String> unregulatedEquipExport(@RequestParam Map<String, Object> map) {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
new Thread(() -> { new Thread(() -> {
contextWrapper.apply(); contextWrapper.apply();
iJgTableDataExportService.unregulatedEquip(getSelectedOrgInfo(), map); iJgTableDataExportService.unregulatedEquip(uuid, getSelectedOrgInfo(), map);
}).start(); }).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!"); return ResponseHelper.buildResponse("后台处理中,请注意下载!");
} }
...@@ -207,10 +209,12 @@ public class JgTableDataExportController extends BaseController { ...@@ -207,10 +209,12 @@ public class JgTableDataExportController extends BaseController {
@GetMapping(value = "/manageEquipment") @GetMapping(value = "/manageEquipment")
@ApiOperation(httpMethod = "GET", value = "已纳管设备列表数据导出", notes = "已纳管设备列表数据导出") @ApiOperation(httpMethod = "GET", value = "已纳管设备列表数据导出", notes = "已纳管设备列表数据导出")
public ResponseModel<String> manageEquipmentExport(@RequestParam Map<String, Object> map) { public ResponseModel<String> manageEquipmentExport(@RequestParam Map<String, Object> map) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> { new Thread(() -> {
contextWrapper.apply(); contextWrapper.apply();
iJgTableDataExportService.manageEquipment(getSelectedOrgInfo(), map); iJgTableDataExportService.manageEquipment(uuid, getSelectedOrgInfo(), map);
}).start(); }).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!"); return ResponseHelper.buildResponse("后台处理中,请注意下载!");
} }
...@@ -228,10 +232,12 @@ public class JgTableDataExportController extends BaseController { ...@@ -228,10 +232,12 @@ public class JgTableDataExportController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "未纳管压力管道列表数据导出", notes = "未纳管压力管道列表数据导出") @ApiOperation(httpMethod = "GET", value = "未纳管压力管道列表数据导出", notes = "未纳管压力管道列表数据导出")
public ResponseModel<String> unregulatedPipe(@RequestParam Map<String, String> params, public ResponseModel<String> unregulatedPipe(@RequestParam Map<String, String> params,
@RequestParam(value = "sort", required = false) String sort) { @RequestParam(value = "sort", required = false) String sort) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> { new Thread(() -> {
contextWrapper.apply(); contextWrapper.apply();
iJgTableDataExportService.unregulatedPipe(params, sort, getSelectedOrgInfo()); iJgTableDataExportService.unregulatedPipe(uuid, params, sort, getSelectedOrgInfo());
}).start(); }).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!"); return ResponseHelper.buildResponse("后台处理中,请注意下载!");
} }
...@@ -241,10 +247,12 @@ public class JgTableDataExportController extends BaseController { ...@@ -241,10 +247,12 @@ public class JgTableDataExportController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "已纳管压力管道列表数据导出", notes = "已纳管压力管道列表数据导出") @ApiOperation(httpMethod = "GET", value = "已纳管压力管道列表数据导出", notes = "已纳管压力管道列表数据导出")
public ResponseModel<String> managePipe(@RequestParam Map<String, String> params, public ResponseModel<String> managePipe(@RequestParam Map<String, String> params,
@RequestParam(value = "sort", required = false) String sort) { @RequestParam(value = "sort", required = false) String sort) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> { new Thread(() -> {
contextWrapper.apply(); contextWrapper.apply();
iJgTableDataExportService.managePipe(params, sort, getSelectedOrgInfo()); iJgTableDataExportService.managePipe(uuid, params, sort, getSelectedOrgInfo());
}).start(); }).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!"); return ResponseHelper.buildResponse("后台处理中,请注意下载!");
} }
...@@ -253,10 +261,43 @@ public class JgTableDataExportController extends BaseController { ...@@ -253,10 +261,43 @@ public class JgTableDataExportController extends BaseController {
@GetMapping(value = "/enterpriseInformationExport") @GetMapping(value = "/enterpriseInformationExport")
@ApiOperation(httpMethod = "GET", value = "基础设置-企业信息列表数据导出", notes = "基础设置-企业信息列表数据导出") @ApiOperation(httpMethod = "GET", value = "基础设置-企业信息列表数据导出", notes = "基础设置-企业信息列表数据导出")
public ResponseModel<String> managePipe(String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto) { public ResponseModel<String> managePipe(String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> { new Thread(() -> {
contextWrapper.apply(); contextWrapper.apply();
iJgTableDataExportService.enterpriseInformationExport(ids, tzBaseEnterpriseInfoDto, getSelectedOrgInfo()); iJgTableDataExportService.enterpriseInformationExport(uuid, ids, tzBaseEnterpriseInfoDto, getSelectedOrgInfo());
}).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!");
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/userInfoExport")
@ApiOperation(httpMethod = "GET", value = "基础设置-企业-人员信息列表数据导出", notes = "基础设置-企业-人员信息列表数据导出")
public ResponseModel<String> userInfoExport(@RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "sort", required = false) String sort,
@RequestParam Map<String, String> map) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> {
contextWrapper.apply();
iJgTableDataExportService.userInfoExport(uuid, ids, map, getSelectedOrgInfo());
}).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!");
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/userInfoExportWithAdmin")
@ApiOperation(httpMethod = "POST", value = "基础设置-监管单位-人员信息列表数据导出", notes = "基础设置-监管单位-人员信息列表数据导出")
public ResponseModel<String> userInfoExportWithAdmin(@RequestParam(value = "ids", required = false) String ids,
@RequestBody Map<String,String> map) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> {
contextWrapper.apply();
iJgTableDataExportService.userInfoExportWithAdmin(uuid, ids, map, getSelectedOrgInfo());
}).start(); }).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!"); return ResponseHelper.buildResponse("后台处理中,请注意下载!");
} }
......
package com.yeejoin.amos.boot.module.jg.biz.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
@FeignClient(name = "TZS-COMMON", path = "/tcm", configuration = {FeignConfiguration.class})
public interface TcmServiceFeignClient {
/**
* 人员信息列表分页查询
*/
@RequestMapping(value = "/userInfo/page", method = RequestMethod.GET)
ResponseModel<Page<Map<String, String>>> page(@RequestParam(value = "current") String current,
@RequestParam(value = "size") String size,
@RequestParam(value = "sort", required = false) String sort,
@RequestParam Map<String, String> dto);
@RequestMapping(value = "/userInfo/permission-page", method = RequestMethod.POST)
ResponseModel<Page<Map<String, String>>> getUserByPermission(@RequestParam(value = "current") long current,
@RequestParam(value = "size") long size,
@RequestParam(value = "sort", required = false) String sort,
@RequestParam(required = false, defaultValue = "all") String type,
@RequestBody Map<String, String> map);
}
...@@ -15,9 +15,11 @@ import java.util.Map; ...@@ -15,9 +15,11 @@ import java.util.Map;
*/ */
public interface IJgTableDataExportService { public interface IJgTableDataExportService {
void startDownLoadMsg(ReginParams reginParams, String uuid);
void gen(String jsonName, String voName, String tableName); void gen(String jsonName, String voName, String tableName);
void certificate(ReginParams reginParams, JgUseRegistrationManageDto dto, List<String> ids, String sort); void certificate(String uuid, ReginParams reginParams, JgUseRegistrationManageDto dto, List<String> ids, String sort);
void maintenance(HttpServletResponse response, List<String> ids); void maintenance(HttpServletResponse response, List<String> ids);
...@@ -47,15 +49,19 @@ public interface IJgTableDataExportService { ...@@ -47,15 +49,19 @@ public interface IJgTableDataExportService {
void changeVehicleRegistrationUnit(HttpServletResponse response, List<String> ids); void changeVehicleRegistrationUnit(HttpServletResponse response, List<String> ids);
void unregulatedEquip(ReginParams reginParams, Map<String, Object> map); void unregulatedEquip(String uuid, ReginParams reginParams, Map<String, Object> map);
void manageEquipment(ReginParams reginParams, Map<String, Object> map); void manageEquipment(String uuid, ReginParams reginParams, Map<String, Object> map);
void equipTransfer(HttpServletResponse response, List<String> ids); void equipTransfer(HttpServletResponse response, List<String> ids);
void managePipe(Map<String, String> params, String sort, ReginParams reginParams); void managePipe(String uuid, Map<String, String> params, String sort, ReginParams reginParams);
void unregulatedPipe(String uuid, Map<String, String> params, String sort, ReginParams reginParams);
void enterpriseInformationExport(String uuid, String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto, ReginParams reginParams);
void unregulatedPipe(Map<String, String> params, String sort, ReginParams reginParams); void userInfoExport(String uuid, String ids, Map<String, String> map, ReginParams reginParams);
void enterpriseInformationExport(String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto, ReginParams reginParams); void userInfoExportWithAdmin(String uuid, String ids, Map<String, String> map, ReginParams reginParams);
} }
...@@ -19,11 +19,13 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.*; ...@@ -19,11 +19,13 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.*; import com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.*;
import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.CbDataDictTypeHandler; import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.CbDataDictTypeHandler;
import com.yeejoin.amos.boot.module.jg.biz.feign.JczsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.JczsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.feign.TcmServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.IJgTableDataExportService; import com.yeejoin.amos.boot.module.jg.biz.service.IJgTableDataExportService;
import com.yeejoin.amos.boot.module.jg.biz.utils.DictUtil; import com.yeejoin.amos.boot.module.jg.biz.utils.DictUtil;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto; import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
...@@ -100,9 +102,14 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -100,9 +102,14 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
@Autowired @Autowired
JczsServiceFeignClient jczsServiceFeignClient; JczsServiceFeignClient jczsServiceFeignClient;
@Autowired @Autowired
TcmServiceFeignClient tcmServiceFeignClient;
@Autowired
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper; private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
@Autowired @Autowired
private TzsUserInfoMapper tzsUserInfoMapper;
@Autowired
private CbDataDictTypeHandler cbDataDictTypeHandler; private CbDataDictTypeHandler cbDataDictTypeHandler;
private final String DOWN_LOAD_START_TEMP = "{\"id\":\"%s\",\"status\":\"starting\"}";
private final String BUCKET_NAME = "upload"; private final String BUCKET_NAME = "upload";
private final String UPLOAD_PATH = "/tzs/excelTempFile"; private final String UPLOAD_PATH = "/tzs/excelTempFile";
private final int PAGE_SIZE = 100; private final int PAGE_SIZE = 100;
...@@ -197,8 +204,23 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -197,8 +204,23 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
} }
/** /**
* 发送主题消息,给企业推送excel下载提醒 * 开始下载 发送消息
*
* @param reginParams
* @param uuid
*/
public void startDownLoadMsg(ReginParams reginParams, String uuid) {
try {
emqKeeper.getMqttClient().publish(String.format(DOWNLOAD_TOPIC, reginParams.getUserModel().getUserId()), String.format(DOWN_LOAD_START_TEMP, uuid).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (Exception e) {
log.error(e.getMessage());
}
}
/**
* 发送主题消息,给企业推送excel 结束下载提醒
* *
* @param topic 主体格式为: /download/excel/${userId} * @param topic 主体格式为: /download/excel/${userId}
* @param jsonObject 文件名称 + excel文件路径(minio) * @param jsonObject 文件名称 + excel文件路径(minio)
...@@ -233,7 +255,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -233,7 +255,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* 登记证列表数据导出 * 登记证列表数据导出
*/ */
@Override @Override
public void certificate(ReginParams reginParams, JgUseRegistrationManageDto dto, List<String> ids, String sort) { public void certificate(String uuid, ReginParams reginParams, JgUseRegistrationManageDto dto, List<String> ids, String sort) {
AgencyUserModel userModel = reginParams.getUserModel(); AgencyUserModel userModel = reginParams.getUserModel();
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
...@@ -292,6 +314,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -292,6 +314,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
String urlString = this.uploadExcelFile(templateExcelFile); String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject() this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "使用登记证列表数据") .fluentPut("fileName", "使用登记证列表数据")
.fluentPut("url", urlString) .fluentPut("url", urlString)
.fluentPut("time", new Date().getTime())); .fluentPut("time", new Date().getTime()));
...@@ -499,7 +523,6 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -499,7 +523,6 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
} }
/** /**
* 车气登记列表数据导出 * 车气登记列表数据导出
* *
...@@ -530,7 +553,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -530,7 +553,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* 未纳管设备列表数据导出 * 未纳管设备列表数据导出
*/ */
@Override @Override
public void unregulatedEquip(ReginParams reginParams, Map<String, Object> map) { public void unregulatedEquip(String uuid, ReginParams reginParams, Map<String, Object> map) {
AgencyUserModel userModel = reginParams.getUserModel(); AgencyUserModel userModel = reginParams.getUserModel();
...@@ -543,6 +566,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -543,6 +566,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
String urlString = this.uploadExcelFile(templateExcelFile); String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject() this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "未纳管设备列表数据") .fluentPut("fileName", "未纳管设备列表数据")
.fluentPut("url", urlString) .fluentPut("url", urlString)
.fluentPut("time", new Date().getTime())); .fluentPut("time", new Date().getTime()));
...@@ -607,7 +632,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -607,7 +632,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* 已纳管设备列表数据导出 * 已纳管设备列表数据导出
*/ */
@Override @Override
public void manageEquipment(ReginParams reginParams, Map<String, Object> map) { public void manageEquipment(String uuid, ReginParams reginParams, Map<String, Object> map) {
AgencyUserModel userModel = reginParams.getUserModel(); AgencyUserModel userModel = reginParams.getUserModel();
List<String> ids = getEquRecords(map); List<String> ids = getEquRecords(map);
// 查询数据 // 查询数据
...@@ -618,6 +643,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -618,6 +643,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
String urlString = this.uploadExcelFile(templateExcelFile); String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject() this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "已纳管设备列表数据") .fluentPut("fileName", "已纳管设备列表数据")
.fluentPut("url", urlString) .fluentPut("url", urlString)
.fluentPut("time", new Date().getTime())); .fluentPut("time", new Date().getTime()));
...@@ -697,7 +724,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -697,7 +724,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* @param reginParams * @param reginParams
*/ */
@Override @Override
public void managePipe(Map<String, String> params, String sort, ReginParams reginParams) { public void managePipe(String uuid, Map<String, String> params, String sort, ReginParams reginParams) {
AgencyUserModel userModel = reginParams.getUserModel(); AgencyUserModel userModel = reginParams.getUserModel();
List<String> proConSeqs = getProConSeqs(params, sort, reginParams); List<String> proConSeqs = getProConSeqs(params, sort, reginParams);
List<JSONObject> jsonObjects = idxBizJgRegisterInfoService.queryPipeEquipInIds(proConSeqs); List<JSONObject> jsonObjects = idxBizJgRegisterInfoService.queryPipeEquipInIds(proConSeqs);
...@@ -707,6 +734,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -707,6 +734,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
String urlString = this.uploadExcelFile(templateExcelFile); String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject() this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "已纳管压力管道列表") .fluentPut("fileName", "已纳管压力管道列表")
.fluentPut("url", urlString) .fluentPut("url", urlString)
.fluentPut("time", new Date().getTime())); .fluentPut("time", new Date().getTime()));
...@@ -720,7 +749,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -720,7 +749,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* @param reginParams * @param reginParams
*/ */
@Override @Override
public void unregulatedPipe(Map<String, String> params, String sort, ReginParams reginParams) { public void unregulatedPipe(String uuid, Map<String, String> params, String sort, ReginParams reginParams) {
AgencyUserModel userModel = reginParams.getUserModel(); AgencyUserModel userModel = reginParams.getUserModel();
List<String> proConSeqs = getProConSeqs(params, sort, reginParams); List<String> proConSeqs = getProConSeqs(params, sort, reginParams);
List<JSONObject> jsonObjects = idxBizJgRegisterInfoService.queryPipeEquipInIds(proConSeqs); List<JSONObject> jsonObjects = idxBizJgRegisterInfoService.queryPipeEquipInIds(proConSeqs);
...@@ -730,6 +759,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -730,6 +759,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
String urlString = this.uploadExcelFile(templateExcelFile); String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject() this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "未纳管压力管道列表") .fluentPut("fileName", "未纳管压力管道列表")
.fluentPut("url", urlString) .fluentPut("url", urlString)
.fluentPut("time", new Date().getTime())); .fluentPut("time", new Date().getTime()));
...@@ -783,7 +814,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -783,7 +814,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* @param reginParams * @param reginParams
*/ */
@Override @Override
public void enterpriseInformationExport(String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto, ReginParams reginParams) { public void enterpriseInformationExport(String uuid, String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto, ReginParams reginParams) {
AgencyUserModel userModel = reginParams.getUserModel(); AgencyUserModel userModel = reginParams.getUserModel();
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
List<String> enterSeqs = getEnterSeqs(ids, tzBaseEnterpriseInfoDto, reginParams); List<String> enterSeqs = getEnterSeqs(ids, tzBaseEnterpriseInfoDto, reginParams);
...@@ -793,9 +824,10 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -793,9 +824,10 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
String categoryJson = item.getEquipCategory(); String categoryJson = item.getEquipCategory();
if (categoryJson != null && !categoryJson.isEmpty()) { if (categoryJson != null && !categoryJson.isEmpty()) {
try { try {
List<String> codes = objectMapper.readValue(categoryJson, new TypeReference<List<String>>() {}); List<String> codes = objectMapper.readValue(categoryJson, new TypeReference<List<String>>() {
});
List<String> names = codes.stream() List<String> names = codes.stream()
.map(x -> cbDataDictTypeHandler.handle("BJSBZL",x)) .map(x -> cbDataDictTypeHandler.handle("BJSBZL", x))
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toList());
item.setEquipCategory(String.join("、", names)); item.setEquipCategory(String.join("、", names));
...@@ -807,8 +839,91 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -807,8 +839,91 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
MultipartFile templateExcelFile = ExcelUtil.createTemplateExcelFile("企业信息列表数据", "企业信息列表列表", exportData, BaseEnterpriseVo.class, null, false); MultipartFile templateExcelFile = ExcelUtil.createTemplateExcelFile("企业信息列表数据", "企业信息列表列表", exportData, BaseEnterpriseVo.class, null, false);
String urlString = this.uploadExcelFile(templateExcelFile); String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject() this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "企业信息列表") .fluentPut("fileName", "企业信息列表")
.fluentPut("url", urlString) .fluentPut("url", urlString)
.fluentPut("time", new Date().getTime())); .fluentPut("time", new Date().getTime()));
} }
private List<String> getUserInfoSeqs(boolean isAdmin, String ids, Map<String, String> map, ReginParams reginParams) {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
List<String> idsList = new ArrayList<>();
if (StringUtils.isEmpty(ids)) {
ResponseModel<Page<Map<String, String>>> page = isAdmin ? tcmServiceFeignClient.getUserByPermission(1, PAGE_SIZE, null, "all", map) :
tcmServiceFeignClient.page("1", String.valueOf(PAGE_SIZE), null, map);
Page<Map<String, String>> pageResult = page.getResult();
int totalPage = (int) Math.ceil((double) pageResult.getTotal() / PAGE_SIZE);
List<CompletableFuture<List<String>>> futures = new ArrayList<>();
List<String> idsCollected = pageResult.getRecords().stream()
.map(item -> item.getOrDefault("sequenceNbr", null))
.filter(Objects::nonNull)
.map(String::valueOf)
.collect(Collectors.toList());
for (int i = 2; i <= totalPage; i++) {
int pageIndex = i;
CompletableFuture<List<String>> future = CompletableFuture.supplyAsync(() -> {
contextWrapper.apply();
ResponseModel<Page<Map<String, String>>> page1 = isAdmin ? tcmServiceFeignClient.getUserByPermission(pageIndex, PAGE_SIZE, null, "all", map) :
tcmServiceFeignClient.page(String.valueOf(pageIndex), String.valueOf(PAGE_SIZE), null, map);
Page<Map<String, String>> resultPage = page1.getResult();
return resultPage.getRecords().stream()
.map(item -> item.getOrDefault("sequenceNbr", null))
.filter(Objects::nonNull)
.map(String::valueOf)
.collect(Collectors.toList());
}, executorService);
futures.add(future);
}
for (CompletableFuture<List<String>> future : futures) {
try {
idsCollected.addAll(future.get());
} catch (InterruptedException | ExecutionException e) {
log.error("人员列表分页查询线程执行失败", e);
}
}
idsList.addAll(idsCollected);
} else {
idsList.addAll(Arrays.asList(ids.split(",")));
}
return idsList;
}
@Override
public void userInfoExport(String uuid, String ids, Map<String, String> map, ReginParams reginParams) {
AgencyUserModel userModel = reginParams.getUserModel();
List<String> userInfoSeqs = getUserInfoSeqs(false, ids, map, reginParams);
List<Map<String, String>> enterInfoWithExport = tzsUserInfoMapper.getUserInfoWithExport(userInfoSeqs);
List<UserInfoVo> exportData = JSON.parseArray(JSON.toJSONString(enterInfoWithExport), UserInfoVo.class);
DictUtil.dictCode2DictName(exportData);
MultipartFile templateExcelFile = ExcelUtil.createTemplateExcelFile("人员信息列表数据", "人员信息列表列表", exportData, UserInfoVo.class, null, false);
String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "人员信息列表")
.fluentPut("url", urlString)
.fluentPut("time", new Date().getTime()));
}
@Override
public void userInfoExportWithAdmin(String uuid, String ids, Map<String, String> map, ReginParams reginParams) {
AgencyUserModel userModel = reginParams.getUserModel();
List<String> userInfoSeqs = getUserInfoSeqs(true, ids, map, reginParams);
List<Map<String, String>> enterInfoWithExport = tzsUserInfoMapper.getUserInfoWithExport(userInfoSeqs);
List<UserInfoVo> exportData = JSON.parseArray(JSON.toJSONString(enterInfoWithExport), UserInfoVo.class);
DictUtil.dictCode2DictName(exportData);
MultipartFile templateExcelFile = ExcelUtil.createTemplateExcelFile("人员信息列表数据", "人员信息列表列表", exportData, UserInfoVo.class, null, false);
String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "人员信息列表")
.fluentPut("url", urlString)
.fluentPut("time", new Date().getTime()));
}
} }
\ No newline at end of file
...@@ -122,8 +122,8 @@ public class TzsUserInfoController extends BaseController { ...@@ -122,8 +122,8 @@ public class TzsUserInfoController extends BaseController {
public ResponseModel<IPage<TzsUserInfoDto>> queryForPage(@RequestParam(value = "current") String current, public ResponseModel<IPage<TzsUserInfoDto>> queryForPage(@RequestParam(value = "current") String current,
@RequestParam(value = "size") String size, @RequestParam(value = "size") String size,
@RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "sort", required = false) String sort,
TzsUserInfoDto dto) { @RequestParam Map<String, String> map) {
TzsUserInfoDto dto = JSON.parseObject(JSON.toJSONString(map), TzsUserInfoDto.class);
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) { if (ObjectUtils.isEmpty(reginParams)) {
return null; return null;
...@@ -312,7 +312,8 @@ public class TzsUserInfoController extends BaseController { ...@@ -312,7 +312,8 @@ public class TzsUserInfoController extends BaseController {
@RequestParam(value = "size") long size, @RequestParam(value = "size") long size,
@RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "sort", required = false) String sort,
@RequestParam(required = false, defaultValue = "all") String type, @RequestParam(required = false, defaultValue = "all") String type,
@RequestBody UserPermissionDto filter) { @RequestBody Map<String,String> map) {
UserPermissionDto filter = JSON.parseObject(JSON.toJSONString(map), UserPermissionDto.class);
filter.setOrgCode(getSelectedOrgInfo().getCompany().getOrgCode()); filter.setOrgCode(getSelectedOrgInfo().getCompany().getOrgCode());
filter.setCityCode(getSelectedOrgInfo().getCompany().getCompanyCode()); filter.setCityCode(getSelectedOrgInfo().getCompany().getCompanyCode());
Page<UserPermissionDto> userPermissionDtos = tzsUserInfoServiceImpl.getUserByPermission(current, size, type, filter,sort); Page<UserPermissionDto> userPermissionDtos = tzsUserInfoServiceImpl.getUserByPermission(current, size, type, filter,sort);
......
...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo; ...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> { public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
...@@ -18,4 +19,6 @@ public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> { ...@@ -18,4 +19,6 @@ public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
List<TzsUserPermissionDto> queryPermissionByUserSeq(@Param("userSeq") Long userSeq, @Param("permissionPost") String permissionPost); List<TzsUserPermissionDto> queryPermissionByUserSeq(@Param("userSeq") Long userSeq, @Param("permissionPost") String permissionPost);
List<TzsUserInfoDto> selectUserPermission(@Param("operator") String operator, @Param("posts") List<String> posts); List<TzsUserInfoDto> selectUserPermission(@Param("operator") String operator, @Param("posts") List<String> posts);
List<Map<String, String>> getUserInfoWithExport(@Param("ids") List<String> userInfoSeqs);
} }
...@@ -100,4 +100,28 @@ ...@@ -100,4 +100,28 @@
</foreach> </foreach>
) )
</select> </select>
<select id="getUserInfoWithExport" resultType="java.util.Map">
SELECT
ur."name",ur."certificate_type",ur."certificate_num",ur."post",ur."phone",ur."birthday",ur."education",ur."speciality",ur."email",ur."address",ur."identification",ur."profile",ur."rec_date",ur."rec_user_id",ur."rec_user_name",ur."amos_user_id",ur."amos_user_name",ur."unit_name",ur."is_delete",ur."lock_status",ur."unit_code",ur."post_name",ur."equip_type",ur."appoint_doc",ur."inner_person_code",ur."other_accessories",ur."permission_level",ur."permission_item",ur."permission_data",ur."new_post",ur."job_title",ur."qr_code_state",ur."sub_post",ur."sub_post_name",ur."transfer_out_time",ur."practice_registration",ur."labor_contract",
up."permission_level", up."permission_item", up."permission_post", up."cert_no", up."expiry_date", up."approved_organ", up."issue_date", up."cert_attachment", up."cert_type", up."job_item", up."other_item", up."remark", up."rec_date", up."rec_user_id", up."rec_user_name", up."item_code",
CASE
WHEN ur.gender = 1 THEN
'男' ELSE '女'
END AS gender,
CASE
WHEN ur."transfer_out" = 1 THEN
'已转出' ELSE '未转出'
END AS transfer_out
FROM "amos_tzs_biz"."tzs_user_info" ur
LEFT JOIN "amos_tzs_biz"."tzs_user_permission" up ON ur."sequence_nbr" = up."user_seq"
<where>
<if test='ids != null'>
and ur.sequence_nbr in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>
\ 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