| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- package cn.com.goldenwater.dcproj.controller.sdqa;
- import cn.com.goldenwater.dcproj.model.BisInspQaScoreSd;
- import cn.com.goldenwater.dcproj.model.BisInspStstnScore;
- import cn.com.goldenwater.dcproj.param.BisInspQaScoreSdParam;
- import cn.com.goldenwater.dcproj.service.BisInspQaScoreSdService;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.service.BisInspStstnScoreService;
- import cn.com.goldenwater.dcproj.utils.StringUtils;
- import cn.com.goldenwater.id.util.UuidUtil;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.util.Assert;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import java.lang.reflect.Field;
- import java.util.List;
- import java.util.stream.Stream;
- /**
- * @author lhc
- * @date 2024-4-7
- */
- @Api(value = "xxx管理",tags="xxx管理")
- @RestController
- @RequestMapping("/bis/insp/sdqa/score")
- public class BisInspQaScoreSdController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspQaScoreSdService bisInspQaScoreSdService;
- @Autowired
- private BisInspStstnScoreService bisInspStstnScoreService;
- @ApiOperation(value = "添加xxx")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspQaScoreSd> insert(@ApiParam(name = "bisInspQaScoreSd", value = "BisInspQaScoreSd", required = true) @RequestBody BisInspQaScoreSd bisInspQaScoreSd) throws NoSuchFieldException, IllegalAccessException {
- bisInspQaScoreSd.setPersId(getCurrentPersId());
- bisInspQaScoreSdService.update(bisInspQaScoreSd);
- Field[] fields = bisInspQaScoreSd.getClass().getDeclaredFields();
- for(Field file : fields){
- if(file.getName().indexOf("Note")>-1 && !"note".equals(file.getName())){
- Field newFiled = bisInspQaScoreSd.getClass().getDeclaredField(file.getName());
- newFiled.setAccessible(true);
- BisInspStstnScore bisInspStstnScore = bisInspStstnScoreService.getByCaseScore(bisInspQaScoreSd.getId(), file.getName().replace("Note",""));
- if(bisInspStstnScore!=null){
- bisInspStstnScore.setExplain(newFiled.get(bisInspQaScoreSd).toString());
- bisInspStstnScoreService.update(bisInspStstnScore);
- }else{
- BisInspStstnScore bisInspStstnScore_n = new BisInspStstnScore();
- bisInspStstnScore_n.setCaseId(bisInspQaScoreSd.getId());
- bisInspStstnScore_n.setScoreName(file.getName().replace("Note",""));
- bisInspStstnScore_n.setExplain(newFiled.get(bisInspQaScoreSd).toString());
- bisInspStstnScoreService.insert(bisInspStstnScore_n);
- }
- }
- }
- return buildSuccessResponse(bisInspQaScoreSd);
- }
- @ApiOperation(value = "根据ID删除xxx")
- @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = bisInspQaScoreSdService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取xxx(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspQaScoreSd> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) throws Exception{
- BisInspQaScoreSd bisInspQaScoreSd = bisInspQaScoreSdService.get(id);
- Field[] fields = bisInspQaScoreSd.getClass().getDeclaredFields();
- for(Field file : fields){
- if(file.getName().indexOf("Note")>-1 && !"note".equals(file.getName())){
- Field newFiled = bisInspQaScoreSd.getClass().getDeclaredField(file.getName());
- newFiled.setAccessible(true);
- BisInspStstnScore bisInspStstnScore = bisInspStstnScoreService.getByCaseScore(bisInspQaScoreSd.getId(), file.getName().replace("Note",""));
- if(bisInspStstnScore!=null){
- newFiled.set(bisInspQaScoreSd,bisInspStstnScore.getExplain());
- }else{
- newFiled.set(bisInspQaScoreSd,"");
- }
- }
- }
- return buildSuccessResponse(bisInspQaScoreSd);
- }
- @ApiOperation(value = "获取工程质量监督履职情况评分")
- @RequestMapping(value = "/findList/{rgstrId}", method = RequestMethod.GET)
- public BaseResponse<List<BisInspQaScoreSd>> findList(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) {
- BisInspQaScoreSdParam bisInspQaScoreSdParam = new BisInspQaScoreSdParam();
- bisInspQaScoreSdParam.setRgstrId(rgstrId);
- List<BisInspQaScoreSd> list = bisInspQaScoreSdService.findList(bisInspQaScoreSdParam);
- return buildSuccessResponse(list);
- }
- }
|