4adf0eda6dab9ca95cef8339d30f6d16ff74e6c2.svn-base 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package cn.com.goldenwater.dcproj.controller.ducha;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.param.InspObjParam;
  5. import cn.com.goldenwater.dcproj.service.BisInspAllObj2Service;
  6. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  7. import cn.com.goldenwater.target.CheckException;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import io.swagger.annotations.ApiParam;
  11. import org.apache.commons.lang.StringUtils;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.beans.factory.annotation.Value;
  14. import org.springframework.web.bind.annotation.RequestBody;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RequestMethod;
  17. import org.springframework.web.bind.annotation.RestController;
  18. /**
  19. * Created by 61618 on 2019/4/17.
  20. */
  21. @Api(value = "督查计划相关接口", tags = "督查计划相关接口")
  22. @RestController
  23. @RequestMapping("/supervision/plan")
  24. public class BisInspAllObj2Controller extends BaseController {
  25. @Value("${export.templatePath}")
  26. private String templatePath;
  27. @Value("${impExcel.basePath}")
  28. private String impExcelPath;
  29. @Autowired
  30. private BisInspAllObj2Service bisInspAllObj2Service;
  31. @Autowired
  32. private OlBisInspOrgService olBisInspOrgService;
  33. /**
  34. * 添加全部督查对象:
  35. * 1. 根据条件查询所有未添加的督查对象
  36. * 2. 循环导入数据
  37. *
  38. * @param inspObjParam 查询条件
  39. * @return
  40. */
  41. @ApiOperation(value = "添加全部督查对象")
  42. @RequestMapping(value = "/insertAllObj", method = RequestMethod.POST)
  43. public BaseResponse<Object> insertAllObj(@ApiParam(name = "InspObjParam", value = "InspObjParam")
  44. @RequestBody InspObjParam inspObjParam) {
  45. if (StringUtils.isBlank(inspObjParam.getObjType()) ||
  46. StringUtils.isBlank(inspObjParam.getInspGroupId())) {
  47. throw new CheckException("缺少必传参数组ID或督查类别!");
  48. }
  49. inspObjParam.setOrgId(getCurrentOrgId());
  50. inspObjParam.setPersId(getCurrentPersId());
  51. inspObjParam.setProvince(olBisInspOrgService.getProvinceFlag(getCurrentOrgId()));
  52. if (StringUtils.isNotBlank(inspObjParam.getOrderBy()) && inspObjParam.getOrderBy().contains("undefined")) {
  53. inspObjParam.setOrderBy("");
  54. }
  55. return buildSuccessResponse(bisInspAllObj2Service.insertAllObj(inspObjParam));
  56. }
  57. }