Commit 9ac1e8a5 authored by hezhuozhi's avatar hezhuozhi

电站统计添加投融时间

parent f05fe12e
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.support.spring.annotation.FastJsonFilter;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import io.swagger.annotations.ApiModel;
......@@ -68,6 +69,7 @@ public class FinancingInfoDto extends BaseDto {
@ApiModelProperty(value = "单价")
private String unitPrice;
@ApiModelProperty(value = "投融创建时间")
private Date trCreateTime;
List<PeasantHousehold> peasantHouseholds;
}
......@@ -102,4 +102,13 @@ public class PowerStationTimeStatisticsDto implements Serializable {
@ApiModelProperty(value = "验收停留时间")
private String ysStopTime;
@ApiModelProperty(value = "投融开始时间")
private Date trCreateTime;
@ApiModelProperty(value = "投融结束时间")
private Date trEndTime;
@ApiModelProperty(value = "投融停留时间")
private String trStopTime;
}
......@@ -82,4 +82,10 @@ public class FinancingInfo extends BaseEntity {
*/
@TableField("unit_price")
private String unitPrice;
/**
* 投融创建时间
*/
@TableField("tr_create_time")
private Date trCreateTime;
}
......@@ -35,4 +35,5 @@ public interface FinancingInfoMapper extends BaseMapper<FinancingInfo> {
List<Map<String,Object>> selectRegionByParentCode(String parentCode, String level);
List<Map<String, Object>> getTrCreateTime();
}
......@@ -92,5 +92,7 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> {
List<PowerStationTimeStatisticsDto> getYsTime(@Param("list") List<Long> peasantHouseholdIdList);
List<PowerStationTimeStatisticsDto> getTrTime(@Param("list") List<Long> peasantHouseholdIdList);
// String getHygfCommercialScale(Long surveyInformationId);
}
......@@ -143,4 +143,12 @@
PARENT_REGION_CODE = #{parentCode} and LEVEL = #{level}
</select>
<select id="getTrCreateTime" resultType="java.util.Map">
SELECT hfi.sequence_nbr as sequenceNbr,hfa.rec_date AS time
FROM
hygf_financing_info hfi
LEFT JOIN hygf_financing_auditing hfa ON hfa.peasant_household_id=hfi.peasant_household_id
WHERE hfi.status='放款完成' and hfa.next_node_name='融资审核'
</select>
</mapper>
......@@ -371,6 +371,21 @@ on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nb
</if>
</where>
</select>
<select id="getTrTime"
resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationTimeStatisticsDto">
SELECT peasant_household_id as sequenceNbr,tr_create_time,disbursement_time as trEndTime
FROM
hygf_financing_info
<where>
<if test="list != null and list.size()>0">
AND peasant_household_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<!-- <select id="getHygfCommercialScale" resultType="String">-->
<!-- select scale from hygf_commercial where survey_information_id=${surveyInformationId}-->
<!-- </select>-->
......
......@@ -63,6 +63,8 @@ public class TestController extends BaseController {
BasicGridRecordMapper basicGridRecordMapper;
@Autowired
AcceptanceCheckMapper acceptanceCheckMapper;
@Autowired
FinancingInfoMapper financingInfoMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/initTime")
......@@ -72,16 +74,29 @@ public class TestController extends BaseController {
ExecutorService executorService = Executors.newFixedThreadPool(5);
// 提交不同的方法
executorService.submit(this::dealKcTime);
executorService.submit(this::dealDzhtqyTime);
executorService.submit(this::dealSgTime);
executorService.submit(this::dealBwTime);
executorService.submit(this::dealYsTime);
// executorService.submit(this::dealKcTime);
// executorService.submit(this::dealDzhtqyTime);
// executorService.submit(this::dealSgTime);
// executorService.submit(this::dealBwTime);
// executorService.submit(this::dealYsTime);
executorService.submit(this::dealTrTime);
// 关闭线程池
executorService.shutdown();
return CommonResponseNewUtil.success();
}
private void dealTrTime() {
log.info("================开始初始投融时间=========================");
List<Map<String, Object>> trCreateTime = financingInfoMapper.getTrCreateTime();
for (Map<String, Object> stringObjectMap : trCreateTime) {
LambdaUpdateWrapper<FinancingInfo> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(FinancingInfo::getTrCreateTime, dealHour(stringObjectMap.get("time")))
.eq(FinancingInfo::getSequenceNbr, stringObjectMap.get("sequenceNbr"));
financingInfoMapper.update(null, wrapper);
}
log.info("================投融时间更新完成=========================");
}
private void dealYsTime() {
log.info("================开始初始验收时间=========================");
List<Map<String, Object>> ysCreateTime = acceptanceCheckMapper.getYsCreateTime();
......
......@@ -187,6 +187,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
financingInfoDto.setSequenceNbr(null);
financingInfoDto.setBatchNo(batcvNo);
financingInfoDto.setRegionalCompaniesSeq(peasantHousehold.getRegionalCompaniesSeq());
financingInfoDto.setTrCreateTime(new Date());
this.createWithModel(financingInfoDto);
//开启工作流 并执行一步
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
......@@ -219,7 +220,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
//批量 兼容审核不通过及整改待推送
else if (financingInfos.getStatus().equals(FinancingAuditEnum.审核不通过.getName()) || financingInfos.getStatus().equals("待推送") ){
financingInfos.setStatus(FinancingAuditEnum.待融资审核.getName());
financingInfos.setTrCreateTime(new Date());
Map<String, Object> orgInfo1 = this.getBaseMapper().selectRZOrgInfo(model.getFinancingCompaniesSeq());
//业务表中无工作流id 需要补充
LambdaQueryWrapper<FinancingAuditing> queryWrapper1 = new LambdaQueryWrapper<>();
......
......@@ -56,6 +56,7 @@ public class PowerStationStatisticsServiceImpl {
Map<Long, List<PowerStationTimeStatisticsDto>> sgMap = getSgTime(sequenceNbrList);
Map<Long, List<PowerStationTimeStatisticsDto>> bwMap = getBwTime(sequenceNbrList);
Map<Long, List<PowerStationTimeStatisticsDto>> ysMap = getYsTime(sequenceNbrList);
Map<Long, List<PowerStationTimeStatisticsDto>> trMap = getTrTime(sequenceNbrList);
for (PowerStationTimeStatisticsDto statisticsDto : statisticsDtos) {
dealKcTime(statisticsDto, kcMap);
dealDzhtqyTime(statisticsDto, dzhtqyMap);
......@@ -64,10 +65,33 @@ public class PowerStationStatisticsServiceImpl {
dealSgTime(statisticsDto, sgMap);
dealBwTime(statisticsDto, bwMap);
dealYsTime(statisticsDto, ysMap);
dealTrTime(statisticsDto, trMap);
}
}
}
private void dealTrTime(PowerStationTimeStatisticsDto statisticsDto, Map<Long, List<PowerStationTimeStatisticsDto>> map) {
List<PowerStationTimeStatisticsDto> time = map.get(statisticsDto.getSequenceNbr());
if (CollectionUtil.isNotEmpty(time)) {
statisticsDto.setTrCreateTime(time.get(0).getTrCreateTime());
statisticsDto.setTrEndTime(time.get(0).getTrEndTime());
statisticsDto.setTrStopTime(dealStopTime(time.get(0).getTrCreateTime(), time.get(0).getTrEndTime()));
}
}
private Map<Long, List<PowerStationTimeStatisticsDto>> getTrTime(List<Long> sequenceNbrList) {
List<PowerStationTimeStatisticsDto> statisticsDtos = new ArrayList<>();
if (sequenceNbrList.size() < 1000) {
statisticsDtos = peasantHouseholdMapper.getTrTime(sequenceNbrList);
} else {
List<List<Long>> lists = ListUtils.splitList(sequenceNbrList, 1000);
for (List<Long> list : lists) {
statisticsDtos.addAll(peasantHouseholdMapper.getTrTime(list));
}
}
return statisticsDtos.stream().collect(Collectors.groupingBy(PowerStationTimeStatisticsDto::getSequenceNbr));
}
private Map<Long, List<PowerStationTimeStatisticsDto>> getYsTime(List<Long> sequenceNbrList) {
List<PowerStationTimeStatisticsDto> statisticsDtos = new ArrayList<>();
if (sequenceNbrList.size() < 1000) {
......@@ -302,6 +326,8 @@ public class PowerStationStatisticsServiceImpl {
excelVO.setSjEndTime(DateUtils.dateFormat(statisticsDto.getSjEndTime(), DateUtils.DATE_TIME_PATTERN));
excelVO.setFhbhCreateTime(DateUtils.dateFormat(statisticsDto.getFhbhCreateTime(), DateUtils.DATE_TIME_PATTERN));
excelVO.setFhbhEndTime(DateUtils.dateFormat(statisticsDto.getFhbhEndTime(), DateUtils.DATE_TIME_PATTERN));
excelVO.setTrCreateTime(DateUtils.dateFormat(statisticsDto.getTrCreateTime(), DateUtils.DATE_TIME_PATTERN));
excelVO.setTrEndTime(DateUtils.dateFormat(statisticsDto.getTrEndTime(), DateUtils.DATE_TIME_PATTERN));
dataList.add(excelVO);
}
ExcelUtils.exportExcelDefaultGroundColor(dataList, null, "电站时间统计", PowerStationTimeStatisticsExcelVO.class, "电站时间统计" + DateUtils.dateFormat(new Date(), "YYYY-MM-dd-HH-mm") + ".xlsx", response);
......
......@@ -120,4 +120,16 @@ public class PowerStationTimeStatisticsExcelVO implements Serializable {
@Excel(name = "验收停留时间", width = 30, orderNum = "27")
@ApiModelProperty(value = "验收停留时间")
private String ysStopTime;
@Excel(name = "投融开始时间", width = 30, orderNum = "28")
@ApiModelProperty(value = "投融开始时间")
private String trCreateTime;
@Excel(name = "投融结束时间", width = 30, orderNum = "29")
@ApiModelProperty(value = "投融结束时间")
private String trEndTime;
@Excel(name = "投融停留时间", width = 30, orderNum = "30")
@ApiModelProperty(value = "投融停留时间")
private String trStopTime;
}
......@@ -173,16 +173,16 @@ hygf.user.group.empty=1775056568031645697
#qiyuesuo.serverUrl = https://openapi.qiyuesuo.cn
#qiyuesuo.accessKey = a1lcd3WRRV
#qiyuesuo.accessSecret = haqYIOxTP20ZYiDNEN92GVBa6aoJLu
#qiyuesuo.secretKey=Fp2LQAqK5gc68hi5
qiyuesuo.serverUrl = https://openapi.qiyuesuo.cn
qiyuesuo.accessKey = a1lcd3WRRV
qiyuesuo.accessSecret = haqYIOxTP20ZYiDNEN92GVBa6aoJLu
qiyuesuo.secretKey=Fp2LQAqK5gc68hi5
qiyuesuo.serverUrl = https://openapi.qiyuesuo.com
qiyuesuo.accessKey = QcmHQu55pl
qiyuesuo.accessSecret = em0zvOMRNCAXoD1ePNTL7hGR5KpKUs
qiyuesuo.secretKey=B6OYbHyfXikAghB2
#qiyuesuo.serverUrl = https://openapi.qiyuesuo.com
#qiyuesuo.accessKey = QcmHQu55pl
#qiyuesuo.accessSecret = em0zvOMRNCAXoD1ePNTL7hGR5KpKUs
#qiyuesuo.secretKey=B6OYbHyfXikAghB2
......
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