package cn.com.goldenwater.dcproj.controller.anze; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.constValue.BisInspEnum; import cn.com.goldenwater.dcproj.constValue.CommonLabel; import cn.com.goldenwater.dcproj.model.AttProjectInsurance; import cn.com.goldenwater.dcproj.model.AttProjectInsuranceRecord; import cn.com.goldenwater.dcproj.model.BisInspAnzeRgstr; import cn.com.goldenwater.dcproj.param.TypeParam; import cn.com.goldenwater.dcproj.service.AttProjectInsuranceRecordService; import cn.com.goldenwater.dcproj.service.BisInspAnzeRgstrService; import cn.com.goldenwater.dcproj.service.OlBisInspOrgService; import cn.com.goldenwater.dcproj.utils.AdLevelUtil; import cn.com.goldenwater.dcproj.utils.DateUtils; import com.github.pagehelper.PageInfo; 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.util.Assert; import org.springframework.web.bind.annotation.*; /** * @author lql * @date 2026-4-21 */ @Api(value = "安责险管理", tags = "安责险管理") @RestController @RequestMapping("/bis/insp/anze/rgstr") public class BisInspAnzeRgstrController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisInspAnzeRgstrService bisInspAnzeRgstrService; @Autowired private OlBisInspOrgService olBisInspOrgService; @Autowired private AttProjectInsuranceRecordService attProjectInsuranceRecordService; @ApiOperation(value = "添加安责险") @RequestMapping(value = "/add", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspAnzeRgstr", value = "BisInspAnzeRgstr", required = true) @RequestBody BisInspAnzeRgstr bisInspAnzeRgstr) { int ret = bisInspAnzeRgstrService.insert(bisInspAnzeRgstr); return buildSuccessResponse(bisInspAnzeRgstr); } @ApiOperation(value = "根据ID删除安责险") @RequestMapping(value = "delete/{id}", method = RequestMethod.POST) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = bisInspAnzeRgstrService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "更新安责险信息") @RequestMapping(value = "/update", method = RequestMethod.POST) public BaseResponse update(@ApiParam(name = "bisInspAnzeRgstr", value = "BisInspAnzeRgstr", required = true) @RequestBody BisInspAnzeRgstr bisInspAnzeRgstr) { Assert.notNull(bisInspAnzeRgstr.getId(), "主键id为必填参数"); int ret = bisInspAnzeRgstrService.update(bisInspAnzeRgstr); return buildSuccessResponse(bisInspAnzeRgstr); } @ApiOperation(value = "根据ID获取安责险(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisInspAnzeRgstr bisInspAnzeRgstr = bisInspAnzeRgstrService.get(id); return buildSuccessResponse(bisInspAnzeRgstr); } @ApiOperation(value = "获取福建通用督察(分页)") @RequestMapping(value = "/findPage", method = RequestMethod.POST) public BaseResponse findPageInfo(@RequestBody TypeParam typeParam) { typeParam.setPresId(getCurrentPersId()); typeParam.setpType(BisInspEnum.ANZE.getValue()); typeParam.setOrgId(getCurrentOrgId()); if (StringUtils.isBlank(typeParam.getTabType())) { typeParam.setTabType(CommonLabel.TAB_TYPE); } typeParam.setNowTime(DateUtils.getToday("yyyy-MM-dd")); if (!org.apache.commons.lang.StringUtils.isBlank(typeParam.getAdCodes())) { typeParam.setAdCodes(AdLevelUtil.getListAddvcd(typeParam.getAdCodes())); } else { typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId()))); } return buildSuccessResponse(bisInspAnzeRgstrService.findAnzePage(typeParam)); } @ApiOperation(value = "根据ID获取安责险(单表)") @RequestMapping(value = "/getBase/{id}", method = RequestMethod.GET) public BaseResponse getBase(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { return buildSuccessResponse(bisInspAnzeRgstrService.getBaseById(id)); } @ApiOperation(value = "根据ID获取安责险(单表)") @RequestMapping(value = "/getRecord/{id}", method = RequestMethod.GET) public BaseResponse getRecord(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { return buildSuccessResponse(bisInspAnzeRgstrService.getRecord(id)); } @ApiOperation(value = "添加投保记录") @RequestMapping(value = "/addRecord", method = RequestMethod.POST) public BaseResponse insertRecord(@ApiParam(name = "attProjectInsuranceRecord", value = "AttProjectInsuranceRecord", required = true) @RequestBody AttProjectInsuranceRecord attProjectInsuranceRecord) { if (StringUtils.isBlank(attProjectInsuranceRecord.getId())) { AttProjectInsurance attProjectInsurance = bisInspAnzeRgstrService.getBaseById(attProjectInsuranceRecord.getRgstrId()); if (attProjectInsurance != null) { attProjectInsuranceRecord.setProjectId(attProjectInsurance.getId()); int ret = attProjectInsuranceRecordService.insert(attProjectInsuranceRecord); return buildSuccessResponse(attProjectInsuranceRecord); } } else { int ret = attProjectInsuranceRecordService.update(attProjectInsuranceRecord); return buildSuccessResponse(attProjectInsuranceRecord); } return buildFailResponse(); } }