Commit bcb3ed48 authored by tianbo's avatar tianbo

bugfix:

1、压力管道使用单位新增装置修改
parent 728a3cb2
......@@ -15,12 +15,10 @@ import com.yeejoin.amos.api.openapi.util.MultiFieldKey;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
......@@ -45,7 +43,6 @@ public class TmCylinderFillingExamineService extends MyBaseServiceImpl<TmCylinde
private EventPublisher eventPublisher;
@DSTransactional
@Transactional(rollbackFor = Exception.class)
public String createCylinderFillingExamine(List<TmCylinderFillingExamineModel> model) {
if (ValidationUtil.isEmpty(model))
throw new BadRequest("液化气体气瓶充装信息审核为空.");
......@@ -87,11 +84,14 @@ public class TmCylinderFillingExamineService extends MyBaseServiceImpl<TmCylinde
if (!ValidationUtil.isEmpty(oldList)) {
List<String> fileUrlList = Lists.newArrayList();
oldList.forEach(old -> {
if (old.getFillingAuditUrl() != null) {
fileUrlList.addAll(Arrays.asList(ValidationUtil.isEmpty(old.getFillingAuditUrl()) ? new String[0] : old.getFillingAuditUrl().split(",")));
if (!ValidationUtil.isEmpty(old.getFillingAuditUrl())) {
fileUrlList.add(old.getFillingAuditUrl());
}
});
eventPublisher.publish(new FileToBeDeleteEvent(this, FileDeleteUtil.extractFileNames(fileUrlList)));
List<String> fileNameList = FileDeleteUtil.extractFileNames(fileUrlList);
if (!ValidationUtil.isEmpty(fileNameList)) {
eventPublisher.publish(new FileToBeDeleteEvent(this, fileNameList));
}
}
}
......
......@@ -32,6 +32,11 @@ public class FileDeleteUtil {
List<String> fileUrls = Lists.newArrayList();
if (!ValidationUtil.isEmpty(jsonStr)) {
try {
log.debug("jsonStr:{}", jsonStr);
if (!JSONObject.isValid(jsonStr)) {
fileUrls.add(jsonStr);
return fileUrls;
}
Object json = JSONObject.parse(jsonStr);
if (json instanceof JSONArray) {
JSONArray jsonArray = JSONObject.parseArray(jsonStr);
......@@ -57,7 +62,7 @@ public class FileDeleteUtil {
}
return fileUrls;
} catch (Exception e) {
log.info("Error parsing JSON: {}", jsonStr);
log.error("Error parsing JSON: {}", jsonStr);
System.err.println("Error parsing JSON: " + e.getMessage());
}
}
......
......@@ -43,7 +43,7 @@ public class IdxBizJgProjectContraptionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增管道工程装置表", notes = "新增管道工程装置表")
public ResponseModel<Boolean> save(@RequestBody IdxBizJgProjectContraptionDto model) {
public ResponseModel<IdxBizJgProjectContraption> save(@RequestBody IdxBizJgProjectContraptionDto model) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.saveFirstMergeProjectContraption(model));
}
......
......@@ -2,8 +2,6 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -13,19 +11,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.converter.DictParamsConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.InspectConclusionConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.InspectTypeConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.PipingExcelDto;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgProjectContraptionService;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
......@@ -38,7 +29,6 @@ import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -60,6 +50,7 @@ import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static com.alibaba.fastjson.JSON.toJSONString;
/**
* 管道工程装置表服务实现类
......@@ -507,7 +498,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
}
}
public boolean saveFirstMergeProjectContraption(IdxBizJgProjectContraptionDto model) {
public IdxBizJgProjectContraption saveFirstMergeProjectContraption(IdxBizJgProjectContraptionDto model) {
// 单位类型
Map<String, Object> companyInfoMap = jgInstallationNoticeService.getCompanyType();
IdxBizJgProjectContraption projectContraption = JSON.parseObject(toJSONString(model), IdxBizJgProjectContraption.class);
......@@ -515,7 +506,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
String equCategoryName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquCategoryCode());
String equDefineName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquDefineCode());
projectContraption.setDataSource("jg");
projectContraption.setIsIntoManagement(true);
projectContraption.setIsIntoManagement(false);
projectContraption.setProvinceName("陕西省");
projectContraption.setEquList(model.getEquListCode());
projectContraption.setEquCategory(model.getEquCategoryCode());
......@@ -526,7 +517,8 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
projectContraption.setPipelineLength(0.0);
projectContraption.setUseUnitName(companyInfoMap.get("companyName").toString());
projectContraption.setUseUnitCreditCode(companyInfoMap.get("creditCode").toString());
return this.saveOrUpdateData(projectContraption);
this.saveOrUpdateData(projectContraption);
return projectContraption;
}
@Override
......
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