Commit 723be421 authored by chenzhao's avatar chenzhao

修改bug

parent 95127744
......@@ -10,13 +10,7 @@ import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceCraneDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceHydrantDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceIotDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceNaturalDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourcePoolDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceTypeDto;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResource;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceCrane;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceHydrant;
......@@ -24,12 +18,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIot;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceNatural;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourcePool;
import com.yeejoin.amos.boot.module.common.api.enums.WaterResourceTypeEnum;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceCraneServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceHydrantServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceIotServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceNaturalServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourcePoolServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanMap;
......@@ -78,6 +67,8 @@ public class WaterResourceController extends BaseController {
WaterResourcePoolServiceImpl waterResourcePoolService;
@Autowired
WaterResourceIotServiceImpl waterResourceIotService;
@Autowired
SourceFileServiceImpl sourceFileService;
/**
* 新增
......@@ -91,15 +82,23 @@ public class WaterResourceController extends BaseController {
String resourceType = model.getResourceType();
Optional<WaterResourceTypeEnum> resourceTypeEnum = EnumsUtils.getEnumObject(WaterResourceTypeEnum.class,
e -> e.getCode().equals(resourceType));
/*bug 2913 截取名字防止传递文件名太长随机生成文件名保存 chenzhao 2021-09-30 start*/
/*bug 2913 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 start*/
List<Object> realityImgList = model.getRealityImgList();
/*
if (realityImgList != null ){
}
realityImgList.forEach(i->{
((Map<String, Object>) i).put("name",QRCodeUtil.generateQRCode()+"."+i.toString().substring(i.toString().lastIndexOf(".") + 1).toLowerCase());
});
/*截取名字防止传递文件名太长随机生成文件名保存 chenzhao 2021-09-30 end*/
});*/
/* 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 end*/
model.setResourceTypeName(resourceTypeEnum.get().getName());
model.setRealityImg(JSONArray.toJSONString(realityImgList));
model.setOrientationImg(JSONArray.toJSONString(model.getOrientationImgList()));
model.setOrientationImg(JSONArray.toJSONString(model. getOrientationImgList()));
/*2021-09-08 前端表示前端传递的address参数已经切割过,后端无需再切割获取 陈召 屏蔽代码 97-102行*/
/* if(model.getAddress()!=null){
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddress());
......@@ -161,6 +160,11 @@ public class WaterResourceController extends BaseController {
} else {
waterResourceServiceImpl.createWithModel(model);
}
if (model.getAttachments() != null && ! model.getAttachments().isEmpty()){
sourceFileService.saveAttachments(model.getSequenceNbr(),model.getAttachments());
}
return ResponseHelper.buildResponse(model);
}
......@@ -182,9 +186,14 @@ public class WaterResourceController extends BaseController {
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}*/
/*bug 2913 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 start*/
if (model.getAttachments() != null && ! model.getAttachments().isEmpty()){
sourceFileService.saveAttachments(model.getSequenceNbr(),model.getAttachments());
}
/*bug 2913 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 start*/
// 更新基本信息
model.setSequenceNbr(sequenceNbr);
model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList()));
//model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList()));
model.setOrientationImg(JSONArray.toJSONString(model.getOrientationImgList()));
WaterResourceDto waterResourceDto = waterResourceServiceImpl.updateWithModel(model);
// 更新属性信息
......@@ -291,7 +300,15 @@ public class WaterResourceController extends BaseController {
public ResponseModel<WaterResourceDto> selectOne(@PathVariable Long sequenceNbr) {
// 查询基本信息
WaterResourceDto waterResourceDto = waterResourceServiceImpl.queryBySeq(sequenceNbr);
waterResourceDto.setRealityImgList(JSONArray.parseArray(waterResourceDto.getRealityImg(), Object.class));
/*bug 2913 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 start*/
Map<String, List<AttachmentDto>> attachments = sourceFileService.getAttachments(sequenceNbr);
if (attachments != null){
waterResourceDto.setAttachments(attachments);
}
/*bug 2913 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 end*/
waterResourceDto.setRealityImgList(waterResourceDto.getRealityImg()!=null?JSONArray.parseArray(waterResourceDto.getRealityImg()):null);
waterResourceDto.setOrientationImgList(waterResourceDto.getOrientationImg()!=null?JSONArray.parseArray(waterResourceDto.getOrientationImg()):null);
Boolean isDelete = waterResourceDto.getIsDelete();
// 查询属性信息
......@@ -360,8 +377,19 @@ public class WaterResourceController extends BaseController {
Page<WaterResourceDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(waterResourceServiceImpl.queryForWaterResourcePage(page, name, resourceType,
belongBuildingId, belongFightingSystemId, sequenceNbr, classifyId));
/*bug 2913 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 start*/
Page<WaterResourceDto> waterResourceDtoPage = waterResourceServiceImpl.queryForWaterResourcePage(page, name, resourceType,
belongBuildingId, belongFightingSystemId, sequenceNbr, classifyId);
List<WaterResourceDto> records = waterResourceDtoPage.getRecords();
records.forEach(i->{
Map<String, List<AttachmentDto>> attachments = sourceFileService.getAttachments(i.getSequenceNbr());
if (attachments != null){
i.setAttachments(attachments);
}
});
/*bug 2913 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 end*/
return ResponseHelper.buildResponse(waterResourceDtoPage);
}
/**
......
......@@ -227,6 +227,20 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
if (ValidationUtil.isEmpty(fireTeam.getSequenceNbr())) {
save(fireTeam);
} else {
/*如果修改的队伍有下级队伍,所属单位一起修改 2021-10-18 陈召 开始*/
LambdaQueryWrapper<FireTeam> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FireTeam::getParent,fireTeam.getSequenceNbr());
wrapper.eq(BaseEntity::getIsDelete,false);
List<FireTeam> fireTeams = baseMapper.selectList(wrapper);
if (!fireTeams.isEmpty()){
fireTeams.forEach(i->{
i.setCompany(fireTeam.getCompany());
i.setCompanyName(fireTeam.getCompanyName());
i.setCompanyCode(fireTeam.getCompanyCode());
updateById(i);
});
}
/*如果修改的队伍有下级队伍,所属单位一起修改 2021-10-18 陈召 结束*/
updateById(fireTeam);
}
return fireTeam;
......
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