Commit 0093587f authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 046d6d48 effdde1b
......@@ -57,11 +57,11 @@ public class JgTableDataExportController extends BaseController {
@RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "sort", required = false) String sort) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
iJgTableDataExportService.startDownLoadMsg("", uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> {
contextWrapper.apply();
iJgTableDataExportService.certificate(uuid, getSelectedOrgInfo(), dto, ids == null ? new ArrayList<>() : Arrays.asList(ids.split(",")), sort);
iJgTableDataExportService.certificate(uuid, dto, ids == null ? new ArrayList<>() : Arrays.asList(ids.split(",")), sort);
}).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!");
}
......@@ -197,10 +197,10 @@ public class JgTableDataExportController extends BaseController {
public ResponseModel<String> unregulatedEquipExport(@RequestParam Map<String, Object> map) {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
iJgTableDataExportService.startDownLoadMsg("未纳管设备列表数据", uuid);
new Thread(() -> {
contextWrapper.apply();
iJgTableDataExportService.unregulatedEquip(uuid, getSelectedOrgInfo(), map);
iJgTableDataExportService.unregulatedEquip(uuid, map);
}).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!");
}
......@@ -210,11 +210,11 @@ public class JgTableDataExportController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "已纳管设备列表数据导出", notes = "已纳管设备列表数据导出")
public ResponseModel<String> manageEquipmentExport(@RequestParam Map<String, Object> map) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
iJgTableDataExportService.startDownLoadMsg("已纳管设备列表数据", uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> {
contextWrapper.apply();
iJgTableDataExportService.manageEquipment(uuid, getSelectedOrgInfo(), map);
iJgTableDataExportService.manageEquipment(uuid, map);
}).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!");
}
......@@ -233,7 +233,7 @@ public class JgTableDataExportController extends BaseController {
public ResponseModel<String> unregulatedPipe(@RequestParam Map<String, String> params,
@RequestParam(value = "sort", required = false) String sort) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
iJgTableDataExportService.startDownLoadMsg("未纳管压力管道列表", uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> {
contextWrapper.apply();
......@@ -248,7 +248,7 @@ public class JgTableDataExportController extends BaseController {
public ResponseModel<String> managePipe(@RequestParam Map<String, String> params,
@RequestParam(value = "sort", required = false) String sort) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
iJgTableDataExportService.startDownLoadMsg("已纳管压力管道列表", uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> {
contextWrapper.apply();
......@@ -262,11 +262,11 @@ public class JgTableDataExportController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "基础设置-企业信息列表数据导出", notes = "基础设置-企业信息列表数据导出")
public ResponseModel<String> managePipe(String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
iJgTableDataExportService.startDownLoadMsg("企业信息列表", uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> {
contextWrapper.apply();
iJgTableDataExportService.enterpriseInformationExport(uuid, ids, tzBaseEnterpriseInfoDto, getSelectedOrgInfo());
iJgTableDataExportService.enterpriseInformationExport(uuid, ids, tzBaseEnterpriseInfoDto);
}).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!");
}
......@@ -278,11 +278,11 @@ public class JgTableDataExportController extends BaseController {
@RequestParam(value = "sort", required = false) String sort,
@RequestParam Map<String, String> map) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
iJgTableDataExportService.startDownLoadMsg("人员信息列表", uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> {
contextWrapper.apply();
iJgTableDataExportService.userInfoExport(uuid, ids, map, getSelectedOrgInfo());
iJgTableDataExportService.userInfoExport(uuid, ids, map);
}).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!");
}
......@@ -291,13 +291,13 @@ public class JgTableDataExportController extends BaseController {
@PostMapping(value = "/userInfoExportWithAdmin")
@ApiOperation(httpMethod = "POST", value = "基础设置-监管单位-人员信息列表数据导出", notes = "基础设置-监管单位-人员信息列表数据导出")
public ResponseModel<String> userInfoExportWithAdmin(@RequestParam(value = "ids", required = false) String ids,
@RequestBody Map<String,String> map) {
@RequestBody Map<String, String> map) {
String uuid = UUID.randomUUID().toString();
iJgTableDataExportService.startDownLoadMsg(getSelectedOrgInfo(), uuid);
iJgTableDataExportService.startDownLoadMsg("人员信息列表", uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> {
contextWrapper.apply();
iJgTableDataExportService.userInfoExportWithAdmin(uuid, ids, map, getSelectedOrgInfo());
iJgTableDataExportService.userInfoExportWithAdmin(uuid, ids, map);
}).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!");
}
......
......@@ -13,14 +13,11 @@ import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.biz.reminder.core.DefaultReminder;
import com.yeejoin.amos.boot.module.jg.biz.reminder.dto.MatchItemDto;
import com.yeejoin.amos.boot.module.jg.biz.reminder.service.CommonReminderService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -50,7 +47,7 @@ public class VehicleInformationReminderAdapter extends DefaultReminder {
lambda.select(JgVehicleInformationEq::getEquId);
List<String> records = vehicleInformationReminderParse.getVehicleInformationEqMapper().selectList(lambda).stream().map(JgVehicleInformationEq::getEquId).collect(Collectors.toList());
Page<ReminderItemDto> mapPage = vehicleInformationReminderParse.getVehicleInformationMapper().queryForUnitVehiclePageForReminder(page, records);
mapPage.getRecords().forEach(item -> item.setDetailData(this.buildSetUseDataByStatus(vehicleInformation, item.getEquipId())));
mapPage.getRecords().forEach(item -> item.setDetailData(this.buildCompareData(vehicleInformation, item.getEquipId())));
return page;
}
......@@ -61,23 +58,18 @@ public class VehicleInformationReminderAdapter extends DefaultReminder {
return Collections.emptyList();
}
private Map<String, Object> buildSetUseDataByStatus(JgVehicleInformation vehicleInformation, String record) {
Map<String, Object> re = getValuesFromHistory(vehicleInformation);
if (re != null) return re;
return vehicleInformationReminderParse.getEquipDetailByRecord(record);
private Map<String, Object> buildCompareData(JgVehicleInformation vehicleInformation, String record) {
Map<String, Object> re = BeanUtil.beanToMap(vehicleInformation);
re.putAll(vehicleInformationReminderParse.getEquipDetailByRecord(record));
return re;
}
private Map<String, Object> getValuesFromHistory(JgVehicleInformation vehicleInformation) {
if (!vehicleInformation.getStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getName())) {
JSONObject his = vehicleInformationReminderParse.getJgCommonService().queryHistoryData(vehicleInformation.getSequenceNbr());
Map<String, Object> re = new HashMap<>();
re.putAll(his);
re.putAll(BeanUtil.beanToMap(vehicleInformation));
private Map<String, Object> buildCompareData(Map<String, Object> vehicleInformation, String record) {
Map<String, Object> re = BeanUtil.beanToMap(vehicleInformation);
re.putAll(vehicleInformationReminderParse.getEquipDetailByRecord(record));
return re;
}
return null;
}
@Override
public IPage<ReminderItemDto> jsonParse(String bizId, Map<String, Object> formData, Page<ReminderItemDto> page) {
......@@ -86,7 +78,7 @@ public class VehicleInformationReminderAdapter extends DefaultReminder {
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) data.get("equipmentLists");
List<String> records = equipmentLists.stream().map(item -> item.get("record").toString()).collect(Collectors.toList());
Page<ReminderItemDto> mapPage = vehicleInformationReminderParse.getVehicleInformationMapper().queryForUnitVehiclePageForReminder(page, records);
mapPage.getRecords().forEach(item -> item.setDetailData(data));
mapPage.getRecords().forEach(item -> item.setDetailData(this.buildCompareData(data, item.getEquipId())));
return page;
}
......@@ -140,6 +132,6 @@ public class VehicleInformationReminderAdapter extends DefaultReminder {
@Override
public String supportBizType() {
return BusinessTypeEnum.JG_VEHICLE_GAS_CYLINDER_CHANGE.name();
return BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.name();
}
}
package com.yeejoin.amos.boot.module.jg.biz.reminder.biz.vehicleInformation;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.biz.reminder.service.CommonReminderService;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgFactoryInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgFactoryInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component
......@@ -29,8 +34,15 @@ public class VehicleInformationReminderParse {
private final CommonServiceImpl jgCommonService;
private final IdxBizJgFactoryInfoMapper jgFactoryInfoMapper;
public Map<String, Object> getEquipDetailByRecord(String record) {
return commonReminderService.getEquipDetailByRecord(record);
IdxBizJgFactoryInfo factoryInfo = jgFactoryInfoMapper.selectOne(new LambdaQueryWrapper<IdxBizJgFactoryInfo>().eq(IdxBizJgFactoryInfo::getRecord, record));
IdxBizJgUseInfo useInfo = idxBizJgUseInfoMapper.selectOne(new LambdaQueryWrapper<IdxBizJgUseInfo>().eq(IdxBizJgUseInfo::getRecord, record));
Map<String, Object> result = new HashMap<>();
result.put("USE_INNER_CODE", useInfo.getUseInnerCode());
result.put("FACTORY_NUM", factoryInfo.getFactoryNum());
return result;
}
}
......@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.ReminderField;
import com.yeejoin.amos.boot.module.jg.api.dto.ReminderItemDto;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.TzsJgColumnReminderRuleServiceImpl;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
......@@ -68,6 +69,6 @@ public class ReminderFieldDiffImpl implements ReminderFieldDiff {
}
private boolean containKeyAndValue(Map<String, Object> detailData, String columnKey) {
return Arrays.stream(columnKey.split(",")).anyMatch(k -> detailData.containsKey(k) && Objects.nonNull(detailData.get(k)));
return Arrays.stream(columnKey.split(",")).anyMatch(k -> detailData.containsKey(k) && ObjectUtils.isNotEmpty(detailData.get(k)));
}
}
......@@ -15,11 +15,11 @@ import java.util.Map;
*/
public interface IJgTableDataExportService {
void startDownLoadMsg(ReginParams reginParams, String uuid);
void startDownLoadMsg(String fileName, String uuid);
void gen(String jsonName, String voName, String tableName);
void certificate(String uuid, ReginParams reginParams, JgUseRegistrationManageDto dto, List<String> ids, String sort);
void certificate(String uuid, JgUseRegistrationManageDto dto, List<String> ids, String sort);
void maintenance(HttpServletResponse response, List<String> ids);
......@@ -49,9 +49,9 @@ public interface IJgTableDataExportService {
void changeVehicleRegistrationUnit(HttpServletResponse response, List<String> ids);
void unregulatedEquip(String uuid, ReginParams reginParams, Map<String, Object> map);
void unregulatedEquip(String uuid, Map<String, Object> map);
void manageEquipment(String uuid, ReginParams reginParams, Map<String, Object> map);
void manageEquipment(String uuid, Map<String, Object> map);
void equipTransfer(HttpServletResponse response, List<String> ids);
......@@ -59,9 +59,9 @@ public interface IJgTableDataExportService {
void unregulatedPipe(String uuid, Map<String, String> params, String sort, ReginParams reginParams);
void enterpriseInformationExport(String uuid, String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto, ReginParams reginParams);
void enterpriseInformationExport(String uuid, String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto);
void userInfoExport(String uuid, String ids, Map<String, String> map, ReginParams reginParams);
void userInfoExport(String uuid, String ids, Map<String, String> map);
void userInfoExportWithAdmin(String uuid, String ids, Map<String, String> map, ReginParams reginParams);
void userInfoExportWithAdmin(String uuid, String ids, Map<String, String> map);
}
......@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
......@@ -109,7 +110,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
private TzsUserInfoMapper tzsUserInfoMapper;
@Autowired
private CbDataDictTypeHandler cbDataDictTypeHandler;
private final String DOWN_LOAD_START_TEMP = "{\"id\":\"%s\",\"status\":\"starting\"}";
private final String DOWN_LOAD_START_TEMP = "{\"id\":\"%s\",\"status\":\"starting\",\"fileName\":\"%s\",\"time\":\"%s\"}";
private final String BUCKET_NAME = "upload";
private final String UPLOAD_PATH = "/tzs/excelTempFile";
private final int PAGE_SIZE = 100;
......@@ -207,13 +208,10 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
/**
* 开始下载 发送消息
*
* @param reginParams
* @param uuid
*/
public void startDownLoadMsg(ReginParams reginParams, String uuid) {
public void startDownLoadMsg(String fileName, 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);
emqKeeper.getMqttClient().publish(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), String.format(DOWN_LOAD_START_TEMP, uuid, fileName, new Date().getTime()).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (Exception e) {
log.error(e.getMessage());
}
......@@ -222,7 +220,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
/**
* 发送主题消息,给企业推送excel 结束下载提醒
*
* @param topic 主体格式为: /download/excel/${userId}
* @param topic 主体格式为: /download/excel/${token}
* @param jsonObject 文件名称 + excel文件路径(minio)
*/
public void sendDownLoadExcelMsg(String topic, JSONObject jsonObject) {
......@@ -255,8 +253,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* 登记证列表数据导出
*/
@Override
public void certificate(String uuid, ReginParams reginParams, JgUseRegistrationManageDto dto, List<String> ids, String sort) {
AgencyUserModel userModel = reginParams.getUserModel();
public void certificate(String uuid, JgUseRegistrationManageDto dto, List<String> ids, String sort) {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
List<CertificateVo> exportData;
......@@ -313,7 +310,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "使用登记证列表数据")
......@@ -553,10 +550,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* 未纳管设备列表数据导出
*/
@Override
public void unregulatedEquip(String uuid, ReginParams reginParams, Map<String, Object> map) {
AgencyUserModel userModel = reginParams.getUserModel();
public void unregulatedEquip(String uuid, Map<String, Object> map) {
List<String> ids = getEquRecords(map);
// 查询数据
List<JSONObject> jsonObjects = idxBizJgRegisterInfoService.queryEquipInIds(ids);
......@@ -565,7 +559,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
MultipartFile templateExcelFile = ExcelUtil.createTemplateExcelFile("未纳管设备列表数据", "未纳管设备列表", exportData, UnregulatedEquipVo.class, null, false);
String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "未纳管设备列表数据")
......@@ -632,8 +626,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* 已纳管设备列表数据导出
*/
@Override
public void manageEquipment(String uuid, ReginParams reginParams, Map<String, Object> map) {
AgencyUserModel userModel = reginParams.getUserModel();
public void manageEquipment(String uuid, Map<String, Object> map) {
List<String> ids = getEquRecords(map);
// 查询数据
List<JSONObject> jsonObjects = idxBizJgRegisterInfoService.queryEquipInIds(ids);
......@@ -642,7 +635,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
MultipartFile templateExcelFile = ExcelUtil.createTemplateExcelFile("已纳管设备列表数据", "已纳管设备列表", exportData, ManageEquipmentVo.class, null, false);
String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "已纳管设备列表数据")
......@@ -725,7 +718,6 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
*/
@Override
public void managePipe(String uuid, Map<String, String> params, String sort, ReginParams reginParams) {
AgencyUserModel userModel = reginParams.getUserModel();
List<String> proConSeqs = getProConSeqs(params, sort, reginParams);
List<JSONObject> jsonObjects = idxBizJgRegisterInfoService.queryPipeEquipInIds(proConSeqs);
List<PipeEquipmentVo> exportData = JSON.parseArray(JSON.toJSONString(jsonObjects), PipeEquipmentVo.class);
......@@ -733,7 +725,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
MultipartFile templateExcelFile = ExcelUtil.createTemplateExcelFile("已纳管压力管道列表数据", "已纳管压力管道列表", exportData, PipeEquipmentVo.class, null, false);
String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "已纳管压力管道列表")
......@@ -750,15 +742,13 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
*/
@Override
public void unregulatedPipe(String uuid, Map<String, String> params, String sort, ReginParams reginParams) {
AgencyUserModel userModel = reginParams.getUserModel();
List<String> proConSeqs = getProConSeqs(params, sort, reginParams);
List<JSONObject> jsonObjects = idxBizJgRegisterInfoService.queryPipeEquipInIds(proConSeqs);
List<PipeEquipmentVo> exportData = JSON.parseArray(JSON.toJSONString(jsonObjects), PipeEquipmentVo.class);
DictUtil.dictCode2DictName(exportData);
MultipartFile templateExcelFile = ExcelUtil.createTemplateExcelFile("未纳管压力管道列表数据", "未纳管压力管道列表", exportData, PipeEquipmentVo.class, null, false);
String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "未纳管压力管道列表")
......@@ -766,7 +756,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
.fluentPut("time", new Date().getTime()));
}
private List<String> getEnterSeqs(String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto, ReginParams reginParams) {
private List<String> getEnterSeqs(String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto) {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
List<String> idsList = new ArrayList<>();
if (StringUtils.isEmpty(ids)) {
......@@ -811,13 +801,11 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
*
* @param ids
* @param tzBaseEnterpriseInfoDto
* @param reginParams
*/
@Override
public void enterpriseInformationExport(String uuid, String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto, ReginParams reginParams) {
AgencyUserModel userModel = reginParams.getUserModel();
public void enterpriseInformationExport(String uuid, String ids, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto) {
ObjectMapper objectMapper = new ObjectMapper();
List<String> enterSeqs = getEnterSeqs(ids, tzBaseEnterpriseInfoDto, reginParams);
List<String> enterSeqs = getEnterSeqs(ids, tzBaseEnterpriseInfoDto);
List<Map<String, String>> enterInfoWithExport = tzBaseEnterpriseInfoMapper.getEnterInfoWithExport(enterSeqs);
List<BaseEnterpriseVo> exportData = JSON.parseArray(JSON.toJSONString(enterInfoWithExport), BaseEnterpriseVo.class);
exportData.forEach(item -> {
......@@ -838,7 +826,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
});
MultipartFile templateExcelFile = ExcelUtil.createTemplateExcelFile("企业信息列表数据", "企业信息列表列表", exportData, BaseEnterpriseVo.class, null, false);
String urlString = this.uploadExcelFile(templateExcelFile);
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, userModel.getUserId()), new JSONObject()
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "企业信息列表")
......@@ -846,7 +834,7 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
.fluentPut("time", new Date().getTime()));
}
private List<String> getUserInfoSeqs(boolean isAdmin, String ids, Map<String, String> map, ReginParams reginParams) {
private List<String> getUserInfoSeqs(boolean isAdmin, String ids, Map<String, String> map) {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
List<String> idsList = new ArrayList<>();
if (StringUtils.isEmpty(ids)) {
......@@ -892,15 +880,14 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
@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);
public void userInfoExport(String uuid, String ids, Map<String, String> map) {
List<String> userInfoSeqs = getUserInfoSeqs(false, ids, map);
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()
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "人员信息列表")
......@@ -909,15 +896,14 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
}
@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);
public void userInfoExportWithAdmin(String uuid, String ids, Map<String, String> map) {
List<String> userInfoSeqs = getUserInfoSeqs(true, ids, map);
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()
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "人员信息列表")
......
......@@ -29,9 +29,10 @@ public interface ITzsUserInfoService extends IService<TzsUserInfo> {
void deleteBatch(Object[] ids);
Map<String, Object> getDetail(Long id);
Map<String, Object> getDetail(Long id, ReginParams reginParams);
boolean BindAccount(Map<String, Object> map);
String startOrStopAccount(Map<String, Object> map);
List<Map<String, Object>> getEquipmentType(String creditCode);
......@@ -46,21 +47,21 @@ public interface ITzsUserInfoService extends IService<TzsUserInfo> {
JSONObject statisticsOfPersonnelTypesByPatentCode(String parentId);
Map<String,Integer> getArrangementStatistic(String companyCode);
Map<String, Integer> getArrangementStatistic(String companyCode);
Map<String,Object> getCompanyType();
Map<String, Object> getCompanyType();
Map<String,Object> getCompanyTypeForRedis(ReginParams selectedOrgInfo);
Map<String, Object> getCompanyTypeForRedis(ReginParams selectedOrgInfo);
Page<TzsEquipListDto> getEquipList(String type,String userSeq,TzsEquipListDto dto, Page<TzsEquipListDto> page);
Page<TzsEquipListDto> getEquipList(String type, String userSeq, TzsEquipListDto dto, Page<TzsEquipListDto> page);
Boolean equipBind(String type, String userSeq, String creditCode, Map<String,Object> map);
Boolean equipBind(String type, String userSeq, String creditCode, Map<String, Object> map);
List<TzsUserInfo> getSafetyList(String companyCode);
List<Map<String,Object>> getGroupList();
List<Map<String, Object>> getGroupList();
Map<String,Object> getPersonType();
Map<String, Object> getPersonType();
List<GroupAndPersonInfoDto> getGroupAndPersonInfo(Long groupId);
......@@ -78,6 +79,7 @@ public interface ITzsUserInfoService extends IService<TzsUserInfo> {
/**
* 批量导入人员
*
* @param file 导入的文件
* @return 失败时返回失败信息,提供时返回success
*/
......
......@@ -113,7 +113,7 @@ public class TzsUserInfoController extends BaseController {
@GetMapping(value = "/getDetail")
@ApiOperation(httpMethod = "GET", value = "详情", notes = "详情")
public ResponseModel<Map<String, Object>> queryForPage(@RequestParam(value = "id") Long id) {
return ResponseHelper.buildResponse(tzsUserInfoService.getDetail(id));
return ResponseHelper.buildResponse(tzsUserInfoService.getDetail(id, getSelectedOrgInfo()));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -312,11 +312,11 @@ public class TzsUserInfoController extends BaseController {
@RequestParam(value = "size") long size,
@RequestParam(value = "sort", required = false) String sort,
@RequestParam(required = false, defaultValue = "all") String type,
@RequestBody Map<String,String> map) {
@RequestBody Map<String, String> map) {
UserPermissionDto filter = JSON.parseObject(JSON.toJSONString(map), UserPermissionDto.class);
filter.setOrgCode(getSelectedOrgInfo().getCompany().getOrgCode());
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);
return ResponseHelper.buildResponse(userPermissionDtos);
}
......@@ -350,7 +350,7 @@ public class TzsUserInfoController extends BaseController {
@GetMapping(value = "/export")
@ApiOperation(httpMethod = "GET", value = "人员管理列表数据导出", notes = "人员管理列表数据导出")
public void userInfoExport(HttpServletResponse response, String ids) {
Assert.hasText(ids,"未选择导出数据");
Assert.hasText(ids, "未选择导出数据");
tzsUserInfoService.userInfoExport(response, Arrays.asList(ids.split(",")));
}
......@@ -369,7 +369,7 @@ public class TzsUserInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/import")
@ApiOperation(value = "人员导入",httpMethod = "POST",notes = "导入已经存在公司的人员")
@ApiOperation(value = "人员导入", httpMethod = "POST", notes = "导入已经存在公司的人员")
public ResponseModel<?> importUser(@RequestBody MultipartFile file) {
return tzsUserInfoService.importUserBatch(file);
}
......@@ -398,7 +398,7 @@ public class TzsUserInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getJobItemBySubPost")
@ApiOperation(httpMethod = "GET", value = "根据人员子类型查询作业项目", notes = "根据人员子类型查询作业项目")
public ResponseModel<List<DictionarieValueModel> > getJobItemBySubPost(@RequestParam(value = "dicKey") String dicKey,
public ResponseModel<List<DictionarieValueModel>> getJobItemBySubPost(@RequestParam(value = "dicKey") String dicKey,
@RequestParam(value = "") String subPost) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues(dicKey).getResult();
// 包含 持证人员(P)6764 或 持证人员(R2)6765 并且不包含持证人员 6713 的情况下 只显示【移动式压力容器充装】和【气瓶充装】
......
......@@ -317,7 +317,11 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
@Override
public Map<String, Object> getDetail(Long id) {
public Map<String, Object> getDetail(Long id, ReginParams reginParams) {
// 为了处理以下场景
// 1:没有单位限制的时候添加了所有类型的人员,现在有了单位类型限制的情况下更新不了原先人员
// 2:多种单位类型的企业编辑另一种单位类型下的人员
List<String> unitTypeAllPostCode = this.postByUnitType(reginParams.getCompany()).stream().map(DataDictionary::getCode).collect(Collectors.toList());
Map<String, Object> maps = new HashMap<>();
TzsUserInfo tzsUserInfo = tzsUserInfoMapper.selectById(id);
TzsUserInfoVo tzsUserInfoVo = new TzsUserInfoVo();
......@@ -326,8 +330,13 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
tzsUserInfoVo.setPost(JSON.parseArray(tzsUserInfo.getPost()));
}
Optional.ofNullable(tzsUserInfo.getNewPost())
.filter(post -> !ObjectUtils.isEmpty(post))
.map(JSON::parseArray)
.map(array -> array.stream()
.map(String::valueOf)
.filter(unitTypeAllPostCode::contains)
.collect(Collectors.toList()))
.filter(list -> !list.isEmpty())
.map(item -> JSONArray.parseArray(JSON.toJSONString(item)))
.ifPresent(tzsUserInfoVo::setNewPost);
Optional.ofNullable(tzsUserInfo.getSubPost())
.filter(post -> !ObjectUtils.isEmpty(post))
......@@ -1686,7 +1695,12 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
@Override
public List<DataDictionary> postByUnitType(CompanyBo company) {
ArrayList<String> postDictCodeList = new ArrayList<>();
JsonNode companyTypeNode = postData.get(company.getCompanyType());
TzBaseEnterpriseInfo enterpriseInfo = baseEnterpriseInfoService.lambdaQuery()
.eq(TzBaseEnterpriseInfo::getUseCode, company.getCompanyCode())
.one();
List<String> unitTypes = Arrays.asList(enterpriseInfo.getUnitType().split("#"));
unitTypes.forEach(unitType -> {
JsonNode companyTypeNode = postData.get(unitType);
if (companyTypeNode != null && companyTypeNode.isObject()) {
Iterator<Map.Entry<String, JsonNode>> fields = companyTypeNode.fields();
while (fields.hasNext()) {
......@@ -1695,6 +1709,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
postDictCodeList.add(postCode); // 主岗位
}
}
});
return this.getAllUserType().stream()
.filter(item -> postDictCodeList.contains(item.getCode()))
.collect(Collectors.toList());
......@@ -1733,13 +1748,13 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
if (!subPostDictCodeList.isEmpty()) {
result.addAll(iDataDictionaryService.lambdaQuery()
.in(DataDictionary::getCode, subPostDictCodeList)
.eq(DataDictionary::getType, "QYRYGW")
.like(DataDictionary::getType, "QYRYGW")
.orderByAsc(DataDictionary::getSortNum)
.list());
} else {
result.addAll(iDataDictionaryService.lambdaQuery()
.in(DataDictionary::getParent, postCode)
.eq(DataDictionary::getType, "QYRYGW")
.like(DataDictionary::getType, "QYRYGW")
.orderByAsc(DataDictionary::getSortNum)
.list());
}
......
......@@ -36,7 +36,6 @@
"6546": [],
"6547": [],
"6548": [],
"6551": [],
"6616": [],
"6763": [],
"": []
......@@ -63,7 +62,6 @@
"6546": [],
"6550": [],
"6548": [],
"6551": [],
"6616": [],
"6617": []
}
......
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