fix(自定义对比): 维护清单编辑问题修复
This commit is contained in:
+12
@@ -123,6 +123,18 @@ public class LawsCustomCompareInfoController {
|
||||
return Result.OK(lawsCustomCompareInfoService.queryInventory(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义对比-清单维护编辑
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "自定义对比-清单维护编辑")
|
||||
@ApiOperation(value="自定义对比-清单维护编辑", notes="自定义对比-清单维护编辑")
|
||||
@PostMapping(value = "/editInventory")
|
||||
public Result<T> editInventory(Map<String, Object> map) {
|
||||
lawsCustomCompareInfoService.editInventory(map);
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义对比-标准检索保存
|
||||
* @return
|
||||
|
||||
+6
@@ -90,5 +90,11 @@ public interface ILawsCustomCompareInfoService extends IService<LawsCustomCompar
|
||||
* @param response
|
||||
*/
|
||||
void exportExcel(String id, HttpServletRequest request, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 自定义对比-清单维护编辑
|
||||
* @param map
|
||||
*/
|
||||
void editInventory(Map<String, Object> map);
|
||||
}
|
||||
|
||||
|
||||
+52
-3
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.laws.customcompare.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -199,9 +200,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
new LambdaQueryWrapper<LawsCustomCompareInventory>()
|
||||
.eq(LawsCustomCompareInventory::getInfoId, id));
|
||||
// 删除自定义对比单元格内容表
|
||||
lawsCustomCompareCellService.remove(
|
||||
new LambdaQueryWrapper<LawsCustomCompareCell>()
|
||||
.eq(LawsCustomCompareCell::getInfoId, id));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -305,6 +304,56 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editInventory(Map<String, Object> map) {
|
||||
String infoId = (String) map.get("infoId");
|
||||
// 获取旧数据信息
|
||||
List<LawsCustomCompareInventory> list = lawsCustomCompareInventoryService.list(
|
||||
new LambdaQueryWrapper<LawsCustomCompareInventory>()
|
||||
.eq(LawsCustomCompareInventory::getInfoId, infoId));
|
||||
|
||||
//重新更新或者添加新数据
|
||||
List<LawsCustomCompareInventory> featureList = JSON.parseArray(JSON.toJSONString(map.get("特点")), LawsCustomCompareInventory.class);
|
||||
List<LawsCustomCompareInventory> compareList = JSON.parseArray(JSON.toJSONString(map.get("对比项")), LawsCustomCompareInventory.class);
|
||||
|
||||
lawsCustomCompareInventoryService.saveOrUpdateBatch(featureList);
|
||||
lawsCustomCompareInventoryService.saveOrUpdateBatch(compareList);
|
||||
|
||||
// 不是第一次添加
|
||||
if (!list.isEmpty()){
|
||||
List<String> idList = list.stream().map(LawsCustomCompareInventory::getInfoId).collect(Collectors.toList());
|
||||
List<String> featureIdList = featureList.stream().map(LawsCustomCompareInventory::getInfoId).collect(Collectors.toList());
|
||||
List<String> compareIdList = compareList.stream().map(LawsCustomCompareInventory::getInfoId).collect(Collectors.toList());
|
||||
|
||||
idList.retainAll(featureIdList);
|
||||
idList.retainAll(compareIdList);
|
||||
|
||||
if (!idList.isEmpty()){
|
||||
// 删除旧数据
|
||||
lawsCustomCompareInventoryService.remove(
|
||||
new LambdaQueryWrapper<LawsCustomCompareInventory>()
|
||||
.in(LawsCustomCompareInventory::getId, idList));
|
||||
|
||||
// 删除单元格数据
|
||||
lawsCustomCompareCellService.remove(
|
||||
new LambdaQueryWrapper<LawsCustomCompareCell>()
|
||||
.in(LawsCustomCompareCell::getFeatureId, idList)
|
||||
.or().eq(LawsCustomCompareCell::getCompareItemId, idList));
|
||||
}else {
|
||||
// 删除旧数据
|
||||
lawsCustomCompareInventoryService.remove(
|
||||
new LambdaQueryWrapper<LawsCustomCompareInventory>()
|
||||
.eq(LawsCustomCompareInventory::getInfoId, infoId));
|
||||
|
||||
// 删除单元格数据
|
||||
lawsCustomCompareCellService.remove(
|
||||
new LambdaQueryWrapper<LawsCustomCompareCell>()
|
||||
.eq(LawsCustomCompareCell::getInfoId, infoId));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void createTableCellContent(XSSFSheet sheet, List<StandardVO> standardVOS, List<LawsCustomCompareInventory> featureList, List<LawsCustomCompareInventory> compareList, List<LawsCustomCompareCell> list) {
|
||||
for (int i = 2; i < compareList.size() + 2; i++) {
|
||||
// 创建行
|
||||
|
||||
Reference in New Issue
Block a user