Commit e74cf60d authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 0ad0b7ae da9e85d4
package com.yeejoin.amos.boot.module.hygf.api.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 节点信息
* @author DELL
*/
@Getter
@AllArgsConstructor
public enum PowerStationNodeEnum {
经销商审核("经销商审核", "0"),
设计审核("设计审核", "1"),
投融审核("投融审核", "2"),
法务审核("法务审核", "3"),
设计上传图纸("设计上传图纸", "4"),
经销商上传图纸("经销商上传图纸", "5"),
文件审核("文件审核", "6");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
public static PowerStationNodeEnum getNodeByCode(String code) {
PowerStationNodeEnum powerStationNodeEnum = null;
for(PowerStationNodeEnum type: PowerStationNodeEnum.values()) {
if (type.getCode().equals(code)) {
powerStationNodeEnum = type;
break;
}
}
return powerStationNodeEnum;
}
}
......@@ -10,10 +10,11 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum PowerStationProcessStateEnum {
进行中("进行中", "0"),
不通过("不通过", "1"),
完成("完成", "2"),
作废("作废", "3");
进行中("进行中", "0", "progress"),
通过("通过", "1", "yes"),
不通过("不通过", "2", "no"),
完成("完成", "3", "complete"),
作废("作废", "4", "reject");
/**
* 名称,描述
......@@ -24,4 +25,20 @@ public enum PowerStationProcessStateEnum {
*/
private String code;
/**
* 编码
*/
private String describe;
public static PowerStationProcessStateEnum getStateByResult(String code) {
PowerStationProcessStateEnum powerStationProcessStateEnum = null;
for(PowerStationProcessStateEnum type: PowerStationProcessStateEnum.values()) {
if (type.getDescribe().equals(code)) {
powerStationProcessStateEnum = type;
break;
}
}
return powerStationProcessStateEnum;
}
}
package com.yeejoin.amos.boot.module.hygf.api.fegin;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
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.RequestParam;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
......@@ -27,4 +25,10 @@ public interface IdxFeginService {
@RequestParam(value = "tableName", required = false) String tableName,
@RequestBody Map<String, Object> kv) throws Exception;
/**
*通用表单提交 数据填报
*/
@RequestMapping(value = "/report/form/getRecordData/{id}", method = RequestMethod.GET)
FeignClientResult<JSONObject> getRecord(@PathVariable("id") String id);
}
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.hygf.api.service;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStation;
import java.util.Map;
/**
* 接口类
*
......@@ -27,5 +29,15 @@ public interface IPowerStationService {
*/
PowerStation getObjByNhId(String id, String state);
/**
* 电站审核接口
* @param pageId 表单id
* @param nodeCode 执行节点code
* @param stationId 电站审核记录id
* @param taskId 任务id
* @param planInstanceId 实例id
* @param kv 表单数据
* @return idx表id
*/
String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv);
}
......@@ -9,6 +9,8 @@ import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import java.util.Map;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -113,4 +115,21 @@ public class PowerStationController extends BaseController {
public ResponseModel<List<PowerStationDto>> selectForList() {
return ResponseHelper.buildResponse(powerStationServiceImpl.queryForPowerStationList());
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "电站审核", notes = "电站审核")
@PostMapping(value = "/powerStationExamine")
public ResponseModel<String> powerStationExamine(@RequestParam(value = "pageId") long pageId,
@RequestParam(value = "nodeCode") String nodeCode,
@RequestParam(value = "stationId") String stationId,
@RequestParam(value = "taskId") String taskId,
@RequestParam(value = "planInstanceId") String planInstanceId,
@RequestBody Map<String, Object> kv) {
return ResponseHelper.buildResponse(powerStationServiceImpl.powerStationExamine(pageId, nodeCode, stationId, taskId, planInstanceId, kv));
}
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationNodeEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationProcessStateEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStation;
import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IPowerStationService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Map;
/**
* 服务实现类
......@@ -19,7 +24,20 @@ import java.util.List;
* @date 2023-07-15
*/
@Service
@Slf4j
public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerStation, PowerStationMapper> implements IPowerStationService {
@Autowired
IdxFeginService idxFeginService;
@Autowired
IPowerStationService powerStationService;
private static final String IDX_REQUEST_STATE="200";
private static final String VERIFY_RESULT_YES="yes";
private static final String VERIFY_RESULT_NO="no";
/**
* 分页查询
*/
......@@ -37,7 +55,7 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
@Override
public boolean savePowerStation(PowerStation powerStation) {
return this.save(powerStation);
return this.saveOrUpdate(powerStation);
}
@Override
......@@ -47,4 +65,55 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
wrapper.eq(PowerStation::getPeasantHouseholdId, id);
return this.baseMapper.selectOne(wrapper);
}
@Override
public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv) {
// 1. 业务相关数据落表
PowerStation powerStation = this.baseMapper.selectById(stationId);
PowerStationNodeEnum nodeByCode = PowerStationNodeEnum.getNodeByCode(nodeCode);
if (PowerStationNodeEnum.设计上传图纸.getCode().equals(nodeCode)) {
} else if (PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) {
} else {
String result = String.valueOf(kv.get("VERIFY_RESULT"));
if (VERIFY_RESULT_NO.equals(result)) {
powerStation.setProcessStatus(PowerStationProcessStateEnum.不通过.getName());
}
PowerStationProcessStateEnum resultObj = PowerStationProcessStateEnum.getStateByResult(result);
switch (nodeByCode) {
case 设计审核:
powerStation.setTechnologyStatus(resultObj.getName());
break;
case 投融审核:
powerStation.setDesignStatus(resultObj.getName());
break;
case 法务审核:
powerStation.setBusinessStatus(resultObj.getName());
break;
case 文件审核:
if (VERIFY_RESULT_YES.equals(result)) {
powerStation.setProcessStatus(PowerStationProcessStateEnum.完成.getName());
}
break;
default:
break;
}
}
// 2. 更新流程状态
String code = null;
try{
// 3. 工作流执行
FeignClientResult<String> submit = idxFeginService.submit(pageId, taskId, planInstanceId, null, null, null, kv);
if (IDX_REQUEST_STATE.equals(String.valueOf(submit.getStatus()))) {
code = submit.getResult();
log.info("流程执行成功:{}", code);
powerStationService.savePowerStation(powerStation);
}
}catch (Exception e){
log.error("工作流执行失败:{}", e.getMessage());
}
return code;
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
......@@ -210,8 +211,17 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
powerStation.setProjectAddress(peasantHousehold.getProjectAddressName());
powerStation.setPeasantHouseholdId(String.valueOf(peasantHousehold.getSequenceNbr()));
powerStation.setProcessStatus(PowerStationProcessStateEnum.进行中.getCode());
powerStationService.savePowerStation(powerStation);
log.info("流程执行成功:{}", code);
// 获取流程信息
FeignClientResult<JSONObject> record = idxFeginService.getRecord(code);
if (IDX_REQUEST_STATE.equals(String.valueOf(record.getStatus()))) {
JSONObject resultObj = record.getResult();
String taskIdNew = String.valueOf(resultObj.get("taskId"));
String processInstanceId = String.valueOf(resultObj.get("processInstanceId"));
powerStation.setTaskId(taskIdNew);
powerStation.setProcessInstanceId(processInstanceId);
}
powerStationService.savePowerStation(powerStation);
}
} catch (Exception e){
e.getMessage();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment