|
@@ -18,7 +18,9 @@ import org.jeecg.modules.costModelList.dto.CostModelListUpdateDTO;
|
|
import org.jeecg.modules.costModelList.dto.FileDTO;
|
|
import org.jeecg.modules.costModelList.dto.FileDTO;
|
|
import org.jeecg.modules.costModelList.entity.CostModelList;
|
|
import org.jeecg.modules.costModelList.entity.CostModelList;
|
|
import org.jeecg.modules.costModelList.service.ICostModelListService;
|
|
import org.jeecg.modules.costModelList.service.ICostModelListService;
|
|
|
|
+import org.jeecg.modules.costModelList.vo.CostModelImportVO;
|
|
import org.jeecg.modules.costModelList.vo.CostModelListQueryVO;
|
|
import org.jeecg.modules.costModelList.vo.CostModelListQueryVO;
|
|
|
|
+import org.jeecg.modules.costModelMsg.service.ICostModelMsgService;
|
|
import org.jeecg.modules.costModelXmxqCl.entity.CostModelXmxqCl;
|
|
import org.jeecg.modules.costModelXmxqCl.entity.CostModelXmxqCl;
|
|
import org.jeecg.modules.costModelXmxqCl.service.ICostModelXmxqClService;
|
|
import org.jeecg.modules.costModelXmxqCl.service.ICostModelXmxqClService;
|
|
import org.jeecg.modules.costModelXmxqWx.entity.CostModelXmxqWx;
|
|
import org.jeecg.modules.costModelXmxqWx.entity.CostModelXmxqWx;
|
|
@@ -51,6 +53,8 @@ public class CostModelListController extends JeecgController<CostModelList, ICos
|
|
@Autowired
|
|
@Autowired
|
|
@SuppressWarnings("all")
|
|
@SuppressWarnings("all")
|
|
private JeecgBaseConfig jeecgBaseConfig;
|
|
private JeecgBaseConfig jeecgBaseConfig;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICostModelMsgService modelMsgService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 成本模型新增
|
|
* 成本模型新增
|
|
@@ -65,43 +69,52 @@ public class CostModelListController extends JeecgController<CostModelList, ICos
|
|
return Result.error("项目名称不可重复!");
|
|
return Result.error("项目名称不可重复!");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ String msg ="添加成功!";
|
|
|
|
+
|
|
CostModelList costModelList = CostModelListConvert.INSTANCE.toCostModelList(dto);
|
|
CostModelList costModelList = CostModelListConvert.INSTANCE.toCostModelList(dto);
|
|
costModelListService.save(costModelList);
|
|
costModelListService.save(costModelList);
|
|
-
|
|
|
|
String xmId = costModelList.getId();
|
|
String xmId = costModelList.getId();
|
|
String xmName = dto.getXmName();
|
|
String xmName = dto.getXmName();
|
|
- String clfUrl1 = dto.getClfurl().get(0).getFilePath();
|
|
|
|
- String wxfUrl1 = dto.getWxfurl().get(0).getFilePath();
|
|
|
|
- costModelList.setClfUrl(clfUrl1);
|
|
|
|
- costModelList.setClfFilename(dto.getClfurl().get(0).getFileName());
|
|
|
|
- costModelList.setClfFilesize(dto.getClfurl().get(0).getFileSize());
|
|
|
|
- costModelList.setWxfUrl(wxfUrl1);
|
|
|
|
- costModelList.setWxfFilename(dto.getWxfurl().get(0).getFileName());
|
|
|
|
- costModelList.setWxfFilesize(dto.getWxfurl().get(0).getFileSize());
|
|
|
|
- String clfUrl = jeecgBaseConfig.getPath().getUpload() + "/"+ clfUrl1;
|
|
|
|
- String wxfUrl = jeecgBaseConfig.getPath().getUpload() + "/"+ wxfUrl1;
|
|
|
|
- log.info("导入的材料费详情地址为:{}",clfUrl);
|
|
|
|
- log.info("导入的外协费详情地址为:{}",wxfUrl);
|
|
|
|
- //计算并导入数据
|
|
|
|
- Result<CostModelList> result1 = clService.importExcel1(xmId, xmName, clfUrl, CostModelXmxqCl.class);
|
|
|
|
- CostModelList costModel1 = result1.getResult();
|
|
|
|
- if(costModel1!=null){
|
|
|
|
- costModelList.setMaxClf(costModel1.getMaxClf());
|
|
|
|
- costModelList.setMinClf(costModel1.getMinClf());
|
|
|
|
- costModelList.setAveClf(costModel1.getAveClf());
|
|
|
|
- costModelList.setRecentClf(costModel1.getRecentClf());
|
|
|
|
|
|
+
|
|
|
|
+ if(dto.getClfurl()!=null && dto.getClfurl().get(0).getFilePath()!=null){
|
|
|
|
+ String clfUrl1 = dto.getClfurl().get(0).getFilePath();
|
|
|
|
+ String clfUrl = jeecgBaseConfig.getPath().getUpload() + "/"+ clfUrl1;
|
|
|
|
+ log.info("导入的材料费详情地址为:{}",clfUrl);
|
|
|
|
+ costModelList.setClfUrl(clfUrl1);
|
|
|
|
+ costModelList.setClfFilename(dto.getClfurl().get(0).getFileName());
|
|
|
|
+ costModelList.setClfFilesize(dto.getClfurl().get(0).getFileSize());
|
|
|
|
+ //计算并导入数据
|
|
|
|
+ Result<CostModelList> result1 = clService.importExcel1(xmId, xmName, clfUrl, CostModelXmxqCl.class);
|
|
|
|
+ CostModelList costModel1 = result1.getResult();
|
|
|
|
+ if(costModel1!=null){
|
|
|
|
+ costModelList.setMaxClf(costModel1.getMaxClf());
|
|
|
|
+ costModelList.setMinClf(costModel1.getMinClf());
|
|
|
|
+ costModelList.setAveClf(costModel1.getAveClf());
|
|
|
|
+ costModelList.setRecentClf(costModel1.getRecentClf());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- Result<CostModelList> result2 = wxService.importExcel1(xmId, xmName, wxfUrl, CostModelXmxqWx.class);
|
|
|
|
- CostModelList costModel2 = result2.getResult();
|
|
|
|
- if(costModel2!=null){
|
|
|
|
- costModelList.setMaxWxf(costModel2.getMaxWxf());
|
|
|
|
- costModelList.setMinWxf(costModel2.getMinWxf());
|
|
|
|
- costModelList.setAveWxf(costModel2.getAveWxf());
|
|
|
|
|
|
+
|
|
|
|
+ if(dto.getWxfurl()!=null && dto.getWxfurl().get(0).getFilePath()!=null){
|
|
|
|
+ String wxfUrl1 = dto.getWxfurl().get(0).getFilePath();
|
|
|
|
+ String wxfUrl = jeecgBaseConfig.getPath().getUpload() + "/"+ wxfUrl1;
|
|
|
|
+ log.info("导入的外协费详情地址为:{}",wxfUrl);
|
|
|
|
+ costModelList.setWxfUrl(wxfUrl1);
|
|
|
|
+ costModelList.setWxfFilename(dto.getWxfurl().get(0).getFileName());
|
|
|
|
+ costModelList.setWxfFilesize(dto.getWxfurl().get(0).getFileSize());
|
|
|
|
+ //计算并导入数据
|
|
|
|
+ Result<CostModelImportVO> result2 = wxService.importExcel1(xmId, xmName, wxfUrl, CostModelXmxqWx.class);
|
|
|
|
+ CostModelList costModel2 = result2.getResult().getCostModel();
|
|
|
|
+ msg = msg +result2.getResult().getTishiMsg();
|
|
|
|
+ if(costModel2!=null){
|
|
|
|
+ costModelList.setMaxWxf(costModel2.getMaxWxf());
|
|
|
|
+ costModelList.setMinWxf(costModel2.getMinWxf());
|
|
|
|
+ costModelList.setAveWxf(costModel2.getAveWxf());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
costModelListService.updateById(costModelList);
|
|
costModelListService.updateById(costModelList);
|
|
|
|
|
|
- return Result.OK("添加成功!");
|
|
|
|
|
|
+ return Result.OK(msg);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -124,33 +137,57 @@ public class CostModelListController extends JeecgController<CostModelList, ICos
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- String clfUrl1 = dto.getClfurl().get(0).getFilePath();
|
|
|
|
- String wxfUrl1 = dto.getWxfurl().get(0).getFilePath();
|
|
|
|
- costModelList.setClfUrl(clfUrl1);
|
|
|
|
- costModelList.setWxfUrl(wxfUrl1);
|
|
|
|
-
|
|
|
|
- String clfUrl = jeecgBaseConfig.getPath().getUpload() + "/"+ clfUrl1;
|
|
|
|
- String wxfUrl = jeecgBaseConfig.getPath().getUpload() + "/"+ wxfUrl1;
|
|
|
|
|
|
+ String msg ="编辑成功!";
|
|
|
|
|
|
- if(!Objects.equals(clfUrl1,costModelList1.getClfUrl())){
|
|
|
|
- Map<String, Object> columnMap = new HashMap<>();
|
|
|
|
- columnMap.put("xiangmu_id",xmId);
|
|
|
|
- clService.removeByMap(columnMap);
|
|
|
|
- //计算并导入数据
|
|
|
|
- Result<CostModelList> result1 = clService.importExcel1(xmId, xmName, clfUrl, CostModelXmxqCl.class);
|
|
|
|
|
|
+ if(dto.getClfurl()!=null && dto.getClfurl().get(0).getFilePath()!=null){
|
|
|
|
+ String clfUrl1 = dto.getClfurl().get(0).getFilePath();
|
|
|
|
+ costModelList.setClfUrl(clfUrl1);
|
|
|
|
+ costModelList.setClfFilename(dto.getClfurl().get(0).getFileName());
|
|
|
|
+ costModelList.setClfFilesize(dto.getClfurl().get(0).getFileSize());
|
|
|
|
+ String clfUrl = jeecgBaseConfig.getPath().getUpload() + "/"+ clfUrl1;
|
|
|
|
+ if(!Objects.equals(clfUrl1,costModelList1.getClfUrl())){
|
|
|
|
+ Map<String, Object> columnMap = new HashMap<>();
|
|
|
|
+ columnMap.put("xiangmu_id",xmId);
|
|
|
|
+ clService.removeByMap(columnMap);
|
|
|
|
+ //计算并导入数据
|
|
|
|
+ Result<CostModelList> result1 = clService.importExcel1(xmId, xmName, clfUrl, CostModelXmxqCl.class);
|
|
|
|
+ CostModelList costModel1 = result1.getResult();
|
|
|
|
+ if(costModel1!=null){
|
|
|
|
+ costModelList.setMaxClf(costModel1.getMaxClf());
|
|
|
|
+ costModelList.setMinClf(costModel1.getMinClf());
|
|
|
|
+ costModelList.setAveClf(costModel1.getAveClf());
|
|
|
|
+ costModelList.setRecentClf(costModel1.getRecentClf());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- if(!Objects.equals(wxfUrl1,costModelList1.getWxfUrl())){
|
|
|
|
- Map<String, Object> columnMap = new HashMap<>();
|
|
|
|
- columnMap.put("xiangmu_id",xmId);
|
|
|
|
- wxService.removeByMap(columnMap);
|
|
|
|
- //计算并导入数据
|
|
|
|
- Result<CostModelList> result2 = wxService.importExcel1(xmId, xmName, wxfUrl, CostModelXmxqWx.class);
|
|
|
|
|
|
+ if(dto.getWxfurl()!=null && dto.getWxfurl().get(0).getFilePath()!=null){
|
|
|
|
+ String wxfUrl1 = dto.getWxfurl().get(0).getFilePath();
|
|
|
|
+ costModelList.setWxfUrl(wxfUrl1);
|
|
|
|
+ costModelList.setWxfFilename(dto.getWxfurl().get(0).getFileName());
|
|
|
|
+ costModelList.setWxfFilesize(dto.getWxfurl().get(0).getFileSize());
|
|
|
|
+ String wxfUrl = jeecgBaseConfig.getPath().getUpload() + "/"+ wxfUrl1;
|
|
|
|
+ if(!Objects.equals(wxfUrl1,costModelList1.getWxfUrl())){
|
|
|
|
+ Map<String, Object> columnMap = new HashMap<>();
|
|
|
|
+ columnMap.put("xiangmu_id",xmId);
|
|
|
|
+ wxService.removeByMap(columnMap);
|
|
|
|
+ //删除原成本模型导入提示信息
|
|
|
|
+ modelMsgService.removeByMap(columnMap);
|
|
|
|
+ //计算并导入数据
|
|
|
|
+ Result<CostModelImportVO> result2 = wxService.importExcel1(xmId, xmName, wxfUrl, CostModelXmxqWx.class);
|
|
|
|
+ CostModelList costModel2 = result2.getResult().getCostModel();
|
|
|
|
+ msg = msg + result2.getResult().getTishiMsg();
|
|
|
|
+ if(costModel2!=null){
|
|
|
|
+ costModelList.setMaxWxf(costModel2.getMaxWxf());
|
|
|
|
+ costModelList.setMinWxf(costModel2.getMinWxf());
|
|
|
|
+ costModelList.setAveWxf(costModel2.getAveWxf());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
costModelList.setXmName(xmName);
|
|
costModelList.setXmName(xmName);
|
|
costModelListService.updateById(costModelList);
|
|
costModelListService.updateById(costModelList);
|
|
- return Result.OK("编辑成功!");
|
|
|
|
|
|
+ return Result.OK(msg);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -196,13 +233,13 @@ public class CostModelListController extends JeecgController<CostModelList, ICos
|
|
//@RequiresPermissions("org.jeecg.modules:kzks_cost_model:delete")
|
|
//@RequiresPermissions("org.jeecg.modules:kzks_cost_model:delete")
|
|
@DeleteMapping(value = "/delete")
|
|
@DeleteMapping(value = "/delete")
|
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
|
+ costModelListService.removeById(id);
|
|
|
|
+
|
|
Map<String, Object> columnMap = new HashMap<>();
|
|
Map<String, Object> columnMap = new HashMap<>();
|
|
columnMap.put("xiangmu_id",id);
|
|
columnMap.put("xiangmu_id",id);
|
|
- clService.removeByMap(columnMap);
|
|
|
|
- Map<String, Object> columnMap1 = new HashMap<>();
|
|
|
|
- columnMap1.put("xiangmu_id",id);
|
|
|
|
- wxService.removeByMap(columnMap1);
|
|
|
|
- costModelListService.removeById(id);
|
|
|
|
|
|
+ clService.removeByMap(columnMap);//删材料费详情
|
|
|
|
+ wxService.removeByMap(columnMap);//删外协费详情
|
|
|
|
+ modelMsgService.removeByMap(columnMap);//删除原成本模型导入提示信息
|
|
return Result.OK("删除成功!");
|
|
return Result.OK("删除成功!");
|
|
}
|
|
}
|
|
|
|
|