Commit a13937f5 authored by xixinzhao's avatar xixinzhao

审核提交

parent 2facb231
package com.yeejoin.amos.boot.module.hygf.api.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 电站审核状态
* @author DELL
*/
@Getter
@AllArgsConstructor
public enum PowerStationProcessStateEnum {
进行中("进行中", "0"),
不通过("不通过", "1"),
完成("完成", "2"),
作废("作废", "3");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
}
......@@ -18,4 +18,14 @@ public interface IPowerStationService {
*/
boolean savePowerStation(PowerStation powerStation);
/**
* 根据农户id和流程状态获取实例
* @param id 农户id
* @param state 流程状态
* @return 电站实例
*/
PowerStation getObjByNhId(String id, String state);
}
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.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.mapper.PowerStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IPowerStationService;
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;
......@@ -36,4 +39,12 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
public boolean savePowerStation(PowerStation powerStation) {
return this.save(powerStation);
}
@Override
public PowerStation getObjByNhId(String id, String state) {
LambdaQueryWrapper<PowerStation> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PowerStation::getProcessStatus, state);
wrapper.eq(PowerStation::getPeasantHouseholdId, id);
return this.baseMapper.selectOne(wrapper);
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
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;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationProcessStateEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService;
......@@ -20,9 +21,11 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -67,6 +70,12 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
@Autowired
IPowerStationService powerStationService;
@Value("${power.station.examine.pageId}")
private long pageId;
@Value("${power.station.examine.planId}")
private String planId;
private static final String regionRedis="app_region_redis";
private static final String OPERATION_TYPE_SUBMIT="submit";
private static final String OPERATION_TYPE_APPLY="apply";
......@@ -167,31 +176,47 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
if(OPERATION_TYPE_SUBMIT.equals(operationType)){
peasantHousehold.setSurveyOrNot(1);
}else if(OPERATION_TYPE_APPLY.equals(operationType)){
// 提交审核
submitExamine(peasantHousehold);
}
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
return surveyInfoAllDto;
}
private void submitExamine(PeasantHousehold peasantHousehold) {
PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.进行中.getCode());
String taskId = null;
Map<String, Object> objectMap = new HashMap<>();
if (ObjectUtils.isNotEmpty(powerStation)) {
// 工作流执行一步
taskId = powerStation.getTaskId();
objectMap.put("approveStatus", "yes");
} else {
// 第一步启动工作流
objectMap.put("approveStatus", "yes");
powerStation = new PowerStation();
}
// 保存并审核
try {
FeignClientResult<String> submit = idxFeginService.submit(1679778420550037506L, null, "c4ed1873-0dc6-4518-a7a9-dbc588ef35e5", null, null, null, objectMap);
FeignClientResult<String> submit = idxFeginService.submit(pageId, taskId, planId, null, null, null, objectMap);
if (IDX_REQUEST_STATE.equals(String.valueOf(submit.getStatus()))) {
String code = submit.getResult();
peasantHousehold.setSurveyOrNot(2);
peasantHousehold.setReview(1);
String code = submit.getResult();
// 插入记录表
PowerStation powerStationDto = new PowerStation();
powerStationDto.setPowerStationCode(peasantHousehold.getPeasantHouseholdNo());
powerStationDto.setOwnersName(peasantHousehold.getOwnersName());
powerStationDto.setProjectAddress(peasantHousehold.getProjectAddressName());
powerStationDto.setProcessStatus("进行中");
powerStationService.savePowerStation(powerStationDto);
log.info("启动流程成功:{}", code);
powerStation.setPowerStationCode(peasantHousehold.getPeasantHouseholdNo());
powerStation.setOwnersName(peasantHousehold.getOwnersName());
powerStation.setProjectAddress(peasantHousehold.getProjectAddressName());
powerStation.setPeasantHouseholdId(String.valueOf(peasantHousehold.getSequenceNbr()));
powerStation.setProcessStatus(PowerStationProcessStateEnum.进行中.getCode());
powerStationService.savePowerStation(powerStation);
log.info("流程执行成功:{}", code);
}
} catch (Exception e){
e.getMessage();
}
}
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
return surveyInfoAllDto;
}
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId,AgencyUserModel userInfo) {
......
......@@ -102,3 +102,8 @@ sms.huawei.templateId=6aaeb4bf916d4db0a1942c598912519e
sms.huawei.sender=1069368924410006092
# 签名名称
sms.huawei.signature=华为云短信测试
# 电站审核pageId
power.station.examine.pageId=1679778420550037506
# 电站审核计划id
power.station.examine.planId=c4ed1873-0dc6-4518-a7a9-dbc588ef35e5
\ No newline at end of file
......@@ -90,6 +90,11 @@
<artifactId>kingbase8</artifactId>
<version>8.6.0</version>
</dependency>
<dependency>
<groupId>org.messaginghub</groupId>
<artifactId>pooled-jms</artifactId>
<version>1.0.5</version>
</dependency>
</dependencies>
</project>
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