分阶段实施详情相关开发。

This commit is contained in:
wangzhijiang
2023-02-23 16:38:10 +08:00
parent a93292d7d5
commit bcf86e986d
3 changed files with 65 additions and 1 deletions
@@ -58,4 +58,6 @@ public interface IPhasedImplementationDetailsEOService extends IService<PhasedIm
* @return
*/
List<PhasedImplementationDetailsEO> queryList();
boolean insertBatch(List<PhasedImplementationDetailsEO> phasedImplDetailsEOList);
}
@@ -897,6 +897,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
}
}
// 查询分阶段实施详情信息
QueryWrapper<PhasedImplementationDetailsEO> phasedImplDetailsQueryWrap = new QueryWrapper<>();
phasedImplDetailsQueryWrap.lambda().eq(PhasedImplementationDetailsEO::getBussDocumentLibraryId,id);
List<PhasedImplementationDetailsEO> phasedImplementationDetailsEOList = this.phasedImplementationDetailsEOService.list(phasedImplDetailsQueryWrap);
dataList.get(0).put("phasedImplementationDetailsEOList",phasedImplementationDetailsEOList);
return dataList;
}
// public List<Map<String, Object>> getDocumentInfoById(String id, String cut) {
@@ -1935,6 +1942,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String insertValue = mustValues + valuesBuilder.toString();
bussDocumentLibraryEOMapper.insertInfo(insertField, insertValue);
map.put("id", idTemp);
List<PhasedImplementationDetailsEO> phasedImplementationDetailsEOS = this.insertBatchPhasedImplementationDetailsInfo(map);
String replaceStandard = StringUtils.valueOf(map.get("replace_standard"));
if (StringUtils.isNotBlank(replaceStandard)) {
//新增时如果填写代替标准,需要向填写的代替标准的负责人发消息
@@ -1943,7 +1953,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//向订阅该领域管理的人发消息和飞书
sendMsg(map, idTemp);
//添加es
map.put("id", idTemp);
map.put("module_type", "文档库");
map.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue());
map.put("create_time", new Date());
@@ -2318,6 +2327,10 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String id = StringUtils.valueOf(map.get("id"));
String title = StringUtils.valueOf(map.get("title"));
String titleEn = StringUtils.valueOf(map.get("title_en"));
// 批量添加分阶段实施明细信息
List<PhasedImplementationDetailsEO> phasedImplDetailsEOList = this.insertBatchPhasedImplementationDetailsInfo(map);
//通过id查询数据
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMapsAll(id);
if(dataList.size() != 0){
@@ -6701,4 +6714,31 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
return count;
}
/**
* 批量添加-分阶段实施明细信息
* @param map
* @return
*/
public List<PhasedImplementationDetailsEO> insertBatchPhasedImplementationDetailsInfo(Map<String, Object> map){
String id = (String) map.get("id");
List<PhasedImplementationDetailsEO> phasedImplDetailsEOList = new ArrayList<>();
if(map.containsKey("phasedImplementationDetailsEOList")){
PhasedImplementationDetailsEO phasedImplDetailsEO = null;
JSONArray phasedImplDetailsEOJsonArr = JSONObject.parseArray(JSONObject.toJSONString(map.get("phasedImplementationDetailsEOList")));
for (Object phasedImplDetailsEOJson : phasedImplDetailsEOJsonArr) {
phasedImplDetailsEO = JSONObject.parseObject(JSONObject.toJSONString(phasedImplDetailsEOJson),PhasedImplementationDetailsEO.class);
phasedImplDetailsEO.setBussDocumentLibraryId(id);
phasedImplDetailsEOList.add(phasedImplDetailsEO);
}
boolean insertPhasedBatchFlag = this.phasedImplementationDetailsEOService.insertBatch(phasedImplDetailsEOList);
if(!insertPhasedBatchFlag){
throw new JeroBootException("添加分阶段实施详情信息失败!");
}
}
return phasedImplDetailsEOList;
}
}
@@ -1,8 +1,10 @@
package com.jero.modules.document.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.modules.document.entity.PhasedImplementationDetailsEO;
import com.jero.modules.document.mapper.PhasedImplementationDetailsEOMapper;
import com.jero.modules.document.service.IPhasedImplementationDetailsEOService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date;
@@ -86,4 +88,24 @@ public class PhasedImplementationDetailsEOServiceImpl extends ServiceImpl<Phased
public List<PhasedImplementationDetailsEO> queryList() {
return list();
}
@Override
public boolean insertBatch(List<PhasedImplementationDetailsEO> phasedImplDetailsEOList) {
boolean flag = true;
if(CollectionUtils.isNotEmpty(phasedImplDetailsEOList)){
try {
String bussDocumentLibraryId = phasedImplDetailsEOList.get(0).getBussDocumentLibraryId();
QueryWrapper<PhasedImplementationDetailsEO> deleteWrap = new QueryWrapper<>();
deleteWrap.lambda().eq(PhasedImplementationDetailsEO::getBussDocumentLibraryId,bussDocumentLibraryId);
this.baseMapper.delete(deleteWrap);
this.saveBatch(phasedImplDetailsEOList);
}catch (Exception ex){
flag = false;
ex.printStackTrace();
log.error("批量添加分阶段实施详情信息失败:" + ex.getMessage());
}
}
return flag;
}
}