| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- package cn.com.goldenwater.dcproj.controller.tac;
- import cn.com.goldenwater.dcproj.constValue.*;
- import cn.com.goldenwater.dcproj.dao.GwSubProcessDao;
- import cn.com.goldenwater.dcproj.model.*;
- import cn.com.goldenwater.dcproj.param.GwSubProcessParam;
- import cn.com.goldenwater.dcproj.param.TacPawpRgstrParam;
- import cn.com.goldenwater.dcproj.param.TacWordBaseParam;
- import cn.com.goldenwater.dcproj.service.*;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.utils.InspUtils;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.lang3.StringUtils;
- 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 java.util.Date;
- import java.util.List;
- import java.util.Map;
- /**
- * @author lune
- * @date 2019-6-19
- */
- @Api(value = "TAC 专业稽察登记表管理", tags = "TAC 专业稽察登记表管理")
- @RestController
- @RequestMapping("/tac/pawp/rgstr")
- public class TacPawpRgstrController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private TacPawpRgstrService tacPawpRgstrService;
- @Autowired
- private TacActiveLogService activeLogService;
- @Autowired
- private GwSubProcessDao gwSubProcessDao;
- @Autowired
- private TacWordBaseService tacWordBaseService;
- @ApiOperation(value = "添加/修改专业稽察登记表")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<TacPawpRgstr> insert(@ApiParam(name = "tacPawpRgstr", value = "TacPawpRgstr", required = true) @RequestBody TacPawpRgstr tacPawpRgstr) {
- if (StringUtils.isNotBlank(tacPawpRgstr.getId())) {
- tacPawpRgstr.setUptm(new Date());
- tacPawpRgstrService.update(tacPawpRgstr);
- } else {
- String uuid = UuidUtil.uuid();
- tacPawpRgstr.setId(uuid);
- tacPawpRgstr.setIntm(new Date());
- tacPawpRgstr.setState(StateEnum.NOWASTSTATE.getKey());
- tacPawpRgstrService.insert(tacPawpRgstr);
- activeLogService.addTacLog(tacPawpRgstr.getName(), StateEnum.EXWASTSTATE.getDesc(), uuid, "", StateEnum.EXWASTSTATE.getKey(),"", "", getCurrentPersId());
- }
- return buildSuccessResponse(tacPawpRgstr);
- }
- @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 = tacPawpRgstrService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "退回底稿给专家")
- @RequestMapping(value = "/zhuli/rollback/{regstrId}/{type}", method = RequestMethod.GET)
- public BaseResponse rollback(
- @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId
- , @ApiParam(name = "type", value = "type", required = true) @PathVariable String type) {
- String key = regstrId + "_" + type + "_roll";
- synchronized (this) {
- if (!tacPawpRgstrService.suoding(key)) {
- return buildFailResponse("操作太频繁,请等会儿再操作");
- }
- }
- TacPawpRgstr pawpRgstr = tacPawpRgstrService.get(regstrId);
- String state = InspUtils.getTypeState(type, pawpRgstr);
- if (StringUtils.isBlank(state)) {
- return buildFailResponse("该状态数据不能回退");
- } else {
- int stateType = Integer.parseInt(state);
- if (stateType != 4) {
- return buildFailResponse("该状态数据不能回退");
- }
- }
- String regstrId_zhuli = pawpRgstr.getId() + "_" + state;
- if (!StateEnum.SUBMIT_ZHULI.getKey().equals(state)) {
- return buildFailResponse("退回底稿失败,该底稿不具备退回条件!");
- }
- String persId = "";
- pawpRgstr = tacPawpRgstrService.rollbackControl(regstrId_zhuli, persId, type, pawpRgstr, StateEnum.SUBMIT_ZHUANJIA.getKey());
- tacPawpRgstrService.update(pawpRgstr);
- activeLogService.addTacLog(pawpRgstr.getName(), StateEnum.SUBMIT_ZHUANJIA.getDesc(), pawpRgstr.getId(), type, StateEnum.SUBMIT_ZHUANJIA.getKey(), "","退稿给专家", getCurrentPersId());
- return buildSuccessResponse("退回底稿完成!!");
- }
- @ApiOperation(value = "提交底稿给助理")
- @RequestMapping(value = "/zhuli/submit/{regstrId}/{type}", method = RequestMethod.GET)
- public BaseResponse zhuliSubmit(@ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId,
- @ApiParam(name = "type", value = "type", required = true) @PathVariable String type) {
- String persId = getCurrentPersId();
- String key = regstrId + "_" + type + "_submit";
- synchronized (this) {
- if (!tacPawpRgstrService.suoding(key)) {
- return buildFailResponse("操作太频繁,请等会儿再操作");
- }
- }
- TacPawpRgstr pawpRgstr = tacPawpRgstrService.get(regstrId);
- if (pawpRgstr == null) {
- return buildFailResponse("稽察督查表不存在!");
- }
- String state = InspUtils.getTypeState(type, pawpRgstr);
- if (StateEnum.SUBMIT_ZHULI.getKey().equals(state)) {
- return buildFailResponse("底稿信息已经提交,请不要重复提交!");
- }
- String regstrId_zhuli = "";
- if (regstrId.contains("_")) {
- regstrId_zhuli = regstrId.substring(0, regstrId.indexOf("_")) + "_4";
- } else {
- regstrId_zhuli = regstrId + "_4";
- }
- TacWordBaseParam wordBaseParam = new TacWordBaseParam();
- wordBaseParam.setType("10" + type);
- wordBaseParam.setBizId(regstrId_zhuli);
- List<TacWordBase> wordBaseList = tacWordBaseService.findList(wordBaseParam);
- if (wordBaseList != null && wordBaseList.size() > 0) {
- return buildFailResponse("底稿信息已经提交,请不要重复提交!");
- }
- pawpRgstr = tacPawpRgstrService.createZhuliData(persId, regstrId, type, pawpRgstr, regstrId_zhuli, StateEnum.SUBMIT_ZHULI.getKey());
- tacPawpRgstrService.update(pawpRgstr);
- activeLogService.addTacLog(pawpRgstr.getName(), StateEnum.SUBMIT_ZHULI.getDesc(), pawpRgstr.getId(), type, StateEnum.SUBMIT_ZHULI.getKey(),"", "提交给助理", getCurrentPersId());
- return buildSuccessResponse("提交完成");
- }
- @ApiOperation(value = "专家提交底稿、助理提交报告;专家提交到助理(交换意见稿)-->成果讨论阶段(助理通过)-->中心修改阶段-->司局修改阶段:flag分别为:4,5,6,7")
- @RequestMapping(value = "/chengguo/submit/{regstrId}/{flag}", method = RequestMethod.GET)
- public BaseResponse chengguoSubmit(@ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId,
- @ApiParam(name = "flag", value = "flag", required = true) @PathVariable String flag) {
- String persId = getCurrentPersId();
- TacPawpRgstr pawpRgstr = tacPawpRgstrService.get(regstrId);
- if (pawpRgstr == null) {
- return buildFailResponse("稽察督查表不存在!");
- }
- if (StringUtils.isBlank(flag)) {
- return buildFailResponse("接口标识不能为空");
- }
- if (flag.equals(pawpRgstr.getState())) {
- return buildFailResponse("报告信息已经提交,请不要重复提交!");
- }
- GwSubProcessParam processParam=new GwSubProcessParam();
- processParam.setApp("tac");
- processParam.setLocalState(flag);
- GwSubProcess gwSubProcess=gwSubProcessDao.getBy(processParam);
- if(gwSubProcess==null ){
- return buildFailResponse("报告已经处于最终阶段不能继续提交!");
- }
- if(StringUtils.isNotBlank(pawpRgstr.getState())){
- if(!gwSubProcess.getPrvState().equals(pawpRgstr.getState()) && !"3".equals(pawpRgstr.getState())){
- return buildFailResponse("上一阶段数据未提交,请确认后再执行当前操作!");
- }
- }else{
- //未空默认刚提交
- if(!"4".equals(gwSubProcess.getPrvState())){
- return buildFailResponse("上一阶段数据未提交,请确认后再执行当前操作!");
- }
- }
- //上一阶段得标识
- String startRegstrId =regstrId+"_"+gwSubProcess.getPrvState();
- if (StringUtils.isBlank(flag)) {
- startRegstrId = regstrId;
- } else {
- int stateType = Integer.parseInt(flag);
- if (stateType < 3) {
- startRegstrId = regstrId;
- }
- }
- String regstrId_flag = "";
- if (regstrId.contains("_")) {
- regstrId_flag = regstrId.substring(0, regstrId.indexOf("_")) + "_" + flag;
- } else {
- regstrId_flag = regstrId + "_" + flag;
- }
- pawpRgstr = tacPawpRgstrService.createZhuliData(persId, startRegstrId, "", pawpRgstr, regstrId_flag, flag);
- // pawpRgstr=typeState(pawpRgstr,type,flag);
- tacPawpRgstrService.update(pawpRgstr);
- if (StateEnum.SUBMIT_ZHULI.getKey().equals(flag)) {
- activeLogService.addTacLog(pawpRgstr.getName(), StateEnum.SUBMIT_ZHULI.getDesc(), pawpRgstr.getId(), "0", StateEnum.SUBMIT_ZHULI.getKey(),"", "专家到助理", getCurrentPersId());
- }
- if (StateEnum.SUBMIT_CHENGGUO.getKey().equals(flag)) {
- activeLogService.addTacLog(pawpRgstr.getName(), StateEnum.SUBMIT_CHENGGUO.getDesc(), pawpRgstr.getId(), "0", StateEnum.SUBMIT_CHENGGUO.getKey(), "","成果到中心", getCurrentPersId());
- }
- if (StateEnum.SUBMIT_ZHONGXIN.getKey().equals(flag)) {
- activeLogService.addTacLog(pawpRgstr.getName(), StateEnum.SUBMIT_ZHONGXIN.getDesc(), pawpRgstr.getId(), "0", StateEnum.SUBMIT_ZHONGXIN.getKey(),"", "中心到司局", getCurrentPersId());
- }
- if (StateEnum.SUBMIT_SIJU.getKey().equals(flag)) {
- activeLogService.addTacLog(pawpRgstr.getName(), StateEnum.SUBMIT_SIJU.getDesc(), pawpRgstr.getId(), "0", StateEnum.SUBMIT_SIJU.getKey(), "","司局通过", getCurrentPersId());
- }
- return buildSuccessResponse("提交完成");
- }
- @ApiOperation(value = "助理通过--助理提交到成果讨论阶段")
- @RequestMapping(value = "/excute/{regstrId}/{type}", method = RequestMethod.GET)
- public BaseResponse<TacPawpRgstr> excute(@ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId,
- @ApiParam(name = "type", value = "type", required = true) @PathVariable String type) {
- if (regstrId.contains(PersTypeEnum.ZHULI.getEnflag())) {
- regstrId = regstrId.substring(0, regstrId.indexOf("_") - 1);
- }
- TacPawpRgstr tacPawpRgstr = tacPawpRgstrService.get(regstrId);
- if (JinChaEnum.TACPAWPPDBST.getKey().equals(type)) {
- tacPawpRgstr.setPdbstStat(StateEnum.SUBMIT_ZHULI.getKey());
- }
- if (JinChaEnum.TacPawpBstocmTsopbfp.getKey().equals(type)) {
- tacPawpRgstr.setBstocmTsopbfpStat(StateEnum.SUBMIT_ZHULI.getKey());
- }
- if (JinChaEnum.TacPawpRaiobis.getKey().equals(type)) {
- tacPawpRgstr.setRaiobisStat(StateEnum.SUBMIT_ZHULI.getKey());
- }
- if (JinChaEnum.TacPawpBstocmCms.getKey().equals(type)) {
- tacPawpRgstr.setBstocmCmsStat(StateEnum.SUBMIT_ZHULI.getKey());
- }
- if (JinChaEnum.TacPawpBitopqPeqaa.getKey().equals(type)) {
- tacPawpRgstr.setBitopqPeqaaStat(StateEnum.SUBMIT_ZHULI.getKey());
- }
- if (JinChaEnum.TacPawpBioesRwunit.getKey().equals(type)) {
- tacPawpRgstr.setBioesRwunitStat(StateEnum.SUBMIT_ZHULI.getKey());
- }
- tacPawpRgstrService.update(tacPawpRgstr);
- return buildSuccessResponse(tacPawpRgstr);
- }
- private TacPawpRgstr typeState(TacPawpRgstr tacPawpRgstr, String type, String flag) {
- if (JinChaEnum.TACPAWPPDBST.getKey().equals(type)) {
- tacPawpRgstr.setPdbstStat(flag);
- }
- if (JinChaEnum.TacPawpBstocmTsopbfp.getKey().equals(type)) {
- tacPawpRgstr.setBstocmTsopbfpStat(flag);
- }
- if (JinChaEnum.TacPawpRaiobis.getKey().equals(type)) {
- tacPawpRgstr.setRaiobisStat(flag);
- }
- if (JinChaEnum.TacPawpBstocmCms.getKey().equals(type)) {
- tacPawpRgstr.setBstocmCmsStat(flag);
- }
- if (JinChaEnum.TacPawpBitopqPeqaa.getKey().equals(type)) {
- tacPawpRgstr.setBitopqPeqaaStat(flag);
- }
- if (JinChaEnum.TacPawpBioesRwunit.getKey().equals(type)) {
- tacPawpRgstr.setBioesRwunitStat(flag);
- }
- return tacPawpRgstr;
- }
- @ApiOperation(value = "根据ID获取专业稽察登记表(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<TacPawpRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- TacPawpRgstr tacPawpRgstr = tacPawpRgstrService.get(id);
- return buildSuccessResponse(tacPawpRgstr);
- }
- @ApiOperation(value = "根据登记表id和专业类型获取操作状态")
- @RequestMapping(value = "/getState/{regstrId}/{type}", method = RequestMethod.GET)
- public BaseResponse<Map<String, String>> getBy(@ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId,
- @ApiParam(name = "type", value = "type", required = true) @PathVariable String type) {
- // TacPawpRgstr tacPawpRgstr = tacPawpRgstrService.get(regstrId);
- // Map<String, String> retMap = new HashMap<>();
- // if (StringUtils.isNotBlank(tacPawpRgstr.getState())) {
- // int stateType = Integer.parseInt(tacPawpRgstr.getState());
- // if (stateType > 3) {
- // retMap.put("state", stateType + "");
- // return buildSuccessResponse(201, "助理提交状态", retMap);
- // }
- // }
- //
- // String state = InspUtils.getTypeState(type, tacPawpRgstr);
- // retMap.put("state", state);
- Map<String, String> statemap = tacPawpRgstrService.getState(regstrId, type);
- String state = statemap.get("state");
- if(StringUtils.isNotBlank(state)&&Integer.parseInt(state)>3) {
- return buildSuccessResponse(201, "助理提交状态", statemap);
- }
- return buildSuccessResponse(202, "专家提交状态",statemap);
- }
- @ApiOperation(value = "司局提交")
- @RequestMapping(value = "/siju/{regstrId}/{type}/{flag}", method = RequestMethod.GET)
- public BaseResponse siju(@ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId,
- @ApiParam(name = "type", value = "type", required = true) @PathVariable String type,
- @ApiParam(name = "flag", value = "flag", required = true) @PathVariable String flag) {
- TacPawpRgstr tacPawpRgstr = tacPawpRgstrService.get(regstrId);
- if (tacPawpRgstr == null) {
- return buildFailResponse("无登记信息记录");
- }
- String state = InspUtils.getTypeState(type, tacPawpRgstr);
- if (StringUtils.isBlank(state)) {
- return buildFailResponse("提交失败");
- }
- if (!StateEnum.SUBMIT_ZHONGXIN.getKey().equals(state)) {
- return buildFailResponse("当前阶段数据不能提交!!");
- }
- tacPawpRgstr = typeState(tacPawpRgstr, type, flag);
- tacPawpRgstrService.update(tacPawpRgstr);
- return buildSuccessResponse("司局提交完成");
- }
- @Autowired
- private BisInspAllRlationService allRlationService;
- @ApiOperation(value = "根据objId获取专业稽察登记表(单表)")
- @RequestMapping(value = "/getBy/{objId}", method = RequestMethod.GET)
- public BaseResponse<TacPawpRgstr> getByNew(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId) {
- TacPawpRgstrParam pawpRgstrParam = new TacPawpRgstrParam();
- pawpRgstrParam.setObjId(objId);
- TacPawpRgstr tacPawpRgstr = tacPawpRgstrService.getBy(pawpRgstrParam);
- String persId = getCurrentPersId();
- return buildSuccessResponse(tacPawpRgstr);
- }
- @ApiOperation(value = "分页查询稽察督查表")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<TacPawpRgstr>> page(@RequestBody TacPawpRgstrParam rgstrParam) {
- PageInfo<TacPawpRgstr> tacPawpRgstr = tacPawpRgstrService.findPageInfo(rgstrParam);
- return buildSuccessResponse(tacPawpRgstr);
- }
- }
|