Commit accd584f authored by suhuiguang's avatar suhuiguang

1.校验填写项是否合格

parent 976157f3
...@@ -401,4 +401,13 @@ public class InputItemController extends AbstractBaseController { ...@@ -401,4 +401,13 @@ public class InputItemController extends AbstractBaseController {
List<InputItemTemplateVo> itemTemplateVoList = ExcelUtils.importExcel(file, 1, 1, InputItemTemplateVo.class); List<InputItemTemplateVo> itemTemplateVoList = ExcelUtils.importExcel(file, 1, 1, InputItemTemplateVo.class);
return CommonResponseUtil.success(inputItemService.uploadListByTemplate(itemTemplateVoList, orgCode, userId)); return CommonResponseUtil.success(inputItemService.uploadListByTemplate(itemTemplateVoList, orgCode, userId));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "校验填写项是否合格")
@GetMapping(value = "/check-is-ok")
public CommonResponse checkIsOk(
@ApiParam(value = "检查项id",required = true) @RequestParam(value = "inputItemId") Long inputItemId,
@ApiParam(value = "填写内容",required = true) @RequestParam(value = "inputValue") String inputValue){
return CommonResponseUtil.success(inputItemService.checkIsOk(inputItemId,inputValue));
}
} }
...@@ -15,6 +15,10 @@ public class CheckInputParam { ...@@ -15,6 +15,10 @@ public class CheckInputParam {
return checkInputImg; return checkInputImg;
} }
public CheckInputParam(String inputValue){
this.inputValue = inputValue;
}
public void setCheckInputImg(List<String> checkInputImg) { public void setCheckInputImg(List<String> checkInputImg) {
this.checkInputImg = checkInputImg; this.checkInputImg = checkInputImg;
} }
......
...@@ -398,7 +398,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -398,7 +398,7 @@ public class CheckServiceImpl implements ICheckService {
checkDao.deleteBatch(list); checkDao.deleteBatch(list);
} }
private CheckInput paraseText(CheckInput checkInput, String json, CheckInputParam item, String isScore) { public static CheckInput paraseText(CheckInput checkInput, String json, CheckInputParam item, String isScore) {
JSONObject jsonObject = JSONObject.parseObject(json); JSONObject jsonObject = JSONObject.parseObject(json);
String checkType = jsonObject.getString("CheckType"); String checkType = jsonObject.getString("CheckType");
int score = 0; int score = 0;
...@@ -431,7 +431,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -431,7 +431,7 @@ public class CheckServiceImpl implements ICheckService {
return checkInput; return checkInput;
} }
private CheckInput paraseNumber(CheckInput checkInput, String json, CheckInputParam item, String isScore) { public static CheckInput paraseNumber(CheckInput checkInput, String json, CheckInputParam item, String isScore) {
JSONObject jsonObject = JSONObject.parseObject(json); JSONObject jsonObject = JSONObject.parseObject(json);
String OkUpStr = jsonObject.get("OkUp").toString(); String OkUpStr = jsonObject.get("OkUp").toString();
; ;
...@@ -472,7 +472,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -472,7 +472,7 @@ public class CheckServiceImpl implements ICheckService {
return checkInput; return checkInput;
} }
private CheckInput paraseSelect(CheckInput checkInput, String json, CheckInputParam item, String isScore) { public static CheckInput paraseSelect(CheckInput checkInput, String json, CheckInputParam item, String isScore) {
JSONArray jsonArray = JSONArray.parseArray(json); JSONArray jsonArray = JSONArray.parseArray(json);
int score = 0; int score = 0;
if (!ObjectUtils.isEmpty(jsonArray)) { if (!ObjectUtils.isEmpty(jsonArray)) {
......
...@@ -2,10 +2,12 @@ package com.yeejoin.amos.maintenance.business.service.impl; ...@@ -2,10 +2,12 @@ package com.yeejoin.amos.maintenance.business.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.maintenance.business.constants.XJConstant;
import com.yeejoin.amos.maintenance.business.dao.mapper.InputItemMapper; import com.yeejoin.amos.maintenance.business.dao.mapper.InputItemMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.RouteMapper; import com.yeejoin.amos.maintenance.business.dao.mapper.RouteMapper;
import com.yeejoin.amos.maintenance.business.dao.repository.IInputItemDao; import com.yeejoin.amos.maintenance.business.dao.repository.IInputItemDao;
import com.yeejoin.amos.maintenance.business.dao.repository.IPointInputItemDao; import com.yeejoin.amos.maintenance.business.dao.repository.IPointInputItemDao;
import com.yeejoin.amos.maintenance.business.param.CheckInputParam;
import com.yeejoin.amos.maintenance.business.param.InputItemPageParam; import com.yeejoin.amos.maintenance.business.param.InputItemPageParam;
import com.yeejoin.amos.maintenance.business.service.intfc.ICatalogTreeService; import com.yeejoin.amos.maintenance.business.service.intfc.ICatalogTreeService;
import com.yeejoin.amos.maintenance.business.service.intfc.IInputItemService; import com.yeejoin.amos.maintenance.business.service.intfc.IInputItemService;
...@@ -14,10 +16,9 @@ import com.yeejoin.amos.maintenance.business.vo.InputItemTemplateVo; ...@@ -14,10 +16,9 @@ import com.yeejoin.amos.maintenance.business.vo.InputItemTemplateVo;
import com.yeejoin.amos.maintenance.business.vo.InputItemVo; import com.yeejoin.amos.maintenance.business.vo.InputItemVo;
import com.yeejoin.amos.maintenance.business.vo.PointInputItemVo; import com.yeejoin.amos.maintenance.business.vo.PointInputItemVo;
import com.yeejoin.amos.maintenance.core.util.query.BaseQuerySpecification; import com.yeejoin.amos.maintenance.core.util.query.BaseQuerySpecification;
import com.yeejoin.amos.maintenance.dao.entity.CatalogTree; import com.yeejoin.amos.maintenance.dao.entity.CheckInput;
import com.yeejoin.amos.maintenance.dao.entity.InputItem; import com.yeejoin.amos.maintenance.dao.entity.InputItem;
import com.yeejoin.amos.maintenance.feign.RemoteSecurityService; import com.yeejoin.amos.maintenance.feign.RemoteSecurityService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -230,4 +231,18 @@ public class InputItemServiceImpl implements IInputItemService { ...@@ -230,4 +231,18 @@ public class InputItemServiceImpl implements IInputItemService {
return inputItemMapper.insertList(list); return inputItemMapper.insertList(list);
} }
@Override
public Boolean checkIsOk(Long inputItemId, String inputValue) {
InputItem inputItem = inputItemDao.findById(inputItemId).orElseThrow(() -> new RuntimeException("检查项不存在"));
CheckInput checkInput = new CheckInput();
if (XJConstant.INPUT_ITEM_SELECT.equals(inputItem.getItemType())) {
CheckServiceImpl.paraseSelect(checkInput, inputItem.getDataJson(), new CheckInputParam(inputValue), inputItem.getIsScore());
} else if (XJConstant.INPUT_ITEM_NUMBER.equals(inputItem.getItemType())) {
CheckServiceImpl.paraseNumber(checkInput, inputItem.getDataJson(), new CheckInputParam(inputValue), inputItem.getIsScore());
} else if (XJConstant.INPUT_ITEM_TEXT.equals(inputItem.getItemType())) {
CheckServiceImpl.paraseText(checkInput, inputItem.getDataJson(), new CheckInputParam(inputValue), inputItem.getIsScore());
}
return checkInput.getIsOk().equals(XJConstant.OK);
}
} }
...@@ -112,4 +112,6 @@ public interface IInputItemService { ...@@ -112,4 +112,6 @@ public interface IInputItemService {
Boolean uploadListByTemplate(List<InputItemTemplateVo> itemTemplateVoList, String orgCode, String userId) throws Exception; Boolean uploadListByTemplate(List<InputItemTemplateVo> itemTemplateVoList, String orgCode, String userId) throws Exception;
Integer insertList(List<InputItem> list); Integer insertList(List<InputItem> list);
Boolean checkIsOk(Long inputItemId, String inputValue);
} }
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