Commit 3dc80e2e authored by chenzhao's avatar chenzhao

修改巡检代码

parent 4e060184
......@@ -14,6 +14,7 @@ import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Repository
@Mapper
......@@ -61,7 +62,7 @@ public interface InputItemMapper extends BaseMapper<InputItem> {
public List<PointInputItemVo> queryCustomInputItem( HashMap<String, Object> param );
List<PointInputItemVo> queryCustomInputItemByCodes(@Param("inputItemNos") List<String> inputItemNos);
List<PointInputItemVo> queryCustomInputItemByCodes(@Param("inputItemNos") Set<String> inputItemNos);
public List<InputItemVo> getInputItemListByitemNos(@Param("itemNos") String[] itemNos);
......
......@@ -47,6 +47,7 @@ import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -282,11 +283,14 @@ public class PointServiceImpl implements IPointService {
ids.add(point.getId());
if (StringUtil.isNotEmpty(param.getEquipInputInfo())) {
String[] infos = param.getEquipInputInfo().split("\\|");
for (int i = 0; i < infos.length; i++) {
String[] split = infos[i].split(":");
String[] info = param.getEquipInputInfo().split("\\|");
Set<String> infos=new HashSet<>();
Collections.addAll(infos,info);
for (String e : infos) {
String[] split = e.split(":");
String equipCode = split[0];
List<String> inputItemCodes = Arrays.asList(split[1].split(","));
Set<String> inputItemCodes = new HashSet<>(Arrays.asList(split[1].split(",")));
// List<String> inputItemCodes = Arrays.asList(split[1].split(","));
List<RoutePoint> routePointList = iRoutePointDao.queryByPointId(point.getId());
HashMap<String, String> equipByCode = routePointItemMapper.getEquipByCode(equipCode);
if (ObjectUtils.isEmpty(equipByCode)) {
......@@ -315,6 +319,9 @@ public class PointServiceImpl implements IPointService {
}
this.addPointClassifyByPointId(newPointClassify);
List<PointInputItemVo> customInputList = inputItemMapper.queryCustomInputItemByCodes(inputItemCodes);
if (ValidationUtil.isEmpty(customInputList) || customInputList.size() < inputItemCodes.size()) {
throw new BadRequest(split[1]+"中存在不正确的检查项编号");
}
for (PointInputItemVo pItemVo : customInputList) {
PointInputItem pointInputItem = new PointInputItem();
pointInputItem.setPointId(newPointClassify.getPointId());
......@@ -336,6 +343,7 @@ public class PointServiceImpl implements IPointService {
}
}
}
}
String inputItems = param.getInputItems();
......
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