Commit 81ed7262 authored by hezhuozhi's avatar hezhuozhi

Merge remote-tracking branch 'origin/wofkflow0620' into wofkflow0620

# Conflicts: # amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/BasicGridAcceptanceServiceImpl.java # amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/UnitInfoServiceImpl.java
parents 9c87d14f 9e81e587
......@@ -88,4 +88,10 @@ public class PowerStationDto extends BaseDto {
@ApiModelProperty(value = "契约锁合同id")
private String contractLockId;
@ApiModelProperty(value = "盖章状态")
private String stampStatus;
@ApiModelProperty(value = "合同状态")
private String status;
}
......@@ -253,4 +253,8 @@ public class HouseholdContract extends BaseEntity {
//合同填充字段值
@TableField(exist = false)
List<ContractFillData> contractFillData;
//查询一个农户拥有的合同是否全是已废弃
@TableField(exist = false)
private Boolean isAllDisuse;
}
......@@ -4,38 +4,45 @@
<select id="selectPage" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.HouseholdContract">
select
*
from hygf_household_contract
LEFT JOIN hygf_peasant_household php ON php.sequence_nbr = hygf_household_contract.peasant_household_id <where>
<if test="dto.name != null and dto.name !='' ">
and hygf_household_contract.name like concat('%',#{dto.name},'%')
</if>
<if test="dto.contractNumber != null and dto.contractNumber !=''">
and hygf_household_contract.contract_number like concat('%',#{dto.contractNumber},'%')
</if>
<if test="dto.initiateStatus != null and dto.initiateStatus !='' ">
and hygf_household_contract.initiate_status = #{dto.initiateStatus}
</if>
<if test="dto.peasantHouseholdId != null and dto.peasantHouseholdId !=''">
and hygf_household_contract.peasant_household_id = #{dto.peasantHouseholdId}
</if>
<if test="dto.dealerId != null and dto.dealerId !=''">
and hygf_household_contract.dealer_id = #{dto.dealerId}
</if>
<if test="dto.surveyStatus != null and dto.surveyStatus !=''">
and hygf_household_contract.survey_status = #{dto.surveyStatus}
</if>
<if test="dto.signStatus != null and dto.signStatus !=''">
and hygf_household_contract.sign_status = #{dto.signStatus}
</if>
<if test="dto.userId != null and dto.userId !=''">
and hygf_household_contract.project_user_id = #{dto.userId}
</if>
<if test="dto.partyA != null and dto.partyA !=''">
and hygf_household_contract.party_a like concat('%',#{dto.partyA},'%')
</if>
</where>
select
*,
(SELECT CASE WHEN SUM( CASE WHEN hhc.`status` = '已作废' THEN 1 ELSE 0 END ) = COUNT(*) THEN 'true' ELSE 'false'
END FROM hygf_household_contract AS hhc
WHERE
hhc.peasant_household_id = hygf_household_contract.peasant_household_id
) AS isAllDisuse
from hygf_household_contract
LEFT JOIN hygf_peasant_household php ON php.sequence_nbr = hygf_household_contract.peasant_household_id
<where>
<if test="dto.name != null and dto.name !='' ">
and hygf_household_contract.name like concat('%',#{dto.name},'%')
</if>
<if test="dto.contractNumber != null and dto.contractNumber !=''">
and hygf_household_contract.contract_number like concat('%',#{dto.contractNumber},'%')
</if>
<if test="dto.initiateStatus != null and dto.initiateStatus !='' ">
and hygf_household_contract.initiate_status = #{dto.initiateStatus}
</if>
<if test="dto.peasantHouseholdId != null and dto.peasantHouseholdId !=''">
and hygf_household_contract.peasant_household_id = #{dto.peasantHouseholdId}
</if>
<if test="dto.dealerId != null and dto.dealerId !=''">
and hygf_household_contract.dealer_id = #{dto.dealerId}
</if>
<if test="dto.surveyStatus != null and dto.surveyStatus !=''">
and hygf_household_contract.survey_status = #{dto.surveyStatus}
</if>
<if test="dto.signStatus != null and dto.signStatus !=''">
and hygf_household_contract.sign_status = #{dto.signStatus}
</if>
<if test="dto.userId != null and dto.userId !=''">
and hygf_household_contract.project_user_id = #{dto.userId}
</if>
<if test="dto.partyA != null and dto.partyA !=''">
and hygf_household_contract.party_a like concat('%',#{dto.partyA},'%')
</if>
</where>
<if test="dto.orderBy == null ">
ORDER BY hygf_household_contract.rec_date DESC
</if>
......
......@@ -10,8 +10,10 @@
hygf_peasant_household.regional_companies_name,
hygf_peasant_household.developer_code,
hygf_peasant_household.developer_user_id,
hygf_peasant_household.project_address_detail
from hygf_power_station LEFT JOIN ( select peasant_household_id,initiate_status, contract_lock_id from hygf_household_contract where hygf_household_contract.status !='已作废'
hygf_peasant_household.project_address_detail,
b.stamp_status,
b.status
from hygf_power_station LEFT JOIN ( select peasant_household_id,initiate_status, contract_lock_id,stamp_status,status from hygf_household_contract where hygf_household_contract.status !='已作废'
) b on b.peasant_household_id=hygf_power_station.peasant_household_id
LEFT JOIN hygf_peasant_household on hygf_peasant_household.sequence_nbr=hygf_power_station.peasant_household_id
where hygf_power_station.is_delete=0
......
//package com.yeejoin.amos.boot.module.hygf.biz.config;
//package com.yeejoin.amos.workflow.config;
//
//import com.baomidou.mybatisplus.core.config.GlobalConfig;
//import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
//import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
//import com.github.pagehelper.PageInterceptor;
//import com.yeejoin.amos.boot.biz.config.MetaHandler;
//import com.yeejoin.amos.boot.biz.config.MybatisSqlInjector;
//import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpowerInterceptor;
//import com.zaxxer.hikari.HikariDataSource;
//import io.seata.rm.datasource.DataSourceProxy;
//import javax.sql.DataSource;
//import org.apache.ibatis.plugin.Interceptor;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.jdbc.DataSourceBuilder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.core.io.support.ResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//import javax.sql.DataSource;
//import java.util.Properties;
//
///**
// * 数据源代理
......@@ -26,14 +33,17 @@
// */
//@Configuration
//public class DataSourceConfiguration {
// @Autowired
// MetaHandler metaHandler;
// private static final String MAPPER_LOCATION = "classpath*:mapper/mysql/*.xml";
//
// @Autowired
// private DataSourceProperties dsp;
//
// @Bean(name = "hikariDataSource")
// public HikariDataSource hikariDataSource() {
// @Bean(name = "mysqlDataSource")
// @Primary
// public DataSource mysqlDataSource() {
// HikariDataSource hds = new HikariDataSource();
// hds.setSchema(dsp.getSchema().get(0));
// hds.setUsername(dsp.getUsername());
// hds.setPassword(dsp.getPassword());
// hds.setJdbcUrl(dsp.getUrl());
......@@ -44,30 +54,65 @@
// return hds;
// }
//
// @Primary
// @Bean("dataSource")
// public DataSourceProxy dataSourceProxy(@Qualifier("dataSource") DataSource hikariDataSource) {
// @Bean("mysqlDataSourceProxy")
// public DataSourceProxy dataSourceProxy(DataSource hikariDataSource) {
// return new DataSourceProxy(hikariDataSource);
// }
//
// @Bean(name = "sqlSessionFactory")
// @Autowired
// public SqlSessionFactory sqlSessionFactoryBean(@Qualifier("dataSource") DataSource dataSourceProxy, PaginationInterceptor paginationInterceptor, MetaHandler metaHandler) throws Exception {
// @Bean(name = "mysqlSqlSessionFactory")
// @Primary
// public SqlSessionFactory mysqlSqlSessionFactory(@Qualifier("mysqlDataSourceProxy") DataSource dataSource, GlobalConfig globalConfig) throws Exception {
// //注意这里一定要用MybatisSqlSessionFactoryBean,如果用SqlSessionFactory,配置无效
// MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
// bean.setDataSource(dataSourceProxy);
// ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
// bean.setMapperLocations(resolver.getResources("classpath*:mapper/*.xml"));
// GlobalConfig globalConfig = new GlobalConfig();
// globalConfig.setSqlInjector(new MybatisSqlInjector());
// bean.setDataSource(dataSource);
// bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION));
// globalConfig.setMetaObjectHandler(metaHandler);
// bean.setGlobalConfig(globalConfig);
// Interceptor[] plugins = {paginationInterceptor};
// bean.setPlugins(plugins);
// //分页插件
// Interceptor interceptor = new PageInterceptor();
// Properties properties = new Properties();
// properties.setProperty("helperDialect", "mysql");
// properties.setProperty("offsetAsPageNum", "true");
// properties.setProperty("rowBoundsWithCount", "true");
// properties.setProperty("reasonable", "true");
// properties.setProperty("supportMethodsArguments","true");
// properties.setProperty("params","pageNum=current;pageSize=size" +
// "" +
// ";");
// interceptor.setProperties(properties);
// bean.setPlugins(new Interceptor[] {interceptor,
// userEmpowerInterceptor(),
// paginationInterceptor()
// });
// return bean.getObject();
// }
//
// @Bean(name = "mysqlTransactionManager")
// @Primary
// public DataSourceTransactionManager mysqlTransactionManager(@Qualifier("mysqlDataSource") DataSource dataSource) {
// return new DataSourceTransactionManager(dataSource);
// }
//
// @Bean(name = "mysqlSqlSessionTemplate")
// @Primary
// public SqlSessionTemplate mysqlSqlSessionTemplate(@Qualifier("mysqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
// return new SqlSessionTemplate(sqlSessionFactory);
// }
//
// @Bean
// public PaginationInterceptor paginationInterceptor() {
// PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
// paginationInterceptor.setDialectType("mysql");
// return paginationInterceptor;
// }
//
//
// @Bean
// public MetaHandler metaHandler() {
// return new MetaHandler();
// public UserEmpowerInterceptor userEmpowerInterceptor() {
// UserEmpowerInterceptor userEmpowerInterceptor = new UserEmpowerInterceptor();
//
// return userEmpowerInterceptor;
// }
//
//
//}
......@@ -18,6 +18,7 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceRectificationOrder
import com.yeejoin.amos.boot.module.hygf.api.mapper.BasicGridAcceptanceMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IAcceptanceRectificationOrderService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -98,7 +99,7 @@ public class AcceptanceRectificationOrderServiceImpl extends BaseService<Accepta
* 提交整改并触发工作流
*/
@Transactional
@GlobalTransactional
public AcceptanceRectificationOrderDto updateAndDriveWorkflow(AcceptanceRectificationOrderDto model, String userId) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
......
......@@ -18,6 +18,7 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BasicGridAcceptanceMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IAcceptanceService;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -109,7 +110,7 @@ public class AcceptanceServiceImpl implements IAcceptanceService {
return Optional.ofNullable(item).orElse(new AcceptanceCheckItem());
}
@Override
@Transactional
@GlobalTransactional
public void checkAccept( Long basicGridAcceptanceId ,String userId){
BasicGridAcceptance basicGridAcceptanc= basicGridAcceptanceMapper.selectById(basicGridAcceptanceId);
basicGridAcceptanc.setAcceptanceStatus(AcceptanceStatusEnum.待投融验收.getCode());
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
......@@ -11,10 +12,12 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
import com.yeejoin.amos.boot.module.hygf.api.service.IBasicGridAcceptanceService;
import com.yeejoin.amos.boot.module.hygf.api.util.NumberUtil;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.*;
......@@ -23,136 +26,138 @@ import java.util.*;
@Service
@Transactional(rollbackFor = Exception.class)
public class BasicGridAcceptanceServiceImpl
extends BaseService<BasicGridAcceptanceDto, BasicGridAcceptance, BasicGridAcceptanceMapper>
implements IBasicGridAcceptanceService {
private final String OK = "0";
private final String PASS = "5";
@Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired
HygfOnGridMapper onGridMapper;
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
WorkflowImpl workflow;
@Autowired
AcceptanceCheckItemMapper acceptanceCheckItemMapper;
@Autowired
AcceptanceRectificationOrderMapper acceptanceRectificationOrderMapper;
@Autowired
RegionalCompaniesMapper regionalCompaniesMapper;
@Autowired
WorkOrderMapper workOrderMapper;
@Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired
private CommonServiceImpl commonService;
public Page<BasicGridAcceptanceDto> selectPage(Long regionCompanyId, Long amosDealerId, int current, int size,
String projectAddress, String powerStationCode, String ownersName, String gridStatus,
String gridConnectionTime, String formType) throws Exception {
PageHelper.startPage(current, size);
Map<String, Object> map = new HashMap<>();
Date date = null;
extends BaseService<BasicGridAcceptanceDto, BasicGridAcceptance, BasicGridAcceptanceMapper>
implements IBasicGridAcceptanceService {
@Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired
HygfOnGridMapper onGridMapper;
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
WorkflowImpl workflow;
@Autowired
AcceptanceCheckItemMapper acceptanceCheckItemMapper;
@Autowired
AcceptanceRectificationOrderMapper acceptanceRectificationOrderMapper;
@Autowired
RegionalCompaniesMapper regionalCompaniesMapper;
@Autowired
WorkOrderMapper workOrderMapper;
@Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired
private CommonServiceImpl commonService;
private final String OK = "0";
private final String PASS = "5";
public Page<BasicGridAcceptanceDto> selectPage(Long regionCompanyId, Long amosDealerId, int current, int size,
String projectAddress, String powerStationCode, String ownersName, String gridStatus,
String gridConnectionTime, String formType) throws Exception {
PageHelper.startPage(current, size);
Map<String, Object> map = new HashMap<>();
Date date = null;
// if (StringUtils.isNotEmpty(gridConnectionTime)) {
// date = DateUtil.formatStringToDate(gridConnectionTime, "yyyy-MM-dd HH:mm:ss");
// }
map.put("projectAddress", projectAddress);
map.put("powerStationCode", powerStationCode);
map.put("ownersName", ownersName);
map.put("gridStatus", gridStatus);
map.put("gridConnectionTime", gridConnectionTime);
map.put("formType", formType);
map.put("regionCompanyId", regionCompanyId);
map.put("amosDealerId", amosDealerId);
List<BasicGridAcceptanceDto> list = basicGridAcceptanceMapper.selectPageList(map);
PageInfo<BasicGridAcceptanceDto> page = new PageInfo(list);
Page<BasicGridAcceptanceDto> pageNew = new Page<>();
pageNew.setCurrent(current);
pageNew.setTotal(page.getTotal());
pageNew.setSize(size);
pageNew.setRecords(page.getList());
return pageNew;
}
map.put("projectAddress", projectAddress);
map.put("powerStationCode", powerStationCode);
map.put("ownersName", ownersName);
map.put("gridStatus", gridStatus);
map.put("gridConnectionTime", gridConnectionTime);
map.put("formType", formType);
map.put("regionCompanyId", regionCompanyId);
map.put("amosDealerId", amosDealerId);
List<BasicGridAcceptanceDto> list = basicGridAcceptanceMapper.selectPageList(map);
PageInfo<BasicGridAcceptanceDto> page = new PageInfo(list);
Page<BasicGridAcceptanceDto> pageNew = new Page<>();
pageNew.setCurrent(current);
pageNew.setTotal(page.getTotal());
pageNew.setSize(size);
pageNew.setRecords(page.getList());
return pageNew;
}
public HygfOnGrid saveEntity(HygfOnGrid grid) {
if (grid.getSequenceNbr() != null) {
onGridMapper.updateById(grid);
} else {
onGridMapper.insert(grid);
}
public HygfOnGrid saveEntity(HygfOnGrid grid) {
if (grid.getSequenceNbr() != null) {
onGridMapper.updateById(grid);
} else {
onGridMapper.insert(grid);
}
return grid;
}
return grid;
}
@Transactional
public HygfOnGrid saveAndCommit(HygfOnGrid grid, String userId) {
@GlobalTransactional
public HygfOnGrid saveAndCommit(HygfOnGrid grid, String userId) {
BasicGridAcceptance basicGridAcceptance = basicGridAcceptanceMapper
.selectOne(new LambdaQueryWrapper<BasicGridAcceptance>()
.eq(BasicGridAcceptance::getWorkOrderPowerStationId, grid.getWorkOrderPowerStationId()));
basicGridAcceptance.setGridStatus(GridStatusEnum.DSH.getCode());
BasicGridAcceptance basicGridAcceptance = basicGridAcceptanceMapper
.selectOne(new LambdaQueryWrapper<BasicGridAcceptance>()
.eq(BasicGridAcceptance::getWorkOrderPowerStationId, grid.getWorkOrderPowerStationId()));
basicGridAcceptance.setGridStatus(GridStatusEnum.DSH.getCode());
if (grid.getType() != null && "1".equals(grid.getType())) {
// 执行工作流
StandardDto standardDto = new StandardDto();
standardDto.setTaskId(basicGridAcceptance.getNextTaskId());
workflow.standard(basicGridAcceptance, standardDto, userId);
if (grid.getType() != null && "1".equals(grid.getType())) {
// 执行工作流
StandardDto standardDto = new StandardDto();
standardDto.setTaskId(basicGridAcceptance.getNextTaskId());
workflow.standard(basicGridAcceptance, standardDto, userId);
} else {
// 调用工作流执行第一个节点
ProcessDto processDto = new ProcessDto();
processDto.setProcessDefinitionKey("hygf_bwys");
processDto.setBusinessKey(String.valueOf(basicGridAcceptance.getSequenceNbr()));
StartProcessDto startProcessDto = new StartProcessDto();
List<ProcessDto> process = new ArrayList<>();
process.add(processDto);
startProcessDto.setProcess(process);
workflow.startProcess(basicGridAcceptance, startProcessDto, userId);
// 线上验收
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网中.getCode());
long idsk = basicGridAcceptance.getPeasantHouseholdId();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
} else {
// 调用工作流执行第一个节点
ProcessDto processDto = new ProcessDto();
processDto.setProcessDefinitionKey("hygf_bwys");
processDto.setBusinessKey(String.valueOf(basicGridAcceptance.getSequenceNbr()));
StartProcessDto startProcessDto = new StartProcessDto();
List<ProcessDto> process = new ArrayList<>();
process.add(processDto);
startProcessDto.setProcess(process);
workflow.startProcess(basicGridAcceptance, startProcessDto, userId);
}
if (grid.getSequenceNbr() != null) {
onGridMapper.updateById(grid);
} else {
onGridMapper.insert(grid);
}
basicGridAcceptanceMapper.updateById(basicGridAcceptance);
// 线上验收
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网中.getCode());
long idsk = basicGridAcceptance.getPeasantHouseholdId();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
}
if (grid.getSequenceNbr() != null) {
onGridMapper.updateById(grid);
} else {
onGridMapper.insert(grid);
}
basicGridAcceptanceMapper.updateById(basicGridAcceptance);
//发起待办
//发起待办
// commonService.buildTaskModel(buildBWYSTaskModel(grid, basicGridAcceptance));
return grid;
}
return grid;
}
private List<TaskModelDto> buildBWYSTaskModel(HygfOnGrid grid, BasicGridAcceptance basicGridAcceptance) {
List<TaskModelDto> taskModelDtoList = new ArrayList<>();
TaskModelDto taskModelDto = new TaskModelDto();
taskModelDto.setFlowCode(basicGridAcceptance.getNextTaskId());
taskModelDto.setFlowCreateDate(new Date());
taskModelDto.setFlowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setPageType(null);
taskModelDto.setExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds());
taskModelDto.setModel(grid);
taskModelDto.setRelationId(basicGridAcceptance.getInstanceId());
taskModelDto.setRoutePath(null);
taskModelDto.setStartUserId(basicGridAcceptance.getRecUserId());
taskModelDto.setStartUser(basicGridAcceptance.getRecUserName());
taskModelDto.setStartDate(basicGridAcceptance.getRecDate());
taskModelDto.setStartUserCompanyName(null);
taskModelDto.setTaskName(basicGridAcceptance.getNextNodeName());
taskModelDto.setTaskCode(String.valueOf(basicGridAcceptance.getWorkOrderId()));
taskModelDto.setTaskType(BusinessTypeEnum.HYGF_BWYS.getCode());
taskModelDto.setTaskTypeLabel(BusinessTypeEnum.HYGF_BWYS.getName());
taskModelDto.setTaskStatus(TaskStatusEnum.UNDERWAY.getValue());
taskModelDto.setTaskStatusLabel(TaskStatusEnum.UNDERWAY.getName());
private List<TaskModelDto> buildBWYSTaskModel(HygfOnGrid grid, BasicGridAcceptance basicGridAcceptance) {
List<TaskModelDto> taskModelDtoList = new ArrayList<>();
TaskModelDto taskModelDto = new TaskModelDto();
taskModelDto.setFlowCode(basicGridAcceptance.getNextTaskId());
taskModelDto.setFlowCreateDate(new Date());
taskModelDto.setFlowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setPageType(null);
taskModelDto.setExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds());
taskModelDto.setModel(grid);
taskModelDto.setRelationId(basicGridAcceptance.getInstanceId());
taskModelDto.setRoutePath(null);
taskModelDto.setStartUserId(basicGridAcceptance.getRecUserId());
taskModelDto.setStartUser(basicGridAcceptance.getRecUserName());
taskModelDto.setStartDate(basicGridAcceptance.getRecDate());
taskModelDto.setStartUserCompanyName(null);
taskModelDto.setTaskName(basicGridAcceptance.getNextNodeName());
taskModelDto.setTaskCode(String.valueOf(basicGridAcceptance.getWorkOrderId()));
taskModelDto.setTaskType(BusinessTypeEnum.HYGF_BWYS.getCode());
taskModelDto.setTaskTypeLabel(BusinessTypeEnum.HYGF_BWYS.getName());
taskModelDto.setTaskStatus(TaskStatusEnum.UNDERWAY.getValue());
taskModelDto.setTaskStatusLabel(TaskStatusEnum.UNDERWAY.getName());
// taskModelDto.setTaskDesc();
// taskModelDto.setTaskContent();
taskModelDto.setNextExecuteUser(basicGridAcceptance.getNextExecutorIds());
......@@ -188,26 +193,26 @@ public class BasicGridAcceptanceServiceImpl
return bool;
}
@Transactional
public void execute(AcceptanceCheckItem dto, String userId) {
// 查询并网审批信息
BasicGridAcceptance basicGridAcceptanc = basicGridAcceptanceMapper.selectById(dto.getBasicGridAcceptanceId());
String nextNodeKey = basicGridAcceptanc.getNextNodeKey();
if (OK.equals(dto.getApprovalStatus())) {
if (BasicGridAcceptancEnum.并网管理端工程审核.getCode().equals(nextNodeKey)) {
basicGridAcceptanc.setGridStatus(GridStatusEnum.YWC.getCode());
basicGridAcceptanc.setAcceptanceStatus(AcceptanceStatusEnum.待提交验收.getCode());
// 并网时间
LambdaUpdateWrapper<HygfOnGrid> upq = new LambdaUpdateWrapper();
upq.eq(HygfOnGrid::getSequenceNbr, dto.getFonGridId());
upq.set(HygfOnGrid::getGridConnectionTime, new Date());
onGridMapper.update(null, upq);
// 并网完成
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网完成.getCode());
long idsk = basicGridAcceptanc.getPeasantHouseholdId();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
@GlobalTransactional
public void execute(AcceptanceCheckItem dto, String userId) {
// 查询并网审批信息
BasicGridAcceptance basicGridAcceptanc = basicGridAcceptanceMapper.selectById(dto.getBasicGridAcceptanceId());
String nextNodeKey = basicGridAcceptanc.getNextNodeKey();
if (OK.equals(dto.getApprovalStatus())) {
if (BasicGridAcceptancEnum.并网管理端工程审核.getCode().equals(nextNodeKey)) {
basicGridAcceptanc.setGridStatus(GridStatusEnum.YWC.getCode());
basicGridAcceptanc.setAcceptanceStatus(AcceptanceStatusEnum.待提交验收.getCode());
// 并网时间
LambdaUpdateWrapper<HygfOnGrid> upq = new LambdaUpdateWrapper();
upq.eq(HygfOnGrid::getSequenceNbr, dto.getFonGridId());
upq.set(HygfOnGrid::getGridConnectionTime, new Date());
onGridMapper.update(null, upq);
// 并网完成
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网完成.getCode());
long idsk = basicGridAcceptanc.getPeasantHouseholdId();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
} else {
......
......@@ -33,6 +33,7 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -112,7 +113,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
return this.queryForList("", false);
}
@Transactional
@GlobalTransactional
public FinancingInfoDto saveModel(FinancingInfoDto model) {
List<String> ids;
if (model.getPeasantHouseholdIds().contains(",")) {
......@@ -156,7 +157,6 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
actWorkflowBatchDTO.setProcess(list);
List<ProcessTaskDTO> processTaskDTOS = workFlowService.startBatch(actWorkflowBatchDTO);
List<WorkflowResultDto> workflowResultDtos = workFlowService.buildWorkFlowInfo(processTaskDTOS);
WorkflowResultDto workflowResultDto = workflowResultDtos.get(0);
FinancingAuditingDto financingAuditingDto = new FinancingAuditingDto();
BeanUtils.copyProperties(workflowResultDto, financingAuditingDto);
......@@ -203,6 +203,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
@Override
@GlobalTransactional
public void rollback(String processId, String peasantHouseholdId) {
workFlowService.stopProcess(processId);
LambdaQueryWrapper<FinancingInfo> queryWrapper = new LambdaQueryWrapper<>();
......@@ -229,7 +230,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
}
@Override
@Transactional
@GlobalTransactional
public void execueFlow(Map<String, Object> params) {
LambdaQueryWrapper<FinancingAuditing> query = new LambdaQueryWrapper<>();
query.eq(FinancingAuditing::getInstanceId, params.get("instanceId").toString());
......
......@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T;
......@@ -163,7 +164,10 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
powerStation.setRecDate(new Date());
Boolean fl = this.saveOrUpdate(powerStation);
//Boolean fl = this.saveOrUpdate(powerStation);
// 避免生成多份数据
Boolean fl = this.saveOrUpdate(powerStation,new LambdaQueryWrapper<PowerStation>()
.eq(PowerStation::getPeasantHouseholdId,powerStation.getPeasantHouseholdId()));
PowerStationNodeEnum powerStationNodeEnum = PowerStationNodeEnum
.getNodeByCode(powerStation.getNextProcessNode());
......@@ -229,7 +233,7 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
}
@Override
@Transactional
@GlobalTransactional
public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId,
String planInstanceId, Map<String, Object> kv) {
String meg = "";
......
......@@ -215,6 +215,7 @@ public class QiyuesuoServiceImpl {
List<Stamper> stampers = new ArrayList<>();
stampers.add(stamper);
stampers.add(stamper2);
//发起合同
SdkResponse<Object> data = this.getSdkResponse(result.getId(), stampers);
return result.getId();
}
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
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.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -23,6 +24,7 @@ import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -37,6 +39,8 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 勘察信息服务实现类
......@@ -46,31 +50,34 @@ import java.util.*;
*/
@Service
@Slf4j
public class SurveyInformationServiceImpl extends BaseService<SurveyInformationDto, SurveyInformation, SurveyInformationMapper> implements ISurveyInformationService {
public class SurveyInformationServiceImpl
extends BaseService<SurveyInformationDto, SurveyInformation, SurveyInformationMapper>
implements ISurveyInformationService {
private static final String regionRedis = "app_region_redis";
private static final String OPERATION_TYPE_SUBMIT = "submit";
private static final String OPERATION_TYPE_APPLY = "apply";
private static final String IDX_REQUEST_STATE = "200";
@Autowired
protected EmqKeeper emqKeeper;
@Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService;
@Autowired
ExtendedInformationServiceImpl extendedInformationService;
@Autowired
CommercialServiceImpl commercialService;
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
DesignInformationServiceImpl designInformationService;
@Autowired
WorkflowFeignClient workflowFeignClient;
@Autowired
RedisUtils redisUtils;
@Autowired
IdxFeginService idxFeginService;
@Autowired
......@@ -81,10 +88,22 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
ToDoTasksMapper toDoTasksMapper;
@Autowired
UserMessageMapper userMessageMapper;
@Value("${power.station.examine.pageId}")
private long pageId;
@Autowired
protected EmqKeeper emqKeeper;
@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";
private static final String IDX_REQUEST_STATE = "200";
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired
WorkOrderMapper workOrderMapper;
@Autowired
......@@ -95,6 +114,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
ConstructionRecordsMapper constructionRecordsMapper;
@Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired
SurveyInformationMapper surveyInformationMapper;
@Autowired
......@@ -105,14 +125,9 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
WorkOrderPowerStationMapper workOrderPowerStationMapper;
@Autowired
AmosRequestContext requestContext;
@Autowired
WorkflowImpl workflow;
@Value("${power.station.examine.pageId}")
private long pageId;
@Value("${power.station.examine.planId}")
private String planId;
@Autowired
private CommonServiceImpl commonService;
/**
* 分页查询
......@@ -128,35 +143,41 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
return this.queryForList("", false);
}
@Transactional
@GlobalTransactional
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto, String operationType) {
try {
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
//更新勘察基本信息
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(), SurveyInformation.class);
// 更新勘察基本信息
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(),
SurveyInformation.class);
surveyInformation.setReview(0);
if (OPERATION_TYPE_APPLY.equals(operationType) && null == surveyInformation.getCreatorTime()) {
surveyInformation.setCreatorTime(new Date());
}
this.saveOrUpdate(surveyInformation);
//更新扩展信息
ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(), ExtendedInformation.class);
// 更新扩展信息
ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(),
ExtendedInformation.class);
extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr());
extendedInformationService.saveOrUpdate(extendedInformation);
// 避免生成多份数据
extendedInformationService.saveOrUpdate(extendedInformation, new LambdaQueryWrapper<ExtendedInformation>()
.eq(ExtendedInformation::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//extendedInformationService.saveOrUpdate(extendedInformation);
//更新勘察明细信息
// 更新勘察明细信息
SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails();
SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class);
surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr());
surveyDetailsService.saveOrUpdate(surveyDetails);
// 避免生成多份数据
surveyDetailsService.saveOrUpdate(surveyDetails, new LambdaQueryWrapper<SurveyDetails>()
.eq(SurveyDetails::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//surveyDetailsService.saveOrUpdate(surveyDetails);
//更新商务信息
// 更新商务信息
CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class);
// 处理省市县
......@@ -170,22 +191,33 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
}
commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 1));
commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
commercialService.saveOrUpdate(commercial);
//勘察后,更新状态
// 避免生成多份数据
commercialService.saveOrUpdate(commercial, new LambdaQueryWrapper<Commercial>()
.eq(Commercial::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//commercialService.saveOrUpdate(commercial);
// 勘察后,更新状态
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformation.getSequenceNbr());
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper()
.selectOne(peasantHouseholdQueryWrapper);
//更新资料归档信息
// 更新资料归档信息
Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
information.setHouseProve(null == commercial ? null : (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal() : null));
information.setCardFile(null == commercial ? null : (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit() : null));
information.setHouseProve(null == commercial ? null
: (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal()
: null));
information.setCardFile(null == commercial ? null
: (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit() : null));
information.setCardFile(commercial.getAgentLegal());
information.setArchivesNumber(this.getNo(CodeEnum.档案.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information
.setArchivesNumber(this.getNo(CodeEnum.档案.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setFileNumber(this.getNo(CodeEnum.文件.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setSurveyInformationId(surveyInformation.getSequenceNbr());
informationService.saveOrUpdate(information);
// 避免生成多份数据
informationService.saveOrUpdate(information, new LambdaQueryWrapper<Information>()
.eq(Information::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//informationService.saveOrUpdate(information);
peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName());
peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone());
......@@ -194,8 +226,10 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress());
peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail());
peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress());
peasantHousehold.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
// 处理项目地址
String projectAddressName = "";
......@@ -207,7 +241,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
}
}
peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1));
//常住地址
// 常住地址
String permanentAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) {
for (RegionModel re : list) {
......@@ -216,10 +250,11 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
}
}
}
peasantHousehold.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
peasantHousehold
.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
if (OPERATION_TYPE_SUBMIT.equals(operationType)) {
// peasantHousehold.setSurveyOrNot(1);
// peasantHousehold.setSurveyOrNot(1);
} else if (OPERATION_TYPE_APPLY.equals(operationType)) {
// 提交审核
submitExamine(peasantHousehold);
......@@ -234,15 +269,17 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE", JSON.toJSONString(doTasks).getBytes(), 2, false);
UserMessage userMessage = new UserMessage(doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName() + "已完成", doTasks.getAmosOrgCode());
UserMessage userMessage = new UserMessage(doTasks.getType(), doTasks.getBusinessId(),
doTasks.getAmosUserId(), new Date(), doTasks.getTaskName() + "已完成",
doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2, false);
emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2,
false);
}
}
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("系统异常");
......@@ -265,8 +302,8 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
private void submitExamine(PeasantHousehold peasantHousehold) {
PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.作废.getCode());
PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()),
PowerStationProcessStateEnum.作废.getCode());
String taskId = null;
Map<String, Object> objectMap = new HashMap<>(1);
......@@ -275,7 +312,6 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
// 保存并审核
try {
BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance();
if (ObjectUtils.isNotEmpty(powerStation)) {
// 工作流执行一步
......@@ -289,7 +325,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId());
} else {
// 第一步启动工作流
//发起工作流
// 发起工作流
// 调用工作流执行第一个节点
ProcessDto processDto = new ProcessDto();
processDto.setBusinessKey(String.valueOf(peasantHousehold.getSequenceNbr()));
......@@ -330,16 +366,12 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
long idsk = peasantHousehold.getSequenceNbr();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
//发起待办
// commonService.buildTaskModel(buildDZSHTaskModel(peasantHousehold, basicGridAcceptance));
} catch (Exception e) {
e.printStackTrace();
throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
}
// PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.作废.getCode());
//
// String taskId = null;
......@@ -388,36 +420,8 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
// }
}
private List<TaskModelDto> buildDZSHTaskModel(PeasantHousehold peasantHousehold, BasicGridAcceptance basicGridAcceptance) {
List<TaskModelDto> taskModelDtoList = new ArrayList<>();
TaskModelDto taskModelDto = new TaskModelDto();
taskModelDto.setFlowCode(basicGridAcceptance.getNextTaskId());
taskModelDto.setFlowCreateDate(new Date());
taskModelDto.setFlowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setPageType(null);
taskModelDto.setExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds());
taskModelDto.setModel(peasantHousehold);
taskModelDto.setRelationId(basicGridAcceptance.getInstanceId());
taskModelDto.setRoutePath(null);
taskModelDto.setStartUserId(basicGridAcceptance.getRecUserId());
taskModelDto.setStartUser(basicGridAcceptance.getRecUserName());
taskModelDto.setStartDate(basicGridAcceptance.getRecDate());
taskModelDto.setStartUserCompanyName(peasantHousehold.getRegionalCompaniesName());
taskModelDto.setTaskName(basicGridAcceptance.getNextNodeName());
taskModelDto.setTaskCode(String.valueOf(basicGridAcceptance.getWorkOrderId()));
taskModelDto.setTaskType(BusinessTypeEnum.HYGF_DZ_SH.getCode());
taskModelDto.setTaskTypeLabel(BusinessTypeEnum.HYGF_DZ_SH.getName());
taskModelDto.setTaskStatus(TaskStatusEnum.UNDERWAY.getValue());
taskModelDto.setTaskStatusLabel(TaskStatusEnum.UNDERWAY.getName());
// taskModelDto.setTaskDesc();
// taskModelDto.setTaskContent();
taskModelDto.setNextExecuteUser(basicGridAcceptance.getNextExecutorIds());
taskModelDtoList.add(taskModelDto);
return taskModelDtoList;
}
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId, String peasantHouseholdId, String processInstanceId, AgencyUserModel userInfo) {
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId, String peasantHouseholdId,
String processInstanceId, AgencyUserModel userInfo) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold();
......@@ -431,16 +435,16 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
}
//勘察基本信息
// 勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = this.baseMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
//农户信息
// 农户信息
//获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
// 获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
......@@ -453,10 +457,12 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
}
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
surveyInfoAllDto.getSurveyInformation()
.setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
}
if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
surveyInfoAllDto.getSurveyInformation()
.setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
}
if (peasantHousehold.getPermanentAddress() == null) {
......@@ -464,9 +470,8 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
}
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
//制单时间
// 制单时间
surveyInfoAllDto.getSurveyInformation().setCreatorTime(surveyInformation.getCreatorTime());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
......@@ -493,8 +498,12 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
if (information == null) {
surveyInfoAllDto.setInformation(new InformationDto());
} else {
information.setHouseProve(null == commercial ? new ArrayList<>() : (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal() : new ArrayList<>()));
information.setCardFile(null == commercial ? new ArrayList<>() : (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit() : new ArrayList<>()));
information.setHouseProve(null == commercial ? new ArrayList<>()
: (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal()
: new ArrayList<>()));
information.setCardFile(null == commercial ? new ArrayList<>()
: (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit()
: new ArrayList<>()));
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
}
......@@ -526,7 +535,6 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
}
commercial.setSurveyPhotosWeb(list);
if (information == null) {
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
commercialDto.setType("zrr");
......@@ -535,29 +543,32 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
} else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if (commercial != null && !StringUtils.isEmpty(commercial.getProjectAddressName())) {
surveyInfoAllDto.getCommercial().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
surveyInfoAllDto.getCommercial()
.setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
}
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper()
.selectOne(extendedInformationQueryWrapper);
if (information == null) {
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
} else {
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
surveyInfoAllDto
.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
DesignInformation designInformation = designInformationService.getBaseMapper().selectOne(designInformationQueryWrapper);
DesignInformation designInformation = designInformationService.getBaseMapper()
.selectOne(designInformationQueryWrapper);
if (designInformation == null) {
surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
} else {
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
}
LambdaQueryWrapper<WorkOrderPowerStation> up1 = new LambdaQueryWrapper();
up1.eq(WorkOrderPowerStation::getPeasantHouseholdId, peasantHouseholdId);
WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(up1);
......@@ -565,42 +576,53 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
Long workOrderId = workOrderPowerStation.getWorkOrderId();
Long workOrderPowerStationId = workOrderPowerStation.getSequenceNbr();
//派工单信息
// 派工单信息
LambdaQueryWrapper<WorkOrder> upl = new LambdaQueryWrapper();
upl.eq(WorkOrder::getSequenceNbr, workOrderId);
WorkOrder workOrder = workOrderMapper.selectOne(upl);
//施工信息
// 施工信息
LambdaQueryWrapper<PowerStationConstructionData> up2 = new LambdaQueryWrapper();
up2.eq(PowerStationConstructionData::getWorkOrderId, workOrderId);
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationConstructionData powerStationConstructionData = powerStationConstructionDataMapper.selectOne(up2);
PowerStationConstructionData powerStationConstructionData = powerStationConstructionDataMapper
.selectOne(up2);
//工程信息
// 工程信息
LambdaQueryWrapper<PowerStationEngineeringInfo> up3 = new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderId, workOrderId);
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoMapper.selectOne(up3);
if (powerStationConstructionData != null) {
powerStationEngineeringInfo = powerStationEngineeringInfo != null ? powerStationEngineeringInfo : new PowerStationEngineeringInfo();
powerStationEngineeringInfo.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo = powerStationEngineeringInfo != null ? powerStationEngineeringInfo
: new PowerStationEngineeringInfo();
powerStationEngineeringInfo
.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo
.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo.setConstructionCollectorBoxInfo(
powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo
.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
powerStationEngineeringInfo.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
powerStationEngineeringInfo
.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
}
//并网信息
// 并网信息
LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData != null ? powerStationConstructionData : new PowerStationConstructionData());
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo != null ? powerStationEngineeringInfo : new PowerStationEngineeringInfo());
surveyInfoAllDto
.setPowerStationConstructionData(powerStationConstructionData != null ? powerStationConstructionData
: new PowerStationConstructionData());
surveyInfoAllDto
.setPowerStationEngineeringInfo(powerStationEngineeringInfo != null ? powerStationEngineeringInfo
: new PowerStationEngineeringInfo());
surveyInfoAllDto.setWorkOrder(workOrder != null ? workOrder : new WorkOrder());
} else {
surveyInfoAllDto.setHygfOnGrid(new HygfOnGrid());
......@@ -609,7 +631,6 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
surveyInfoAllDto.setWorkOrder(new WorkOrder());
}
if (!StringUtils.isEmpty(processInstanceId)) {
try {
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(processInstanceId).getResult();
......@@ -619,11 +640,13 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
}
List<LinkedHashMap> flowLoggernew = new ArrayList<>();
for (LinkedHashMap linkedHashMap : flowLogger) {
if (linkedHashMap.get("operateDate") != null && !linkedHashMap.get("operateDate").toString().isEmpty()) {
if (linkedHashMap.get("operateDate") != null
&& !linkedHashMap.get("operateDate").toString().isEmpty()) {
LinkedHashMap linke = new LinkedHashMap();
linke.put("approvalStatue", linkedHashMap.get("approvalStatue").toString());
//审核意见
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap.get("approvalSuggestion");
// 审核意见
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap
.get("approvalSuggestion");
if (approvalSuggestion != null && !approvalSuggestion.isEmpty()) {
linke.put("approvalSuggestion", approvalSuggestion.get(0).get("message"));
}
......@@ -643,7 +666,6 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
return surveyInfoAllDto;
}
public JSONArray getRegionName() {
JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
......@@ -652,7 +674,8 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient
.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
if (regionModel.getChildren() != null && !regionModel.getChildren().isEmpty()) {
......
......@@ -29,6 +29,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -161,7 +162,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
}
@Override
@Transactional
@GlobalTransactional
public UnitRegisterDto registerUnit(UnitRegisterDto model) {
UnitInfoDto regUnitInfo = model.getUnitInfoDto();
......@@ -576,7 +577,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
@Override
@Transactional
@GlobalTransactional
public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv) {
// 2.更新审核记录表
......@@ -705,6 +706,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
}
// // 2.更新审核记录表
// UnitInfo unitInfo=null;
// try{
......@@ -939,15 +941,26 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
commerceInfoMapper.updateById(commerceInfo);
//区域公司
LambdaQueryWrapper<RegionalCompanies> qu = new LambdaQueryWrapper<>();
qu.eq(RegionalCompanies::getUnitId, unitInfo.getAmosCompanySeq());
List<RegionalCompanies> oldList = regionalCompaniesMapper.selectList(qu);
regionalCompaniesMapper.delete(qu);
List<RegionalCompanies> regionalComp = new ArrayList<>();
FeignClientResult<Collection<CompanyModel>> feignClientResult = Privilege.companyClient.querySubAgencyTree(regionalCompanies);
List<CompanyModel> companyModel = (List<CompanyModel>) feignClientResult.getResult();
List<String> lisd = unitInfo.getRegionalCompaniesSeq();
//区域公司
LambdaQueryWrapper<RegionalCompanies> qu=new LambdaQueryWrapper<>();
qu.eq(RegionalCompanies::getUnitId,unitInfo.getAmosCompanySeq());
List<RegionalCompanies> oldList = regionalCompaniesMapper.selectList(qu);
regionalCompaniesMapper.delete(qu);
List<String> oldDisString = oldList.stream().map((regionalCompanies) -> regionalCompanies.getRegionalCompaniesSeq().toString()).collect(Collectors.toList());
List<String> newDisString = dis.stream().map((regionalCompaniesSeq) -> regionalCompaniesSeq.toString()).collect(Collectors.toList());
for(String item:oldDisString){
if(!newDisString.contains(item)){
throw new BadRequest("所属区域公司只能增加, 不能删除");
}
}
List<RegionalCompanies> regionalComp= new ArrayList<>();
FeignClientResult<Collection<CompanyModel>> feignClientResult= Privilege.companyClient.querySubAgencyTree(regionalCompanies);
List<CompanyModel> companyModel = (List<CompanyModel>)feignClientResult.getResult();
List<String> lisd=unitInfo.getRegionalCompaniesSeq();
if (oldList == null) {
......
......@@ -33,322 +33,281 @@ import java.util.*;
* @date 2024-01-02
*/
@Service
public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,WorkOrderMapper> implements IWorkOrderService {
@Autowired
RegionalCompaniesMapper regionalCompaniesMapper;
@Autowired
WorkOrderMapper workOrderMapper;
@Autowired
WorkOrderPowerStationServiceImpl workOrderPowerStationServiceImpl;
@Autowired
WorkOrderPowerStationMapper workOrderPowerStationMapper;
@Autowired
DesignInformationMapper designInformationMapper;
@Autowired
PowerStationConstructionDataServiceImpl powerStationConstructionDataService;
@Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService;
@Autowired
ExtendedInformationServiceImpl extendedInformationService;
@Autowired
CommercialServiceImpl commercialService;
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
DesignInformationServiceImpl designInformationService;
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
SurveyInformationMapper surveyInformationMapper;
@Autowired
PowerStationConstructionDataMapper powerStationConstructionDataMapper;
@Autowired
PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
@Autowired
PowerStationEngineeringInfoServiceImpl powerStationEngineeringInfoService;
@Autowired
HygfOnGridMapper hygfOnGridMapper;
@Autowired
ConstructionRecordsServiceImpl constructionRecordsServiceImpl;
@Autowired
ConstructionRecordsMapper constructionRecordsMapper;
@Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired
WorkflowFeignClient workflowFeignClient;
@Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
/**
* 分页查询
*/
public Page<WorkOrderDto> queryForWorkOrderPage(Page<WorkOrderDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<WorkOrderDto> queryForWorkOrderList() {
return this.queryForList("" , false);
}
@Transactional
public WorkOrder saveWorkOrder (WorkOrder model, UserUnitInformationDto userUnitInformationDto) {
//保存派工单
RegionalCompanies regionalCompanies= regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId());
String code= NumberUtil.getCode(CodeEnum.派工单.getCode(),regionalCompanies.getCompanyCode(),regionalCompanies.getRegionalAddress());
model.setWorkOrderNum(code);
model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName());
model.setRegionCode(regionalCompanies.getRegionalCompaniesCode());
model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode());
model.setRegionAddress(regionalCompanies.getRegionalAddress());
//获取经销商单位信息
model.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
model.setAmosDealerName(userUnitInformationDto.getAmosDealerName());
model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode());
workOrderMapper.insert(model);
//保存派工单 电站信息
List<PeasantHousehold> peasantHouseholdId=model.getPeasantHouseholdId();
List<ConstructionRecords> constructionRecordlist=new ArrayList<>();
List<WorkOrderPowerStation> li=new ArrayList<>();
for (PeasantHousehold peasantHousehold : peasantHouseholdId) {
WorkOrderPowerStation workOrderPowerStation=new WorkOrderPowerStation();
workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr());
workOrderPowerStation.setWorkOrderId(model.getSequenceNbr());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode());
li.add(workOrderPowerStation);
}
workOrderPowerStationServiceImpl.saveBatch(li);
for (WorkOrderPowerStation workOrderPowerStation : li) {
//增加操作日志
ConstructionRecords da=new ConstructionRecords(
workOrderPowerStation.getRecUserName(),
"新建派工单",
new Date(),
"",
workOrderPowerStation.getWorkOrderId(),
workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(),
"");
constructionRecordlist.add(da);
}
constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
return model;
}
@Transactional
public WorkOrder updateWorkOrder (WorkOrder model, UserUnitInformationDto userUnitInformationDto) {
//保存派工单
RegionalCompanies regionalCompanies= regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId());
model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName());
model.setRegionCode(regionalCompanies.getRegionalCompaniesCode());
model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode());
model.setRegionAddress(regionalCompanies.getRegionalAddress());
//获取经销商单位信息
model.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
model.setAmosDealerName(userUnitInformationDto.getAmosDealerName());
model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode());
workOrderMapper.updateById(model);
LambdaQueryWrapper<WorkOrderPowerStation> up=new LambdaQueryWrapper();
up.eq(WorkOrderPowerStation::getWorkOrderId,model.getSequenceNbr());
workOrderPowerStationMapper.delete(up);
//保存派工单 电站信息
List<PeasantHousehold> peasantHouseholdId=model.getPeasantHouseholdId();
List<WorkOrderPowerStation> li=new ArrayList<>();
for (PeasantHousehold peasantHousehold : peasantHouseholdId) {
WorkOrderPowerStation workOrderPowerStation=new WorkOrderPowerStation();
workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr());
workOrderPowerStation.setWorkOrderId(model.getSequenceNbr());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode());
li.add(workOrderPowerStation);
}
workOrderPowerStationServiceImpl.saveBatch(li);
List<ConstructionRecords> constructionRecordlist=new ArrayList<>();
for (WorkOrderPowerStation workOrderPowerStation : li) {
//增加操作日志
ConstructionRecords da=new ConstructionRecords(
workOrderPowerStation.getRecUserName(),
"编辑派工单",
new Date(),
"",
workOrderPowerStation.getWorkOrderId(),
workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(),
"");
constructionRecordlist.add(da);
}
constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
return model;
}
public WorkOrder selectOne(Long sequenceNbr) {
WorkOrder model= workOrderMapper.selectById(sequenceNbr);
List<PeasantHousehold> li=workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr,null);
model.setPeasantHouseholdId(li);
return model;
}
public Map<String,Object> selectOneall(Long sequenceNbr) {
WorkOrder model= workOrderMapper.selectById(sequenceNbr);
List<PeasantHousehold> lih=workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr,null);
//获取所有电站Bom,分组合并,暂时不相加
List<Long> ids=new ArrayList<>();
for (PeasantHousehold documentStation : lih) {
ids.add(documentStation.getSequenceNbr());
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.in("peasant_household_id", ids);
List<DesignInformation> li = designInformationMapper.selectList(designInformationQueryWrapper);
DesignInformation designInformation=new DesignInformation();
//组件
List<Object> assembly=new ArrayList<>();
//逆变器
List<Object> inverter=new ArrayList<>();
//电表箱
List<Object> electricityMeter=new ArrayList<>();
//电缆
List<Object> cable=new ArrayList<>();
for (DesignInformation des : li) {
if(des.getAssembly()!=null&&!des.getAssembly().isEmpty()){
assembly.addAll(des.getAssembly());
}
if(des.getInverter()!=null&&!des.getInverter().isEmpty()){
inverter.addAll(des.getInverter());
}
if(des.getElectricityMeter()!=null&&!des.getElectricityMeter().isEmpty()){
electricityMeter.addAll(des.getElectricityMeter());
}
if(des.getCable()!=null&&!des.getCable().isEmpty()){
cable.addAll(des.getCable());
}
}
List<PeasantHousehold> list=workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr,null);
Map<String,Object> map =new HashMap<>();
designInformation.setAssembly(assembly);
designInformation.setInverter(inverter);
designInformation.setElectricityMeter(electricityMeter);
designInformation.setCable(cable);
map.put("workOrder",model);
map.put("designInformation",designInformation);
map.put("peasantHousehold",list);
return map;
}
@Transactional
public PowerStationConstructionData addOrUpdate(PowerStationConstructionData powerStationConstructionData){
public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, WorkOrderMapper>
implements IWorkOrderService {
@Autowired
RegionalCompaniesMapper regionalCompaniesMapper;
@Autowired
WorkOrderMapper workOrderMapper;
@Autowired
WorkOrderPowerStationServiceImpl workOrderPowerStationServiceImpl;
@Autowired
WorkOrderPowerStationMapper workOrderPowerStationMapper;
@Autowired
DesignInformationMapper designInformationMapper;
@Autowired
PowerStationConstructionDataServiceImpl powerStationConstructionDataService;
@Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService;
@Autowired
ExtendedInformationServiceImpl extendedInformationService;
@Autowired
CommercialServiceImpl commercialService;
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
DesignInformationServiceImpl designInformationService;
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
SurveyInformationMapper surveyInformationMapper;
@Autowired
PowerStationConstructionDataMapper powerStationConstructionDataMapper;
@Autowired
PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
@Autowired
PowerStationEngineeringInfoServiceImpl powerStationEngineeringInfoService;
@Autowired
HygfOnGridMapper hygfOnGridMapper;
@Autowired
ConstructionRecordsServiceImpl constructionRecordsServiceImpl;
@Autowired
ConstructionRecordsMapper constructionRecordsMapper;
@Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired
WorkflowFeignClient workflowFeignClient;
@Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
/**
* 分页查询
*/
public Page<WorkOrderDto> queryForWorkOrderPage(Page<WorkOrderDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<WorkOrderDto> queryForWorkOrderList() {
return this.queryForList("", false);
}
@Transactional
public WorkOrder saveWorkOrder(WorkOrder model, UserUnitInformationDto userUnitInformationDto) {
// 保存派工单
RegionalCompanies regionalCompanies = regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId());
String code = NumberUtil.getCode(CodeEnum.派工单.getCode(), regionalCompanies.getCompanyCode(),
regionalCompanies.getRegionalAddress());
model.setWorkOrderNum(code);
model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName());
model.setRegionCode(regionalCompanies.getRegionalCompaniesCode());
model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode());
model.setRegionAddress(regionalCompanies.getRegionalAddress());
// 获取经销商单位信息
model.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
model.setAmosDealerName(userUnitInformationDto.getAmosDealerName());
model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode());
workOrderMapper.insert(model);
// 保存派工单 电站信息
List<PeasantHousehold> peasantHouseholdId = model.getPeasantHouseholdId();
List<ConstructionRecords> constructionRecordlist = new ArrayList<>();
List<WorkOrderPowerStation> li = new ArrayList<>();
for (PeasantHousehold peasantHousehold : peasantHouseholdId) {
WorkOrderPowerStation workOrderPowerStation = new WorkOrderPowerStation();
workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr());
workOrderPowerStation.setWorkOrderId(model.getSequenceNbr());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode());
li.add(workOrderPowerStation);
}
workOrderPowerStationServiceImpl.saveBatch(li);
for (WorkOrderPowerStation workOrderPowerStation : li) {
// 增加操作日志
ConstructionRecords da = new ConstructionRecords(workOrderPowerStation.getRecUserName(), "新建派工单",
new Date(), "", workOrderPowerStation.getWorkOrderId(), workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(), "");
constructionRecordlist.add(da);
}
constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
return model;
}
@Transactional
public WorkOrder updateWorkOrder(WorkOrder model, UserUnitInformationDto userUnitInformationDto) {
// 保存派工单
RegionalCompanies regionalCompanies = regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId());
model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName());
model.setRegionCode(regionalCompanies.getRegionalCompaniesCode());
model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode());
model.setRegionAddress(regionalCompanies.getRegionalAddress());
// 获取经销商单位信息
model.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
model.setAmosDealerName(userUnitInformationDto.getAmosDealerName());
model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode());
workOrderMapper.updateById(model);
LambdaQueryWrapper<WorkOrderPowerStation> up = new LambdaQueryWrapper();
up.eq(WorkOrderPowerStation::getWorkOrderId, model.getSequenceNbr());
workOrderPowerStationMapper.delete(up);
// 保存派工单 电站信息
List<PeasantHousehold> peasantHouseholdId = model.getPeasantHouseholdId();
List<WorkOrderPowerStation> li = new ArrayList<>();
for (PeasantHousehold peasantHousehold : peasantHouseholdId) {
WorkOrderPowerStation workOrderPowerStation = new WorkOrderPowerStation();
workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr());
workOrderPowerStation.setWorkOrderId(model.getSequenceNbr());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode());
li.add(workOrderPowerStation);
}
workOrderPowerStationServiceImpl.saveBatch(li);
List<ConstructionRecords> constructionRecordlist = new ArrayList<>();
for (WorkOrderPowerStation workOrderPowerStation : li) {
// 增加操作日志
ConstructionRecords da = new ConstructionRecords(workOrderPowerStation.getRecUserName(), "编辑派工单",
new Date(), "", workOrderPowerStation.getWorkOrderId(), workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(), "");
constructionRecordlist.add(da);
}
constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
return model;
}
public WorkOrder selectOne(Long sequenceNbr) {
WorkOrder model = workOrderMapper.selectById(sequenceNbr);
List<PeasantHousehold> li = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null);
model.setPeasantHouseholdId(li);
return model;
}
public Map<String, Object> selectOneall(Long sequenceNbr) {
WorkOrder model = workOrderMapper.selectById(sequenceNbr);
List<PeasantHousehold> lih = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null);
// 获取所有电站Bom,分组合并,暂时不相加
List<Long> ids = new ArrayList<>();
for (PeasantHousehold documentStation : lih) {
ids.add(documentStation.getSequenceNbr());
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.in("peasant_household_id", ids);
List<DesignInformation> li = designInformationMapper.selectList(designInformationQueryWrapper);
DesignInformation designInformation = new DesignInformation();
// 组件
List<Object> assembly = new ArrayList<>();
// 逆变器
List<Object> inverter = new ArrayList<>();
// 电表箱
List<Object> electricityMeter = new ArrayList<>();
// 电缆
List<Object> cable = new ArrayList<>();
for (DesignInformation des : li) {
if (des.getAssembly() != null && !des.getAssembly().isEmpty()) {
assembly.addAll(des.getAssembly());
}
if (des.getInverter() != null && !des.getInverter().isEmpty()) {
inverter.addAll(des.getInverter());
}
if (des.getElectricityMeter() != null && !des.getElectricityMeter().isEmpty()) {
electricityMeter.addAll(des.getElectricityMeter());
}
if (des.getCable() != null && !des.getCable().isEmpty()) {
cable.addAll(des.getCable());
}
}
List<PeasantHousehold> list = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null);
Map<String, Object> map = new HashMap<>();
designInformation.setAssembly(assembly);
designInformation.setInverter(inverter);
designInformation.setElectricityMeter(electricityMeter);
designInformation.setCable(cable);
map.put("workOrder", model);
map.put("designInformation", designInformation);
map.put("peasantHousehold", list);
return map;
}
@Transactional
public PowerStationConstructionData addOrUpdate(PowerStationConstructionData powerStationConstructionData) {
// if(powerStationConstructionData.getSequenceNbr()!=null){
//修改施工电站状态
LambdaUpdateWrapper<WorkOrderPowerStation> up=new LambdaUpdateWrapper();
up.eq(WorkOrderPowerStation::getSequenceNbr,powerStationConstructionData.getWorkOrderPowerStationId());
if(powerStationConstructionData.getConstructionStatus().equals("未完成")){
up.set(WorkOrderPowerStation::getPowerStationConstructionStatus,WorkOrderEnum.施工中.getCode());
}else{
up.set(WorkOrderPowerStation::getPowerStationConstructionStatus,WorkOrderEnum.待登记.getCode());
WorkOrderPowerStation basicGridAcceptanc= workOrderPowerStationMapper.selectById(powerStationConstructionData.getWorkOrderPowerStationId());
//施工完成
LambdaUpdateWrapper<PeasantHousehold> up1 =new LambdaUpdateWrapper<>();
up1.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网完成.getCode());
long idsk= basicGridAcceptanc.getPeasantHouseholdId();
up1.eq(PeasantHousehold::getSequenceNbr,idsk);
peasantHouseholdMapper.update(null,up1);
}
workOrderPowerStationMapper.update(null,up);
//修改派工单状态
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getWorkOrderId,powerStationConstructionData.getWorkOrderId());
List<String> d=new ArrayList<>();
d.add(WorkOrderEnum.施工中.getCode());
d.add(WorkOrderEnum.待施工.getCode());
qu.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d);
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu);
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr,powerStationConstructionData.getWorkOrderId());
if(list!=null&&!list.isEmpty()){
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.施工中.getCode());
}else{
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.登记中.getCode());
}
workOrderMapper.update(null,upq);
//新增施工信息
powerStationConstructionDataService.saveOrUpdate(powerStationConstructionData);
//增加操作日志
if(powerStationConstructionData.getSequenceNbr()!=null){
ConstructionRecords da=new ConstructionRecords(
powerStationConstructionData.getRecUserName(),
"编辑施工资料",
new Date(),
"",
powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getWorkOrderPowerStationId(),
null,
"");
constructionRecordsServiceImpl.save(da);
}else{
ConstructionRecords da=new ConstructionRecords(
powerStationConstructionData.getRecUserName(),
"新增施工资料",
new Date(),
"",
powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getWorkOrderPowerStationId(),
null,
"");
constructionRecordsServiceImpl.save(da);
}
// 修改施工电站状态
LambdaUpdateWrapper<WorkOrderPowerStation> up = new LambdaUpdateWrapper();
up.eq(WorkOrderPowerStation::getSequenceNbr, powerStationConstructionData.getWorkOrderPowerStationId());
if (powerStationConstructionData.getConstructionStatus().equals("未完成")) {
up.set(WorkOrderPowerStation::getPowerStationConstructionStatus, WorkOrderEnum.施工中.getCode());
} else {
up.set(WorkOrderPowerStation::getPowerStationConstructionStatus, WorkOrderEnum.待登记.getCode());
WorkOrderPowerStation basicGridAcceptanc = workOrderPowerStationMapper
.selectById(powerStationConstructionData.getWorkOrderPowerStationId());
// 施工完成
LambdaUpdateWrapper<PeasantHousehold> up1 = new LambdaUpdateWrapper<>();
up1.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网完成.getCode());
long idsk = basicGridAcceptanc.getPeasantHouseholdId();
up1.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up1);
}
workOrderPowerStationMapper.update(null, up);
// 修改派工单状态
LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getWorkOrderId, powerStationConstructionData.getWorkOrderId());
List<String> d = new ArrayList<>();
d.add(WorkOrderEnum.施工中.getCode());
d.add(WorkOrderEnum.待施工.getCode());
qu.in(WorkOrderPowerStation::getPowerStationConstructionStatus, d);
List<WorkOrderPowerStation> list = workOrderPowerStationMapper.selectList(qu);
LambdaUpdateWrapper<WorkOrder> upq = new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr, powerStationConstructionData.getWorkOrderId());
if (list != null && !list.isEmpty()) {
upq.set(WorkOrder::getWorkOrderStatus, WorkOrderEnum.施工中.getCode());
} else {
upq.set(WorkOrder::getWorkOrderStatus, WorkOrderEnum.登记中.getCode());
}
workOrderMapper.update(null, upq);
// 新增施工信息
powerStationConstructionDataService.saveOrUpdate(powerStationConstructionData);
// 增加操作日志
if (powerStationConstructionData.getSequenceNbr() != null) {
ConstructionRecords da = new ConstructionRecords(powerStationConstructionData.getRecUserName(), "编辑施工资料",
new Date(), "", powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getWorkOrderPowerStationId(), null, "");
constructionRecordsServiceImpl.save(da);
} else {
ConstructionRecords da = new ConstructionRecords(powerStationConstructionData.getRecUserName(), "新增施工资料",
new Date(), "", powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getWorkOrderPowerStationId(), null, "");
constructionRecordsServiceImpl.save(da);
}
// }else{
// //修改施工电站状态
......@@ -380,387 +339,399 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
//
// }
return powerStationConstructionData;
}
public Page<WorkOrder> selectPage( int pageNum,int pageSize, WorkOrder workOrder){
PageHelper.startPage(pageNum, pageSize);
List<WorkOrder> list=workOrderMapper.selectWorkOrderList(workOrder);
PageInfo<WorkOrder> page = new PageInfo(list);
Page<WorkOrder> pagenew = new Page<WorkOrder>();
pagenew.setCurrent(pageNum);
pagenew.setTotal(page.getTotal());
pagenew.setSize(pageSize);
pagenew.setRecords(page.getList());
return pagenew;
}
public Page<WorkOrderPage> queryForwgpage( int pageNum,int pageSize, WorkOrderPage workOrder){
PageHelper.startPage(pageNum, pageSize);
List<WorkOrderPage> list=workOrderMapper.queryForwgpage(workOrder);
PageInfo<WorkOrderPage> page = new PageInfo(list);
Page<WorkOrderPage> pagenew = new Page<WorkOrderPage>();
pagenew.setCurrent(pageNum);
pagenew.setTotal(page.getTotal());
pagenew.setSize(pageSize);
pagenew.setRecords(page.getList());
return pagenew;
}
public SurveyInfoAllDto getsurveyQueryxq(Long peasantHouseholdId,Long workOrderId,Long workOrderPowerStationId) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold();
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
//勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
//农户信息
//获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
}
if(!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())){
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
}
if(peasantHousehold.getPermanentAddress() ==null){
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
}
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if(surveyDetails == null){
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
}else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
}
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
if(information == null){
surveyInfoAllDto.setInformation(new InformationDto());
}else {
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
}
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
if(commercial==null){
commercial=new Commercial();
}
commercial.setApplicant(peasantHousehold.getOwnersName());
commercial.setIdCard(peasantHousehold.getIdCard());
commercial.setTelephone(peasantHousehold.getTelephone());
commercial.setProjectAddress(peasantHousehold.getProjectAddress());
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
if(information == null){
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
commercialDto.setType("zrr");
commercialDto.setLegalType("zjdnhw");
surveyInfoAllDto.setCommercial(commercialDto);
}else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if(commercial !=null && !StringUtils.isEmpty(commercial.getProjectAddressName())){
surveyInfoAllDto.getCommercial().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
}
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper);
if(information == null){
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
}else {
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
DesignInformation designInformation = designInformationService.getBaseMapper().selectOne(designInformationQueryWrapper);
if(designInformation == null){
surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
}else {
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
}
//派工单信息
LambdaQueryWrapper<WorkOrder> upl=new LambdaQueryWrapper();
upl.eq(WorkOrder::getSequenceNbr,workOrderId);
WorkOrder workOrder= workOrderMapper.selectOne(upl);
//施工信息
LambdaQueryWrapper<PowerStationConstructionData> up2=new LambdaQueryWrapper();
up2.eq(PowerStationConstructionData::getWorkOrderId,workOrderId);
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId,workOrderPowerStationId);
PowerStationConstructionData powerStationConstructionData=powerStationConstructionDataMapper.selectOne(up2);
//工程信息
LambdaQueryWrapper<PowerStationEngineeringInfo> up3=new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderId,workOrderId);
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId,workOrderPowerStationId);
PowerStationEngineeringInfo powerStationEngineeringInfo=powerStationEngineeringInfoMapper.selectOne(up3);
if(powerStationConstructionData!=null){
powerStationEngineeringInfo=powerStationEngineeringInfo!=null?powerStationEngineeringInfo:new PowerStationEngineeringInfo();
powerStationEngineeringInfo.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
powerStationEngineeringInfo.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
}
//施工自审
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId);
up5.orderByAsc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5);
ConstructionRecords data=new ConstructionRecords();
data.setConstructionRecordsList(li);
surveyInfoAllDto.setConstructionRecords(data);
//并网信息
LambdaQueryWrapper<HygfOnGrid> up4=new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderId,workOrderId);
up4.eq(HygfOnGrid::getWorkOrderPowerStationId,workOrderPowerStationId);
HygfOnGrid hygfOnGrid=hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid!=null?hygfOnGrid:new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData);
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
surveyInfoAllDto.setWorkOrder(workOrder);
return surveyInfoAllDto;
}
public PowerStationEngineeringInfoAllDto getPowerStationEngineeringInfo(Long workOrderPowerStationId) {
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr,workOrderPowerStationId);
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu);
Long peasantHouseholdId=workOrderPowerStation.getPeasantHouseholdId();
Long workOrderId=workOrderPowerStation.getWorkOrderId();
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold();
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
//勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
//农户信息
//获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
}
if(!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())){
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
}
if(peasantHousehold.getPermanentAddress() ==null){
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
}
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if(surveyDetails == null){
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
}else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
}
return powerStationConstructionData;
}
public Page<WorkOrder> selectPage(int pageNum, int pageSize, WorkOrder workOrder) {
PageHelper.startPage(pageNum, pageSize);
List<WorkOrder> list = workOrderMapper.selectWorkOrderList(workOrder);
PageInfo<WorkOrder> page = new PageInfo(list);
Page<WorkOrder> pagenew = new Page<WorkOrder>();
pagenew.setCurrent(pageNum);
pagenew.setTotal(page.getTotal());
pagenew.setSize(pageSize);
pagenew.setRecords(page.getList());
return pagenew;
}
public Page<WorkOrderPage> queryForwgpage(int pageNum, int pageSize, WorkOrderPage workOrder) {
PageHelper.startPage(pageNum, pageSize);
List<WorkOrderPage> list = workOrderMapper.queryForwgpage(workOrder);
PageInfo<WorkOrderPage> page = new PageInfo(list);
Page<WorkOrderPage> pagenew = new Page<WorkOrderPage>();
pagenew.setCurrent(pageNum);
pagenew.setTotal(page.getTotal());
pagenew.setSize(pageSize);
pagenew.setRecords(page.getList());
return pagenew;
}
public SurveyInfoAllDto getsurveyQueryxq(Long peasantHouseholdId, Long workOrderId, Long workOrderPowerStationId) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold();
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
// 勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
// 农户信息
// 获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation()
.setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
}
if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation()
.setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
}
if (peasantHousehold.getPermanentAddress() == null) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
}
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if (surveyDetails == null) {
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
} else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
}
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
if (information == null) {
surveyInfoAllDto.setInformation(new InformationDto());
} else {
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
}
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
if (commercial == null) {
commercial = new Commercial();
}
commercial.setApplicant(peasantHousehold.getOwnersName());
commercial.setIdCard(peasantHousehold.getIdCard());
commercial.setTelephone(peasantHousehold.getTelephone());
commercial.setProjectAddress(peasantHousehold.getProjectAddress());
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
if (information == null) {
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
commercialDto.setType("zrr");
commercialDto.setLegalType("zjdnhw");
surveyInfoAllDto.setCommercial(commercialDto);
} else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if (commercial != null && !StringUtils.isEmpty(commercial.getProjectAddressName())) {
surveyInfoAllDto.getCommercial()
.setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
}
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper()
.selectOne(extendedInformationQueryWrapper);
if (information == null) {
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
} else {
surveyInfoAllDto
.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
DesignInformation designInformation = designInformationService.getBaseMapper()
.selectOne(designInformationQueryWrapper);
if (designInformation == null) {
surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
} else {
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
}
// 派工单信息
LambdaQueryWrapper<WorkOrder> upl = new LambdaQueryWrapper();
upl.eq(WorkOrder::getSequenceNbr, workOrderId);
WorkOrder workOrder = workOrderMapper.selectOne(upl);
// 施工信息
LambdaQueryWrapper<PowerStationConstructionData> up2 = new LambdaQueryWrapper();
up2.eq(PowerStationConstructionData::getWorkOrderId, workOrderId);
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationConstructionData powerStationConstructionData = powerStationConstructionDataMapper.selectOne(up2);
// 工程信息
LambdaQueryWrapper<PowerStationEngineeringInfo> up3 = new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderId, workOrderId);
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoMapper.selectOne(up3);
if (powerStationConstructionData != null) {
powerStationEngineeringInfo = powerStationEngineeringInfo != null ? powerStationEngineeringInfo
: new PowerStationEngineeringInfo();
powerStationEngineeringInfo
.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo
.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo
.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo
.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
powerStationEngineeringInfo
.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
}
// 施工自审
LambdaQueryWrapper<ConstructionRecords> up5 = new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId, workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId, workOrderPowerStationId);
up5.orderByAsc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li = constructionRecordsMapper.selectList(up5);
ConstructionRecords data = new ConstructionRecords();
data.setConstructionRecordsList(li);
surveyInfoAllDto.setConstructionRecords(data);
// 并网信息
LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData);
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
surveyInfoAllDto.setWorkOrder(workOrder);
return surveyInfoAllDto;
}
public PowerStationEngineeringInfoAllDto getPowerStationEngineeringInfo(Long workOrderPowerStationId) {
LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr, workOrderPowerStationId);
WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(qu);
Long peasantHouseholdId = workOrderPowerStation.getPeasantHouseholdId();
Long workOrderId = workOrderPowerStation.getWorkOrderId();
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold();
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
// 勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
// 农户信息
// 获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation()
.setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
}
if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation()
.setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
}
if (peasantHousehold.getPermanentAddress() == null) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
}
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if (surveyDetails == null) {
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
} else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
}
// 商务信息
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
if(commercial==null){
commercial=new Commercial();
}
commercial.setApplicant(peasantHousehold.getOwnersName());
commercial.setIdCard(peasantHousehold.getIdCard());
commercial.setTelephone(peasantHousehold.getTelephone());
commercial.setProjectAddress(peasantHousehold.getProjectAddress());
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
if (commercial == null) {
commercial = new Commercial();
}
commercial.setApplicant(peasantHousehold.getOwnersName());
commercial.setIdCard(peasantHousehold.getIdCard());
commercial.setTelephone(peasantHousehold.getTelephone());
commercial.setProjectAddress(peasantHousehold.getProjectAddress());
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
// 资料归档
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
if(information == null){
surveyInfoAllDto.setInformation(new InformationDto());
}else {
// 将商务信息的房产证明文件数据赋值给资料归档的房产证明文件
information.setCardFile(commercial.getIdCardCredit());
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
}
if(information == null){
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
commercialDto.setType("zrr");
commercialDto.setLegalType("zjdnhw");
surveyInfoAllDto.setCommercial(commercialDto);
}else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if(commercial !=null && !StringUtils.isEmpty(commercial.getProjectAddressName())){
surveyInfoAllDto.getCommercial().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
}
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper);
if(information == null){
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
}else {
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
DesignInformation designInformation = designInformationService.getBaseMapper().selectOne(designInformationQueryWrapper);
if(designInformation == null){
surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
}else {
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
}
//派工单信息
LambdaQueryWrapper<WorkOrder> upl=new LambdaQueryWrapper();
upl.eq(WorkOrder::getSequenceNbr,workOrderId);
WorkOrder workOrder= workOrderMapper.selectOne(upl);
//施工信息
LambdaQueryWrapper<PowerStationConstructionData> up2=new LambdaQueryWrapper();
up2.eq(PowerStationConstructionData::getWorkOrderId,workOrderId);
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId,workOrderPowerStationId);
PowerStationConstructionData powerStationConstructionData=powerStationConstructionDataMapper.selectOne(up2);
//工程信息
LambdaQueryWrapper<PowerStationEngineeringInfo> up3=new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderId,workOrderId);
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId,workOrderPowerStationId);
PowerStationEngineeringInfo powerStationEngineeringInfo=powerStationEngineeringInfoMapper.selectOne(up3);
if(powerStationConstructionData!=null){
powerStationEngineeringInfo=powerStationEngineeringInfo!=null?powerStationEngineeringInfo:new PowerStationEngineeringInfo();
powerStationEngineeringInfo.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
powerStationEngineeringInfo.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
}
//并网信息
LambdaQueryWrapper<HygfOnGrid> up4=new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderId,workOrderId);
up4.eq(HygfOnGrid::getWorkOrderPowerStationId,workOrderPowerStationId);
HygfOnGrid hygfOnGrid=hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid!=null?hygfOnGrid:new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData);
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
surveyInfoAllDto.setWorkOrder(workOrder);
//施工自审
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId);
up5.orderByAsc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5);
ConstructionRecords data=new ConstructionRecords();
data.setConstructionRecordsList(li);
surveyInfoAllDto.setConstructionRecords(data);
LambdaQueryWrapper<BasicGridAcceptance> quv=new LambdaQueryWrapper();
quv.eq(BasicGridAcceptance::getPeasantHouseholdId,peasantHouseholdId);
BasicGridAcceptance basicGridAcceptance= basicGridAcceptanceMapper.selectOne(quv);
//审核意见
if(Objects.nonNull(basicGridAcceptance) && !StringUtils.isEmpty(basicGridAcceptance.getInstanceId())){
try {
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(basicGridAcceptance.getInstanceId()).getResult();
List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger");
if (flowLogger.size() > 0 ){
Collections.reverse(flowLogger);
}
List<LinkedHashMap> flowLoggernew =new ArrayList<>();
for (LinkedHashMap linkedHashMap : flowLogger) {
if(linkedHashMap.get("operateDate")!=null&&!linkedHashMap.get("operateDate").toString().isEmpty()){
LinkedHashMap linke=new LinkedHashMap();
linke.put("approvalStatue",linkedHashMap.get("approvalStatue").toString());
//审核意见
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>)linkedHashMap.get("approvalSuggestion");
if(approvalSuggestion!=null&&!approvalSuggestion.isEmpty()){
linke.put("approvalSuggestion",approvalSuggestion.get(0).get("message"));
}
linke.put("taskName",linkedHashMap.get("taskName").toString());
linke.put("operator",linkedHashMap.get("operator").toString());
linke.put("operateDate",linkedHashMap.get("operateDate").toString());
flowLoggernew.add(linke);
}
}
LoggerDto loggerDto =new LoggerDto();
loggerDto.setLogger(flowLoggernew);
surveyInfoAllDto.setLoggerDto(loggerDto);
} catch (Exception e){
e.printStackTrace();
}
}
return surveyInfoAllDto;
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
if (information == null) {
surveyInfoAllDto.setInformation(new InformationDto());
} else {
// 将商务信息的房产证明文件数据赋值给资料归档的房产证明文件
information.setCardFile(commercial.getIdCardCredit());
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
}
if (information == null) {
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
commercialDto.setType("zrr");
commercialDto.setLegalType("zjdnhw");
surveyInfoAllDto.setCommercial(commercialDto);
} else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if (commercial != null && !StringUtils.isEmpty(commercial.getProjectAddressName())) {
surveyInfoAllDto.getCommercial()
.setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
}
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper()
.selectOne(extendedInformationQueryWrapper);
if (information == null) {
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
} else {
surveyInfoAllDto
.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
DesignInformation designInformation = designInformationService.getBaseMapper()
.selectOne(designInformationQueryWrapper);
if (designInformation == null) {
surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
} else {
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
}
// 派工单信息
LambdaQueryWrapper<WorkOrder> upl = new LambdaQueryWrapper();
upl.eq(WorkOrder::getSequenceNbr, workOrderId);
WorkOrder workOrder = workOrderMapper.selectOne(upl);
// 施工信息
LambdaQueryWrapper<PowerStationConstructionData> up2 = new LambdaQueryWrapper();
up2.eq(PowerStationConstructionData::getWorkOrderId, workOrderId);
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationConstructionData powerStationConstructionData = powerStationConstructionDataMapper.selectOne(up2);
// 工程信息
LambdaQueryWrapper<PowerStationEngineeringInfo> up3 = new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderId, workOrderId);
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoMapper.selectOne(up3);
if (powerStationConstructionData != null) {
powerStationEngineeringInfo = powerStationEngineeringInfo != null ? powerStationEngineeringInfo
: new PowerStationEngineeringInfo();
powerStationEngineeringInfo
.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo
.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo
.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo
.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
powerStationEngineeringInfo
.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
}
// 并网信息
LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData);
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
surveyInfoAllDto.setWorkOrder(workOrder);
// 施工自审
LambdaQueryWrapper<ConstructionRecords> up5 = new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId, workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId, workOrderPowerStationId);
up5.orderByAsc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li = constructionRecordsMapper.selectList(up5);
ConstructionRecords data = new ConstructionRecords();
data.setConstructionRecordsList(li);
surveyInfoAllDto.setConstructionRecords(data);
LambdaQueryWrapper<BasicGridAcceptance> quv = new LambdaQueryWrapper();
quv.eq(BasicGridAcceptance::getPeasantHouseholdId, peasantHouseholdId);
BasicGridAcceptance basicGridAcceptance = basicGridAcceptanceMapper.selectOne(quv);
// 审核意见
if (Objects.nonNull(basicGridAcceptance) && !StringUtils.isEmpty(basicGridAcceptance.getInstanceId())) {
try {
Map<String, Object> flowLoggerMap = workflowFeignClient
.getFlowLogger(basicGridAcceptance.getInstanceId()).getResult();
List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger");
if (flowLogger.size() > 0) {
Collections.reverse(flowLogger);
}
List<LinkedHashMap> flowLoggernew = new ArrayList<>();
for (LinkedHashMap linkedHashMap : flowLogger) {
if (linkedHashMap.get("operateDate") != null
&& !linkedHashMap.get("operateDate").toString().isEmpty()) {
LinkedHashMap linke = new LinkedHashMap();
linke.put("approvalStatue", linkedHashMap.get("approvalStatue").toString());
// 审核意见
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap
.get("approvalSuggestion");
if (approvalSuggestion != null && !approvalSuggestion.isEmpty()) {
linke.put("approvalSuggestion", approvalSuggestion.get(0).get("message"));
}
linke.put("taskName", linkedHashMap.get("taskName").toString());
linke.put("operator", linkedHashMap.get("operator").toString());
linke.put("operateDate", linkedHashMap.get("operateDate").toString());
flowLoggernew.add(linke);
}
}
LoggerDto loggerDto = new LoggerDto();
loggerDto.setLogger(flowLoggernew);
surveyInfoAllDto.setLoggerDto(loggerDto);
} catch (Exception e) {
e.printStackTrace();
}
}
return surveyInfoAllDto;
// LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
// peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
// peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
......@@ -826,137 +797,139 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
// surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
// return surveyInfoAllDto;
}
@Transactional(isolation = Isolation.REPEATABLE_READ)
public PowerStationEngineeringInfoAllDto addPowerStationEngineeringInfo(PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto){
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr,powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu);
//修改电站状态
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待审核.getCode());
workOrderPowerStationMapper.updateById(workOrderPowerStation);
//修改派工单状态PowerStationEngineeringInfo
LambdaQueryWrapper<WorkOrderPowerStation> qu1=new LambdaQueryWrapper();
qu1.eq(WorkOrderPowerStation::getWorkOrderId,workOrderPowerStation.getWorkOrderId());
List<String> d=new ArrayList<>();
d.add(WorkOrderEnum.施工中.getCode());
d.add(WorkOrderEnum.待施工.getCode());
d.add(WorkOrderEnum.待登记.getCode());
qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d);
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu1);
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId());
if(list==null||list.isEmpty()){
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.审核中.getCode());
workOrderMapper.update(null,upq);
}
//新增完工登记
PowerStationEngineeringInfo powerStationEngineeringInfo= powerStationEngineeringInfoAllDto.getPowerStationEngineeringInfo();
powerStationEngineeringInfo.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
powerStationEngineeringInfo.setWorkOrderPowerStationId(powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
powerStationEngineeringInfoService.saveOrUpdate(powerStationEngineeringInfo);
//增加操作日志
ConstructionRecords da=new ConstructionRecords(
powerStationEngineeringInfo.getRecUserName(),
"完工登记",
new Date(),
"",
workOrderPowerStation.getWorkOrderId(),
workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(),
"");
constructionRecordsServiceImpl.save(da);
return powerStationEngineeringInfoAllDto;
}
public PowerStationEngineeringInfoAllDto getConstructionRecords(Long workOrderPowerStationId,String rename) {
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr,workOrderPowerStationId);
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu);
Long peasantHouseholdId=workOrderPowerStation.getPeasantHouseholdId();
Long workOrderId=workOrderPowerStation.getWorkOrderId();
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto();
//施工自审
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId);
up5.orderByDesc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5);
ConstructionRecords data=new ConstructionRecords();
data.setConstructionRecordsList(li);
data.setOperationTime(new Date());
data.setOperator(rename);
surveyInfoAllDto.setConstructionRecords(data);
return surveyInfoAllDto;
}
@Transactional(isolation = Isolation.REPEATABLE_READ)
}
@Transactional(isolation = Isolation.REPEATABLE_READ)
public PowerStationEngineeringInfoAllDto addPowerStationEngineeringInfo(
PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto) {
LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr, powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(qu);
// 修改电站状态
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待审核.getCode());
workOrderPowerStationMapper.updateById(workOrderPowerStation);
// 修改派工单状态PowerStationEngineeringInfo
LambdaQueryWrapper<WorkOrderPowerStation> qu1 = new LambdaQueryWrapper();
qu1.eq(WorkOrderPowerStation::getWorkOrderId, workOrderPowerStation.getWorkOrderId());
List<String> d = new ArrayList<>();
d.add(WorkOrderEnum.施工中.getCode());
d.add(WorkOrderEnum.待施工.getCode());
d.add(WorkOrderEnum.待登记.getCode());
qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus, d);
List<WorkOrderPowerStation> list = workOrderPowerStationMapper.selectList(qu1);
LambdaUpdateWrapper<WorkOrder> upq = new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr, workOrderPowerStation.getWorkOrderId());
if (list == null || list.isEmpty()) {
upq.set(WorkOrder::getWorkOrderStatus, WorkOrderEnum.审核中.getCode());
workOrderMapper.update(null, upq);
}
// 新增完工登记
PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoAllDto
.getPowerStationEngineeringInfo();
powerStationEngineeringInfo.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
powerStationEngineeringInfo
.setWorkOrderPowerStationId(powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
powerStationEngineeringInfoService.saveOrUpdate(powerStationEngineeringInfo);
// 增加操作日志
ConstructionRecords da = new ConstructionRecords(powerStationEngineeringInfo.getRecUserName(), "完工登记",
new Date(), "", workOrderPowerStation.getWorkOrderId(), workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(), "");
constructionRecordsServiceImpl.save(da);
return powerStationEngineeringInfoAllDto;
}
public PowerStationEngineeringInfoAllDto getConstructionRecords(Long workOrderPowerStationId, String rename) {
LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr, workOrderPowerStationId);
WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(qu);
Long peasantHouseholdId = workOrderPowerStation.getPeasantHouseholdId();
Long workOrderId = workOrderPowerStation.getWorkOrderId();
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto();
// 施工自审
LambdaQueryWrapper<ConstructionRecords> up5 = new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId, workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId, workOrderPowerStationId);
up5.orderByDesc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li = constructionRecordsMapper.selectList(up5);
ConstructionRecords data = new ConstructionRecords();
data.setConstructionRecordsList(li);
data.setOperationTime(new Date());
data.setOperator(rename);
surveyInfoAllDto.setConstructionRecords(data);
return surveyInfoAllDto;
}
@Transactional(isolation = Isolation.REPEATABLE_READ)
public ConstructionRecords addConstructionRecords(ConstructionRecords constructionRecords){
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr,constructionRecords.getWorkOrderPowerStationId());
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu);
if(constructionRecords.getOperationResults().equals("通过")){
//修改电站状态
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.已完工.getCode());
//修改完工时间
LambdaUpdateWrapper<PowerStationEngineeringInfo> upq1=new LambdaUpdateWrapper();
upq1.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId,workOrderPowerStation.getSequenceNbr());
upq1.set(PowerStationEngineeringInfo::getCompletionDate,new Date());
powerStationEngineeringInfoMapper.update(null,upq1);
BasicGridAcceptance dat=new BasicGridAcceptance();
dat.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
dat.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr());
dat.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId());
dat.setGridStatus("1");
//新增并网记录
basicGridAcceptanceMapper.insert(dat);
workOrderPowerStationMapper.updateById(workOrderPowerStation);
//修改派工单状态
LambdaQueryWrapper<WorkOrderPowerStation> qu1=new LambdaQueryWrapper();
qu1.eq(WorkOrderPowerStation::getWorkOrderId,workOrderPowerStation.getWorkOrderId());
List<String> d=new ArrayList<>();
d.add(WorkOrderEnum.施工中.getCode());
d.add(WorkOrderEnum.待施工.getCode());
d.add(WorkOrderEnum.待登记.getCode());
d.add(WorkOrderEnum.待审核.getCode());
qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d);
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu1);
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId());
if(list==null||list.isEmpty()){
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.已完工.getCode());
workOrderMapper.update(null,upq);
}
}else{
//修改电站状态
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.未通过.getCode());
workOrderPowerStationMapper.updateById(workOrderPowerStation);
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId());
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.未通过
.getCode());
workOrderMapper.update(null,upq);
}
//增加操作日志
constructionRecords.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
constructionRecords.setOperationContent("完工自审-"+constructionRecords.getOperationResults());
constructionRecords.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr());
constructionRecords.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId());
constructionRecordsServiceImpl.save(constructionRecords);
synchronized (constructionRecords) {
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr,constructionRecords.getWorkOrderPowerStationId());
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu);
if(constructionRecords.getOperationResults().equals("通过")){
//修改电站状态
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.已完工.getCode());
//修改完工时间
LambdaUpdateWrapper<PowerStationEngineeringInfo> upq1=new LambdaUpdateWrapper();
upq1.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId,workOrderPowerStation.getSequenceNbr());
upq1.set(PowerStationEngineeringInfo::getCompletionDate,new Date());
powerStationEngineeringInfoMapper.update(null,upq1);
BasicGridAcceptance dat=new BasicGridAcceptance();
dat.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
dat.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr());
dat.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId());
dat.setGridStatus("1");
//新增并网记录
LambdaQueryWrapper<BasicGridAcceptance> bga = new LambdaQueryWrapper<>();
bga.eq(BasicGridAcceptance::getPeasantHouseholdId, workOrderPowerStation.getPeasantHouseholdId());
BasicGridAcceptance b = basicGridAcceptanceMapper.selectOne(bga);
//防止重复增加
if(b==null)
{
basicGridAcceptanceMapper.insert(dat);
}
workOrderPowerStationMapper.updateById(workOrderPowerStation);
//修改派工单状态
LambdaQueryWrapper<WorkOrderPowerStation> qu1=new LambdaQueryWrapper();
qu1.eq(WorkOrderPowerStation::getWorkOrderId,workOrderPowerStation.getWorkOrderId());
List<String> d=new ArrayList<>();
d.add(WorkOrderEnum.施工中.getCode());
d.add(WorkOrderEnum.待施工.getCode());
d.add(WorkOrderEnum.待登记.getCode());
d.add(WorkOrderEnum.待审核.getCode());
qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d);
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu1);
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId());
if(list==null||list.isEmpty()){
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.已完工.getCode());
workOrderMapper.update(null,upq);
}
}else{
//修改电站状态
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.未通过.getCode());
workOrderPowerStationMapper.updateById(workOrderPowerStation);
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId());
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.未通过
.getCode());
workOrderMapper.update(null,upq);
}
//增加操作日志
constructionRecords.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
constructionRecords.setOperationContent("完工自审-"+constructionRecords.getOperationResults());
constructionRecords.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr());
constructionRecords.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId());
constructionRecordsServiceImpl.save(constructionRecords);
}
return constructionRecords;
}
......
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -1128,7 +1128,8 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "运维数据 ")
@GetMapping("/operationData")
public ResponseModel<IPage<Map<String, Object>>> operationData(@RequestParam(value = "areaCode", required = false) String areaCode) {
public ResponseModel<IPage<Map<String, Object>>> operationData(@RequestParam(value = "areaCode", required = false) String areaCode,
@RequestParam(value = "stationId", required = false) String stationId) {
// List<StationCacheInfoDto> list = commonServiceImpl.getListStationCacheInfoDto();
......@@ -1152,13 +1153,14 @@ public class MonitorFanIdxController extends BaseController {
// result.setRecords(mapList);
// result.setCurrent(1);
// result.setTotal(mapList.size());
return ResponseHelper.buildResponse(monitorService.operationData(areaCode));
return ResponseHelper.buildResponse(monitorService.operationData(areaCode,stationId));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "全国新能源接入情况 ")
@GetMapping("/getAccessSituation")
public ResponseModel<Map<String, Object>> getAccessSituation(@RequestParam(value = "areaCode", required = false) String areaCode) {
return ResponseHelper.buildResponse(monitorService.getAccessSituation(areaCode));
public ResponseModel<Map<String, Object>> getAccessSituation(@RequestParam(value = "areaCode", required = false) String areaCode,
@RequestParam(value = "stationId", required = false) String stationId) {
return ResponseHelper.buildResponse(monitorService.getAccessSituation(areaCode,stationId));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......
......@@ -15,10 +15,11 @@ import java.util.Map;
public interface MonitorService {
/**
* @param areaCode 区域编码
* @param stationId 场站id
* @return 全国运维数据
* @Description 根据区域编码动态运维数据
*/
IPage<Map<String, Object>> operationData(String areaCode);
IPage<Map<String, Object>> operationData(String areaCode,String stationId);
/**
* @return Map<String, Object>
......@@ -122,7 +123,8 @@ public interface MonitorService {
/**
* 获取接入情况
* @param areaCode
* @param stationId
* @return
*/
Map<String, Object> getAccessSituation(String areaCode);
Map<String, Object> getAccessSituation(String areaCode,String stationId);
}
......@@ -31,6 +31,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.io.IOException;
......@@ -60,11 +61,14 @@ public class MonitorServiceImpl implements MonitorService {
private Resource overviewGF;
@Override
public IPage<Map<String, Object>> operationData(String areaCode) {
public IPage<Map<String, Object>> operationData(String areaCode,String stationId) {
List<StationCacheInfoDto> list = getListStationCacheInfoDto();
if (null != areaCode) {
list = list.stream().filter(e -> e.getAreaCode().toUpperCase(Locale.ROOT).equals(areaCode.toUpperCase(Locale.ROOT))).collect(Collectors.toList());
}
if (!StringUtils.isEmpty(stationId)) {
list = list.stream().filter(e -> e.getStationId().toUpperCase(Locale.ROOT).equals(stationId.toUpperCase(Locale.ROOT))).collect(Collectors.toList());
}
List<Map<String, Object>> mapList = new ArrayList<>();
Map<String, List<StationCacheInfoDto>> listMap = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getStationType, Collectors.toList()));
for (StationType value : StationType.values()) {
......@@ -944,8 +948,8 @@ public class MonitorServiceImpl implements MonitorService {
}
@Override
public Map<String, Object> getAccessSituation(String areaCode) {
IPage<Map<String, Object>> page = operationData(areaCode);
public Map<String, Object> getAccessSituation(String areaCode, String stationId) {
IPage<Map<String, Object>> page = operationData(areaCode,stationId);
List<Map<String, Object>> records = page.getRecords();
Map<String, Object> map = new HashMap<>();
if (!CollectionUtils.isEmpty(records)) {
......
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