| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- package cn.com.goldenwater.dcproj.controller.rsml;
- import cn.com.goldenwater.dcproj.model.BisInspRsmlRgstr;
- import cn.com.goldenwater.dcproj.model.BisInspRsmlRgstrRunManage;
- import cn.com.goldenwater.dcproj.param.BisInspRsmlRgstrRunManageParam;
- import cn.com.goldenwater.dcproj.service.BisInspRsmlRgstrRunManageService;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.service.BisInspRsmlRgstrService;
- 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 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.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.RestController;
- import javax.servlet.http.HttpServletRequest;
- import java.util.Date;
- import java.util.List;
- /**
- * @author lune
- * @date 2020-3-9
- */
- @Api(value = "BIS 运行管理情况管理",tags="BIS 运行管理情况管理")
- @RestController
- @RequestMapping("/bis/insp/rsml/rgstr/run/manage")
- public class BisInspRsmlRgstrRunManageController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspRsmlRgstrRunManageService bisInspRsmlRgstrRunManageService;
- @Autowired
- private BisInspRsmlRgstrService bisInspRsmlRgstrService;
- @ApiOperation(value = "添加/修改运行管理情况")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspRsmlRgstrRunManage> insert(@ApiParam(name = "bisInspRsmlRgstrRunManage", value = "BisInspRsmlRgstrRunManage", required = true) @RequestBody BisInspRsmlRgstrRunManage bisInspRsmlRgstrRunManage) {
- if(StringUtils.isBlank(bisInspRsmlRgstrRunManage.getId())) {
- BisInspRsmlRgstrRunManageParam runManageParam = new BisInspRsmlRgstrRunManageParam();
- runManageParam.setRgstrId(bisInspRsmlRgstrRunManage.getRgstrId());
- List<BisInspRsmlRgstrRunManage> list = bisInspRsmlRgstrRunManageService.findList(runManageParam);
- if (list.size() > 0) {
- bisInspRsmlRgstrRunManage.setId(list.get(0).getId());
- bisInspRsmlRgstrRunManage.setUptm(new Date());
- bisInspRsmlRgstrRunManageService.update(bisInspRsmlRgstrRunManage);
- } else {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisInspRsmlRgstrRunManage.setIntm(new Date());
- bisInspRsmlRgstrRunManage.setUptm(new Date());
- bisInspRsmlRgstrRunManage.setId(uuid);
- bisInspRsmlRgstrRunManageService.insert(bisInspRsmlRgstrRunManage);
- }
- }else{
- bisInspRsmlRgstrRunManage.setUptm(new Date());
- bisInspRsmlRgstrRunManageService.update(bisInspRsmlRgstrRunManage);
- }
- if (StringUtils.isNotBlank(bisInspRsmlRgstrRunManage.getRgstrId())) {
- BisInspRsmlRgstr rgstr = bisInspRsmlRgstrService.get(bisInspRsmlRgstrRunManage.getRgstrId());
- if (rgstr != null) {
- rgstr.setRunManageState(bisInspRsmlRgstrRunManage.getStatus());
- if (!"2".equals(rgstr.getState())) {
- rgstr.setState("1");
- }
- bisInspRsmlRgstrService.update(rgstr);
- }
- }
- return buildSuccessResponse(bisInspRsmlRgstrRunManage);
- }
- @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 = bisInspRsmlRgstrRunManageService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取运行管理情况(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspRsmlRgstrRunManage> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspRsmlRgstrRunManage bisInspRsmlRgstrRunManage = bisInspRsmlRgstrRunManageService.get(id);
- return buildSuccessResponse(bisInspRsmlRgstrRunManage);
- }
- @ApiOperation(value = "获取运行管理情况(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspRsmlRgstrRunManage>> list(@ApiParam(name = "bisInspRsmlRgstrRunManageParam", value = "bisInspRsmlRgstrRunManageParam", required = true) @RequestBody BisInspRsmlRgstrRunManageParam bisInspRsmlRgstrRunManageParam) {
- List<BisInspRsmlRgstrRunManage> bisInspRsmlRgstrRunManageList = bisInspRsmlRgstrRunManageService.findList(bisInspRsmlRgstrRunManageParam);
- return buildSuccessResponse(bisInspRsmlRgstrRunManageList);
- }
- @ApiOperation(value = "获取运行管理情况(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspRsmlRgstrRunManage>> page(@ApiParam(name = "bisInspRsmlRgstrRunManageParam", value = "bisInspRsmlRgstrRunManageParam", required = true) @RequestBody BisInspRsmlRgstrRunManageParam bisInspRsmlRgstrRunManageParam) {
- PageInfo<BisInspRsmlRgstrRunManage> bisInspRsmlRgstrRunManageList = bisInspRsmlRgstrRunManageService.findPageInfo(bisInspRsmlRgstrRunManageParam);
- return buildSuccessResponse(bisInspRsmlRgstrRunManageList);
- }
- @ApiOperation(value = "根据rgstrId获取运行管理情况")
- @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
- public BaseResponse<BisInspRsmlRgstrRunManage> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId, HttpServletRequest request) {
- BisInspRsmlRgstrRunManageParam runManageParam = new BisInspRsmlRgstrRunManageParam();
- runManageParam.setRgstrId(rgstrId);
- BisInspRsmlRgstrRunManage runManage = bisInspRsmlRgstrRunManageService.getBy(runManageParam);
- return buildSuccessResponse(runManage);
- }
- }
|