package cn.com.goldenwater.dcproj.controller.importex; import cn.com.goldenwater.dcproj.model.ImpPblmInfo; import cn.com.goldenwater.dcproj.param.ImpPblmInfoParam; import cn.com.goldenwater.dcproj.service.ImpPblmInfoService; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.utils.LoadExcel; 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.*; import org.springframework.web.multipart.MultipartFile; import java.util.List; /** * @author lune * @date 2019-7-23 */ @Api(value = "IMP 检查发现问题汇总表管理", tags = "IMP 检查发现问题汇总表管理") @RestController @RequestMapping("/imp/pblm/info") public class ImpPblmInfoController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private ImpPblmInfoService impPblmInfoService; @ApiOperation(value = "添加/修改检查发现问题汇总表") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "impPblmInfo", value = "ImpPblmInfo", required = true) @RequestBody ImpPblmInfo impPblmInfo) { if (StringUtils.isBlank(impPblmInfo.getId())) { String uuid = UuidUtil.uuid(); // 生成uuid impPblmInfo.setId(uuid); impPblmInfoService.insert(impPblmInfo); } else { impPblmInfoService.update(impPblmInfo); } return buildSuccessResponse(impPblmInfo); } @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 = impPblmInfoService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取检查发现问题汇总表(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { ImpPblmInfo impPblmInfo = impPblmInfoService.get(id); return buildSuccessResponse(impPblmInfo); } @ApiOperation(value = "获取检查发现问题汇总表(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "impPblmInfoParam", value = "impPblmInfoParam", required = true) @RequestBody ImpPblmInfoParam impPblmInfoParam) { List impPblmInfoList = impPblmInfoService.findList(impPblmInfoParam); return buildSuccessResponse(impPblmInfoList); } @ApiOperation(value = "获取检查发现问题汇总表(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "impPblmInfoParam", value = "impPblmInfoParam", required = true) @RequestBody ImpPblmInfoParam impPblmInfoParam) { PageInfo impPblmInfoList = impPblmInfoService.findPageInfo(impPblmInfoParam); return buildSuccessResponse(impPblmInfoList); } @ApiOperation(value = "根据月份批量插入小型水库问题信息") @RequestMapping(value = "insertList/{mnth}", method = RequestMethod.POST) public BaseResponse insertList(@ApiParam(name = "mnth", value = "mnth", required = true) @PathVariable String mnth, @RequestParam("file") MultipartFile file) { try { List list = LoadExcel.getPblmObjListByFile(file); impPblmInfoService.insertList(list,mnth); }catch (Exception e){ e.printStackTrace(); } return buildSuccessResponse(""); } @ApiOperation(value = "根据月份批量处理小型水库问题信息") @RequestMapping(value = "handleRsData", method = RequestMethod.POST) public BaseResponse handleRsData(@ApiParam(name = "mnth", value = "月份", required = true) @RequestParam String mnth, @ApiParam(name = "orgId", value = "机构ID", required = true) @RequestParam String orgId) { try { impPblmInfoService.handleRsData(mnth,orgId); }catch (Exception e){ e.printStackTrace(); } return buildSuccessResponse(""); } }