package cn.com.goldenwater.dcproj.controller.tac; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.model.TacPawpBstocmCpssInfo; import cn.com.goldenwater.dcproj.model.TacPawpRgstr; import cn.com.goldenwater.dcproj.param.TacPawpBstocmCpssInfoParam; import cn.com.goldenwater.dcproj.service.BisInspAllRlationService; import cn.com.goldenwater.dcproj.service.TacPawpBstocmCpssInfoService; import cn.com.goldenwater.dcproj.service.TacPawpRgstrService; import cn.com.goldenwater.id.util.UuidUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; /** * @author lune * @date 2019-6-21 */ @Api(value = "TAC 专业稽察工作底稿--附件2建设管理基本情况表--3.建设监理制管理", tags = "TAC 专业稽察工作底稿--附件2建设管理基本情况表--3.建设监理制管理") @RestController @RequestMapping("/tac/pawp/bstocm/cpss/info") public class TacPawpBstocmCpssInfoController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private TacPawpBstocmCpssInfoService tacPawpBstocmCpssInfoService; @Autowired private TacPawpRgstrService tacPawpRgstrService; @ApiOperation(value = "添加专业稽察工作底稿--附件2建设管理基本情况表--3.建设监理制") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "tacPawpBstocmCpssInfo", value = "TacPawpBstocmCpssInfo", required = true) @RequestBody TacPawpBstocmCpssInfo tacPawpBstocmCpssInfo) { if (StringUtils.isNotBlank(tacPawpBstocmCpssInfo.getId())) { tacPawpBstocmCpssInfoService.update(tacPawpBstocmCpssInfo); } else { String uuid = UuidUtil.uuid(); tacPawpBstocmCpssInfo.setId(uuid); int ret = tacPawpBstocmCpssInfoService.insert(tacPawpBstocmCpssInfo); } TacPawpRgstr tacPawpRgstr = new TacPawpRgstr(); tacPawpRgstr.setId(tacPawpBstocmCpssInfo.getRgstrId()); tacPawpRgstr.setBstocmCpssStat(StringUtils.isBlank(tacPawpBstocmCpssInfo.getBstocmCpssStat()) ? "0" : tacPawpBstocmCpssInfo.getBstocmCpssStat()); tacPawpRgstrService.update(tacPawpRgstr); return buildSuccessResponse(tacPawpBstocmCpssInfo); } @ApiOperation(value = "根据ID删除专业稽察工作底稿--附件2建设管理基本情况表--3.建设监理制") @RequestMapping(value = "/del/{id}", method = RequestMethod.GET) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = tacPawpBstocmCpssInfoService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取专业稽察工作底稿--附件2建设管理基本情况表--3.建设监理制(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { TacPawpBstocmCpssInfo tacPawpBstocmCpssInfo = tacPawpBstocmCpssInfoService.get(id); return buildSuccessResponse(tacPawpBstocmCpssInfo); } @Autowired private BisInspAllRlationService allRlationService; @ApiOperation(value = "根据rgstrId获取专业稽察工作底稿--附件2建设管理基本情况表--3.建设监理制(单表)") @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET) public BaseResponse getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId, HttpServletRequest request) { TacPawpBstocmCpssInfoParam pawpRaiobisParam = new TacPawpBstocmCpssInfoParam(); pawpRaiobisParam.setRgstrId(allRlationService.getRegistr(request, rgstrId)); TacPawpBstocmCpssInfo tacPawpRaiobis = tacPawpBstocmCpssInfoService.getBy(pawpRaiobisParam); return buildSuccessResponse(tacPawpRaiobis); } }