Merge remote-tracking branch 'origin/dev_2nd_LCYH' into dev_2nd_LCYH

This commit is contained in:
wangzhijiang
2023-04-07 11:21:12 +08:00
3 changed files with 46 additions and 4 deletions
@@ -72,8 +72,8 @@ public class HeadCustomEOController extends JeroController<HeadCustomEO, IHeadCu
@AutoLog(value = "自定义表头-列表查询")
@ApiOperation(value="自定义表头-列表查询", notes="自定义表头-列表查询")
@GetMapping(value = "/list")
public Result<List<HeadCustomVO>> queryList(String cut,String moduleFlag) {
List<HeadCustomVO> list = headCustomEOService.queryList(cut,moduleFlag);
public Result<List<HeadCustomVO>> queryList(String cut,String moduleFlag,String paramsManifestId) {
List<HeadCustomVO> list = headCustomEOService.queryList(cut,moduleFlag,paramsManifestId);
return Result.OK(list);
}
@@ -59,5 +59,5 @@ public interface IHeadCustomEOService extends IService<HeadCustomEO> {
*
* @return
*/
List<HeadCustomVO> queryList(String cut, String moduleFlag);
List<HeadCustomVO> queryList(String cut, String moduleFlag,String paramsManifestId);
}
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.cert.collect.entity.ParamsConfigEO;
import com.jero.modules.cert.collect.service.IParamsConfigEOService;
import com.jero.modules.head.entity.HeadCustomEO;
import com.jero.modules.head.enums.AffirmFlagEnum;
import com.jero.modules.head.enums.headCustomEnum;
@@ -14,6 +16,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -24,6 +27,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* @Description: 自定义表头
@@ -33,6 +37,8 @@ import java.util.stream.Collectors;
*/
@Service
public class HeadCustomEOServiceImpl extends ServiceImpl<HeadCustomEOMapper, HeadCustomEO> implements IHeadCustomEOService {
@Autowired
private IParamsConfigEOService paramsConfigEOService;
/**
* 保存
@@ -232,7 +238,7 @@ public class HeadCustomEOServiceImpl extends ServiceImpl<HeadCustomEOMapper, Hea
* @return
*/
@Override
public List<HeadCustomVO> queryList(String cut, String moduleFlag) {
public List<HeadCustomVO> queryList(String cut, String moduleFlag,String paramsManifestId) {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
LambdaQueryWrapper<HeadCustomEO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(HeadCustomEO::getCreateBy, loginUser.getUsername()).in(HeadCustomEO::getModuleFlag, moduleFlag);
@@ -273,6 +279,10 @@ public class HeadCustomEOServiceImpl extends ServiceImpl<HeadCustomEOMapper, Hea
getHeadCustomVO(cut, headCustomEO, headCustomVO);
headCustomVOOneList.add(headCustomVO);
}
//参数项收集清单和上报库详情,单独处理配置项
dynamicConfig(moduleFlag, paramsManifestId, headCustomVOOneList);
if ("法规清单".equals(moduleFlag) || "虚拟清单详情".equals(moduleFlag) || "维护清单".equals(moduleFlag)) {
res = checkDefaultHead(headCustomVOOneList, cut, moduleFlag).stream().distinct().collect(Collectors.toList());
} else {
@@ -282,6 +292,38 @@ public class HeadCustomEOServiceImpl extends ServiceImpl<HeadCustomEOMapper, Hea
return res;
}
/**
* 参数项收集清单和上报库详情,单独处理配置项
* @param moduleFlag
* @param paramsManifestId
* @param headCustomVOOneList
*/
private void dynamicConfig(String moduleFlag, String paramsManifestId, List<HeadCustomVO> headCustomVOOneList) {
if((headCustomEnum.PARAMETER_COLLECTION_LIST.getName().equals(moduleFlag)
|| headCustomEnum.REPORT_DATABASE_DETAILS.getName().equals(moduleFlag))
&& !headCustomVOOneList.isEmpty()){
List<ParamsConfigEO> paramsConfigEOList = paramsConfigEOService.queryList(paramsManifestId);
if(!paramsConfigEOList.isEmpty()){
int index = IntStream.range(0, headCustomVOOneList.size())
.filter(x -> headCustomVOOneList.get(x).getTitle().equals("查看")
|| headCustomVOOneList.get(x).getTitle().equals("View")).findFirst().orElse(-1);
headCustomVOOneList.removeIf(e-> StringUtils.isNotBlank(e.getTitle())
&& (e.getTitle().contains("查看") || e.getTitle().contains("View")));
int count=1;
List<HeadCustomVO> headCustomVOList = new LinkedList<>();
for (ParamsConfigEO paramsConfigEO : paramsConfigEOList) {
HeadCustomVO headCustomVO = new HeadCustomVO();
headCustomVO.setDb_field_name(paramsConfigEO.getId());
headCustomVO.setDb_field_txt(String.valueOf(count++));
headCustomVO.setIsLock(paramsConfigEO.getIsLock());
headCustomVO.setType("true");
headCustomVOList.add(headCustomVO);
}
headCustomVOOneList.addAll(index , headCustomVOList);
}
}
}
/**
* 检查默认表头,如果不存在则添加进列表
*/