Commit c74c0a68 authored by wujiang's avatar wujiang

Merge branch 'developer_bw' of…

Merge branch 'developer_bw' of http://39.100.92.250:5000/moa/jxdj_zx/amos-boot-zx-biz into developer_bw
parents d29ca458 a1198097
......@@ -8,7 +8,7 @@ import java.util.List;
public interface TanYinCustomerInfoMapper extends BaseMapper<TanYinCustomerInfo> {
@Select("select project_no from tanyin_customer_info group by project_no")
@Select("select project_no from house_pv_data.tanyin_customer_info group by project_no")
List<String> listProjectNo();
}
......@@ -295,7 +295,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
if (ObjectUtils.isEmpty(TdHYGFStationMonthGenerate)) {
TdHYGFStationMonthGenerate = new TdHYGFStationMonthGenerate();
}
householdPvApiService.addTdHYGFStationDayGenerate(TdHYGFStationMonthGenerate,hour);
TdHYGFStationMonthGenerate.setThirdStationId(stationIds.get(i));
TdHYGFStationMonthGenerate.setDayTime(DateUtil.format(today1, "yyyy-MM-dd"));
TdHYGFStationMonthGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM"));
......@@ -308,7 +308,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
TdHYGFStationMonthGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
TdHYGFStationMonthGenerate.setStationName(jpStation.getName());
TdHYGFStationMonthGenerate.setStationState(jpStation.getState());
householdPvApiService.addTdHYGFStationDayGenerate(TdHYGFStationMonthGenerate,hour);
if (ObjectUtils.isEmpty(TdHYGFStationMonthGenerate.getCreatedTime())) {
TdHYGFStationMonthGenerate.setCreatedTime(System.currentTimeMillis());
TdHYGFStationMonthGenerateMapper.insert(TdHYGFStationMonthGenerate);
......
......@@ -51,15 +51,23 @@ public class HouseholdPvApiServiceImpl extends BaseService<HouseholdPvApiDto, Ho
.eq("day_time", DateUtil.format(new Date(), "yyyy-MM-dd"))
.eq("hour", currentTime)
.eq("year_month", DateUtil.format(new Date(), "yyyy-MM")));
Long createdTime = tdHYGFStationDayGenerate.getCreatedTime();
boolean flag= false;
if (ObjectUtils.isEmpty(tdHYGFStationDayGenerate)) {
tdHYGFStationDayGenerate = new TdHYGFStationDayGenerate();
flag= true;
}
BeanUtils.copyProperties(tdHYGFStationMonthGenerate,tdHYGFStationDayGenerate);
tdHYGFStationDayGenerate.setHour(currentTime);
if (tdHYGFStationDayGenerate.getStationState().equals("离线")){
tdHYGFStationDayGenerate.setGenerate(null);
}
tdHYGFStationDayGenerate.setCreatedTime(System.currentTimeMillis());
if (flag){
tdHYGFStationDayGenerate.setCreatedTime(System.currentTimeMillis());
}else {
tdHYGFStationDayGenerate.setCreatedTime(createdTime);
}
TdHYGFStationDayGenerateMapper.insert(tdHYGFStationDayGenerate);
}
......
......@@ -282,8 +282,13 @@ public class SunlightServiceImpl implements SunlightService {
Map<String, String> map5 = sunlightDto.getTotal_income();
if (map5 != null && map5.get("unit") != null && !map5.get("unit").isEmpty()
&& !"--".equals(map5.get("value"))) {
jpStation.setCumulativeIncome(SunlightUtil.sy.get(String.valueOf(map5.get("unit")))
* Double.valueOf(String.valueOf(map5.get("value"))));// 累计收益
if (!map5.get("unit").equals("")){
jpStation.setCumulativeIncome(SunlightUtil.sy.get(String.valueOf(map5.get("unit")))
* Double.valueOf(String.valueOf(map5.get("value"))));// 累计收益
}else {
jpStation.setCumulativeIncome(0.0);
}
}
} catch (Exception e) {
......
package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.api.householdapi.Utils.RedisUtils;
import com.yeejoin.amos.api.householdapi.Utils.TanYinApiUtils;
import com.yeejoin.amos.api.householdapi.constant.TanYinConstant;
import com.yeejoin.amos.api.householdapi.face.dto.SunlightDto;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpCollector;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
......@@ -175,7 +179,6 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
*/
@Scheduled (cron = "${dataRequestScheduled.tanYin}")
@Override
public void customerInfoList() {
try {
String startDate = LocalDate.now().minusMonths(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
......@@ -221,7 +224,6 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
@Scheduled (cron = "${dataRequestScheduled.tanYin}")
@Async
@Override
@PostConstruct
public void stationList() {
long ts = System.currentTimeMillis();
log.info("-------碳银同步电站开始: {} ------- ", ts);
......@@ -236,16 +238,17 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
for (List<String> projectNoList : projectNoLists) {
Map<String, Object> params = MapBuilder.<String, Object>create().put("projectNoList", projectNoList).put("powerDate", powerDate).build();
List<TanYinStationInfo> tanYinStationInfoList = tanYinApiUtils.post("电站基本信息", apiUrl + TanYinConstant.stationListUrl, params, null, TanYinStationInfo.class);
if (CollectionUtils.isEmpty(tanYinStationInfoList)) {
continue;
if (!CollectionUtils.isEmpty(tanYinStationInfoList)) {
tanYinStationInfos.addAll(tanYinStationInfoList);
}
tanYinStationInfos.addAll(tanYinStationInfoList);
}
if (CollectionUtils.isEmpty(tanYinStationInfos)) {
log.warn("-------碳银同步电站结束: 未同步到电站基本信息 -------");
return;
}
List<String> stationIds = tanYinStationInfos.stream().map(TanYinStationInfo::getProjectNo).collect(Collectors.toList());
//删除多余的场站
deleteTyMessage(stationIds);
List<JpStation> jpStations = jpStationMapper.selectList(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.TANYIN.getCode()).in("third_station_id", stationIds));
Map<String, JpStation> jpStationMap = jpStations.stream().collect(Collectors.toMap(JpStation::getThirdStationId, Function.identity()));
......@@ -300,6 +303,7 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
jpStation.setYearIncome(tanYinStationInfo.getYearPower() != null ? Double.parseDouble(tanYinStationInfo.getYearPower()) * 0.45 : 0.0);
jpStation.setCumulativeIncome(tanYinStationInfo.getTotalPower() != null ? Double.parseDouble(tanYinStationInfo.getTotalPower()) * 0.45 : 0.0);
jpStation.setArea(tanYinStationInfo.getArea());
jpStation.setState("在线");
// jpStation.setEmail();
// jpStation.setCreateTime();
// jpStation.setRatedPower();
......@@ -433,6 +437,45 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
}
private void deleteTyMessage(List<String> stationIds) {
// 所有场站信息
if(CollectionUtil.isNotEmpty(stationIds)){
//场站
QueryWrapper<JpStation> wrapper = new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.TANYIN.getCode());
List<JpStation> jpStations = jpStationMapper.selectList(wrapper);
if(CollectionUtil.isNotEmpty(jpStations)){
for (JpStation jpStation : jpStations) {
if(!stationIds.contains(jpStation.getThirdStationId())){
//删除多余数据
jpStationMapper.deleteById(jpStation.getSequenceNbr());
}
}
}
//采集器
QueryWrapper<JpCollector> wrapper1 = new QueryWrapper<JpCollector>().eq("third_code", PVProducerInfoEnum.TANYIN.getCode());
List<JpCollector> jpCollectors = jpCollectorMapper.selectList(wrapper1);
if(CollectionUtil.isNotEmpty(jpCollectors)){
for (JpCollector jpCollector : jpCollectors) {
if(!stationIds.contains(jpCollector.getThirdStationId())){
//删除多余数据
jpCollectorMapper.deleteById(jpCollector.getSequenceNbr());
}
}
}
//逆变器
QueryWrapper<JpInverter> wrapper2 = new QueryWrapper<JpInverter>().eq("third_code", PVProducerInfoEnum.TANYIN.getCode());
List<JpInverter> jpInverters = jpInverterMapper.selectList(wrapper2);
if(CollectionUtil.isNotEmpty(jpInverters)){
for (JpInverter jpInverter : jpInverters) {
if(!stationIds.contains(jpInverter.getThirdStationId())){
//删除多余数据
jpInverterMapper.deleteById(jpInverter.getSequenceNbr());
}
}
}
}
}
@Override
public void inverterList() {
......
......@@ -23,7 +23,7 @@ public enum UploadStatusEnum {
public static UploadStatusEnum getNodeByCode(String code) {
UploadStatusEnum anEnum = null;
for (UploadStatusEnum type : UploadStatusEnum.values()) {
if (type.getCode() == code) {
if (type.getCode().equals(code) ) {
anEnum = type;
break;
}
......
......@@ -11,9 +11,9 @@ import lombok.Data;
*/
@Data
public class DayGenerateEX {
@ExcelProperty(value = "电站编号", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelProperty(value = "号", index = 0)
@ApiModelProperty(value = "序号")
private Integer index;
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
......
......@@ -22,4 +22,7 @@ public class DropDown {
@ApiModelProperty(value = "单位名称+单位id")
private String id;
@ApiModelProperty(value = "单位地址")
private String address;
}
......@@ -73,6 +73,9 @@ public class IcbcWithholdDto extends BaseDto {
* 失败原因
*/
private String uploadErrorDesc;
private String receiptFile;
/**
* 失败原因
*/
......
......@@ -55,32 +55,30 @@ public class IcbcWithholdRecordDto extends BaseDto {
/**
* 开户状态, 00-初始,01-开户中,02-开户成功,03-开户失败
*/
@ExcelProperty(value = "开户状态", index = 5)
@ApiModelProperty(value = "开户状态, 00-初始,01-开户中,02-开户成功,03-开户失败")
@ExcelIgnore @ApiModelProperty(value = "开户状态, 00-初始,01-开户中,02-开户成功,03-开户失败")
private String openAccountStatus;
/**
* 协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认
*/
@ExcelProperty(value = "协议状态", index = 6)
@ApiModelProperty(value = "协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认")
@ExcelIgnore @ApiModelProperty(value = "协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认")
private String protocolStatus;
@ExcelProperty(value = "协议状态", index = 7)
@ExcelProperty(value = "批次号", index = 5)
@ApiModelProperty(value = "批次号")
private String batchNo;
@ExcelProperty(value = "项目编号", index = 8)
@ExcelProperty(value = "项目编号", index = 6)
@ApiModelProperty(value = "项目编号")
private String projectId;
@ExcelProperty(value = "付款金额", index = 9)
@ExcelProperty(value = "付款金额(元)", index = 7)
@ApiModelProperty(value = "付款金额")
private double paymentAmount;
@ExcelProperty(value = "代扣状态", index = 10)
@ExcelProperty(value = "代扣状态", index = 8)
@ApiModelProperty(value = "代扣状态")
private String withholdStatus;
......@@ -88,7 +86,7 @@ public class IcbcWithholdRecordDto extends BaseDto {
@ApiModelProperty(value = "上传时间")
private Date withholdTime;
@ExcelProperty(value = "缴费时间", index = 11)
@ExcelProperty(value = "缴费时间", index = 9)
@ApiModelProperty(value = "缴费时间")
private Date paymentTime;
......
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 第三方场站
*
* @author system_generator
* @date 2023-09-19
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "JpStationBatchDto", description = "第三方场站批量")
public class JpStationBatchDto extends BaseDto {
private List<String> sequenceNbrList;
@ApiModelProperty("项目公司Code")
private String regionalCompaniesCode;
@ApiModelProperty("项目公司名称")
private String regionalCompaniesName;
@ApiModelProperty("经销商名称")
private String amosCompanyName;
@ApiModelProperty("经销商Code")
private String amosCompanyCode;
}
......@@ -36,9 +36,10 @@ public class JpStationDto extends BaseDto {
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
@ExcelProperty(value = "电站编号", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelProperty(value = "序号", index = 0)
@ApiModelProperty(value = "序号")
private Integer index;
@ExcelIgnore
@ApiModelProperty(value = "组织编码")
private String systemCode;
......
......@@ -14,9 +14,9 @@ public class MonthGenerateEX {
@ExcelProperty(value = "电站编号", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelProperty(value = "号", index = 0)
@ApiModelProperty(value = "序号")
private Integer index;
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
......
......@@ -11,9 +11,9 @@ import lombok.Data;
*/
@Data
public class YearGenerateEX {
@ExcelProperty(value = "电站编号", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelProperty(value = "号", index = 0)
@ApiModelProperty(value = "序号")
private Integer index;
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
......
......@@ -14,5 +14,5 @@ import java.util.List;
*/
public interface IcbcWithholdMapper extends BaseMapper<IcbcWithhold> {
public List<IcbcWithholdDto> queryForIcbcWithholdPage( String uploader, String uploadStartTime, String uploadEndTime, String uploadStatus, String confirmator, String confirmationStartTime, String confirmationEndTime,String desc);
public List<IcbcWithholdDto> queryForIcbcWithholdPage( String uploader, String uploadStartTime, String uploadEndTime, String uploadStatus, String confirmator, String confirmationStartTime, String confirmationEndTime,String desc, String withholdStatus);
}
......@@ -37,8 +37,9 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<JpStation> getJpStationList(@Param("dto") JpStationDto reviewDto);
@UserEmpower(field ={"ORG_CODE"} ,dealerField ={"ORG_CODE"}, fieldConditions ={"in","in"} ,relationship="and",specific=false)
List<DropDown> getRegion(String regionName);
List<DropDown> getRegion(String regionName, String address);
List<String> getRegionAddress();
@UserEmpower(field ={"ORG_CODE"} ,dealerField ={"ORG_CODE"}, fieldConditions ={"in","in"} ,relationship="and",specific=false)
List<DropDown> getRegionByProvince(@Param(value = "ids") List<String> ids);
......@@ -100,4 +101,5 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<Map<String, String>> queryUnitInfo();
}
......@@ -257,8 +257,6 @@ public class SFTPUtil {
if (null != output) {
output.close();
}
// 关闭连接
disconnect();
} catch (IOException e) {
logger.error("关闭文件时出错!");
logger.error(e.getMessage());
......@@ -275,14 +273,57 @@ public class SFTPUtil {
* @param localZipPath 本地ZIP文件保存路径
* @return 是否成功
*/
public boolean downloadAndZipFiles(String remotePath, String filenamePattern, String localZipPath) {
// public boolean downloadAndZipFiles(String remotePath, String filenamePattern, String localZipPath) {
// boolean success = false;
// Path tempDir = null;
// try {
// // 创建临时目录
// tempDir = Files.createTempDirectory("sftp_download_temp");
//
// // 列出远程目录中的所有文件`
// Vector<?> filesList = sftp.ls(remotePath);
//
// List<Path> downloadedFiles = new ArrayList<>();
// for (Object obj : filesList) {
// ChannelSftp.LsEntry entry = (ChannelSftp.LsEntry) obj;
// String filename = entry.getFilename();
// if (filename.contains(filenamePattern)) {
// Path localFilePath = tempDir.resolve(filename);
// downloadFile(remotePath, filename, localFilePath.toString());
// downloadedFiles.add(localFilePath);
// }
// }
//
// // 打包下载的文件到ZIP文件
// FileUtils.createZipFile(downloadedFiles, localZipPath);
// success = true;
// logger.info("成功接收文件并打包到ZIP文件: " + localZipPath);
// } catch (Exception e) {
// logger.error("下载或打包文件时发生异常!", e);
// } finally {
// try {
// // 删除临时目录及其内容
// if (tempDir != null) {
// FileUtils.cleanup(tempDir);
// }
// disconnect();
// } catch (IOException e) {
// logger.error("删除临时目录时出错!", e);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// return success;
// }
public boolean downloadAndZipFiles(String remotePath, String filenamePattern, String localZipPath) {
boolean success = false;
Path tempDir = null;
try {
// 创建临时目录
tempDir = Files.createTempDirectory("sftp_download_temp");
// 列出远程目录中的所有文件`
// 列出远程目录中的所有文件
Vector<?> filesList = sftp.ls(remotePath);
List<Path> downloadedFiles = new ArrayList<>();
......@@ -295,13 +336,24 @@ public class SFTPUtil {
downloadedFiles.add(localFilePath);
}
}
disconnect();
// 确保本地ZIP路径的父目录存在
Path localZipFilePath = Paths.get(localZipPath);
Path parentDir = localZipFilePath.getParent();
if (parentDir != null && !Files.exists(parentDir)) {
Files.createDirectories(parentDir);
}
// 打包下载的文件到ZIP文件
FileUtils.createZipFile(downloadedFiles, localZipPath);
FileUtils.createZipFile(downloadedFiles, localZipPath);
success = true;
logger.info("成功接收文件并打包到ZIP文件: " + localZipPath);
} catch (SftpException e) {
logger.error("下载文件时发生异常!", e);
} catch (IOException e) {
logger.error("处理文件或创建目录时发生异常!", e);
} catch (Exception e) {
logger.error("下载或打包文件时发生异常!", e);
logger.error("其他异常!", e);
} finally {
try {
// 删除临时目录及其内容
......@@ -317,8 +369,6 @@ public class SFTPUtil {
}
return success;
}
/**
* 上传文件至远程sftp服务器
*
......@@ -872,9 +922,11 @@ public class SFTPUtil {
if (!fileName.equals(".") && !fileName.equals("..")) { // 排除当前和上级目录条目
String fileContentAsString = getFileContentAsString(remotePath, fileName);
List<String> contents = Arrays.asList(fileContentAsString.split("\r\n"));
for (String content : contents) {
ResultLinkField resultLinkField = contentHandle(content);
allJsonData.add(resultLinkField);
if (null != contents && contents.size() > 0) {
for (String content : contents) {
ResultLinkField resultLinkField = contentHandle(content);
allJsonData.add(resultLinkField);
}
}
}
}
......
......@@ -161,7 +161,7 @@
<select id="exportTotal" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordExportDTO">
SELECT
MAX(ph.owners_name) AS custName,
MAX(ph.telephone) AS idCard,
MAX(ph.telephone) AS phone,
MAX(ph.id_card) AS idCard,
MAX(ph.regional_companies_name) AS regionalCompaniesName,
MAX(re.medium_id) AS mediumId,
......
......@@ -19,11 +19,14 @@
<if test="uploadStatus != null and uploadStatus != ''">
and upload_status = #{uploadStatus}
</if>
<if test="withholdStatus != null and withholdStatus != ''">
and withhold_status = #{withholdStatus}
</if>
<if test="confirmator != null and confirmator != ''">
and confirmator like concat('%',#{confirmator},'%')
</if>
<if test="desc != null and desc != ''">
and uploader like concat('%',#{desc},'%')
and content like concat('%',#{desc},'%')
</if>
<if test="confirmationStartTime != null and confirmationStartTime != ''">
and confirmation_time > #{confirmationStartTime}
......
......@@ -81,7 +81,8 @@
) ph
LEFT JOIN hygf_icbc_withhold_record re ON ph.amos_user_id = re.amos_user_id
<where>
ph.is_delete = 0
ph.is_delete = 0 AND re.withhold_status in ('成功','失败')
<if test="developerCode != null and developerCode != ''">
AND ph.developer_code = #{developerCode}
</if>
......@@ -119,9 +120,8 @@
<if test="dto.amosUserId != null and dto.amosUserId != ''">
AND re.amos_user_id = #{dto.amosUserId}
</if>
<if test="dto.batchNo != null and dto.batchNo != ''">
AND re.batch_no = #{dto.batchNo}
AND re.batch_no like concat('%',#{dto.batchNo},'%')
</if>
<if test="dto.withholdStatus != null and dto.withholdStatus != ''">
AND re.withhold_status = #{dto.withholdStatus}
......
......@@ -246,13 +246,27 @@
<select id="getRegion" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown">
SELECT privilege_company.ORG_CODE orgCode,
privilege_company.COMPANY_NAME name
privilege_company.COMPANY_NAME name,
privilege_company.ADDRESS address
FROM privilege_company
WHERE IS_DELETED = 0
and privilege_company.COMPANY_TYPE = 'region'
<if test="regionName!=null and regionName!=''">
and privilege_company.COMPANY_NAME like concat('%',#{regionName}, '%')
</if>
<if test="address!=null and address!='' and address !='未知省份'">
and privilege_company.ADDRESS like concat('%',#{address}, '%')
</if>
<if test="address!=null and address!='' and address == '未知省份'">
and privilege_company.ADDRESS is null
</if>
</select>
<select id="getRegionAddress" resultType="String">
SELECT DISTINCT IFNULL(privilege_company.address, '未知省份') AS address
FROM privilege_company
WHERE IS_DELETED = 0
and privilege_company.COMPANY_TYPE = 'region'
</select>
<select id="getRegionNode" resultType="string">
......@@ -865,7 +879,7 @@
and (amos_company_code is not null and regional_companies_code is not null )
</if>
</where>
order by rec_date DESC
order by sequence_nbr DESC
</select>
<select id="queryUnitInfo" resultType="java.util.Map">
......
......@@ -41,12 +41,10 @@
SELECT LOGIN_ID FROM auth_login_info login
WHERE
ID_TYPE = 'mobile' and IS_DELETED = '0'
<if test="">
and USER_ID in
<foreach collection="userIds" item="item" separator="," open="(" close=")">
<foreach collection="userIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</foreach>
</select>
</mapper>
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordDTO;
import com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdRecordDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.IcbcWithhold;
import com.yeejoin.amos.boot.module.hygf.api.entity.IcbcWithholdRecord;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
......@@ -48,7 +51,7 @@ public class IcbcWithholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增 聚富通代扣信息表", notes = "新增 聚富通代扣信息表")
public ResponseModel save(@RequestBody IcbcWithhold model) {
public ResponseModel save(@RequestBody IcbcWithhold model) throws Exception {
icbcWithholdServiceImpl.saveRecord(model);
return CommonResponseNewUtil.success();
}
......@@ -115,9 +118,10 @@ public class IcbcWithholdController extends BaseController {
@RequestParam(value = "confirmator",required = false) String confirmator,
@RequestParam(value = "confirmationStartTime",required = false) String confirmationStartTime,
@RequestParam(value = "confirmationEndTime",required = false) String confirmationEndTime,
@RequestParam(value = "withholdStatus",required = false) String withholdStatus,
@RequestParam(value = "desc",required = false) String desc) {
return ResponseHelper.buildResponse(icbcWithholdServiceImpl.queryForIcbcWithholdPage(current,size,uploader,uploadStartTime,uploadEndTime,uploadStatus,confirmator,confirmationStartTime,confirmationEndTime,desc));
return ResponseHelper.buildResponse(icbcWithholdServiceImpl.queryForIcbcWithholdPage(current,size,uploader,uploadStartTime,uploadEndTime,uploadStatus,confirmator,confirmationStartTime,confirmationEndTime,desc,withholdStatus));
} /**
* 列表分页查询
*
......@@ -180,7 +184,7 @@ public class IcbcWithholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = " 聚富通代扣信息回盘文件获取", notes = " 聚富通代扣信息回盘文件获取")
@GetMapping(value = "/downLoadicbcFile")
public ResponseModel<String> downLoadicbcFile( Long sequenceNbr,String batchNo,HttpServletResponse response ) throws Exception {
public ResponseModel downLoadicbcFile( Long sequenceNbr,String batchNo,HttpServletResponse response ) throws Exception {
icbcWithholdServiceImpl.downLoadicbcFile(batchNo,sequenceNbr,response);
return ResponseHelper.buildResponse(null);
}
......
......@@ -288,7 +288,7 @@ public class JpInverterController extends BaseController {
dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM-dd"));
}
//List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode());
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode(), dataDto.getName());
try {
setResponseHeadForDowload(response,"逆变器日报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates);
......@@ -322,7 +322,7 @@ public class JpInverterController extends BaseController {
dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM"));
}
// List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates =jpInverterServiceImpl.jpInverterMonthReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode());
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates =jpInverterServiceImpl.jpInverterMonthReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode(),dataDto.getName());
try {
setResponseHeadForDowload(response,"逆变器月报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterMonthGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器月报表").doWrite(tdHYGFInverterMonthGenerates);
......@@ -357,7 +357,7 @@ public class JpInverterController extends BaseController {
dataDto.setTime(DateUtil.format(new Date(),"yyyy"));
}
// List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates =jpInverterServiceImpl.jpInverterYearReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode());
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates =jpInverterServiceImpl.jpInverterYearReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode(), dataDto.getName());
try {
setResponseHeadForDowload(response,"逆变器年报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterYearGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器年报表").doWrite(tdHYGFInverterYearGenerates);
......
......@@ -2,12 +2,14 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.config.DealerRestrict;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationBatchDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
......@@ -27,6 +29,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.Key;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;
......@@ -426,19 +429,36 @@ public class JpStationController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司")
@GetMapping(value = "/getRegion")
@UserLimits
public ResponseModel<List<Map<String, String>>> getRegion(@RequestParam(required = false) String regionName) {
public ResponseModel<List<Map<String, String>>> getRegion(@RequestParam(required = false) String regionName, @RequestParam(required = false) String address) {
List<DropDown> list = jpStationMapper.getRegion(regionName);
List<DropDown> list = jpStationMapper.getRegion(regionName, address);
List<Map<String, String>> result = new ArrayList<>();
list.forEach(dropDown -> {
Map<String, String> item = new HashMap<>();
item.put("text", dropDown.getName());
item.put("value", dropDown.getOrgCode());
item.put("address", dropDown.getAddress());
result.add(item);
});
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司地址", notes = "查询当前登录人权限区域公司地址")
@GetMapping(value = "/getRegionAddress")
@UserLimits
public ResponseModel<List<Map<String, String>>> getRegionAddress() {
List<String> list = jpStationMapper.getRegionAddress();
List<Map<String, String>> result = new ArrayList<>();
list.forEach(address -> {
Map<String, String> item = new HashMap<>();
item.put("text", address);
item.put("value", address);
result.add(item);
});
return ResponseHelper.buildResponse(result);
}
//查询当前登录人权限区域公司
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司")
......@@ -845,6 +865,14 @@ public class JpStationController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/updateBatchCompanyCode")
@ApiOperation(httpMethod = "POST", value = "批量更新项目公司和经销商", notes = "批量更新项目公司和经销商")
public ResponseModel<?> updateBatchCompanyCode( @RequestBody JpStationBatchDto jpStationBatchDto) {
jpStationServiceImpl.updateBatchCompanyCode(jpStationBatchDto);
return ResponseHelper.buildResponse(null);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/queryStation")
@ApiOperation(httpMethod = "POST", value = "查询场站", notes = "查询场站")
public ResponseModel<?> queryStation(@RequestBody JpStationDto reviewDto) {
......@@ -919,7 +947,7 @@ public class JpStationController extends BaseController {
@UserLimits
public ResponseModel<List<Map<String, Object>>> getRegionStatistics(@RequestParam(required = false) String regionName) {
// 获取区域公司列表
List<DropDown> regionlist = jpStationMapper.getRegion(regionName);
List<DropDown> regionlist = jpStationMapper.getRegion(regionName, null);
List<Map<String, Object>> result = new ArrayList<>();
......
......@@ -2,8 +2,10 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PeasantHouseholdEnum;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
......@@ -13,7 +15,9 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationEngineeringInfoAllD
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStation;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PersonnelBusinessMapper;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -164,6 +168,20 @@ public class PeasantHouseholdController extends BaseController {
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/updateAddress/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新农户地址", notes = "根据sequenceNbr更新农户地址")
public ResponseModel updateAddress(@RequestBody PeasantHouseholdDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
peasantHouseholdServiceImpl.updateAddress(model,sequenceNbr);
return CommonResponseNewUtil.success();
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
......
......@@ -42,10 +42,13 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
......@@ -58,6 +61,7 @@ import java.nio.file.Paths;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
......@@ -90,7 +94,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
@Value("${icbc.Withhold.sftpUserName}")
public String sftpUserName;
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
private static int sequence = 0; // 当天的序列号
private static final AtomicInteger sequence = new AtomicInteger(0);
private static String uploadPath = "/JftFeeWithhold/upload"; // 上传地址
private static String downLoadPath = "/JftFeeWithhold/download"; // 下载地址
private static String file ="";
......@@ -126,7 +130,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
int billNo = 0;
int totalAmt = 0;
//生成批次号 若已从保存生成取原有批次号
String batchNo = StringUtil.isEmpty(model.getBatchNo())?generateBatchNumber():model.getBatchNo();
String batchNo = StringUtil.isEmpty(model.getBatchNo())?checkBatcnNumber():model.getBatchNo();
String loopField = "";
//判断接口调用来源 不为空时说明是先保存后在列表按钮上生成 可直取冗余数据
if (StringUtils.isNotEmpty(model.getIcbcRecordInfos())){
......@@ -213,8 +217,8 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
* 生成文件
*
*/
public void saveRecord(IcbcWithhold model) {
String batch = generateBatchNumber();
public void saveRecord(IcbcWithhold model) throws Exception {
String batch = checkBatcnNumber();
model.getRecordDTOS().forEach(e->{
e.setSequenceNbr(null);
e.setBatchNo(batch);
......@@ -262,21 +266,72 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
}
public synchronized String generateBatchNumber() {
// public synchronized String generateBatchNumber() {
// LocalDate currentDate = LocalDate.now();
// // 如果是新的一天,重置序列号
// if (!currentDate.equals(lastDate)) {
// sequence = 0;
// lastDate = currentDate;
// }
// // 生成8位日期
// String datePart = currentDate.format(DATE_FORMATTER);
// // 生成5位序列号
// String sequencePart = String.format("%05d", sequence++);
// // 拼接成完整的批次号
// return checkBatcnNumber(sequencePart,datePart,partnerIdentification);
// }
public String checkBatcnNumber()throws Exception{
LocalDate currentDate = LocalDate.now();
// 如果是新的一天,重置序列号
String datePart = currentDate.format(DATE_FORMATTER);
if (!currentDate.equals(lastDate)) {
sequence = 0;
sequence.set(0); // 重置序列号从0开始
lastDate = currentDate;
}
// 生成8位日期
String datePart = currentDate.format(DATE_FORMATTER);
// 生成5位序列号
String sequencePart = String.format("%05d", sequence++);
// 拼接成完整的批次号
return datePart + partnerIdentification + sequencePart;
// 定义序列号的最大值,这里设为五位数的最大值99999
int maxSequence = 99999;
// 设置最大尝试次数,防止无限循环
int maxAttempts = 10000;
// 构建批次号前缀,由日期部分和合作伙伴识别码组成
String batchNoPrefix = datePart + partnerIdentification;
// 使用 AtomicInteger 来管理序列号,保证线程安全
AtomicInteger attemptCounter = new AtomicInteger(0);
// 尝试生成唯一批次号,最多进行 maxAttempts 次尝试
while (attemptCounter.incrementAndGet() <= maxAttempts) {
// 获取当前序列号,并原子性地递增计数器
int currentSequence = sequence.getAndIncrement();
// 如果序列号超过了设定的最大值,则重置计数器
if (currentSequence > maxSequence) {
sequence.set(0); // 重置序列号从0开始
currentSequence = sequence.getAndIncrement(); // 再次获取新的序列号
}
// 格式化序列号为固定长度的字符串,不足的部分用零填充
String sequencePart = String.format("%05d", currentSequence);
// 组合完整的批次号
String batchNo = batchNoPrefix + sequencePart;
// 查询数据库以确认该批次号是否已经被占用
LambdaQueryWrapper<IcbcWithhold> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcbcWithhold::getBatchNo, batchNo);
List<IcbcWithhold> existingRecord = this.getBaseMapper().selectList(wrapper);
// 如果没有找到重复记录,则说明此批次号可用,直接返回
if (CollectionUtil.isEmpty(existingRecord)) {
return batchNo; // 当找到唯一批次号时返回
}
}
// 如果经过多次尝试后仍然未能生成唯一的批次号,则抛出异常
throw new Exception(" 如果经过多次尝试后仍然未能生成唯一的批次号");
}
public static void writeStringToFile(String content, String filename) throws IOException {
createDirectoryIfNotExists(filename);
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "GBK"))) {
......@@ -328,7 +383,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
this.downloadAndSaveZipFile(model.getReceiptFile(),batchNo,"回盘文件",response);
}
String path = new ClassPathResource(file+"secretKey/login-gxjrid_rsa").getPath();
String path = new ClassPathResource(file+"secretKey/登录-gxjrid_rsa").getPath();
SFTPUtil sftp = new SFTPUtil(sftpIp, sftpPort,
sftpUserName,
path, null);
......@@ -340,6 +395,19 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
sftp.priKeyConnect();
Path currentWorkingDir = Paths.get("");
Path dirPath = currentWorkingDir.resolve(batchNo);
try {
if (!Files.exists(dirPath)) {
Files.createDirectories(dirPath);
System.out.println("Directory created: " + dirPath);
} else {
System.out.println("Directory already exists: " + dirPath);
}
} catch (IOException e) {
e.printStackTrace();
System.err.println("Failed to create directory: " + dirPath);
}
System.out.println("Current working directory: " + System.getProperty("user.dir"));
if (sftp.isExist(downLoadPath)) {
sftp.downloadAndZipFiles(downLoadPath,batchNo,dirPath.toString()+"/"+batchNo+".zip");
logger.info("文件下载成功");
......@@ -411,17 +479,35 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
if (sftp.isExist(downLoadPath)) {
//获取回盘文件扣款状态
List<ResultLinkField> files = sftp.getAllResultFilesContentAsJson(downLoadPath);
for (ResultLinkField resultLinkField : files) {
LambdaUpdateWrapper<IcbcWithhold> updateWrapper = new LambdaUpdateWrapper<>();
if (resultLinkField.getStatus().equals("1")) {
updateWrapper.set(IcbcWithhold::getPaymentErrorDesc,resultLinkField.getErrMsg());
updateWrapper.set(IcbcWithhold::getWithholdStatus,UploadStatusEnum.失败.getName());
}else {
updateWrapper.set(IcbcWithhold::getWithholdStatus,UploadStatusEnum.成功.getName());
if (CollectionUtil.isNotEmpty(files)){
Map<String, List<ResultLinkField>> collect = files.stream().collect(Collectors.groupingBy(ResultLinkField::getBatchNo));
for (String batchNo : collect.keySet()) {
LambdaQueryWrapper<IcbcWithhold> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IcbcWithhold::getBatchNo,batchNo);
IcbcWithhold model = this.getBaseMapper().selectOne(queryWrapper);
List<IcbcWithholdRecord> icbcWithholdRecords = JSONArray.parseArray(model.getIcbcRecordInfos(), IcbcWithholdRecord.class);
Boolean isSuccess = true;
List<ResultLinkField> resultLinkFields = collect.get(batchNo);
//若失败 组装失败农户姓名及原因
String err ="";
for (ResultLinkField resultLinkField : resultLinkFields) {
if (resultLinkField.getStatus().equals("1")){
err = err+ icbcWithholdRecords.get(Integer.valueOf(resultLinkField.getBillNo())-1).getCustName() + ":" + resultLinkField.getErrMsg() + ";";
isSuccess = false;
}
}
LambdaUpdateWrapper<IcbcWithhold> updateWrapper = new LambdaUpdateWrapper<>();
if (!isSuccess) {
updateWrapper.set(IcbcWithhold::getPaymentErrorDesc,err);
updateWrapper.set(IcbcWithhold::getWithholdStatus,UploadStatusEnum.失败.getName());
}else {
updateWrapper.set(IcbcWithhold::getWithholdStatus,UploadStatusEnum.成功.getName());
}
updateWrapper.eq(IcbcWithhold::getBatchNo,batchNo);
this.getBaseMapper().update(null,updateWrapper);
}
updateWrapper.eq(IcbcWithhold::getBatchNo,resultLinkField.getBatchNo());
this.getBaseMapper().update(null,updateWrapper);
}
}
}
......@@ -485,10 +571,10 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
}
public Page<IcbcWithholdDto> queryForIcbcWithholdPage(int current, int size, String uploader, String uploadStartTime, String uploadEndTime, String uploadStatus, String confirmator, String confirmationStartTime, String confirmationEndTime,String desc) {
public Page<IcbcWithholdDto> queryForIcbcWithholdPage(int current, int size, String uploader, String uploadStartTime, String uploadEndTime, String uploadStatus, String confirmator, String confirmationStartTime, String confirmationEndTime,String desc,String withholdStatus) {
Page<IcbcWithholdDto> page = new Page<>();
PageHelper.startPage(current,size);
List<IcbcWithholdDto> icbcWithholdDtos = this.getBaseMapper().queryForIcbcWithholdPage(uploader,uploadStartTime,uploadEndTime,uploadStatus,confirmator,confirmationStartTime,confirmationEndTime,desc);
List<IcbcWithholdDto> icbcWithholdDtos = this.getBaseMapper().queryForIcbcWithholdPage(uploader,uploadStartTime,uploadEndTime,uploadStatus,confirmator,confirmationStartTime,confirmationEndTime,desc,withholdStatus);
PageInfo<IcbcWithholdDto> pageInfo = new PageInfo<>(icbcWithholdDtos);
page.setSize(pageInfo.getSize());
......@@ -500,12 +586,11 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
public void upIcbcWithholdRecordWithholdStatus() {
LambdaQueryWrapper<IcbcWithhold> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcbcWithhold::getUploadStatus,UploadStatusEnum.成功.getCode());
wrapper.eq(IcbcWithhold::getWithholdStatus,UploadStatusEnum.代扣处理中.getCode());
List<String> batchNos = this.getBaseMapper().selectList(wrapper).stream()
.map(IcbcWithhold::getBatchNo)
.collect(Collectors.toList());;
LambdaQueryWrapper<IcbcWithholdRecord> wrapper = new LambdaQueryWrapper<>();
wrapper.isNull(IcbcWithholdRecord::getWithholdStatus).or().eq(IcbcWithholdRecord::getWithholdStatus,"处理中");
Set<String> batchNos = icbcWithholdRecordService.getBaseMapper().selectList(wrapper).stream()
.map(IcbcWithholdRecord::getBatchNo)
.collect(Collectors.toSet());;
String APP_ID = "11000000000000028870";
String MY_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAlcIeANdqipul3/qAIRlknSacHiFCMzLzUJisGcr9ipm3p2rir8WDsac2MxgtUt+f89SGNoWyjv4q0/QAKQQTd5U3KuGAksCJLBGVibuFe7G7YGYVezUksjvocvp8GIinCIkzq67KL2SOpGXAu3s+282rx8AxdTZA/EhXQvbORbWz5+DamyY+wS7Maa8KmIOb6WZPtiXgENZxDHAafrqW8Gt1BnVfJNf5yS5J9Wl+LcR1EPvi5iH8dSIdn1ZMVupoREjV/DvItSogVehsqTRZWuekAo2xH9YEli1UMG/l3deViRn/A4VmPPzdv0xXpn/yO+OTjWez+KmSmJfAZXBvAgMBAAECggEABRYviWFWTz8X+1qeIDI/nHO2KFt3X2tAxkJztd/8h5PYmYw3e4NPATp5Ayp4UgIlW/ExxNW91EiImBL/F939eJIpA8sDJ8U4hqb+U+fOZyksOZnDOIAHmE+I24vl588yFM9Z6F55gGeeDVJ0SZHqIG/nz8i339aLt02yj3N6V1peQugBP6L9arcD+gVu4F70whkqW+lHBK/WzX1OazqEx3Ip175jqzi9/0vO/h/kqnGGXuMi2VeuAPsa+d0a6lf/FScxqCt3t6dCkJ5DPA1MCj81dPi5ZfCM/vE0N8I6LEV+RyC7bb4YVO/PoicFjb2j8vfLvldOUrsvkNH51dZusQKBgQDpMHacOBpIuVzEFfNtS9SgA96cUV6NCSmHoQppJ/p9xKzY4DpcqoOCIBT4WCvVe6PeN5mrjzt8Q5gJWxiq0tVgIF9k8GjLmuiJ2v4Qh8aUmlRwn0T0DYiX/Y7uzX+pRlkpoKrSktlTOT9vmGwZDGDk0h2+H3hZ3YQEucfA6bhHmQKBgQDTbHrbr1WsUR9lrdLaGi/Uphpl3BXLuCnJXav3yIZOktO5V68MfPZXLP7aaNtbK3n0YHD+Uv8wpHBBSWQYjVYlGdvlniA/W1pr73GZJECFfS1BmmFC4GG3E92D5IkmrcPlUuz8XxKrlwHnfW1F0MoDvhp930vS0tS6u+WYTt9dRwKBgCeEQPVkRIACeYf5OFFTQmsDfNv8pgs8fD8xuTPsxHQ/uhLenMVLWBHbIfKb7oG0/CYSQgZitW/vfHpJZ7q7E9HAaqoOW5P1YmbKJ7fhanOQW7LiKqs5B+bJ30j0piendkCpq4kXvaBu2SMuL1NnV5wvRz8K0jhYY6DxYrp8YPAxAoGAZxWTaZ25tgTvvBHeprzx6Ur7wAJpFiU7KpVjjbLV2WW5mbro/LvJGIQ11qQdn/w4wDBtp3MsPblPimWQSnBPOlO7Zd+NdZbDJbFfv/1vACcic8Qj/AmPW0ZyUSaSwKskwqGGLx7j6Yn9QbNkHhBJDz4XiJvhSm/FjS6kKXj7a20CgYEArnEiPmL5g1Ca/qKK9ql8Q6P9gipIfGGpaFu23y0trbcFpVn8Oos/ic0Jgw4Xiz+rqvb6bW2V6lqBJ+9/kdn0i7zlZxKNpYsW2xFgi04OU3d5HkGL16Y1rpqMYYEhjFaOIn7J8P046UYR99yaybgQd18TE6oFrX8OL5uY8M4ge4Y=";
String icbcPulicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB";
......@@ -535,7 +620,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
response = client.execute(request, System.currentTimeMillis() + "");
if (response.isSuccess()) {
List<JftApiPayFeewithholdQuerydetailResponseV1.TradeInfo> tradeList = response.getTradeList();
List<JftApiPayFeewithholdQuerydetailResponseV1.TradeInfo> filterList = tradeList.stream().filter(e -> batchNos.contains(e)).collect(Collectors.toList());
List<JftApiPayFeewithholdQuerydetailResponseV1.TradeInfo> filterList = tradeList.stream().filter(e -> batchNos.contains(e.getBatchNo())).collect(Collectors.toList());
filterList.forEach(e->{
LambdaUpdateWrapper<IcbcWithholdRecord> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IcbcWithholdRecord::getBatchNo,e.getBatchNo());
......
......@@ -209,6 +209,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime());
tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN));
tdHYGFInverterDayGenerate.setTotalGen(tdHYGFInverterDayGenerate.getTotalGen() == null ? 0:Double.valueOf(String.format("%.3f",tdHYGFInverterDayGenerate.getTotalGen()/1000)));
tdHYGFInverterDayGenerate.setTotalPower(tdHYGFInverterDayGenerate.getTotalPower() == null ? 0:Double.valueOf(String.format("%.3f",tdHYGFInverterDayGenerate.getTotalPower())));
tdHYGFInverterDayGenerate.setRegionalCompaniesName(regionalCompaniesNameMap.get(tdHYGFInverterDayGenerate.getRegionalCompaniesCode()));
});
......@@ -246,26 +247,56 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
// return tdHYGFInverterDayGeneratePage;
}
@UserLimits
public List<TdHYGFInverterDayGenerate> jpInverterDayReportExport(String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode) {
public List<TdHYGFInverterDayGenerate> jpInverterDayReportExport(String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode,String name) {
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
Date date = DateUtil.parse(time, "yyyy-MM-dd");
String startTime = DateUtil.format(date, "yyyy-MM-dd") + "00:00:00";
String endTime = DateUtil.format(date, "yyyy-MM-dd") + "23:59:59";
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>()
.ge("created_time", startTime)
.le("created_time", endTime);
// .in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
CharSequence time1 = time + " 00:00:00";
CharSequence time2 = time + " 23:59:59";
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String startTime = DateUtil.format(LocalDateTime.parse(time1,df), "yyyy-MM-dd HH:mm:ss");
String endTime = DateUtil.format(LocalDateTime.parse(time2,df), "yyyy-MM-dd HH:mm:ss");
// QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>()
// .ge("created_time", startTime)
// .le("created_time", endTime);
//// .in("third_station_id", stationIds);
// ;
// if (CollectionUtil.isNotEmpty(sncodes)) {
// queryWrapper.in("sn_code", sncodes);
// }
// queryWrapper.orderByDesc("created_time");
//
// PageHelper.startPage(current, size);
// List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper);
List<Map<String, Object>> listData = tdHYGFInverterDayGenerateMapper.selectSnCodeList(startTime, endTime, sncodes);
List<String> snCodeList = new ArrayList<>();
List<String> maxCreatedTimeList = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
listData.stream().forEach(item -> {
if(item.get("sn_code") != null) {
snCodeList.add(item.get("sn_code").toString());
}
if(item.get("max_created_time") != null) {
maxCreatedTimeList.add(sdf.format(item.get("max_created_time")));
}
});
if(StringUtils.isNotEmpty(name)) {
name = '%' + name + "%";
}
queryWrapper.eq(!StringUtils.isEmpty(regionalCompaniesCode),"regional_companies_code",regionalCompaniesCode);
queryWrapper.orderByDesc("created_time");
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper);
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectListPage(snCodeList, null, startTime, endTime,regionalCompaniesCode, name);
tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> {
Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime());
tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN));
tdHYGFInverterDayGenerate.setTotalGen(tdHYGFInverterDayGenerate.getTotalGen() == null ? 0:Double.valueOf(String.format("%.3f",tdHYGFInverterDayGenerate.getTotalGen()/1000)));
tdHYGFInverterDayGenerate.setRegionalCompaniesName(regionalCompaniesNameMap.get(tdHYGFInverterDayGenerate.getRegionalCompaniesCode()));
tdHYGFInverterDayGenerate.setTotalPower(tdHYGFInverterDayGenerate.getTotalPower() == null ? 0:Double.valueOf(String.format("%.3f",tdHYGFInverterDayGenerate.getTotalPower())));
});
return tdHYGFInverterDayGenerates;
}
......@@ -324,15 +355,20 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
//// return tdHYGFInverterMonthGeneratePage;
}
@UserLimits
public List<TdHYGFInverterMonthGenerate> jpInverterMonthReportExport( String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode) {
public List<TdHYGFInverterMonthGenerate> jpInverterMonthReportExport( String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode,String name) {
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterMonthGenerate>()
.eq("year_month", time);
// .in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
if (StringUtils.isNotEmpty(name)) {
queryWrapper.like("name", "%" + name + "%");
}
queryWrapper.eq(!StringUtils.isEmpty(regionalCompaniesCode),"regional_companies_code",regionalCompaniesCode);
queryWrapper.orderByDesc("day_time");
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates = tdHYGFInverterMonthGenerateMapper.selectList(queryWrapper);
tdHYGFInverterMonthGenerates.forEach(tdHYGFInverterMonthGenerate -> {
......@@ -390,7 +426,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
// return tdHYGFInverterYearGeneratePage;
}
@UserLimits
public List<TdHYGFInverterYearGenerate> jpInverterYearReportExport(String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode) {
public List<TdHYGFInverterYearGenerate> jpInverterYearReportExport(String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode,String name) {
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterYearGenerate>()
.eq("year", time);
......@@ -398,11 +434,15 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
if (StringUtils.isNotEmpty(name)) {
queryWrapper.like("name", "%" + name + "%");
}
queryWrapper.eq(!StringUtils.isEmpty(regionalCompaniesCode),"regional_companies_code",regionalCompaniesCode);
queryWrapper.orderByDesc("month_time");
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates = tdHYGFInverterYearGenerateMapper.selectList(queryWrapper);
tdHYGFInverterYearGenerates.forEach(tdHYGFInverterYearGenerate -> {
tdHYGFInverterYearGenerate.setFullhour(tdHYGFInverterYearGenerate.getFullhour()!=null?Double.valueOf(String.format("%.2f",tdHYGFInverterYearGenerate.getFullhour())):null);
tdHYGFInverterYearGenerate.setGenerate(tdHYGFInverterYearGenerate.getGenerate()!=null?Double.valueOf(String.format("%.2f",tdHYGFInverterYearGenerate.getGenerate())):null);
tdHYGFInverterYearGenerate.setRegionalCompaniesName(regionalCompaniesNameMap.get(tdHYGFInverterYearGenerate.getRegionalCompaniesCode()));
});
return tdHYGFInverterYearGenerates;
......
......@@ -596,17 +596,23 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
public List<JpStationDto> getJpStationDtoAlldto( List<JpStationDto> da){
List<JpStationDto> ld=new ArrayList<>();
Map<String,String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
int index=1;
for (JpStationDto jpStation : da) {
JpStationDto hd=new JpStationDto();
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setIndex(index++);
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setThirdStationId(jpStation.getThirdStationId());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower())):null);
hd.setFullhour(jpStation.getAccumulatedPower()!=null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower()*FD/jpStation.getCapacity())):null);
if(jpStation.getCapacity()!=0){
hd.setFullhour(jpStation.getAccumulatedPower()!=null ? Double.valueOf(String.format("%.3f",Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower()))*FD/jpStation.getCapacity())):null);
}else {
hd.setFullhour(jpStation.getAccumulatedPower()!=null ? Double.valueOf(String.format("%.3f",Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower()))*FD)):null);
}
hd.setCumulativeIncome(jpStation.getCumulativeIncome()!=null?Double.valueOf(String.format("%.3f",jpStation.getCumulativeIncome())):null);
hd.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(jpStation.getRegionalCompaniesCode()));
......@@ -620,10 +626,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
List<JpStationDto> ld = new ArrayList<>();
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
Integer index=1;
for (JpStation jpStation : da) {
JpStationDto hd = new JpStationDto();
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setIndex(index++);
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
......@@ -648,21 +655,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setThirdStationId(jpStation.getThirdStationId());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setDayGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setTimeDate(dayGenerate.getDayTime());
hd.setDayIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setRegionalCompaniesCode(dayGenerate.getRegionalCompaniesCode());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
break;
}
}
hd.setState(dayGenerate.getStationState());
hd.setName(dayGenerate.getStationName());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setDayGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setTimeDate(dayGenerate.getDayTime());
hd.setDayIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setRegionalCompaniesCode(dayGenerate.getRegionalCompaniesCode());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
ld.add(hd);
}
return ld;
......@@ -694,21 +701,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setThirdStationId(jpStation.getThirdStationId());
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setMonthGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setMonthIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getMonthTime());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setRegionalCompaniesCode(dayGenerate.getRegionalCompaniesCode());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
break;
}
}
hd.setName(dayGenerate.getStationName());
hd.setState(dayGenerate.getStationState());
hd.setMonthGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setMonthIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getMonthTime());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setRegionalCompaniesCode(dayGenerate.getRegionalCompaniesCode());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
ld.add(hd);
}
return ld;
......@@ -723,22 +730,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setThirdStationId(jpStation.getThirdStationId());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setYearGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setYearIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getYearTime());
hd.setRegionalCompaniesCode(dayGenerate.getRegionalCompaniesCode());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
break;
}
}
hd.setName(dayGenerate.getStationName());
hd.setState(dayGenerate.getStationState());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setYearGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setYearIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getYearTime());
hd.setRegionalCompaniesCode(dayGenerate.getRegionalCompaniesCode());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
ld.add(hd);
}
return ld;
......@@ -801,7 +807,8 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
.doWrite(listy);
break;
default:
list = getJpStationDtoAll(dataJpStation);
List<JpStationDto> listJ= jpStationMapper.queryForDealerReviewPage(reviewDto);
list = getJpStationDtoAlldto(listJ);
setResponseHeadForDowload(response, "电站累计报表.xls");
EasyExcel.write(response.getOutputStream()).head(JpStationDto.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表")
......@@ -889,25 +896,25 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
public List<DayGenerateEX> getJpStationDtodaynew( List<JpStation> da, List<DayGenerate> listday){
List<DayGenerateEX> ld=new ArrayList<>();
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
int index=1;
for (DayGenerate dayGenerate : listday) {
DayGenerateEX hd = new DayGenerateEX();
for (JpStation jpStation : da) {
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setDayGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setTimeDate(dayGenerate.getDayTime());
hd.setDayIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
break;
}
}
hd.setIndex(index++);
hd.setName(dayGenerate.getStationName());
hd.setState(dayGenerate.getStationState());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setDayGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setTimeDate(dayGenerate.getDayTime());
hd.setDayIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
ld.add(hd);
}
return ld;
......@@ -916,23 +923,24 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
public List<MonthGenerateEX> getJpStationDtomonthnew(List<JpStation> da, List<MonthGenerate> listmonth) {
List<MonthGenerateEX> ld = new ArrayList<>();
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
int index=1;
for (MonthGenerate dayGenerate : listmonth) {
MonthGenerateEX hd = new MonthGenerateEX();
for (JpStation jpStation : da) {
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setMonthGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setMonthIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getMonthTime());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
break;
}
}
hd.setIndex(index++);
hd.setName(dayGenerate.getStationName());
hd.setMonthGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setMonthIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getMonthTime());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
ld.add(hd);
}
return ld;
......@@ -941,24 +949,25 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
public List<YearGenerateEX> getJpStationDtoyearnew(List<JpStation> da, List<YearGenerate> listyear) {
List<YearGenerateEX> ld = new ArrayList<>();
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
int index=1;
for (YearGenerate dayGenerate : listyear) {
YearGenerateEX hd = new YearGenerateEX();
for (JpStation jpStation : da) {
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setYearGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setYearIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getYearTime());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
break;
}
}
hd.setIndex(index++);
hd.setName(dayGenerate.getStationName());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setYearGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setYearIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getYearTime());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
ld.add(hd);
}
return ld;
......@@ -1141,4 +1150,15 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
}
return result;
}
public void updateBatchCompanyCode(JpStationBatchDto jpStationBatchDto) {
if(CollectionUtil.isNotEmpty(jpStationBatchDto.getSequenceNbrList())){
LambdaUpdateWrapper<JpStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(JpStation::getRegionalCompaniesCode,jpStationBatchDto.getRegionalCompaniesCode())
.set(JpStation::getAmosCompanyCode,jpStationBatchDto.getAmosCompanyCode())
.in(JpStation::getSequenceNbr,jpStationBatchDto.getSequenceNbrList());
this.update(wrapper);
}
}
}
\ No newline at end of file
......@@ -5,9 +5,11 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
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;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
......@@ -27,6 +29,8 @@ import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.*;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -56,7 +60,10 @@ import java.util.stream.Collectors;
@Service
@Slf4j
public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto,PeasantHousehold,PeasantHouseholdMapper> implements IPeasantHouseholdService {
@Autowired
RedisUtils redisUtils;
private static final String regionRedis="app_region_redis";
public static final String SECRETKEY = "qaz";
@Autowired
SurveyInformationServiceImpl surveyInformationService;
......@@ -92,6 +99,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
ToDoTasksServiceImpl toDoTasksServiceImpl;
@Autowired
RegionalCompaniesMapper regionalCompaniesMapper;
@Autowired
PowerStationServiceImpl powerStationService;
private Long TOKEN_TIME = 1209600l;
// @Autowired
// CommonServiceImpl commonService;
......@@ -136,8 +145,6 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Value("${farmer.registerPassword}")
private String registerPassword;
@Autowired
private RedisUtils redisUtils;
@Autowired
private IWxService wxService;
......@@ -263,6 +270,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
return code;
}
/**
* 分页查询
*/
......@@ -1044,6 +1053,84 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
return peasantHouseholdIPage;
}
public JSONArray getRegionName(){
JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
jsonArray= JSONArray.parseArray(redisUtils.get(regionRedis).toString());
}else {
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
if(null != regionModel && null != regionModel.getChildren()) {
for (RegionModel child : regionModel.getChildren()) {
if(null != child && null != child.getChildren()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}
}
redisUtils.set(regionRedis,jsonArray);
}
return jsonArray;
}
public void updateAddress(PeasantHouseholdDto model, Long sequenceNbr) {
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
if(model.getProjectAddress().size()>0){
// 处理项目地址
String projectAddressName = "";
for (Integer reg : model.getProjectAddress())
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
projectAddressName = projectAddressName + re.getRegionName() + "/";
}
}
model.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1));
}
if ("1".equals(model.getIsPermanent())) {
model.setPermanentAddress(model.getProjectAddress());
model.setPermanentAddressDetail(model.getProjectAddressDetail());
}
if(model.getPermanentAddress().size()>0){
// 处理常驻地址
String permanentAddressName = "";
for (Integer reg : model.getPermanentAddress())
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
permanentAddressName = permanentAddressName + re.getRegionName() + "/";
}
}
model.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
}
LambdaUpdateWrapper<PeasantHousehold> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(BaseEntity::getSequenceNbr, sequenceNbr);
updateWrapper.set(PeasantHousehold::getPermanentAddress, model.getPermanentAddress());
updateWrapper.set(PeasantHousehold::getPermanentAddressName, model.getPermanentAddressName());
updateWrapper.set(PeasantHousehold::getPermanentAddressDetail, model.getPermanentAddressDetail());
updateWrapper.set(PeasantHousehold::getProjectAddress, model.getProjectAddress());
updateWrapper.set(PeasantHousehold::getProjectAddressDetail, model.getProjectAddressDetail());
updateWrapper.set(PeasantHousehold::getProjectAddressName, model.getProjectAddressName());
this.update(updateWrapper);
LambdaUpdateWrapper<PowerStation> up = new LambdaUpdateWrapper<>();
up.eq(PowerStation::getPeasantHouseholdId, sequenceNbr);
up.set(PowerStation::getProjectAddress, model.getProjectAddressName());
powerStationService.update(up);
}
// public void saveHistoryPeasantHousehold(PowerStationEngineeringInfoAllDto surveyInfoAllDto,String operationType) {
//
// SurveyInformationDto model = surveyInfoAllDto.getSurveyInformation();
......
......@@ -189,7 +189,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
try {
Systemctl.smsClient.sendCommonSms(params).getResult();
} catch (Exception e) {
throw new BadRequest(todoTelephone+"发送短信失败:" + e.getMessage());
log.error(e.getMessage(),e);
}
}
}
......@@ -241,7 +241,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
public void importRepaymentExcel(MultipartFile file) {
//获取当前用户权限的公司
try {
List<DropDown> region = jpStationMapper.getRegion(null);
List<DropDown> region = jpStationMapper.getRegion(null, null);
if (CollectionUtil.isEmpty(region)) {
throw new BadRequest("该用户没有公司");
}
......
......@@ -295,6 +295,7 @@ public class SurveyInformationServiceImpl
peasantHousehold
.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
if (OPERATION_TYPE_SUBMIT.equals(operationType)) {
// peasantHousehold.setSurveyOrNot(1);
} else if (OPERATION_TYPE_APPLY.equals(operationType)) {
......
......@@ -88,6 +88,7 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto, ToDoTasks, T
qw.eq(StringUtils.isNotEmpty(dto.getType()), "type", dto.getType());
qw.eq(StringUtils.isNotEmpty(dto.getState()), "state", dto.getState());
qw.like(StringUtils.isNotEmpty(dto.getAmosUserId()), "amos_user_id", "%"+dto.getAmosUserId()+"%");
qw.like(StringUtils.isNotEmpty(dto.getTaskName()), "task_name", "%"+dto.getTaskName()+"%");
qw.orderBy(Boolean.TRUE, Boolean.FALSE, "creation_time");
IPage<ToDoTasks> toDoTasksPage = toDoTasksMapper.selectPage(dto, qw);
......
......@@ -48,6 +48,7 @@ public class UserMessageServiceImpl extends BaseService<UserMessageDto,UserMessa
QueryWrapper<UserMessage> qw = new QueryWrapper<>();
qw.eq(StringUtils.isNotEmpty(dto.getType()), "type",dto.getType() );
qw.like(StringUtils.isNotEmpty(dto.getAmosUserId()), "amos_user_id","%"+dto.getAmosUserId()+"%" );
qw.like(StringUtils.isNotEmpty(dto.getTaskName()), "task_name","%"+dto.getTaskName()+"%" );
qw.orderBy(Boolean.TRUE, Boolean.FALSE, "creation_time");
IPage<UserMessage> toDoTasksPage = userMessageMapper.selectPage(dto, qw);
return toDoTasksPage;
......
......@@ -580,8 +580,14 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
String routhPath = toDoTasksService.getRouthPath(TaskTypeStationEnum.施工.getCode(),workflowResultDto.getNextNodeKey(), routhPathVO);
String wxRouthPath = toDoTasksService.getWxRouthPath(TaskTypeStationEnum.施工.getCode(),workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.施工.getCode(), hygfWorkOrderStationAuditing.getWorkOrderPowerStationId(), taskName,regionalCompaniesCode,routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
List<String> filterUsers = toDoTasksService.filterUsers(TaskTypeStationEnum.施工.getCode(), workflowResultDto.getNextNodeKey(),userIds, regionalCompaniesCode, amosDealerOrgCode);
List<String> filterUsers;
if("Activity_0bs6t4g".equals(workflowResultDto.getNextNodeKey())){
String roleId = toDoTasksService.getRoleIdByName("户用光伏-经销商-施工");
filterUsers = toDoTasksService.getTodoUserIds(regionalCompaniesCode, roleId, amosDealerOrgCode);
}else {
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
filterUsers = toDoTasksService.filterUsers(TaskTypeStationEnum.施工.getCode(), workflowResultDto.getNextNodeKey(),userIds, regionalCompaniesCode, amosDealerOrgCode);
}
toDoTasksService.completeAndAddToDoTask(filterUsers,toDoTasks,"");
}
......
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