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; ...@@ -8,7 +8,7 @@ import java.util.List;
public interface TanYinCustomerInfoMapper extends BaseMapper<TanYinCustomerInfo> { 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(); List<String> listProjectNo();
} }
...@@ -295,7 +295,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -295,7 +295,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
if (ObjectUtils.isEmpty(TdHYGFStationMonthGenerate)) { if (ObjectUtils.isEmpty(TdHYGFStationMonthGenerate)) {
TdHYGFStationMonthGenerate = new TdHYGFStationMonthGenerate(); TdHYGFStationMonthGenerate = new TdHYGFStationMonthGenerate();
} }
householdPvApiService.addTdHYGFStationDayGenerate(TdHYGFStationMonthGenerate,hour);
TdHYGFStationMonthGenerate.setThirdStationId(stationIds.get(i)); TdHYGFStationMonthGenerate.setThirdStationId(stationIds.get(i));
TdHYGFStationMonthGenerate.setDayTime(DateUtil.format(today1, "yyyy-MM-dd")); TdHYGFStationMonthGenerate.setDayTime(DateUtil.format(today1, "yyyy-MM-dd"));
TdHYGFStationMonthGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM")); TdHYGFStationMonthGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM"));
...@@ -308,7 +308,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -308,7 +308,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
TdHYGFStationMonthGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode()); TdHYGFStationMonthGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
TdHYGFStationMonthGenerate.setStationName(jpStation.getName()); TdHYGFStationMonthGenerate.setStationName(jpStation.getName());
TdHYGFStationMonthGenerate.setStationState(jpStation.getState()); TdHYGFStationMonthGenerate.setStationState(jpStation.getState());
householdPvApiService.addTdHYGFStationDayGenerate(TdHYGFStationMonthGenerate,hour);
if (ObjectUtils.isEmpty(TdHYGFStationMonthGenerate.getCreatedTime())) { if (ObjectUtils.isEmpty(TdHYGFStationMonthGenerate.getCreatedTime())) {
TdHYGFStationMonthGenerate.setCreatedTime(System.currentTimeMillis()); TdHYGFStationMonthGenerate.setCreatedTime(System.currentTimeMillis());
TdHYGFStationMonthGenerateMapper.insert(TdHYGFStationMonthGenerate); TdHYGFStationMonthGenerateMapper.insert(TdHYGFStationMonthGenerate);
......
...@@ -51,15 +51,23 @@ public class HouseholdPvApiServiceImpl extends BaseService<HouseholdPvApiDto, Ho ...@@ -51,15 +51,23 @@ public class HouseholdPvApiServiceImpl extends BaseService<HouseholdPvApiDto, Ho
.eq("day_time", DateUtil.format(new Date(), "yyyy-MM-dd")) .eq("day_time", DateUtil.format(new Date(), "yyyy-MM-dd"))
.eq("hour", currentTime) .eq("hour", currentTime)
.eq("year_month", DateUtil.format(new Date(), "yyyy-MM"))); .eq("year_month", DateUtil.format(new Date(), "yyyy-MM")));
Long createdTime = tdHYGFStationDayGenerate.getCreatedTime();
boolean flag= false;
if (ObjectUtils.isEmpty(tdHYGFStationDayGenerate)) { if (ObjectUtils.isEmpty(tdHYGFStationDayGenerate)) {
tdHYGFStationDayGenerate = new TdHYGFStationDayGenerate(); tdHYGFStationDayGenerate = new TdHYGFStationDayGenerate();
flag= true;
} }
BeanUtils.copyProperties(tdHYGFStationMonthGenerate,tdHYGFStationDayGenerate); BeanUtils.copyProperties(tdHYGFStationMonthGenerate,tdHYGFStationDayGenerate);
tdHYGFStationDayGenerate.setHour(currentTime); tdHYGFStationDayGenerate.setHour(currentTime);
if (tdHYGFStationDayGenerate.getStationState().equals("离线")){ if (tdHYGFStationDayGenerate.getStationState().equals("离线")){
tdHYGFStationDayGenerate.setGenerate(null); tdHYGFStationDayGenerate.setGenerate(null);
} }
tdHYGFStationDayGenerate.setCreatedTime(System.currentTimeMillis()); if (flag){
tdHYGFStationDayGenerate.setCreatedTime(System.currentTimeMillis());
}else {
tdHYGFStationDayGenerate.setCreatedTime(createdTime);
}
TdHYGFStationDayGenerateMapper.insert(tdHYGFStationDayGenerate); TdHYGFStationDayGenerateMapper.insert(tdHYGFStationDayGenerate);
} }
......
...@@ -282,8 +282,13 @@ public class SunlightServiceImpl implements SunlightService { ...@@ -282,8 +282,13 @@ public class SunlightServiceImpl implements SunlightService {
Map<String, String> map5 = sunlightDto.getTotal_income(); Map<String, String> map5 = sunlightDto.getTotal_income();
if (map5 != null && map5.get("unit") != null && !map5.get("unit").isEmpty() if (map5 != null && map5.get("unit") != null && !map5.get("unit").isEmpty()
&& !"--".equals(map5.get("value"))) { && !"--".equals(map5.get("value"))) {
jpStation.setCumulativeIncome(SunlightUtil.sy.get(String.valueOf(map5.get("unit"))) if (!map5.get("unit").equals("")){
* Double.valueOf(String.valueOf(map5.get("value"))));// 累计收益 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) { } catch (Exception e) {
......
package com.yeejoin.amos.api.householdapi.face.service.impl; 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.collection.ListUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapBuilder; import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.api.householdapi.Utils.RedisUtils; import com.yeejoin.amos.api.householdapi.Utils.RedisUtils;
import com.yeejoin.amos.api.householdapi.Utils.TanYinApiUtils; import com.yeejoin.amos.api.householdapi.Utils.TanYinApiUtils;
import com.yeejoin.amos.api.householdapi.constant.TanYinConstant; 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.JpInverter;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
...@@ -175,7 +179,6 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe ...@@ -175,7 +179,6 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
*/ */
@Scheduled (cron = "${dataRequestScheduled.tanYin}") @Scheduled (cron = "${dataRequestScheduled.tanYin}")
@Override @Override
public void customerInfoList() { public void customerInfoList() {
try { try {
String startDate = LocalDate.now().minusMonths(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String startDate = LocalDate.now().minusMonths(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
...@@ -221,7 +224,6 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe ...@@ -221,7 +224,6 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
@Scheduled (cron = "${dataRequestScheduled.tanYin}") @Scheduled (cron = "${dataRequestScheduled.tanYin}")
@Async @Async
@Override @Override
@PostConstruct
public void stationList() { public void stationList() {
long ts = System.currentTimeMillis(); long ts = System.currentTimeMillis();
log.info("-------碳银同步电站开始: {} ------- ", ts); log.info("-------碳银同步电站开始: {} ------- ", ts);
...@@ -236,16 +238,17 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe ...@@ -236,16 +238,17 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
for (List<String> projectNoList : projectNoLists) { for (List<String> projectNoList : projectNoLists) {
Map<String, Object> params = MapBuilder.<String, Object>create().put("projectNoList", projectNoList).put("powerDate", powerDate).build(); 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); List<TanYinStationInfo> tanYinStationInfoList = tanYinApiUtils.post("电站基本信息", apiUrl + TanYinConstant.stationListUrl, params, null, TanYinStationInfo.class);
if (CollectionUtils.isEmpty(tanYinStationInfoList)) { if (!CollectionUtils.isEmpty(tanYinStationInfoList)) {
continue; tanYinStationInfos.addAll(tanYinStationInfoList);
} }
tanYinStationInfos.addAll(tanYinStationInfoList);
} }
if (CollectionUtils.isEmpty(tanYinStationInfos)) { if (CollectionUtils.isEmpty(tanYinStationInfos)) {
log.warn("-------碳银同步电站结束: 未同步到电站基本信息 -------"); log.warn("-------碳银同步电站结束: 未同步到电站基本信息 -------");
return; return;
} }
List<String> stationIds = tanYinStationInfos.stream().map(TanYinStationInfo::getProjectNo).collect(Collectors.toList()); 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)); 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())); Map<String, JpStation> jpStationMap = jpStations.stream().collect(Collectors.toMap(JpStation::getThirdStationId, Function.identity()));
...@@ -300,6 +303,7 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe ...@@ -300,6 +303,7 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
jpStation.setYearIncome(tanYinStationInfo.getYearPower() != null ? Double.parseDouble(tanYinStationInfo.getYearPower()) * 0.45 : 0.0); 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.setCumulativeIncome(tanYinStationInfo.getTotalPower() != null ? Double.parseDouble(tanYinStationInfo.getTotalPower()) * 0.45 : 0.0);
jpStation.setArea(tanYinStationInfo.getArea()); jpStation.setArea(tanYinStationInfo.getArea());
jpStation.setState("在线");
// jpStation.setEmail(); // jpStation.setEmail();
// jpStation.setCreateTime(); // jpStation.setCreateTime();
// jpStation.setRatedPower(); // jpStation.setRatedPower();
...@@ -433,6 +437,45 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe ...@@ -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 @Override
public void inverterList() { public void inverterList() {
......
...@@ -23,7 +23,7 @@ public enum UploadStatusEnum { ...@@ -23,7 +23,7 @@ public enum UploadStatusEnum {
public static UploadStatusEnum getNodeByCode(String code) { public static UploadStatusEnum getNodeByCode(String code) {
UploadStatusEnum anEnum = null; UploadStatusEnum anEnum = null;
for (UploadStatusEnum type : UploadStatusEnum.values()) { for (UploadStatusEnum type : UploadStatusEnum.values()) {
if (type.getCode() == code) { if (type.getCode().equals(code) ) {
anEnum = type; anEnum = type;
break; break;
} }
......
...@@ -11,9 +11,9 @@ import lombok.Data; ...@@ -11,9 +11,9 @@ import lombok.Data;
*/ */
@Data @Data
public class DayGenerateEX { public class DayGenerateEX {
@ExcelProperty(value = "电站编号", index = 0) @ExcelProperty(value = "号", index = 0)
@ApiModelProperty(value = "电站编码") @ApiModelProperty(value = "序号")
private String code; private Integer index;
@ExcelProperty(value = "电站名称", index = 1) @ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称") @ApiModelProperty(value = "电站名称")
private String name; private String name;
......
...@@ -22,4 +22,7 @@ public class DropDown { ...@@ -22,4 +22,7 @@ public class DropDown {
@ApiModelProperty(value = "单位名称+单位id") @ApiModelProperty(value = "单位名称+单位id")
private String id; private String id;
@ApiModelProperty(value = "单位地址")
private String address;
} }
...@@ -73,6 +73,9 @@ public class IcbcWithholdDto extends BaseDto { ...@@ -73,6 +73,9 @@ public class IcbcWithholdDto extends BaseDto {
* 失败原因 * 失败原因
*/ */
private String uploadErrorDesc; private String uploadErrorDesc;
private String receiptFile;
/** /**
* 失败原因 * 失败原因
*/ */
......
...@@ -55,32 +55,30 @@ public class IcbcWithholdRecordDto extends BaseDto { ...@@ -55,32 +55,30 @@ public class IcbcWithholdRecordDto extends BaseDto {
/** /**
* 开户状态, 00-初始,01-开户中,02-开户成功,03-开户失败 * 开户状态, 00-初始,01-开户中,02-开户成功,03-开户失败
*/ */
@ExcelProperty(value = "开户状态", index = 5) @ExcelIgnore @ApiModelProperty(value = "开户状态, 00-初始,01-开户中,02-开户成功,03-开户失败")
@ApiModelProperty(value = "开户状态, 00-初始,01-开户中,02-开户成功,03-开户失败")
private String openAccountStatus; private String openAccountStatus;
/** /**
* 协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认 * 协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认
*/ */
@ExcelProperty(value = "协议状态", index = 6) @ExcelIgnore @ApiModelProperty(value = "协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认")
@ApiModelProperty(value = "协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认")
private String protocolStatus; private String protocolStatus;
@ExcelProperty(value = "协议状态", index = 7) @ExcelProperty(value = "批次号", index = 5)
@ApiModelProperty(value = "批次号") @ApiModelProperty(value = "批次号")
private String batchNo; private String batchNo;
@ExcelProperty(value = "项目编号", index = 8) @ExcelProperty(value = "项目编号", index = 6)
@ApiModelProperty(value = "项目编号") @ApiModelProperty(value = "项目编号")
private String projectId; private String projectId;
@ExcelProperty(value = "付款金额", index = 9) @ExcelProperty(value = "付款金额(元)", index = 7)
@ApiModelProperty(value = "付款金额") @ApiModelProperty(value = "付款金额")
private double paymentAmount; private double paymentAmount;
@ExcelProperty(value = "代扣状态", index = 10) @ExcelProperty(value = "代扣状态", index = 8)
@ApiModelProperty(value = "代扣状态") @ApiModelProperty(value = "代扣状态")
private String withholdStatus; private String withholdStatus;
...@@ -88,7 +86,7 @@ public class IcbcWithholdRecordDto extends BaseDto { ...@@ -88,7 +86,7 @@ public class IcbcWithholdRecordDto extends BaseDto {
@ApiModelProperty(value = "上传时间") @ApiModelProperty(value = "上传时间")
private Date withholdTime; private Date withholdTime;
@ExcelProperty(value = "缴费时间", index = 11) @ExcelProperty(value = "缴费时间", index = 9)
@ApiModelProperty(value = "缴费时间") @ApiModelProperty(value = "缴费时间")
private Date paymentTime; 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 { ...@@ -36,9 +36,10 @@ public class JpStationDto extends BaseDto {
@ExcelProperty(value = "电站名称", index = 1) @ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称") @ApiModelProperty(value = "电站名称")
private String name; private String name;
@ExcelProperty(value = "电站编号", index = 0)
@ApiModelProperty(value = "电站编码")
private String code; private String code;
@ExcelProperty(value = "序号", index = 0)
@ApiModelProperty(value = "序号")
private Integer index;
@ExcelIgnore @ExcelIgnore
@ApiModelProperty(value = "组织编码") @ApiModelProperty(value = "组织编码")
private String systemCode; private String systemCode;
......
...@@ -14,9 +14,9 @@ public class MonthGenerateEX { ...@@ -14,9 +14,9 @@ public class MonthGenerateEX {
@ExcelProperty(value = "电站编号", index = 0) @ExcelProperty(value = "号", index = 0)
@ApiModelProperty(value = "电站编码") @ApiModelProperty(value = "序号")
private String code; private Integer index;
@ExcelProperty(value = "电站名称", index = 1) @ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称") @ApiModelProperty(value = "电站名称")
private String name; private String name;
......
...@@ -11,9 +11,9 @@ import lombok.Data; ...@@ -11,9 +11,9 @@ import lombok.Data;
*/ */
@Data @Data
public class YearGenerateEX { public class YearGenerateEX {
@ExcelProperty(value = "电站编号", index = 0) @ExcelProperty(value = "号", index = 0)
@ApiModelProperty(value = "电站编码") @ApiModelProperty(value = "序号")
private String code; private Integer index;
@ExcelProperty(value = "电站名称", index = 1) @ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称") @ApiModelProperty(value = "电站名称")
private String name; private String name;
......
...@@ -14,5 +14,5 @@ import java.util.List; ...@@ -14,5 +14,5 @@ import java.util.List;
*/ */
public interface IcbcWithholdMapper extends BaseMapper<IcbcWithhold> { 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> { ...@@ -37,8 +37,9 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<JpStation> getJpStationList(@Param("dto") JpStationDto reviewDto); List<JpStation> getJpStationList(@Param("dto") JpStationDto reviewDto);
@UserEmpower(field ={"ORG_CODE"} ,dealerField ={"ORG_CODE"}, fieldConditions ={"in","in"} ,relationship="and",specific=false) @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) @UserEmpower(field ={"ORG_CODE"} ,dealerField ={"ORG_CODE"}, fieldConditions ={"in","in"} ,relationship="and",specific=false)
List<DropDown> getRegionByProvince(@Param(value = "ids") List<String> ids); List<DropDown> getRegionByProvince(@Param(value = "ids") List<String> ids);
...@@ -100,4 +101,5 @@ public interface JpStationMapper extends BaseMapper<JpStation> { ...@@ -100,4 +101,5 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<Map<String, String>> queryUnitInfo(); List<Map<String, String>> queryUnitInfo();
} }
...@@ -257,8 +257,6 @@ public class SFTPUtil { ...@@ -257,8 +257,6 @@ public class SFTPUtil {
if (null != output) { if (null != output) {
output.close(); output.close();
} }
// 关闭连接
disconnect();
} catch (IOException e) { } catch (IOException e) {
logger.error("关闭文件时出错!"); logger.error("关闭文件时出错!");
logger.error(e.getMessage()); logger.error(e.getMessage());
...@@ -275,14 +273,57 @@ public class SFTPUtil { ...@@ -275,14 +273,57 @@ public class SFTPUtil {
* @param localZipPath 本地ZIP文件保存路径 * @param localZipPath 本地ZIP文件保存路径
* @return 是否成功 * @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; boolean success = false;
Path tempDir = null; Path tempDir = null;
try { try {
// 创建临时目录 // 创建临时目录
tempDir = Files.createTempDirectory("sftp_download_temp"); tempDir = Files.createTempDirectory("sftp_download_temp");
// 列出远程目录中的所有文件` // 列出远程目录中的所有文件
Vector<?> filesList = sftp.ls(remotePath); Vector<?> filesList = sftp.ls(remotePath);
List<Path> downloadedFiles = new ArrayList<>(); List<Path> downloadedFiles = new ArrayList<>();
...@@ -295,13 +336,24 @@ public class SFTPUtil { ...@@ -295,13 +336,24 @@ public class SFTPUtil {
downloadedFiles.add(localFilePath); downloadedFiles.add(localFilePath);
} }
} }
disconnect();
// 确保本地ZIP路径的父目录存在
Path localZipFilePath = Paths.get(localZipPath);
Path parentDir = localZipFilePath.getParent();
if (parentDir != null && !Files.exists(parentDir)) {
Files.createDirectories(parentDir);
}
// 打包下载的文件到ZIP文件 // 打包下载的文件到ZIP文件
FileUtils.createZipFile(downloadedFiles, localZipPath); FileUtils.createZipFile(downloadedFiles, localZipPath);
success = true; success = true;
logger.info("成功接收文件并打包到ZIP文件: " + localZipPath); logger.info("成功接收文件并打包到ZIP文件: " + localZipPath);
} catch (SftpException e) {
logger.error("下载文件时发生异常!", e);
} catch (IOException e) {
logger.error("处理文件或创建目录时发生异常!", e);
} catch (Exception e) { } catch (Exception e) {
logger.error("下载或打包文件时发生异常!", e); logger.error("其他异常!", e);
} finally { } finally {
try { try {
// 删除临时目录及其内容 // 删除临时目录及其内容
...@@ -317,8 +369,6 @@ public class SFTPUtil { ...@@ -317,8 +369,6 @@ public class SFTPUtil {
} }
return success; return success;
} }
/** /**
* 上传文件至远程sftp服务器 * 上传文件至远程sftp服务器
* *
...@@ -872,9 +922,11 @@ public class SFTPUtil { ...@@ -872,9 +922,11 @@ public class SFTPUtil {
if (!fileName.equals(".") && !fileName.equals("..")) { // 排除当前和上级目录条目 if (!fileName.equals(".") && !fileName.equals("..")) { // 排除当前和上级目录条目
String fileContentAsString = getFileContentAsString(remotePath, fileName); String fileContentAsString = getFileContentAsString(remotePath, fileName);
List<String> contents = Arrays.asList(fileContentAsString.split("\r\n")); List<String> contents = Arrays.asList(fileContentAsString.split("\r\n"));
for (String content : contents) { if (null != contents && contents.size() > 0) {
ResultLinkField resultLinkField = contentHandle(content); for (String content : contents) {
allJsonData.add(resultLinkField); ResultLinkField resultLinkField = contentHandle(content);
allJsonData.add(resultLinkField);
}
} }
} }
} }
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
<select id="exportTotal" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordExportDTO"> <select id="exportTotal" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordExportDTO">
SELECT SELECT
MAX(ph.owners_name) AS custName, MAX(ph.owners_name) AS custName,
MAX(ph.telephone) AS idCard, MAX(ph.telephone) AS phone,
MAX(ph.id_card) AS idCard, MAX(ph.id_card) AS idCard,
MAX(ph.regional_companies_name) AS regionalCompaniesName, MAX(ph.regional_companies_name) AS regionalCompaniesName,
MAX(re.medium_id) AS mediumId, MAX(re.medium_id) AS mediumId,
......
...@@ -19,11 +19,14 @@ ...@@ -19,11 +19,14 @@
<if test="uploadStatus != null and uploadStatus != ''"> <if test="uploadStatus != null and uploadStatus != ''">
and upload_status = #{uploadStatus} and upload_status = #{uploadStatus}
</if> </if>
<if test="withholdStatus != null and withholdStatus != ''">
and withhold_status = #{withholdStatus}
</if>
<if test="confirmator != null and confirmator != ''"> <if test="confirmator != null and confirmator != ''">
and confirmator like concat('%',#{confirmator},'%') and confirmator like concat('%',#{confirmator},'%')
</if> </if>
<if test="desc != null and desc != ''"> <if test="desc != null and desc != ''">
and uploader like concat('%',#{desc},'%') and content like concat('%',#{desc},'%')
</if> </if>
<if test="confirmationStartTime != null and confirmationStartTime != ''"> <if test="confirmationStartTime != null and confirmationStartTime != ''">
and confirmation_time > #{confirmationStartTime} and confirmation_time > #{confirmationStartTime}
......
...@@ -81,7 +81,8 @@ ...@@ -81,7 +81,8 @@
) ph ) ph
LEFT JOIN hygf_icbc_withhold_record re ON ph.amos_user_id = re.amos_user_id LEFT JOIN hygf_icbc_withhold_record re ON ph.amos_user_id = re.amos_user_id
<where> <where>
ph.is_delete = 0 ph.is_delete = 0 AND re.withhold_status in ('成功','失败')
<if test="developerCode != null and developerCode != ''"> <if test="developerCode != null and developerCode != ''">
AND ph.developer_code = #{developerCode} AND ph.developer_code = #{developerCode}
</if> </if>
...@@ -119,9 +120,8 @@ ...@@ -119,9 +120,8 @@
<if test="dto.amosUserId != null and dto.amosUserId != ''"> <if test="dto.amosUserId != null and dto.amosUserId != ''">
AND re.amos_user_id = #{dto.amosUserId} AND re.amos_user_id = #{dto.amosUserId}
</if> </if>
<if test="dto.batchNo != null and dto.batchNo != ''"> <if test="dto.batchNo != null and dto.batchNo != ''">
AND re.batch_no = #{dto.batchNo} AND re.batch_no like concat('%',#{dto.batchNo},'%')
</if> </if>
<if test="dto.withholdStatus != null and dto.withholdStatus != ''"> <if test="dto.withholdStatus != null and dto.withholdStatus != ''">
AND re.withhold_status = #{dto.withholdStatus} AND re.withhold_status = #{dto.withholdStatus}
......
...@@ -246,13 +246,27 @@ ...@@ -246,13 +246,27 @@
<select id="getRegion" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown"> <select id="getRegion" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown">
SELECT privilege_company.ORG_CODE orgCode, SELECT privilege_company.ORG_CODE orgCode,
privilege_company.COMPANY_NAME name privilege_company.COMPANY_NAME name,
privilege_company.ADDRESS address
FROM privilege_company FROM privilege_company
WHERE IS_DELETED = 0 WHERE IS_DELETED = 0
and privilege_company.COMPANY_TYPE = 'region' and privilege_company.COMPANY_TYPE = 'region'
<if test="regionName!=null and regionName!=''"> <if test="regionName!=null and regionName!=''">
and privilege_company.COMPANY_NAME like concat('%',#{regionName}, '%') and privilege_company.COMPANY_NAME like concat('%',#{regionName}, '%')
</if> </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>
<select id="getRegionNode" resultType="string"> <select id="getRegionNode" resultType="string">
...@@ -865,7 +879,7 @@ ...@@ -865,7 +879,7 @@
and (amos_company_code is not null and regional_companies_code is not null ) and (amos_company_code is not null and regional_companies_code is not null )
</if> </if>
</where> </where>
order by rec_date DESC order by sequence_nbr DESC
</select> </select>
<select id="queryUnitInfo" resultType="java.util.Map"> <select id="queryUnitInfo" resultType="java.util.Map">
......
...@@ -41,12 +41,10 @@ ...@@ -41,12 +41,10 @@
SELECT LOGIN_ID FROM auth_login_info login SELECT LOGIN_ID FROM auth_login_info login
WHERE WHERE
ID_TYPE = 'mobile' and IS_DELETED = '0' ID_TYPE = 'mobile' and IS_DELETED = '0'
<if test="">
and USER_ID in and USER_ID in
<foreach collection="userIds" item="item" separator="," open="(" close=")"> <foreach collection="userIds" item="item" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
</if>
</select> </select>
</mapper> </mapper>
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSONArray; 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.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordDTO; 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.IcbcWithhold;
import com.yeejoin.amos.boot.module.hygf.api.entity.IcbcWithholdRecord;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil; import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -48,7 +51,7 @@ public class IcbcWithholdController extends BaseController { ...@@ -48,7 +51,7 @@ public class IcbcWithholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增 聚富通代扣信息表", notes = "新增 聚富通代扣信息表") @ApiOperation(httpMethod = "POST", value = "新增 聚富通代扣信息表", notes = "新增 聚富通代扣信息表")
public ResponseModel save(@RequestBody IcbcWithhold model) { public ResponseModel save(@RequestBody IcbcWithhold model) throws Exception {
icbcWithholdServiceImpl.saveRecord(model); icbcWithholdServiceImpl.saveRecord(model);
return CommonResponseNewUtil.success(); return CommonResponseNewUtil.success();
} }
...@@ -115,9 +118,10 @@ public class IcbcWithholdController extends BaseController { ...@@ -115,9 +118,10 @@ public class IcbcWithholdController extends BaseController {
@RequestParam(value = "confirmator",required = false) String confirmator, @RequestParam(value = "confirmator",required = false) String confirmator,
@RequestParam(value = "confirmationStartTime",required = false) String confirmationStartTime, @RequestParam(value = "confirmationStartTime",required = false) String confirmationStartTime,
@RequestParam(value = "confirmationEndTime",required = false) String confirmationEndTime, @RequestParam(value = "confirmationEndTime",required = false) String confirmationEndTime,
@RequestParam(value = "withholdStatus",required = false) String withholdStatus,
@RequestParam(value = "desc",required = false) String desc) { @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 { ...@@ -180,7 +184,7 @@ public class IcbcWithholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = " 聚富通代扣信息回盘文件获取", notes = " 聚富通代扣信息回盘文件获取") @ApiOperation(httpMethod = "GET",value = " 聚富通代扣信息回盘文件获取", notes = " 聚富通代扣信息回盘文件获取")
@GetMapping(value = "/downLoadicbcFile") @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); icbcWithholdServiceImpl.downLoadicbcFile(batchNo,sequenceNbr,response);
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
......
...@@ -288,7 +288,7 @@ public class JpInverterController extends BaseController { ...@@ -288,7 +288,7 @@ public class JpInverterController extends BaseController {
dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM-dd")); dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM-dd"));
} }
//List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null; //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 { try {
setResponseHeadForDowload(response,"逆变器日报表.xls"); setResponseHeadForDowload(response,"逆变器日报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates); EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates);
...@@ -322,7 +322,7 @@ public class JpInverterController extends BaseController { ...@@ -322,7 +322,7 @@ public class JpInverterController extends BaseController {
dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM")); dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM"));
} }
// List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null; // 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 { try {
setResponseHeadForDowload(response,"逆变器月报表.xls"); setResponseHeadForDowload(response,"逆变器月报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterMonthGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器月报表").doWrite(tdHYGFInverterMonthGenerates); EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterMonthGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器月报表").doWrite(tdHYGFInverterMonthGenerates);
...@@ -357,7 +357,7 @@ public class JpInverterController extends BaseController { ...@@ -357,7 +357,7 @@ public class JpInverterController extends BaseController {
dataDto.setTime(DateUtil.format(new Date(),"yyyy")); dataDto.setTime(DateUtil.format(new Date(),"yyyy"));
} }
// List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null; // 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 { try {
setResponseHeadForDowload(response,"逆变器年报表.xls"); setResponseHeadForDowload(response,"逆变器年报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterYearGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器年报表").doWrite(tdHYGFInverterYearGenerates); 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; ...@@ -2,12 +2,14 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; 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.DealerRestrict;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits; 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.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.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics; import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics;
import com.yeejoin.amos.boot.module.hygf.api.entity.*; import com.yeejoin.amos.boot.module.hygf.api.entity.*;
...@@ -27,6 +29,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -27,6 +29,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.security.Key;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -426,19 +429,36 @@ public class JpStationController extends BaseController { ...@@ -426,19 +429,36 @@ public class JpStationController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司") @ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司")
@GetMapping(value = "/getRegion") @GetMapping(value = "/getRegion")
@UserLimits @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<Map<String, String>> result = new ArrayList<>();
list.forEach(dropDown -> { list.forEach(dropDown -> {
Map<String, String> item = new HashMap<>(); Map<String, String> item = new HashMap<>();
item.put("text", dropDown.getName()); item.put("text", dropDown.getName());
item.put("value", dropDown.getOrgCode()); item.put("value", dropDown.getOrgCode());
item.put("address", dropDown.getAddress());
result.add(item); result.add(item);
}); });
return ResponseHelper.buildResponse(result); 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) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司") @ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司")
...@@ -845,6 +865,14 @@ public class JpStationController extends BaseController { ...@@ -845,6 +865,14 @@ public class JpStationController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @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") @PostMapping(value = "/queryStation")
@ApiOperation(httpMethod = "POST", value = "查询场站", notes = "查询场站") @ApiOperation(httpMethod = "POST", value = "查询场站", notes = "查询场站")
public ResponseModel<?> queryStation(@RequestBody JpStationDto reviewDto) { public ResponseModel<?> queryStation(@RequestBody JpStationDto reviewDto) {
...@@ -919,7 +947,7 @@ public class JpStationController extends BaseController { ...@@ -919,7 +947,7 @@ public class JpStationController extends BaseController {
@UserLimits @UserLimits
public ResponseModel<List<Map<String, Object>>> getRegionStatistics(@RequestParam(required = false) String regionName) { 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<>(); List<Map<String, Object>> result = new ArrayList<>();
......
...@@ -2,8 +2,10 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller; ...@@ -2,8 +2,10 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; 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.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PeasantHouseholdEnum; import com.yeejoin.amos.boot.module.hygf.api.Enum.PeasantHouseholdEnum;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower; import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
...@@ -13,7 +15,9 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationEngineeringInfoAllD ...@@ -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.SurveyInformationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto; 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.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.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.PeasantHouseholdServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
...@@ -164,6 +168,20 @@ public class PeasantHouseholdController extends BaseController { ...@@ -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删除 * 根据sequenceNbr删除
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
......
...@@ -209,6 +209,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -209,6 +209,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime()); Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime());
tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN)); tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN));
tdHYGFInverterDayGenerate.setTotalGen(tdHYGFInverterDayGenerate.getTotalGen() == null ? 0:Double.valueOf(String.format("%.3f",tdHYGFInverterDayGenerate.getTotalGen()/1000))); 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())); tdHYGFInverterDayGenerate.setRegionalCompaniesName(regionalCompaniesNameMap.get(tdHYGFInverterDayGenerate.getRegionalCompaniesCode()));
}); });
...@@ -246,26 +247,56 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -246,26 +247,56 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
// return tdHYGFInverterDayGeneratePage; // return tdHYGFInverterDayGeneratePage;
} }
@UserLimits @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(); Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
Date date = DateUtil.parse(time, "yyyy-MM-dd"); CharSequence time1 = time + " 00:00:00";
String startTime = DateUtil.format(date, "yyyy-MM-dd") + "00:00:00"; CharSequence time2 = time + " 23:59:59";
String endTime = DateUtil.format(date, "yyyy-MM-dd") + "23:59:59"; DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>() String startTime = DateUtil.format(LocalDateTime.parse(time1,df), "yyyy-MM-dd HH:mm:ss");
.ge("created_time", startTime) String endTime = DateUtil.format(LocalDateTime.parse(time2,df), "yyyy-MM-dd HH:mm:ss");
.le("created_time", endTime);
// .in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) { // QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>()
queryWrapper.in("sn_code", sncodes); // .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); List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectListPage(snCodeList, null, startTime, endTime,regionalCompaniesCode, name);
queryWrapper.orderByDesc("created_time");
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper);
tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> { tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> {
Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime()); Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime());
tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN)); tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN));
tdHYGFInverterDayGenerate.setTotalGen(tdHYGFInverterDayGenerate.getTotalGen() == null ? 0:Double.valueOf(String.format("%.3f",tdHYGFInverterDayGenerate.getTotalGen()/1000))); tdHYGFInverterDayGenerate.setTotalGen(tdHYGFInverterDayGenerate.getTotalGen() == null ? 0:Double.valueOf(String.format("%.3f",tdHYGFInverterDayGenerate.getTotalGen()/1000)));
tdHYGFInverterDayGenerate.setRegionalCompaniesName(regionalCompaniesNameMap.get(tdHYGFInverterDayGenerate.getRegionalCompaniesCode())); tdHYGFInverterDayGenerate.setRegionalCompaniesName(regionalCompaniesNameMap.get(tdHYGFInverterDayGenerate.getRegionalCompaniesCode()));
tdHYGFInverterDayGenerate.setTotalPower(tdHYGFInverterDayGenerate.getTotalPower() == null ? 0:Double.valueOf(String.format("%.3f",tdHYGFInverterDayGenerate.getTotalPower())));
}); });
return tdHYGFInverterDayGenerates; return tdHYGFInverterDayGenerates;
} }
...@@ -324,15 +355,20 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -324,15 +355,20 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
//// return tdHYGFInverterMonthGeneratePage; //// return tdHYGFInverterMonthGeneratePage;
} }
@UserLimits @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(); Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterMonthGenerate>() QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterMonthGenerate>()
.eq("year_month", time); .eq("year_month", time);
// .in("third_station_id", stationIds); // .in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) { if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes); queryWrapper.in("sn_code", sncodes);
} }
if (StringUtils.isNotEmpty(name)) {
queryWrapper.like("name", "%" + name + "%");
}
queryWrapper.eq(!StringUtils.isEmpty(regionalCompaniesCode),"regional_companies_code",regionalCompaniesCode); queryWrapper.eq(!StringUtils.isEmpty(regionalCompaniesCode),"regional_companies_code",regionalCompaniesCode);
queryWrapper.orderByDesc("day_time"); queryWrapper.orderByDesc("day_time");
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates = tdHYGFInverterMonthGenerateMapper.selectList(queryWrapper); List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates = tdHYGFInverterMonthGenerateMapper.selectList(queryWrapper);
tdHYGFInverterMonthGenerates.forEach(tdHYGFInverterMonthGenerate -> { tdHYGFInverterMonthGenerates.forEach(tdHYGFInverterMonthGenerate -> {
...@@ -390,7 +426,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -390,7 +426,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
// return tdHYGFInverterYearGeneratePage; // return tdHYGFInverterYearGeneratePage;
} }
@UserLimits @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(); Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterYearGenerate>() QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterYearGenerate>()
.eq("year", time); .eq("year", time);
...@@ -398,11 +434,15 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -398,11 +434,15 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
if (CollectionUtil.isNotEmpty(sncodes)) { if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes); queryWrapper.in("sn_code", sncodes);
} }
if (StringUtils.isNotEmpty(name)) {
queryWrapper.like("name", "%" + name + "%");
}
queryWrapper.eq(!StringUtils.isEmpty(regionalCompaniesCode),"regional_companies_code",regionalCompaniesCode); queryWrapper.eq(!StringUtils.isEmpty(regionalCompaniesCode),"regional_companies_code",regionalCompaniesCode);
queryWrapper.orderByDesc("month_time"); queryWrapper.orderByDesc("month_time");
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates = tdHYGFInverterYearGenerateMapper.selectList(queryWrapper); List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates = tdHYGFInverterYearGenerateMapper.selectList(queryWrapper);
tdHYGFInverterYearGenerates.forEach(tdHYGFInverterYearGenerate -> { tdHYGFInverterYearGenerates.forEach(tdHYGFInverterYearGenerate -> {
tdHYGFInverterYearGenerate.setFullhour(tdHYGFInverterYearGenerate.getFullhour()!=null?Double.valueOf(String.format("%.2f",tdHYGFInverterYearGenerate.getFullhour())):null); 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())); tdHYGFInverterYearGenerate.setRegionalCompaniesName(regionalCompaniesNameMap.get(tdHYGFInverterYearGenerate.getRegionalCompaniesCode()));
}); });
return tdHYGFInverterYearGenerates; return tdHYGFInverterYearGenerates;
......
...@@ -5,9 +5,11 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -5,9 +5,11 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.BooleanUtil; import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
...@@ -27,6 +29,8 @@ import com.yeejoin.amos.component.robot.AmosRequestContext; ...@@ -27,6 +29,8 @@ import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.*; import com.yeejoin.amos.feign.privilege.model.*;
import com.yeejoin.amos.feign.privilege.util.DesUtil; 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 lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -56,7 +60,10 @@ import java.util.stream.Collectors; ...@@ -56,7 +60,10 @@ import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto,PeasantHousehold,PeasantHouseholdMapper> implements IPeasantHouseholdService { 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"; public static final String SECRETKEY = "qaz";
@Autowired @Autowired
SurveyInformationServiceImpl surveyInformationService; SurveyInformationServiceImpl surveyInformationService;
...@@ -92,6 +99,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto ...@@ -92,6 +99,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
ToDoTasksServiceImpl toDoTasksServiceImpl; ToDoTasksServiceImpl toDoTasksServiceImpl;
@Autowired @Autowired
RegionalCompaniesMapper regionalCompaniesMapper; RegionalCompaniesMapper regionalCompaniesMapper;
@Autowired
PowerStationServiceImpl powerStationService;
private Long TOKEN_TIME = 1209600l; private Long TOKEN_TIME = 1209600l;
// @Autowired // @Autowired
// CommonServiceImpl commonService; // CommonServiceImpl commonService;
...@@ -136,8 +145,6 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto ...@@ -136,8 +145,6 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Value("${farmer.registerPassword}") @Value("${farmer.registerPassword}")
private String registerPassword; private String registerPassword;
@Autowired
private RedisUtils redisUtils;
@Autowired @Autowired
private IWxService wxService; private IWxService wxService;
...@@ -263,6 +270,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto ...@@ -263,6 +270,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
return code; return code;
} }
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -1044,6 +1053,84 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto ...@@ -1044,6 +1053,84 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
return peasantHouseholdIPage; 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) { // public void saveHistoryPeasantHousehold(PowerStationEngineeringInfoAllDto surveyInfoAllDto,String operationType) {
// //
// SurveyInformationDto model = surveyInfoAllDto.getSurveyInformation(); // SurveyInformationDto model = surveyInfoAllDto.getSurveyInformation();
......
...@@ -189,7 +189,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R ...@@ -189,7 +189,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
try { try {
Systemctl.smsClient.sendCommonSms(params).getResult(); Systemctl.smsClient.sendCommonSms(params).getResult();
} catch (Exception e) { } 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 ...@@ -241,7 +241,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
public void importRepaymentExcel(MultipartFile file) { public void importRepaymentExcel(MultipartFile file) {
//获取当前用户权限的公司 //获取当前用户权限的公司
try { try {
List<DropDown> region = jpStationMapper.getRegion(null); List<DropDown> region = jpStationMapper.getRegion(null, null);
if (CollectionUtil.isEmpty(region)) { if (CollectionUtil.isEmpty(region)) {
throw new BadRequest("该用户没有公司"); throw new BadRequest("该用户没有公司");
} }
......
...@@ -295,6 +295,7 @@ public class SurveyInformationServiceImpl ...@@ -295,6 +295,7 @@ public class SurveyInformationServiceImpl
peasantHousehold peasantHousehold
.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1)); .setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
if (OPERATION_TYPE_SUBMIT.equals(operationType)) { if (OPERATION_TYPE_SUBMIT.equals(operationType)) {
// peasantHousehold.setSurveyOrNot(1); // peasantHousehold.setSurveyOrNot(1);
} else if (OPERATION_TYPE_APPLY.equals(operationType)) { } else if (OPERATION_TYPE_APPLY.equals(operationType)) {
......
...@@ -88,6 +88,7 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto, ToDoTasks, T ...@@ -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.getType()), "type", dto.getType());
qw.eq(StringUtils.isNotEmpty(dto.getState()), "state", dto.getState()); 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.getAmosUserId()), "amos_user_id", "%"+dto.getAmosUserId()+"%");
qw.like(StringUtils.isNotEmpty(dto.getTaskName()), "task_name", "%"+dto.getTaskName()+"%");
qw.orderBy(Boolean.TRUE, Boolean.FALSE, "creation_time"); qw.orderBy(Boolean.TRUE, Boolean.FALSE, "creation_time");
IPage<ToDoTasks> toDoTasksPage = toDoTasksMapper.selectPage(dto, qw); IPage<ToDoTasks> toDoTasksPage = toDoTasksMapper.selectPage(dto, qw);
......
...@@ -48,6 +48,7 @@ public class UserMessageServiceImpl extends BaseService<UserMessageDto,UserMessa ...@@ -48,6 +48,7 @@ public class UserMessageServiceImpl extends BaseService<UserMessageDto,UserMessa
QueryWrapper<UserMessage> qw = new QueryWrapper<>(); QueryWrapper<UserMessage> qw = new QueryWrapper<>();
qw.eq(StringUtils.isNotEmpty(dto.getType()), "type",dto.getType() ); 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.getAmosUserId()), "amos_user_id","%"+dto.getAmosUserId()+"%" );
qw.like(StringUtils.isNotEmpty(dto.getTaskName()), "task_name","%"+dto.getTaskName()+"%" );
qw.orderBy(Boolean.TRUE, Boolean.FALSE, "creation_time"); qw.orderBy(Boolean.TRUE, Boolean.FALSE, "creation_time");
IPage<UserMessage> toDoTasksPage = userMessageMapper.selectPage(dto, qw); IPage<UserMessage> toDoTasksPage = userMessageMapper.selectPage(dto, qw);
return toDoTasksPage; return toDoTasksPage;
......
...@@ -580,8 +580,14 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W ...@@ -580,8 +580,14 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
String routhPath = toDoTasksService.getRouthPath(TaskTypeStationEnum.施工.getCode(),workflowResultDto.getNextNodeKey(), routhPathVO); String routhPath = toDoTasksService.getRouthPath(TaskTypeStationEnum.施工.getCode(),workflowResultDto.getNextNodeKey(), routhPathVO);
String wxRouthPath = toDoTasksService.getWxRouthPath(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); 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;
List<String> filterUsers = toDoTasksService.filterUsers(TaskTypeStationEnum.施工.getCode(), workflowResultDto.getNextNodeKey(),userIds, regionalCompaniesCode, amosDealerOrgCode); 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,""); 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