| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- package cn.com.goldenwater.dcproj.controller.zhejiang;
- import cn.com.goldenwater.dcproj.model.AttZhejiangJgCheck;
- import cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr;
- import cn.com.goldenwater.dcproj.param.AttZhejiangJgCheckParam;
- import cn.com.goldenwater.dcproj.service.AttZhejiangJgCheckService;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.service.BisZhejiangJgRgstrService;
- import cn.com.goldenwater.id.util.UuidUtil;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiModelProperty;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.lang3.StringUtils;
- import com.github.pagehelper.PageInfo;
- 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 lune
- * @date 2020-5-12
- */
- @Api(value = "ATT 管理",tags="ATT 管理")
- @RestController
- @RequestMapping("/att/zhejiang/jg/check")
- public class AttZhejiangJgCheckController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private AttZhejiangJgCheckService attZhejiangJgCheckService;
- @Autowired
- private BisZhejiangJgRgstrService bisZhejiangJgRgstrService;
- @ApiOperation(value = "添加/修改")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<AttZhejiangJgCheck> insert(@ApiParam(name = "attZhejiangJgCheck", value = "AttZhejiangJgCheck", required = true) @RequestBody AttZhejiangJgCheck attZhejiangJgCheck) {
- attZhejiangJgCheck.setPersId(getCurrentPersId());
- attZhejiangJgCheck.setUptm(new Date());
- if(StringUtils.isBlank(attZhejiangJgCheck.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- attZhejiangJgCheck.setId(uuid);
- attZhejiangJgCheck.setIntm(new Date());
- attZhejiangJgCheckService.insert(attZhejiangJgCheck);
- }else{
- attZhejiangJgCheckService.update(attZhejiangJgCheck);
- }
- if (StringUtils.isNotBlank(attZhejiangJgCheck.getDepartId())) {
- BisZhejiangJgRgstr rgstr = bisZhejiangJgRgstrService.get(attZhejiangJgCheck.getDepartId());
- if (rgstr != null) {
- rgstr.setJgState(attZhejiangJgCheck.getDataStat());
- if (!"2".equals(rgstr.getState())) {
- rgstr.setState("1");
- }
- bisZhejiangJgRgstrService.update(rgstr);
- }
- }
- return buildSuccessResponse(attZhejiangJgCheck);
- }
- @ApiOperation(value = "根据ID删除")
- @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = attZhejiangJgCheckService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<AttZhejiangJgCheck> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- AttZhejiangJgCheck attZhejiangJgCheck = attZhejiangJgCheckService.get(id);
- return buildSuccessResponse(attZhejiangJgCheck);
- }
- @ApiOperation(value = "获取(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<AttZhejiangJgCheck>> list(@ApiParam(name = "attZhejiangJgCheckParam", value = "attZhejiangJgCheckParam", required = true) @RequestBody AttZhejiangJgCheckParam attZhejiangJgCheckParam) {
- List<AttZhejiangJgCheck> attZhejiangJgCheckList = attZhejiangJgCheckService.findList(attZhejiangJgCheckParam);
- return buildSuccessResponse(attZhejiangJgCheckList);
- }
- @ApiOperation(value = "获取(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<AttZhejiangJgCheck>> page(@ApiParam(name = "attZhejiangJgCheckParam", value = "attZhejiangJgCheckParam", required = true) @RequestBody AttZhejiangJgCheckParam attZhejiangJgCheckParam) {
- PageInfo<AttZhejiangJgCheck> attZhejiangJgCheckList = attZhejiangJgCheckService.findPageInfo(attZhejiangJgCheckParam);
- return buildSuccessResponse(attZhejiangJgCheckList);
- }
- /**
- * 根据部门Id获取浙江监管管理信息
- * @param departId 部门Id
- * @return
- */
- @ApiModelProperty(value = "获取浙江监管管理信息(单表)")
- @GetMapping("/check/{departId}")
- public BaseResponse<AttZhejiangJgCheck> getAttZhejiangJgCheckByDepartId(@ApiParam(name = "departId", value = "departId", required = true) @PathVariable String departId) {
- AttZhejiangJgCheckParam attZhejiangJgCheckParam = new AttZhejiangJgCheckParam();
- attZhejiangJgCheckParam.setDepartId(departId);
- AttZhejiangJgCheck attZhejiangJgCheck = attZhejiangJgCheckService.getBy(attZhejiangJgCheckParam);
- return buildSuccessResponse(attZhejiangJgCheck);
- }
- }
|