| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- package cn.com.goldenwater.dcproj.controller.plansd;
- import cn.com.goldenwater.dcproj.model.BisInspPlanDp;
- import cn.com.goldenwater.dcproj.param.BisInspPlanDpParam;
- import cn.com.goldenwater.dcproj.param.BisInspPlandpRlParam;
- import cn.com.goldenwater.dcproj.service.BisInspPlanDpService;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.service.BisInspPlandpRlService;
- import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
- import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.collections.CollectionUtils;
- 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.*;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.stream.Collectors;
- /**
- * @author hjp
- * @date 2022-8-9
- */
- @Api(value = "山东业务处室和参加实施单位基本信息管理", tags = "山东业务处室和参加实施单位基本信息管理")
- @RestController
- @RequestMapping("/bis/insp/plan/dp")
- public class BisInspPlanDpController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspPlanDpService bisInspPlanDpService;
- @Autowired
- private BisInspPlandpRlService bisInspPlandpRlService;
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @ApiOperation(value = "添加山东业务处室和参加实施单位基本信息")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspPlanDp> insert(@ApiParam(name = "bisInspPlanDp", value = "BisInspPlanDp", required = true) @RequestBody BisInspPlanDp bisInspPlanDp) {
- bisInspPlanDp.setPersId(getCurrentPersId());
- if (StringUtils.isBlank(bisInspPlanDp.getId())){
- bisInspPlanDpService.insert(bisInspPlanDp);
- }else {
- bisInspPlanDpService.update(bisInspPlanDp);
- }
- return buildSuccessResponse(bisInspPlanDp);
- }
- @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 = bisInspPlanDpService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取山东业务处室和参加实施单位基本信息(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspPlanDp> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspPlanDp bisInspPlanDp = bisInspPlanDpService.get(id);
- return buildSuccessResponse(bisInspPlanDp);
- }
- @ApiOperation(value = "根据用户id获取绑定的处室")
- @RequestMapping(value = "getByPersId", method = RequestMethod.GET)
- public BaseResponse<List<BisInspPlanDp>> getByPersId(@RequestParam String id) {
- List<BisInspPlanDp> bisInspPlanDpList = bisInspPlanDpService.getByPersId(id);
- return buildSuccessResponse(bisInspPlanDpList);
- }
- @ApiOperation(value = "获取单位基本信息列表数据")
- @RequestMapping(value = "/findList", method = RequestMethod.POST)
- public BaseResponse<List<BisInspPlanDp>> findList(@RequestBody BisInspPlanDpParam param) {
- return buildSuccessResponse(bisInspPlanDpService.findList(param));
- }
- @ApiOperation(value = "根据计划id和阶段 查看下拉可以选择的单位处室")
- @RequestMapping(value = "/byStageList", method = RequestMethod.POST)
- public BaseResponse<List<BisInspPlanDp>> byStageList(@RequestBody BisInspPlandpRlParam param) {
- Assert.notNull(param.getStage(), "Stage为必填参数");
- Assert.notNull(param.getPlanId(), "年度计划ID为必填参数");
- List<String> idList = bisInspPlandpRlService.findByPlanDpIdList(param);
- List<BisInspPlanDp> list = new ArrayList<>();
- if (CollectionUtils.isNotEmpty(idList)) {
- BisInspPlanDpParam bisInspPlanDpParam = new BisInspPlanDpParam();
- bisInspPlanDpParam.setIds(idList.stream().collect(Collectors.joining("','", "'", "'")));
- bisInspPlanDpParam.setAdCode(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
- list = bisInspPlanDpService.findList(bisInspPlanDpParam);
- }
- return buildSuccessResponse(list);
- }
- }
|