| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package cn.com.goldenwater.dcproj.controller.rsml;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.model.BisInspRsmlRgstrSafe;
- import cn.com.goldenwater.dcproj.param.BisInspRsmlRgstrSafeParam;
- import cn.com.goldenwater.dcproj.service.BisInspRsmlRgstrSafeService;
- import cn.com.goldenwater.dcproj.service.BisInspRsmlRgstrService;
- import cn.com.goldenwater.id.util.UuidUtil;
- import cn.com.goldenwater.target.CheckException;
- 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 java.util.Date;
- import java.util.List;
- /**
- * @author lhc
- * @date 2021-3-15
- */
- @Api(value = "xxx管理", tags = "xxx管理")
- @RestController
- @RequestMapping("/bis/insp/rsml/rgstr/safe")
- public class BisInspRsmlRgstrSafeController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspRsmlRgstrSafeService bisInspRsmlRgstrSafeService;
- @Autowired
- private BisInspRsmlRgstrService bisInspRsmlRgstrService;
- @ApiOperation(value = "修改xxx")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspRsmlRgstrSafe> insert(@ApiParam(name = "bisInspRsmlRgstrSafe", value = "BisInspRsmlRgstrSafe", required = true) @RequestBody BisInspRsmlRgstrSafe bisInspRsmlRgstrSafe) {
- if (StringUtils.isBlank(bisInspRsmlRgstrSafe.getRgstrId())) {
- throw new CheckException("缺少登记表编码!");
- }
- BisInspRsmlRgstrSafeParam benefitsParam = new BisInspRsmlRgstrSafeParam();
- benefitsParam.setRgstrId(bisInspRsmlRgstrSafe.getRgstrId());
- List<BisInspRsmlRgstrSafe> list = bisInspRsmlRgstrSafeService.findList(benefitsParam);
- bisInspRsmlRgstrSafe.setUpTm(new Date());
- if (list != null && list.size() > 0) {
- bisInspRsmlRgstrSafe.setId(list.get(0).getId());
- bisInspRsmlRgstrSafeService.update(bisInspRsmlRgstrSafe);
- } else {
- bisInspRsmlRgstrSafe.setId(UuidUtil.uuid());
- bisInspRsmlRgstrSafe.setInTm(new Date());
- bisInspRsmlRgstrSafeService.insert(bisInspRsmlRgstrSafe);
- }
- bisInspRsmlRgstrService.updateRsvr(bisInspRsmlRgstrSafe.getRgstrId(), bisInspRsmlRgstrSafe.getStatus(), "persSafe");
- return buildSuccessResponse(bisInspRsmlRgstrSafe);
- }
- @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 = bisInspRsmlRgstrSafeService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取xxx(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspRsmlRgstrSafe> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspRsmlRgstrSafe bisInspRsmlRgstrSafe = bisInspRsmlRgstrSafeService.get(id);
- return buildSuccessResponse(bisInspRsmlRgstrSafe);
- }
- }
|