Commit 7c4b2462 authored by 朱晨阳's avatar 朱晨阳

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

parents 8ce5a5e7 696eb39f
......@@ -189,6 +189,30 @@ public class DateUtils {
}
/**
* 时间格式字符串化成标准字符串 2024-05-23T14:19:05.432 => 2024-05-23 14:19:05
*
* @param dateString Date
* @return
* @throws ParseException
*/
public static Object dateStringFormat(Object dateString){
if(Objects.isNull(dateString)){
return null;
}
try {
// 转换为 LocalDateTime
LocalDateTime localDateTime = LocalDateTime.parse(String.valueOf(dateString));
// 转换为 Date
Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_PATTERN);
return sdf.format(date);
}catch (Exception e){
return dateString;
}
}
/**
* 暂时不操作原生截取做下转换
*
* @param str
......
......@@ -16,7 +16,7 @@ public enum CommonEnum {
经销商代建("经销商代建","fzx","电站类型"),
平顶屋("平顶屋","pdw","屋顶类型"),
斜顶屋("斜顶屋","xdw","屋顶类型"),
庭院("ty","other","屋顶类型"),
庭院("庭院","ty","屋顶类型"),
别墅("别墅","bs","房屋整体情况"),
普通民房("普通民房","pymf","房屋整体情况"),
单门独院("单门独院","dmdy","房屋整体情况"),
......@@ -62,6 +62,8 @@ public enum CommonEnum {
SMC("SMC","smc","材质"),
不锈钢("不锈钢","bxg","材质"),
钢板喷塑("钢板喷塑","gbps","材质"),
单面("单面","dm","组件类型"),
双面("双面","sm","组件类型"),
其他("其他","other","公用");
/**
......@@ -80,7 +82,7 @@ public enum CommonEnum {
public static String getNameByCode(String code) {
String name = null;
String name = "";
for(CommonEnum obj: CommonEnum.values()) {
if (obj.getCode().equals(code)) {
name = obj.getName();
......
package com.yeejoin.amos.boot.module.hygf.api.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.StringUtils;
import java.util.List;
@Getter
@AllArgsConstructor
public enum StatisicsHomePageEnum {
序号("xh",0),
省份("sf",1),
项目公司("regionalCompaniesName",2),
代理商("developerName",3),
实际建设容量("realScale",4),
未勘察("wkc",5),
勘察未通过("kcwtg",6),
勘察未通过容量("kcwtgrl",7),
勘察进行中("kcjxz",8),
勘察进行中容量("kcjxzrl",9),
勘察已完成("kcywc",10),
勘察已完成容量("kcywcrl",11),
备货未通过("bhwtg",12),
备货未通过容量("bhwtgrl",13),
备货进行中("bhjxz",14),
备货进行中容量("bhjxzrl",15),
备货已完成("bhywc",16),
备货已完成容量("bhywcrl",17),
施工未通过("sgwtg",18),
施工未通过容量("sgwtgrl",19),
施工进行中("sgjxz",20),
施工进行中容量("sgjxzrl",21),
施工已完成("sgywc",22),
施工已完成容量("sgywcrl",23),
并网未通过("bwwtg",24),
并网未通过容量("bwwtgrl",25),
并网进行中("bwjxz",26),
并网进行中容量("bwjxzrl",27),
并网已完成("bwywc",28),
并网已完成容量("bwywcrl",29),
验收未通过("yswtg",30),
验收未通过容量("yswtgrl",31),
验收进行中("ysjxz",32),
验收进行中容量("ysjxzrl",33),
验收已完成("ysywc",34),
验收已完成容量("ysywcrl",35),
融资公司("rzgs",36),
融资户数("rzhs",37),
融资容量("rzrl",38),
融资单价("rzdj",39),
放款金额("fkje",40);
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private int code;
public static Integer getCodeByName(String name) {
for(StatisicsHomePageEnum obj: StatisicsHomePageEnum.values()) {
if (obj.getName().equals(name)) {
return obj.getCode();
}
}
return null;
}
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
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;
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "BusinessFieldDto", description = "业务字段Dto")
public class BusinessFieldDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "字段名称")
private String fieldName;
@ApiModelProperty(value = "字段标识")
private String fieldFlag;
@ApiModelProperty(value = "业务类型")
private String businessType;
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.support.spring.annotation.FastJsonFilter;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import io.swagger.annotations.ApiModel;
......@@ -68,6 +69,7 @@ public class FinancingInfoDto extends BaseDto {
@ApiModelProperty(value = "单价")
private String unitPrice;
@ApiModelProperty(value = "投融创建时间")
private Date trCreateTime;
List<PeasantHousehold> peasantHouseholds;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
@ApiModel("电站时间批量处理Dto")
public class PowerStationTimeStatisticsBatchDto {
@ApiModelProperty("主键Id")
private List<String> sequenceNbrList;
@ApiModelProperty("过滤字段")
private Map<String, Object> filters;
}
......@@ -102,4 +102,13 @@ public class PowerStationTimeStatisticsDto implements Serializable {
@ApiModelProperty(value = "验收停留时间")
private String ysStopTime;
@ApiModelProperty(value = "投融开始时间")
private Date trCreateTime;
@ApiModelProperty(value = "投融结束时间")
private Date trEndTime;
@ApiModelProperty(value = "投融停留时间")
private String trStopTime;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.yeejoin.amos.boot.module.hygf.api.entity.HygfBusinessField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
@ApiModel(value = "StationFieldDto", description = "电站字段Dto")
public class StationFieldDto {
@ApiModelProperty(value = "电站ID")
private List<String> stationIdList;
@ApiModelProperty(value = "业务字段主键")
private List<String> businessIdList;
@ApiModelProperty(value = "业务字段")
private List<HygfBusinessField> businessFieldList;
@ApiModelProperty(value = "导出页面Code")
private String exportPageCode;
@ApiModelProperty(value = "过滤条件")
private Map<String, Object> filters;
}
......@@ -82,4 +82,16 @@ public class FinancingInfo extends BaseEntity {
*/
@TableField("unit_price")
private String unitPrice;
/**
* 投融创建时间
*/
@TableField("tr_create_time")
private Date trCreateTime;
/**
* 投融创建时间
*/
@TableField("tr_end_time")
private Date trEndTime;
}
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode()
@Accessors(chain = true)
@TableName("hygf_business_field")
public class HygfBusinessField extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 字段名称
*/
@TableField("field_name")
private String fieldName;
/**
* 字段标识
*/
@TableField("field_flag")
private String fieldFlag;
/**
* 业务类型
*/
@TableField("business_type")
private String businessType;
/**
* 业务名称
*/
@TableField("business_name")
private String businessName;
}
package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.dto.BasicGridRecordDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.WorkOrderPage;
import com.yeejoin.amos.boot.module.hygf.api.entity.HygfBusinessField;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface BusinessFieldMapper extends BaseMapper<HygfBusinessField> {
/**
* 获取电站的电站Id
* @return
*/
@UserEmpower(field = {"hph.regional_companies_code"}, dealerField = {"hph.regional_companies_code"}, fieldConditions = {"in"}, relationship = "and")
List<String> getDzStationIdByProcessStatus(@Param("map") Map<String, Object> map);
/**
* 获取投融的电站Id
* @return
*/
@UserEmpower(field = {"sta.regional_companies_code"},dealerField = {"sta.developer_code","sta.regional_companies_code"},fieldConditions = {"eq","in"},relationship = {"and"})
List<String> getTrStationIdByStatus(@Param(value = "params") Map<String,Object> params,@Param(value = "amosOrgCodes")List<String> amosOrgCodes);
/**
* 获取施工验收场站Id
* @param map
* @return
*/
@UserEmpower(field = {"region_code"}, dealerField = {"hygf_work_order.amos_dealer_org_code","hygf_work_order.region_code","hygf_peasant_household.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and")
List<String> getSgysStationId(@Param("dto") Map<String, Object> map);
/**
* 获取并网验收场站Id
* @param map
* @return
*/
@UserEmpower(field ={"hph.regional_companies_code"} ,dealerField={"hph.developer_code","hph.regional_companies_code","hph.developer_user_id"},fieldConditions ={"in","in","in"} ,relationship="and")
List<String> getBwysStationId(@Param("map") Map<String, Object> map);
/**
* 获取验收审核场站Id
* @param map
* @return
*/
@UserEmpower(field ={"hph.regional_companies_code"} ,dealerField={"hph.developer_code","hph.regional_companies_code","hph.developer_user_id"},fieldConditions ={"in","in","in"} ,relationship="and")
List<String> getYsshStationId(@Param("map") Map<String, Object> map);
/**
* 获取发货场站
* @param map
* @return
*/
@UserEmpower(field ={"regional_companies_code"} ,dealerField={"developer_code","regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
List<String> getFhStationId (@Param("map") Map<String, Object> map);
/**
* 获取基本信息
* @param stationIdList
* @return
*/
List<Map<String, Object>> getBasicInformation(@Param("list") List<String> stationIdList);
/**
* 获取勘察信息
* @param stationIdList
* @return
*/
List<Map<String, Object>> getSurveyInformation(@Param("list") List<String> stationIdList);
/**
* 获取设计信息
* @param stationIdList
* @return
*/
List<Map<String, Object>> getDesignInformation(@Param("list") List<String> stationIdList);
/**
* 获取商务信息
* @param stationIdList
* @return
*/
List<Map<String, Object>> getBusinessInformation(@Param("list") List<String> stationIdList);
/**
* 获取扩展信息
* @param stationIdList
* @return
*/
List<Map<String, Object>> getExtendedInformation(@Param("list") List<String> stationIdList);
/**
* 获取资料归档信息
* @param stationIdList
* @return
*/
List<Map<String, Object>> getArchivingInformation(@Param("list") List<String> stationIdList);
/**
* 获取工程信息
* @param stationIdList
* @return
*/
List<Map<String, Object>> getEngineeringInformation(@Param("list") List<String> stationIdList);
/**
* 获取并网信息
* @param stationIdList
* @return
*/
List<Map<String, Object>> getGridInformation(@Param("list") List<String> stationIdList);
/**
* 获取派工单信息
* @param stationIdList
* @return
*/
List<Map<String, Object>> getDispatchOrderInformation(@Param("list") List<String> stationIdList);
}
......@@ -35,4 +35,8 @@ public interface FinancingInfoMapper extends BaseMapper<FinancingInfo> {
List<Map<String,Object>> selectRegionByParentCode(String parentCode, String level);
List<Map<String, Object>> getTrCreateTime();
List<Map<String, Object>> getTrEndTime();
}
......@@ -45,6 +45,8 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<String> getRegionNode(String province);
List<String> getRegionNodeByCode(String code);
List<DropDown> getRegionAll();
@UserEmpower(field ={"hygf_regional_companies.regional_companies_code"} ,dealerField ={"hygf_unit_info.amos_company_code","hygf_regional_companies.regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
......
......@@ -73,10 +73,11 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> {
/**
* 获取所有电站详情
* @param map
* @return
*/
@UserEmpower(field = {"hph.regional_companies_code"}, dealerField = {"hph.regional_companies_code"}, fieldConditions = {"in"}, relationship = "and")
List<PowerStationTimeStatisticsDto> getAllPowerStationTimeDetail();
List<PowerStationTimeStatisticsDto> getAllPowerStationTimeDetail(@Param("map")Map<String, Object> map);
List<PowerStationTimeStatisticsDto> getKcTime(@Param("list") List<Long> peasantHouseholdIdList);
......@@ -92,5 +93,7 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> {
List<PowerStationTimeStatisticsDto> getYsTime(@Param("list") List<Long> peasantHouseholdIdList);
List<PowerStationTimeStatisticsDto> getTrTime(@Param("list") List<Long> peasantHouseholdIdList);
// String getHygfCommercialScale(Long surveyInformationId);
}
package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
public interface StatisticsHomepageMapper {
@UserEmpower(field ={"ph.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> surveyStatusTotal(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"hygf_peasant_household.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public int selectWKC(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"ph.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> homePageExport(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"b.regionalCompaniesCode"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> merCount(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"ph.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> contractStatusTotal(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"hygf_peasant_household.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> desionTotal(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"hygf_peasant_household.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> preparationMoneyTotal(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"hygf_peasant_household.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> workOrderTotal(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"hygf_peasant_household.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> gridStatusTotal(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"hygf_peasant_household.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> acceptanceStatusTotal(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"hph.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> financingStatusTotal(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district);
@UserEmpower(field ={"hygf_peasant_household.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> inverterTotal(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district, @RequestParam(value = "regions")List<String> regions);
@UserEmpower(field ={"jp.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> inverterTotalJp(@RequestParam(value = "developerCode") String developerCode, @RequestParam(value = "regionalCompaniesCode")String regionalCompaniesCode, @RequestParam(value = "province")String province, @RequestParam(value = "city") String city, @RequestParam(value = "district")String district, @RequestParam(value = "regions")List<String> regions);
@UserEmpower(field ={"hygf_peasant_household.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public Map<String,Object> stationNum(String developerCode, String regionalCompaniesCode, String province, String city, String district);
@UserEmpower(field ={"ph.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public Map<String,Object> statisticsPowerStation(String developerCode, String regionalCompaniesCode, String province, String city, String district);
@UserEmpower(field ={"hygf_peasant_household.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public Map<String,Object> statisticsPreparationMoney(String developerCode, String regionalCompaniesCode, String province, String city, String district);
public String selectProvince (String regionSeq);
@UserEmpower(field ={"hygf_repayment.regional_companies_code"},dealerField ={"hygf_peasant_household.developer_code"} ,fieldConditions ={"eq"} ,relationship="and")
public List<Map<String,Object>> getRent (@RequestParam(value = "regionalCompaniesCode") String regionalCompaniesCode, @RequestParam(value = "regions")List<String> regions);
}
package com.yeejoin.amos.boot.module.hygf.api.service;
public interface IBusinessFieldService {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper">
<select id="getDzStationIdByProcessStatus" resultType="java.lang.String">
select
hps.peasant_household_id
from hygf_power_station hps
left join hygf_peasant_household hph ON hph.sequence_nbr = hps.peasant_household_id
where hps.is_delete=0
<if test="map.powerStationCode!=null and map.powerStationCode!=''">
and hps.power_station_code like concat(concat('%',#{map.powerStationCode}),'%')
</if>
<if test="map.ownersName!=null and map.ownersName!=''">
and hps.owners_name like concat(concat('%',#{map.ownersName}),'%')
</if>
<if test="map.serviceAgent!=null and map.serviceAgent!=''">
and hps.service_agent like concat(concat('%',#{map.serviceAgent}),'%')
</if>
<if test="map.regionalCompaniesName!=null and map.regionalCompaniesName!=''">
and hph.regional_companies_name like concat(concat('%',#{map.regionalCompaniesName}),'%')
</if>
<if test="map.processStatus != null and map.processStatus != ''">
and hps.process_status = #{map.processStatus}
</if>
<if test="map.province != null and map.province != ''">
and hph.project_address like concat(concat('%',#{map.province}),'%')
</if>
GROUP BY hps.peasant_household_id
ORDER BY hps.rec_date desc
</select>
<select id="getBasicInformation" resultType="java.util.Map">
SELECT
hsi.*,hph.id_card,hph.peasant_household_no,hph.owners_name,hph.telephone,hph.project_address_name,hph.project_address_detail,hph.permanent_address_name,hph.permanent_address_detail,hph.sequence_nbr AS stationId
FROM
hygf_survey_information hsi
LEFT JOIN hygf_peasant_household hph ON hph.survey_information_id=hsi.sequence_nbr
<where>
<if test="list != null and list.size()>0">
AND hph.sequence_nbr IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getSurveyInformation" resultType="java.util.Map">
SELECT
hsd.*,hph.sequence_nbr AS stationId
FROM
hygf_survey_details hsd
LEFT JOIN hygf_peasant_household hph ON hph.survey_information_id=hsd.survey_information_id
<where>
<if test="list != null and list.size()>0">
AND hph.sequence_nbr IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getDesignInformation" resultType="java.util.Map">
SELECT
hdi.*,hdi.peasant_household_id AS stationId
FROM
hygf_design_information hdi
<where>
<if test="list != null and list.size()>0">
AND hdi.peasant_household_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getBusinessInformation" resultType="java.util.Map">
SELECT
hc.*,hph.sequence_nbr AS stationId
FROM
hygf_commercial hc
LEFT JOIN hygf_peasant_household hph ON hph.survey_information_id=hc.survey_information_id
<where>
<if test="list != null and list.size()>0">
AND hph.sequence_nbr IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getExtendedInformation" resultType="java.util.Map">
SELECT
hei.*,hph.sequence_nbr AS stationId
FROM
hygf_extended_information hei
LEFT JOIN hygf_peasant_household hph ON hph.survey_information_id=hei.survey_information_id
<where>
<if test="list != null and list.size()>0">
AND hph.sequence_nbr IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getArchivingInformation" resultType="java.util.Map">
SELECT
hi.*,hph.sequence_nbr AS stationId
FROM
hygf_information hi
LEFT JOIN hygf_peasant_household hph ON hph.survey_information_id=hi.survey_information_id
<where>
<if test="list != null and list.size()>0">
AND hph.sequence_nbr IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getEngineeringInformation" resultType="java.util.Map">
SELECT
hpsei.*,hwops.peasant_household_id AS stationId,hpsc.construction_component_info,hpsc.construction_inverter_info,hpsc.construction_collector_box_info,hpsc.construction_grid_box_info
FROM
hygf_power_station_engineering_info hpsei
LEFT JOIN hygf_work_order_power_station hwops ON hwops.sequence_nbr=hpsei.work_order_power_station_id
LEFT JOIN hygf_power_station_construction_data hpsc on hpsc.work_order_power_station_id=hpsei.work_order_power_station_id
<where>
<if test="list != null and list.size()>0">
AND hwops.peasant_household_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getGridInformation" resultType="java.util.Map">
SELECT
hogaa.*,hogaa.peasant_household_id AS stationId
FROM
hygf_on_grid_and_acceptance hogaa
<where>
<if test="list != null and list.size()>0">
AND hogaa.peasant_household_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getDispatchOrderInformation" resultType="java.util.Map">
SELECT
hwo.*,hwops.peasant_household_id AS stationId
FROM
hygf_work_order hwo
LEFT JOIN hygf_work_order_power_station hwops ON hwo.sequence_nbr=hwops.work_order_id
<where>
<if test="list != null and list.size()>0">
AND hwops.peasant_household_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getTrStationIdByStatus" resultType="java.lang.String">
SELECT sta.sequenceNbr FROM (SELECT
hph.sequence_nbr AS sequenceNbr,
hph.peasant_household_no peasantHouseholdNo,
hph.owners_name AS ownersName,
concat(hph.project_address_name,project_address_detail) AS projectAddress,
hph.regional_companies_name AS regionalCompaniesName,
IFNULL( info.`status`, '待推送' ) AS status,
hygf_unit_info.head_name responsibleUserName,
hygf_unit_info.head_phone responsibleUserPhone,
CONCAT(info.disbursement_money,'') as disbursementMoney,
hph.regional_companies_code,
hph.developer_code,
hph.is_history isHistory,
info.financing_companies_name financingCompaniesName
FROM
`hygf_peasant_household` hph
LEFT JOIN hygf_financing_info info ON info.peasant_household_id = hph.sequence_nbr
LEFT JOIN hygf_unit_info on hph.developer_code = hygf_unit_info.amos_company_code
<where>
hph.construction_state = '验收完成'
<if test="params.ownersName != null and params.ownersName !=''">
and hph.owners_name like concat('%',#{params.ownersName},'%')
</if>
<if test="params.isHistory != null and params.isHistory !='' and params.type != 2 ">
and hph.is_history is not null
</if>
<if test="(params.isHistory == null or params.isHistory == '') and params.type != 2">
and hph.is_history is null
</if>
<if test="params.regionalCompaniesCode != null and params.regionalCompaniesCode !=''">
and hph.regional_companies_code = #{params.regionalCompaniesCode}
</if>
<if test="params.batchNo != null and params.batchNo !=''">
and info.batch_no = #{batchNo}
</if>
<if test="params.type == 2 ">
and info.status in ('待融资审核','审核通过','放款完成','已放款','审核不通过' ) and info.financing_companies_seq = #{params.financingCompaniesSeq}
</if>
<if test="params.region != null and params.region !='' ">
and hph.project_address like concat ('%',#{params.region},'%')
</if>
<if test="params.peasantHouseholdNo != null and params.peasantHouseholdNo !='' ">
and hph.peasant_household_no = #{params.peasantHouseholdNo}
</if>
</where>
ORDER BY
info.rec_date DESC ,hph.sequence_nbr DESC ) as sta
<where>
<if test="params.status != null and params.status.size() > 0">
and sta.status in
<foreach collection="params.status" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getSgysStationId" resultType="java.lang.String">
select
hygf_peasant_household.sequence_nbr sequenceNbr
from hygf_work_order_power_station LEFT join hygf_work_order
on hygf_work_order.sequence_nbr=hygf_work_order_power_station.work_order_id
LEFT JOIN hygf_peasant_household on hygf_peasant_household.sequence_nbr=hygf_work_order_power_station.peasant_household_id
LEFT JOIN hygf_power_station_engineering_info on hygf_power_station_engineering_info.work_order_power_station_id=hygf_work_order_power_station.sequence_nbr
<where>
<if test="dto.workOrderId!=null and dto.workOrderId!=''">
and hygf_work_order.sequence_nbr = #{dto.workOrderId}
</if>
<if test=' dto.type!=null and dto.type == "1"'>
and hygf_work_order_power_station.power_station_construction_status in ('待登记','未通过','已完工','待审核')
</if>
<if test=' dto.type !=null and dto.type == "2"'>
and hygf_work_order_power_station.power_station_construction_status IN ( '未通过', '已完工', '待审核', '待整改', '整改中','整改待审核' )
</if>
<if test=' dto.type !=null and dto.type == "3" and dto.workOrderPowerStationNodes !=null'>
and ( hygf_work_order_power_station.work_order_power_station_node is not null
or hygf_work_order_power_station.work_order_power_station_node = 'all'
or hygf_work_order_power_station.power_station_area_status is not null
or hygf_work_order_power_station.power_station_design_status is not null
or hygf_work_order_power_station.power_station_engineering_status is not null
)
</if>
<if test="dto.projectAddressName!=null and dto.projectAddressName!=''">
and hygf_peasant_household.project_address_name like concat(concat('%',#{dto.projectAddressName}),'%')
</if>
<if test="dto.peasantHouseholdNo!=null and dto.peasantHouseholdNo!=''">
and hygf_peasant_household.peasant_household_no like concat(concat('%',#{dto.peasantHouseholdNo}),'%')
</if>
<if test="dto.ownersName!=null and dto.ownersName!=''">
and hygf_peasant_household.owners_name like concat(concat('%',#{dto.ownersName}),'%')
</if>
<if test="dto.workOrderNum!=null and dto.workOrderNum!=''">
and hygf_work_order.work_order_num like concat(concat('%',#{dto.workOrderNum}),'%')
</if>
<if test="dto.projectRegionManager!=null and dto.projectRegionManager!=''">
and hygf_work_order.project_region_manager like concat(concat('%',#{dto.projectRegionManager}),'%')
</if>
<if test="dto.powerStationConstructionStatus!=null and dto.powerStationConstructionStatus!=''">
and hygf_work_order_power_station.power_station_construction_status=#{dto.powerStationConstructionStatus}
</if>
<if test="dto.amosDealerId!=null and dto.amosDealerId!=''">
and hygf_work_order.amos_dealer_id = #{dto.amosDealerId}
</if>
<if test="dto.regionCompanyId!=null and dto.regionCompanyId!=''">
and hygf_work_order.region_company_id =#{dto.regionCompanyId}
</if>
<if test="dto.province != null and dto.province != ''">
and hygf_peasant_household.project_address like concat(concat('%',#{dto.province}),'%')
</if>
</where>
ORDER BY
hygf_work_order_power_station.sequence_nbr DESC
</select>
<select id="getBwysStationId" resultType="java.lang.String">
SELECT
hph.sequence_nbr sequenceNbr
FROM
hygf_basic_grid_record hbga
LEFT JOIN hygf_peasant_household hph ON hph.sequence_nbr = hbga.peasant_household_id
LEFT JOIN hygf_on_grid_and_acceptance hogaa ON hogaa.work_order_power_station_id = hbga.work_order_power_station_id
LEFT JOIN hygf_work_order ON hygf_work_order.sequence_nbr = hbga.work_order_id
<where>
hbga.is_delete = 0
<if test="map.amosDealerId!=null and map.amosDealerId!=''">
and hygf_work_order.amos_dealer_id = #{map.amosDealerId}
</if>
<if test="map.regionCompanyId!=null and map.regionCompanyId!=''">
and hygf_work_order.region_company_id =#{map.regionCompanyId}
</if>
<if test="map.powerStationCode!=null and map.powerStationCode!=''">
and hph.peasant_household_no like concat('%',#{map.powerStationCode},'%')
</if>
<if test="map.formType != null and map.formType!=''">
AND hbga.grid_status IN ('2', '3', '4')
</if>
<if test="map.projectAddress != null and map.projectAddress!=''">
AND hph.project_address_name LIKE concat(concat('%', #{map.projectAddress}), '%')
</if>
<if test="map.type != null">
AND ( (hbga.basic_grid_node IS NOT NULL AND hbga.basic_grid_node != 'jxsAdmin' )
OR hbga.power_station_area_status IS NOT NULL
OR hbga.power_station_design_status IS NOT NULL
OR hbga.power_station_engineering_status IS NOT NULL )
</if>
<if test="map.ownersName != null and map.ownersName !=''">
AND hph.owners_name LIKE concat(concat('%', #{map.ownersName}), '%')
</if>
<if test="map.gridStatus != null and map.gridStatus !=''">
AND hbga.grid_status = #{map.gridStatus}
</if>
<if test="map.gridConnectionTime != null">
AND DATE_FORMAT(hogaa.grid_time, '%Y-%m-%d') = #{map.gridConnectionTime}
</if>
<if test="map.province != null and map.province != ''">
AND hph.project_address like concat(concat('%',#{map.province}),'%')
</if>
</where>
ORDER BY hbga.sequence_nbr desc
</select>
<select id="getYsshStationId" resultType="java.lang.String">
SELECT
hph.sequence_nbr sequenceNbr
FROM
hygf_acceptance_check hbga
LEFT JOIN hygf_peasant_household hph ON hph.sequence_nbr = hbga.peasant_household_id
LEFT JOIN hygf_on_grid_and_acceptance hogaa ON hogaa.work_order_power_station_id = hbga.work_order_power_station_id
LEFT JOIN hygf_work_order ON hygf_work_order.sequence_nbr = hbga.work_order_id
<where>
hbga.is_delete = 0
<if test="map.amosDealerId!=null and map.amosDealerId!=''">
and hygf_work_order.amos_dealer_id = #{map.amosDealerId}
</if>
<if test="map.regionCompanyId!=null and map.regionCompanyId!=''">
and hygf_work_order.region_company_id =#{map.regionCompanyId}
</if>
<if test="map.powerStationCode!=null and map.powerStationCode!=''">
and hph.peasant_household_no like concat('%',#{map.powerStationCode},'%')
</if>
<if test="map.formType != null and map.formType!=''">
AND hbga.acceptance_check_status IN ('2', '3', '4')
</if>
<if test="map.projectAddress != null and map.projectAddress!=''">
AND hph.project_address_name LIKE concat(concat('%', #{map.projectAddress}), '%')
</if>
<if test="map.type != null">
and ( (hbga.basic_grid_node is not null AND hbga.basic_grid_node != 'jxsAdmin')
or hbga.basic_grid_node = 'all'
or hbga.power_station_area_status is not null
or hbga.power_station_financing_status is not null
or hbga.power_station_assets_status is not null
or hbga.power_station_legal_status is not null
)
</if>
<if test="map.ownersName != null and map.ownersName !=''">
AND hph.owners_name LIKE concat(concat('%', #{map.ownersName}), '%')
</if>
<if test="map.acceptanceCheckStatus != null and map.acceptanceCheckStatus !=''">
AND hbga.acceptance_check_status = #{map.acceptanceCheckStatus}
</if>
<if test="map.acceptanceTime != null">
AND DATE_FORMAT(hogaa.acceptance_time, '%Y-%m-%d') = #{map.acceptanceTime}
</if>
<if test="map.province != null and map.province != ''">
AND hph.project_address like concat(concat('%',#{map.province}),'%')
</if>
</where>
ORDER BY hbga.sequence_nbr desc
</select>
<select id="getFhStationId" resultType="java.lang.String">
select b.sequenceNbr from ( select DISTINCT
hygf_peasant_household.peasant_household_no as peasantHouseholdNo,
hygf_peasant_household.owners_name as ownersName,
hygf_peasant_household.regional_companies_name as regionalCompaniesName,
hygf_peasant_household.regional_companies_seq as regionalCompaniesSeq,
hygf_peasant_household.regional_companies_code ,
hygf_peasant_household.developer_code,
hygf_peasant_household.developer_name as developerName,
hygf_peasant_household.developer_id as developeId,
hygf_peasant_household.sequence_nbr as sequenceNbr,
substring_index ( hygf_peasant_household.project_address_name, '/', 1 ) AS province,
concat_ws('/',hygf_peasant_household.project_address_name,hygf_peasant_household.project_address_detail) as address,
hygf_peasant_household.preparation_money_state preparationMoneyState,
hygf_document_station.preparation_money_id as preparationMoneyId,
hygf_preparation_money.delivery_time as deliveryTime,
hygf_preparation_money.arrival_time as arrivalTime,
(select instance_id from hygf_preparation_money_auditing where hygf_document_station.preparation_money_id = hygf_preparation_money_auditing.preparation_money_id limit 1) as instanceId from
hygf_peasant_household
LEFT JOIN hygf_document_station on hygf_peasant_household.sequence_nbr = hygf_document_station.station_id
LEFT JOIN hygf_power_station on hygf_peasant_household.sequence_nbr = hygf_power_station.peasant_household_id
LEFT JOIN hygf_preparation_money on hygf_preparation_money.sequence_nbr = hygf_document_station.preparation_money_id
<where>
<if test=" map.preparationMoneyState == 0 ">
and hygf_peasant_household.preparation_money_state in ('待发货','待补货','暂存发货')
</if>
<if test="map.regionalCompaniesSeq!=null and map.regionalCompaniesSeq !='' ">
and hygf_peasant_household.regional_companies_code like concat('%',#{map.regionalCompaniesSeq},'%')
</if>
<if test="map.developerId!=null and map.developerId !=''">
and hygf_peasant_household.developer_code like concat('%',#{map.developerId},'%')
</if>
<if test="map.state!=null and map.state !=''">
and hygf_peasant_household.preparation_money_state = #{map.state}
</if>
<if test="map.ownersName!=null and map.ownersName !=''">
and hygf_peasant_household.owners_name like concat ('%',#{map.ownersName},'%')
</if>
<if test=" map.preparationMoneyState == 1 ">
and hygf_peasant_household.preparation_money_state not in ('待发货','待补货','暂存发货') and preparation_money_state is not null and preparation_money_state != ''
</if>
<if test="map.province != null and map.province != ''">
and hygf_peasant_household.project_address like concat(concat('%',#{map.province}),'%')
</if>
</where>
<if test=" map.preparationMoneyState == 1 ">
order by hygf_preparation_money.delivery_time DESC
</if>
<if test=" map.preparationMoneyState == 0 ">
order by hygf_peasant_household.sequence_nbr DESC
</if>
) b
</select>
</mapper>
......@@ -143,4 +143,21 @@
PARENT_REGION_CODE = #{parentCode} and LEVEL = #{level}
</select>
<select id="getTrCreateTime" resultType="java.util.Map">
SELECT hfi.sequence_nbr as sequenceNbr,max(hfa.rec_date) AS time
FROM
hygf_financing_info hfi
LEFT JOIN hygf_financing_auditing hfa ON hfa.peasant_household_id=hfi.peasant_household_id
WHERE hfa.next_node_name='融资审核'
GROUP BY hfi.sequence_nbr
</select>
<select id="getTrEndTime" resultType="java.util.Map">
SELECT hfi.sequence_nbr as sequenceNbr,hfa.rec_date AS time
FROM
hygf_financing_info hfi
LEFT JOIN hygf_financing_auditing hfa ON hfa.peasant_household_id=hfi.peasant_household_id
WHERE hfa.next_node_name is null
</select>
</mapper>
......@@ -273,6 +273,28 @@
Subtree;
</select>
<select id="getRegionNodeByCode" resultType="string">
WITH RECURSIVE Subtree AS (
SELECT
SEQUENCE_NBR
FROM
systemctl_region sr
WHERE
sr.REGION_CODE = #{code}
UNION ALL
SELECT
h.SEQUENCE_NBR
FROM
systemctl_region h
JOIN
Subtree s ON h.PARENT_ID = s.SEQUENCE_NBR
)
SELECT
*
FROM
Subtree;
</select>
<select id="getRegionByProvince" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown">
SELECT privilege_company.ORG_CODE orgCode,
......
......@@ -245,6 +245,7 @@ on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nb
</foreach>
</if>
</where>
ORDER BY hph.rec_date DESC ,hph.sequence_nbr DESC
</select>
<select id="getAllPowerStationTimeDetail"
......@@ -263,6 +264,21 @@ on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nb
LEFT JOIN hygf_commercial hc ON hc.survey_information_id = hph.survey_information_id
LEFT JOIN hygf_work_order_power_station hwops ON hph.sequence_nbr = hwops.peasant_household_id
LEFT JOIN hygf_power_station_engineering_info hpsei ON hwops.sequence_nbr = hpsei.work_order_power_station_id
<where>
<if test="map.ownersName!=null and map.ownersName !=''">
and hph.owners_name like concat ('%',#{map.ownersName},'%')
</if>
<if test="map.province!=null and map.province !=''">
and hph.project_address_name like concat ('%',#{map.province},'%')
</if>
<if test="map.regionalCompaniesName!=null and map.regionalCompaniesName !=''">
and hph.regional_companies_name like concat ('%',#{map.regionalCompaniesName},'%')
</if>
<if test="map.serviceAgent!=null and map.serviceAgent !=''">
and hph.developer_name like concat ('%',#{map.serviceAgent},'%')
</if>
</where>
ORDER BY hph.rec_date DESC ,hph.sequence_nbr DESC
</select>
<select id="getKcTime"
......@@ -371,6 +387,21 @@ on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nb
</if>
</where>
</select>
<select id="getTrTime"
resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationTimeStatisticsDto">
SELECT peasant_household_id as sequenceNbr,tr_create_time,tr_end_time
FROM
hygf_financing_info
<where>
<if test="list != null and list.size()>0">
AND peasant_household_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<!-- <select id="getHygfCommercialScale" resultType="String">-->
<!-- select scale from hygf_commercial where survey_information_id=${surveyInformationId}-->
<!-- </select>-->
......
......@@ -2,42 +2,81 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationMapper">
<select id="queryPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto">
select DISTINCT
hygf_power_station.*,
b.initiate_status,
b.contract_lock_id,
hygf_peasant_household.regional_companies_code,
hygf_peasant_household.regional_companies_name,
hygf_peasant_household.developer_code,
hygf_peasant_household.developer_user_id,
hygf_peasant_household.project_address_detail,
substring_index ( hygf_peasant_household.project_address_name, '/', 1 ) AS province,
b.stamp_status,
b.status
from hygf_power_station LEFT JOIN ( SELECT bb.peasant_household_id, initiate_status, contract_lock_id, stamp_status, status FROM (SELECT peasant_household_id,MAX(sequence_nbr) AS sequence_nbr from hygf_household_contract GROUP BY peasant_household_id ) aa LEFT JOIN hygf_household_contract bb ON aa.sequence_nbr=bb.sequence_nbr) b on b.peasant_household_id=hygf_power_station.peasant_household_id
LEFT JOIN hygf_peasant_household on hygf_peasant_household.sequence_nbr=hygf_power_station.peasant_household_id
where hygf_power_station.is_delete=0
<if test="powerStationCode!=null and powerStationCode!=''">
and hygf_power_station.power_station_code like concat(concat('%',#{powerStationCode}),'%')
SELECT DISTINCT
ps.sequence_nbr,
ps.power_station_code,
ps.owners_name,
ps.project_address,
ps.service_agent,
ps.power_station_type,
ps.process_status,
ps.design_status,
ps.business_status,
ps.technology_status,
ps.process_instance_id,
ps.peasant_household_id,
ps.task_id,
ps.node_routing,
ps.process_definition_id,
ps.node_role,
ps.next_process_node,
ps.flow_task_id,
ps.plan_instance_id,
ps.drawing_review,
ps.next_node_name,
ps.next_execute_user_ids,
lc.initiate_status,
lc.contract_lock_id,
ph.regional_companies_code,
ph.regional_companies_name,
ph.developer_code,
ph.developer_user_id,
ph.project_address_detail,
SUBSTRING_INDEX(ph.project_address_name, '/', 1) AS province,
lc.stamp_status,
lc.status
FROM
hygf_power_station ps
LEFT JOIN (
SELECT
peasant_household_id,
initiate_status,
contract_lock_id,
stamp_status,
status
FROM (
SELECT
hhc.*,
ROW_NUMBER() OVER (PARTITION BY peasant_household_id ORDER BY sequence_nbr DESC) AS rn
FROM
hygf_household_contract hhc
) subq
WHERE subq.rn = 1
) lc
ON lc.peasant_household_id = ps.peasant_household_id
LEFT JOIN hygf_peasant_household ph
ON ph.sequence_nbr = ps.peasant_household_id
WHERE
ps.is_delete = 0
<if test="powerStationCode != null and powerStationCode != ''">
AND ps.power_station_code LIKE CONCAT('%', #{powerStationCode}, '%')
</if>
<if test="ownersName!=null and ownersName!=''">
and hygf_power_station.owners_name like concat(concat('%',#{ownersName}),'%')
<if test="ownersName != null and ownersName != ''">
AND ps.owners_name LIKE CONCAT('%', #{ownersName}, '%')
</if>
<if test="serviceAgent!=null and serviceAgent!=''">
and hygf_power_station.service_agent like concat(concat('%',#{serviceAgent}),'%')
<if test="serviceAgent != null and serviceAgent != ''">
AND ps.service_agent LIKE CONCAT('%', #{serviceAgent}, '%')
</if>
<if test="regionalCompaniesName!=null and regionalCompaniesName!=''">
and hygf_peasant_household.regional_companies_name like concat(concat('%',#{regionalCompaniesName}),'%')
<if test="regionalCompaniesName != null and regionalCompaniesName != ''">
AND ph.regional_companies_name LIKE CONCAT('%', #{regionalCompaniesName}, '%')
</if>
<if test="processStatus != null and processStatus != ''">
and hygf_power_station.process_status = #{processStatus}
AND ps.process_status = #{processStatus}
</if>
<if test="province != null and province != ''">
and hygf_peasant_household.project_address like concat(concat('%',#{province}),'%')
AND ph.project_address_name LIKE CONCAT('%', #{province}, '%')
</if>
<!-- GROUP BY hygf_peasant_household.sequence_nbr-->
ORDER BY hygf_power_station.rec_date desc
ORDER BY ps.rec_date DESC
</select>
<select id="getInstanceIdByhouseId" resultType="java.lang.String">
select process_instance_id From hygf_power_station where peasant_household_id = #{peasantHouseholdId}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.StatisticsHomepageMapper">
<select id="surveyStatusTotal" resultType="map">
SELECT
SUM(CASE WHEN ps.process_status = '不通过' THEN 1 ELSE 0 END)AS '未通过',
SUM(CASE WHEN ps.process_status = '进行中' AND ps.business_status = '通过' AND next_node_name = '设计上传典型图库' THEN 1 ELSE 0 END) AS '已完成(法务审核)',
SUM(CASE WHEN ps.process_status = '完成' THEN 1 ELSE 0 END) AS completeTotal,
SUM(CASE WHEN ps.process_status = '进行中' AND (ps.business_status IS NULL OR ps.design_status IS NULL OR ps.technology_status IS NULL or ps.business_status = '' OR ps.design_status = '' OR ps.technology_status = '') THEN 1 ELSE 0 END) AS '进行中(审核)'
FROM
hygf_power_station ps
LEFT JOIN
hygf_peasant_household ph ON ps.peasant_household_id = ph.sequence_nbr
WHERE
ps.is_delete = 0
<if test="developerCode != null and developerCode != ''">
AND ph.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND ph.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND ph.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND ph.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND ph.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</select>
<select id="selectWKC" resultType="int">
SELECT count(*) FROM hygf_peasant_household WHERE construction_state = '待勘察' and is_delete = 0
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</select>
<select id="contractStatusTotal" resultType="map">
SELECT
SUM(CASE WHEN status = '未签署' THEN 1 ELSE 0 END) AS '未签署',
SUM(CASE WHEN status = '双方已签署' THEN 1 ELSE 0 END) AS '双方已签署',
SUM(CASE WHEN status = '农户已签署' THEN 1 ELSE 0 END) AS '农户已签署',
SUM(CASE WHEN status = '已作废' THEN 1 ELSE 0 END) AS '已作废'
FROM
( SELECT hhc.*, ROW_NUMBER() OVER ( PARTITION BY peasant_household_id ORDER BY sequence_nbr DESC ) AS rn FROM hygf_household_contract hhc ) subq
LEFT JOIN hygf_peasant_household ph ON ph.SEQUENCE_NBR = subq.peasant_household_id
WHERE
subq.rn = 1
<if test="developerCode != null and developerCode != ''">
AND ph.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND ph.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND ph.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND ph.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND ph.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</select>
<select id="desionTotal" resultType="map">
SELECT
SUM( CASE WHEN next_node_name = '经销商设计人员上传设计图' and process_status = '进行中'THEN 1 ELSE 0 END ) AS '典设图已上传',
SUM( CASE WHEN next_node_name = '设计图纸审核' and process_status = '进行中'THEN 1 ELSE 0 END ) AS '施工图已上传'
FROM
`hygf_power_station`
LEFT JOIN
hygf_peasant_household ON hygf_power_station.peasant_household_id = hygf_peasant_household.sequence_nbr
<where>
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
</select>
<select id="preparationMoneyTotal" resultType="map">
SELECT
SUM( CASE WHEN preparation_money_state = '待发货' or preparation_money_state = '暂存发货'or preparation_money_state = '待补货' THEN 1 ELSE 0 END ) AS '待发货',
SUM( CASE WHEN preparation_money_state = '备货完成' THEN 1 ELSE 0 END ) AS '已收货',
SUM( CASE WHEN preparation_money_state = '待收货' THEN 1 ELSE 0 END ) AS '已发货'
FROM
hygf_peasant_household
WHERE
preparation_money_state IS NOT NULL
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</select>
<select id="workOrderTotal" resultType="map">
SELECT
count(*) AS total,
(CASE WHEN power_station_construction_status = '待施工' THEN '派工发料'
WHEN power_station_construction_status = '未通过' THEN '未通过'
WHEN power_station_construction_status = '施工中' or power_station_construction_status = '待登记' THEN '施工资料已上传'
WHEN power_station_construction_status = '待审核' and work_order_power_station_node IS NULL THEN '完工登记'
WHEN power_station_construction_status = '待审核' and work_order_power_station_node ='area' THEN '完工自审'
WHEN power_station_construction_status = '已完工' THEN '已完成'
WHEN power_station_construction_status = '待审核' and work_order_power_station_node in ('engineering','design') THEN '审核中'
ELSE power_station_construction_status END )
AS statusText,
ROUND(COALESCE(SUM(ei.real_scale), 0), 2) AS realScale FROM
hygf_work_order_power_station
LEFT JOIN
hygf_power_station_engineering_info ei on ei.work_order_power_station_id =hygf_work_order_power_station.sequence_nbr
LEFT JOIN
hygf_peasant_household ON hygf_work_order_power_station.peasant_household_id = hygf_peasant_household.sequence_nbr
<where>
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY
power_station_construction_status,work_order_power_station_node
</select>
<select id="gridStatusTotal" resultType="map">
SELECT
COUNT( * ) AS total,
CASE WHEN grid_status = '1' THEN '待登记'
WHEN grid_status = '2' THEN '审核中'
WHEN grid_status = '3' THEN '已完成'
WHEN grid_status = '4' THEN '未通过'
WHEN grid_status = '5' THEN '审核中'
WHEN grid_status = '6' THEN '审核中'
WHEN grid_status = '7' THEN '审核中'
WHEN grid_status = '8' THEN '审核中'
WHEN grid_status = '9' THEN '整改待审核'
ELSE '待整改' END AS statusText,
ROUND(COALESCE(SUM(ei.real_scale), 0), 2) AS realScale
FROM
hygf_basic_grid_record
LEFT JOIN hygf_work_order_power_station ps ON ps.sequence_nbr = hygf_basic_grid_record.work_order_power_station_id
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr
LEFT JOIN hygf_peasant_household ON hygf_basic_grid_record.peasant_household_id = hygf_peasant_household.sequence_nbr
<where>
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY
grid_status
</select>
<select id="acceptanceStatusTotal" resultType="map">
SELECT
COUNT(*) AS total,
CASE
WHEN acceptance_check_status = '15' THEN '待提交'
WHEN acceptance_check_status = '2' THEN '审核中'
WHEN acceptance_check_status = '3' THEN '已完成'
WHEN acceptance_check_status = '4' THEN '未通过'
WHEN acceptance_check_status = '7' THEN '审核中'
WHEN acceptance_check_status = '9' THEN '整改待审核'
WHEN acceptance_check_status = '11' THEN '审核中'
WHEN acceptance_check_status = '12' THEN '审核中'
WHEN acceptance_check_status = '13' THEN '审核中'
WHEN acceptance_check_status = '14' THEN '审核中'
ELSE '待整改'
END AS statusText,
ROUND(COALESCE(SUM(ei.real_scale), 0), 2) AS realScale
FROM
hygf_acceptance_check
LEFT JOIN
hygf_work_order_power_station ps ON ps.sequence_nbr = hygf_acceptance_check.work_order_power_station_id
LEFT JOIN
hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr
LEFT JOIN
hygf_peasant_household ON hygf_acceptance_check.peasant_household_id = hygf_peasant_household.sequence_nbr
<where>
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY
acceptance_check_status
</select>
<select id="financingStatusTotal" resultType="map">
SELECT
count(*) AS total,
CASE
WHEN info.`status` = '已放款' THEN
'已放款'
WHEN info.`status` = '审核通过' THEN
'待放款'
WHEN info.`status` = '待融资审核' THEN
'待审核'
WHEN info.`status` = '审核不通过' THEN
'未通过'
WHEN info.`status` = '放款完成' THEN
'放款完成' ELSE '待推送'
END AS statusText,
SUM( info.disbursement_money ) AS disbursementMoney,
ROUND(COALESCE(SUM( ei.real_scale ),0),2) AS realScale
FROM
`hygf_peasant_household` hph
LEFT JOIN hygf_financing_info info ON info.peasant_household_id = hph.sequence_nbr
LEFT JOIN hygf_work_order_power_station ps ON ps.peasant_household_id = hph.sequence_nbr
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr
WHERE
hph.construction_state = '验收完成'
<if test="developerCode != null and developerCode != ''">
AND hph.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND hph.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND hph.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND hph.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND hph.project_address LIKE CONCAT ('%',#{district},'%')
</if>
GROUP BY
STATUS
</select>
<select id="inverterTotal" resultType="map">
SELECT
FLOOR(SUM((LENGTH(construction_inverter_info)-LENGTH(REPLACE(construction_inverter_info,'"id"',''))))/LENGTH('"id"')) AS total,
'户用开发逆变器' AS statusText,
0 AS realScale
FROM
hygf_power_station_construction_data
LEFT JOIN
hygf_work_order_power_station on hygf_power_station_construction_data.work_order_power_station_id =hygf_work_order_power_station.sequence_nbr
LEFT JOIN
hygf_peasant_household ON hygf_work_order_power_station.peasant_household_id = hygf_peasant_household.sequence_nbr
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</select>
<select id="inverterTotalJp" resultType="map">
SELECT
COUNT(*) total,
'接入逆变器' AS statusText,
ROUND(COALESCE(SUM( ji.capacity),0),2) AS realScale
FROM
hygf_jp_inverter ji
LEFT JOIN hygf_jp_station jp ON jp.third_station_id = ji.third_station_id
LEFT JOIN privilege_company pc on jp.regional_companies_code = pc.ORG_CODE
WHERE
jp.regional_companies_code IS NOT NULL
<if test="developerCode != null and developerCode != ''">
AND jp.amos_company_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND jp.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="regions != null and regions.size()>0 ">
and pc.REGION_SEQ in
<foreach collection="regions" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</if>
</select>
<select id="stationNum" resultType="map">
SELECT count(*) as total FROM hygf_peasant_household WHERE is_delete = 0
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</select>
<select id="homePageExport" resultType="map">
SELECT
ph.regional_companies_name AS regionalCompaniesName,
ph.developer_name AS developerName,
ROUND(COALESCE(SUM(IFNULL(ei.real_scale, 0))/1000, 0), 2) AS realScale,
SUM(CASE WHEN ph.construction_state = '待勘察' THEN 1 ELSE 0 END) AS wkc,
SUM(CASE WHEN ps.process_status = '不通过' THEN 1 ELSE 0 END) AS kcwtg,
'' AS kcwtgrl,
SUM(CASE WHEN ps.process_status = '进行中' THEN 1 ELSE 0 END) AS kcjxz,
'' AS kcjxzrl,
SUM(CASE WHEN ps.process_status = '完成' THEN 1 ELSE 0 END) AS kcywc,
ROUND(COALESCE(SUM(CASE WHEN ps.process_status = '完成' THEN ei.real_scale ELSE 0 END)/1000, 0), 2) AS kcywcrl,
SUM(CASE WHEN ph.preparation_money_state = '备货完成' THEN 1 ELSE 0 END) AS bhywc,
ROUND(COALESCE(SUM(CASE WHEN ph.preparation_money_state = '备货完成' THEN ei.real_scale ELSE 0 END)/1000, 0), 2) AS bhywcrl,
SUM(CASE WHEN ph.preparation_money_state = '待发货' or ph.preparation_money_state = '暂存发货'or ph.preparation_money_state = '待补货' THEN 1 ELSE 0 END ) AS bhwtg,
'' AS bhjxzrl,
SUM(CASE WHEN ph.preparation_money_state = '待收货' THEN 1 ELSE 0 END) AS bhjxz,
'' AS bhwtgrl,
SUM(CASE WHEN wops.power_station_construction_status = '未通过' THEN 1 ELSE 0 END) AS sgwtg,
SUM(CASE WHEN wops.power_station_construction_status = '未通过' THEN ROUND(COALESCE(ei.real_scale/1000, 0), 2) ELSE 0 END) AS sgwtgrl,
SUM(CASE WHEN wops.power_station_construction_status NOT IN ('未通过', '已完工', '待施工') THEN 1 ELSE 0 END) AS sgjxz,
ROUND(COALESCE( SUM(CASE WHEN wops.power_station_construction_status NOT IN ('未通过', '已完工', '待施工') THEN ei.real_scale/1000 ELSE 0 END), 0), 2) AS sgjxzrl,
SUM(CASE WHEN wops.power_station_construction_status = '已完工' THEN 1 ELSE 0 END) AS sgywc,
ROUND(COALESCE(SUM(CASE WHEN wops.power_station_construction_status = '已完工' THEN ei.real_scale/1000 ELSE 0 END) , 0), 2)AS sgywcrl,
SUM(CASE WHEN br.grid_status = '4' THEN 1 ELSE 0 END) AS bwwtg,
SUM(CASE WHEN br.grid_status = '4' THEN ROUND(COALESCE(ei.real_scale/1000, 0), 2) ELSE 0 END) AS bwwtgrl,
SUM(CASE WHEN br.grid_status NOT IN ('4', '3', '1') THEN 1 ELSE 0 END) AS bwjxz,
ROUND(COALESCE(SUM(CASE WHEN br.grid_status NOT IN ('4', '3', '1') THEN ei.real_scale/1000 ELSE 0 END), 0), 2) AS bwjxzrl,
SUM(CASE WHEN br.grid_status = '3' THEN 1 ELSE 0 END) AS bwywc,
ROUND(COALESCE(SUM(CASE WHEN br.grid_status = '3' THEN ei.real_scale/1000 ELSE 0 END), 0), 2) AS bwywcrl,
SUM(CASE WHEN ac.acceptance_check_status = '3' THEN 1 ELSE 0 END) AS ysywc,
ROUND(COALESCE(SUM(CASE WHEN ac.acceptance_check_status = '3' THEN ei.real_scale/1000 ELSE 0 END), 0), 2) AS ysywcrl,
SUM(CASE WHEN ac.acceptance_check_status = '4' THEN 1 ELSE 0 END) AS yswtg,
ROUND(COALESCE(SUM(CASE WHEN ac.acceptance_check_status = '4' THEN ei.real_scale/1000 ELSE 0 END), 0), 2) AS yswtgrl,
SUM(CASE WHEN ac.acceptance_check_status NOT IN ('3', '4', '15') THEN 1 ELSE 0 END) AS ysjxz,
ROUND(COALESCE(SUM(CASE WHEN ac.acceptance_check_status NOT IN ('3', '4', '15') THEN ei.real_scale/1000 ELSE 0 END), 0), 2) AS ysjxzrl,
SUM(CASE WHEN fi.status = '放款完成' THEN 1 ELSE 0 END) AS rzhs,
MAX(CASE WHEN fi.status = '放款完成' THEN fi.unit_price ELSE 0 END) AS rzdj,
MAX(CASE WHEN fi.status = '放款完成' THEN fi.financing_companies_name ELSE '' END) AS rzgs,
ROUND(COALESCE(SUM(CASE WHEN fi.status = '放款完成' THEN fi.disbursement_money ELSE 0 END), 0), 2) AS fkje,
ROUND(COALESCE(SUM(CASE WHEN fi.status = '放款完成' THEN ei.real_scale/1000 ELSE 0 END), 0), 2)AS rzrl
FROM
hygf_peasant_household ph
LEFT JOIN hygf_power_station ps ON ps.peasant_household_id = ph.sequence_nbr
LEFT JOIN hygf_work_order_power_station wops ON wops.peasant_household_id = ph.sequence_nbr
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = wops.sequence_nbr
LEFT JOIN hygf_acceptance_check ac ON ac.peasant_household_id = ph.sequence_nbr
LEFT JOIN hygf_basic_grid_record br ON br.peasant_household_id = ph.sequence_nbr
LEFT JOIN hygf_financing_info fi ON fi.peasant_household_id = ph.sequence_nbr
WHERE
ph.is_delete = 0
<if test="developerCode != null and developerCode != ''">
AND ph.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND ph.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND ph.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND ph.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND ph.project_address LIKE CONCAT ('%',#{district},'%')
</if>
GROUP BY
ph.regional_companies_name,
ph.developer_name
order by
ph.regional_companies_name,ph.developer_name
</select>
<select id="merCount" resultType="map">
SELECT
count( regionalCompaniesName ) AS total,
max( regionalCompaniesName ) regionalCompaniesName,
max( regionSeq ) AS regionSeq,
max( regionalCompaniesCode ) AS regionalCompaniesCode,
max( developerCode ) AS developerCode,
max( projectAddress ) AS projectAddress
FROM
(
SELECT
ph.regional_companies_name AS regionalCompaniesName,
ph.developer_name developerName,
max( pc.REGION_SEQ ) AS regionSeq,
max( ph.regional_companies_code ) AS regionalCompaniesCode,
max( ph.developer_code ) AS developerCode,
max( ph.project_address ) AS projectAddress
FROM
hygf_peasant_household ph
LEFT JOIN privilege_company pc ON pc.SEQUENCE_NBR = ph.regional_companies_seq
<where>
<if test="developerCode != null and developerCode != ''">
AND ph.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND ph.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND ph.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND ph.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND ph.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY
ph.regional_companies_name,
ph.developer_name
ORDER BY
ph.regional_companies_name,
ph.developer_name
) b
GROUP BY
regionalCompaniesName
</select>
<select id="selectProvince" resultType="String">
WITH RECURSIVE ParentTree AS (
-- 初始查询:选择根节点
SELECT
SEQUENCE_NBR,
PARENT_ID,
REGION_NAME
FROM
systemctl_region sr
WHERE
sr.SEQUENCE_NBR = #{regionSeq}
UNION ALL
-- 递归部分:选择父节点
SELECT
p.SEQUENCE_NBR,
p.PARENT_ID,
p.REGION_NAME
FROM
systemctl_region p
JOIN
ParentTree pt ON p.SEQUENCE_NBR = pt.PARENT_ID
)
SELECT
pt.REGION_NAME AS topLevelNodeName
FROM
ParentTree pt
WHERE
pt.PARENT_ID = 0;
</select>
<select id="getRent" resultType="map">
SELECT
sum( CASE WHEN repay_state = '1' THEN rent ELSE 0 END ) yhk,
sum( CASE WHEN repay_state = '0' THEN rent ELSE 0 END ) sywhk,
sum( CASE WHEN repay_state = '0' AND ( YEAR ( repay_date ) = YEAR ( CURDATE())) THEN rent ELSE 0 END ) jnwhk,
max(regional_companies_code) regionalCompaniesCode,
max(hygf_repayment.company_name) regionalCompaniesName,
max(pc.REGION_SEQ) regionSeq
FROM
hygf_repayment
LEFT JOIN
privilege_company pc on pc.ORG_CODE = hygf_repayment.regional_companies_code
<where>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
and regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="regions != null and regions.size()>0 ">
and pc.REGION_SEQ in
<foreach collection="regions" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</if>
</where>
GROUP BY
regional_companies_code
</select>
<select id="statisticsPowerStation" resultType="map">
SELECT
IFNULL( sum( CASE WHEN lc.STATUS = '已作废' THEN 1 ELSE 0 END ), 0 ) yzf,
IFNULL( sum( CASE WHEN lc.STATUS = '双方已签署' THEN 1 ELSE 0 END ), 0 ) sfyqs,
IFNULL( sum( CASE WHEN lc.STATUS = '双方已签署' THEN ei.real_scale ELSE 0 END ), 0 ) sfyqsrl,
IFNULL( sum( CASE WHEN lc.STATUS = '农户已签署' THEN 1 ELSE 0 END ), 0 ) nhyqs,
IFNULL( sum( CASE WHEN lc.STATUS = '未签署' THEN 1 ELSE 0 END ), 0 ) wqs,
IFNULL( SUM( CASE WHEN ps.process_status = '不通过' THEN 1 ELSE 0 END ), 0 ) AS kcwtg,
IFNULL( SUM( CASE WHEN ps.process_status = '进行中' THEN 1 ELSE 0 END ), 0 ) AS kcjxz,
IFNULL( SUM( CASE WHEN ps.process_status = '完成' THEN 1 ELSE 0 END ), 0 ) AS kcywc,
IFNULL( SUM( CASE WHEN ps.process_status = '完成' THEN ei.real_scale ELSE 0 END ), 0 ) AS kcywcrl
FROM
hygf_power_station ps
LEFT JOIN (
SELECT
peasant_household_id,
initiate_status,
contract_lock_id,
stamp_status,
STATUS
FROM
( SELECT hhc.*, ROW_NUMBER() OVER ( PARTITION BY peasant_household_id ORDER BY sequence_nbr DESC ) AS rn FROM hygf_household_contract hhc ) subq
WHERE
subq.rn = 1
) lc ON lc.peasant_household_id = ps.peasant_household_id
LEFT JOIN hygf_peasant_household ph ON ph.sequence_nbr = ps.peasant_household_id
LEFT JOIN hygf_work_order_power_station wops ON wops.peasant_household_id = ph.sequence_nbr
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = wops.sequence_nbr
WHERE
ps.is_delete = 0
<if test="developerCode != null and developerCode != ''">
AND ph.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND ph.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND ph.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND ph.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND ph.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</select>
<select id="statisticsPreparationMoney" resultType="map">
SELECT
IFNULL(SUM( CASE WHEN preparation_money_state = '待发货' or preparation_money_state = '暂存发货' or preparation_money_state = '待补货' THEN 1 ELSE 0 END ), 0 ) AS dfh,
IFNULL(SUM( CASE WHEN preparation_money_state = '备货完成' THEN 1 ELSE 0 END ), 0 ) AS ysh,
IFNULL(SUM( CASE WHEN preparation_money_state = '备货完成' THEN ei.real_scale ELSE 0 END ), 0 ) AS yshrl,
IFNULL(SUM( CASE WHEN preparation_money_state = '待收货' THEN 1 ELSE 0 END ), 0 ) AS yfh
FROM
hygf_peasant_household
LEFT JOIN hygf_work_order_power_station wops ON wops.peasant_household_id = hygf_peasant_household.sequence_nbr
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = wops.sequence_nbr
WHERE
preparation_money_state IS NOT NULL
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</select>
</mapper>
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.yeejoin.amos.boot.module.hygf.api.dto.StationFieldDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.HygfBusinessField;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.BusinessFieldServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "业务字段Api")
@RequestMapping(value = "/businessField")
public class BusinessFieldController {
@Autowired
BusinessFieldServiceImpl businessFieldService;
/**
* 获取所有的字段
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAllField")
@ApiOperation(httpMethod = "GET",value = "获取所有的字段", notes = "获取所有的字段")
public ResponseModel<Map<String,List<HygfBusinessField>>> getAllField() {
return ResponseHelper.buildResponse(businessFieldService.getAllField());
}
/**
* 导出电站Excel
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/exportStationExcelByField")
@ApiOperation(httpMethod = "POST", value = "导出电站Excel根据字段", notes = "导出电站Excel根据字段")
public void exportStationExcelByField(@RequestBody StationFieldDto stationFieldDto, HttpServletResponse response) {
businessFieldService.exportStationExcelByField(stationFieldDto, response);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.google.common.net.HttpHeaders;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.CommerceInfoDto;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.FinancingInfoServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.StatisticsHomepageServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,6 +30,8 @@ public class CommonController {
FinancingInfoServiceImpl financingInfoService;
@Autowired
CommonServiceImpl commonService;
@Autowired
StatisticsHomepageServiceImpl statisticsHomepageService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/selectRegion")
......@@ -95,4 +99,65 @@ public class CommonController {
}
/**
* 统计首页环形图
*
* @return
*/
@GetMapping(value = "/statisticsHomepage")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "首页统计环形图及统计表", notes = "首页统计环形图及统计表")
@UserLimits
public ResponseModel<Map<String, Object>> statisticsHomepage(@RequestParam(required = false) String developerCode,
@RequestParam(required = false) String regionalCompaniesCode,
@RequestParam(required = false) String province,
@RequestParam(required = false) String city,
@RequestParam(required = false) String district) {
return ResponseHelper.buildResponse(statisticsHomepageService.statisticsHomepage(developerCode,regionalCompaniesCode,province,city,district));
}
/**
* 统计首页环形图
*
* @return
*/
@GetMapping(value = "/statisticsTop")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表上方统计表", notes = "列表上方统计表")
@UserLimits
public ResponseModel<Map<String, Object>> statisticsTop(@RequestParam(required = false) String developerCode,
@RequestParam(required = false) String regionalCompaniesCode,
@RequestParam(required = false) String province,
@RequestParam(required = false) String city,
@RequestParam(required = true) String type,
@RequestParam(required = false) String district) {
return ResponseHelper.buildResponse(statisticsHomepageService.statisticsTop(type,developerCode,regionalCompaniesCode,province,city,district));
}
/**
* 统计首页环形图
*
* @return
*/
@GetMapping(value = "/homePageExport")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "资料下载进度获取", notes = "资料下载进度获取")
@UserLimits
public void homePageExport(@RequestParam(required = false) String developerCode,
@RequestParam(required = false) String regionalCompaniesCode,
@RequestParam(required = false) String province,
@RequestParam(required = false) String city,
@RequestParam(required = false) String district,
HttpServletResponse response) throws IOException {
statisticsHomepageService.homePageExport(developerCode,regionalCompaniesCode,province,city,district,response);
}
}
......@@ -305,14 +305,14 @@ public class PeasantHouseholdController extends BaseController {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.deleteUser(sequenceNbr, peasantHouseholdNo));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "更新详情信息", notes = "更新详情信息")
@PostMapping(value = "/saveHistory")
public ResponseModel updateDetail(@RequestBody PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto,@RequestParam(value = "operationType") String operationType) {
peasantHouseholdServiceImpl.saveHistoryPeasantHousehold(powerStationEngineeringInfoAllDto,operationType);
return ResponseHelper.buildResponse(null);
}
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @ApiOperation(httpMethod = "POST",value = "更新详情信息", notes = "更新详情信息")
// @PostMapping(value = "/saveHistory")
// public ResponseModel updateDetail(@RequestBody PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto,@RequestParam(value = "operationType") String operationType) {
//
// peasantHouseholdServiceImpl.saveHistoryPeasantHousehold(powerStationEngineeringInfoAllDto,operationType);
// return ResponseHelper.buildResponse(null);
// }
/**
......
......@@ -49,8 +49,8 @@ public class PowerStationStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/exportPowerStationExcel")
@ApiOperation(httpMethod = "POST", value = "导出电站Excel", notes = "导出电站Excel")
public ResponseModel<?> exportPowerStationExcel(@RequestBody PowerStationTimeStatisticsBatchDto powerStationTimeStatisticsBatchDto, HttpServletResponse response) {
powerStationStatisticsService.exportPowerStationExcel(powerStationTimeStatisticsBatchDto.getSequenceNbrList(), response);
public ResponseModel<?> exportPowerStationExcel(@RequestBody PowerStationTimeStatisticsBatchDto statisticsBatchDto, HttpServletResponse response) {
powerStationStatisticsService.exportPowerStationExcel(statisticsBatchDto, response);
return ResponseHelper.buildResponse(null);
}
......
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.qiyuesuo.sdk.v2.bean.Contract;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.QiyuesuoServiceImpl;
import com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser;
import com.yeejoin.amos.boot.module.standard.api.mapper.PublicAgencyUserMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.util.AesUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -20,17 +26,11 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser;
import com.yeejoin.amos.boot.module.standard.api.mapper.PublicAgencyUserMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.util.AesUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 农户信息
......@@ -44,210 +44,249 @@ import io.swagger.annotations.ApiOperation;
@Slf4j
public class TestController extends BaseController {
private static final String regionRedis = "app_region_redis";
@Autowired
UnitInfoMapper unitInfoMapper;
@Autowired
PublicAgencyUserMapper publicAgencyUserMapper;
@Autowired
PowerStationMapper powerStationMapper;
@Autowired
QiyuesuoServiceImpl qiyuesuoService;
@Autowired
HouseholdContractMapper householdContractMapper;
@Autowired
WorkOrderPowerStationMapper workOrderPowerStationMapper;
@Autowired
BasicGridRecordMapper basicGridRecordMapper;
@Autowired
AcceptanceCheckMapper acceptanceCheckMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/initTime")
@ApiOperation(httpMethod = "GET", value = "初始时间", notes = "初始时间")
public ResponseModel<Object> initTime() {
// 创建线程池
ExecutorService executorService = Executors.newFixedThreadPool(5);
// 提交不同的方法
executorService.submit(this::dealKcTime);
executorService.submit(this::dealDzhtqyTime);
executorService.submit(this::dealSgTime);
executorService.submit(this::dealBwTime);
executorService.submit(this::dealYsTime);
// 关闭线程池
executorService.shutdown();
return CommonResponseNewUtil.success();
}
private void dealYsTime() {
log.info("================开始初始验收时间=========================");
List<Map<String,Object>> ysCreateTime = acceptanceCheckMapper.getYsCreateTime();
for (Map<String, Object> stringObjectMap : ysCreateTime) {
LambdaUpdateWrapper<AcceptanceCheck> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(AcceptanceCheck::getYsCreateTime,stringObjectMap.get("time"))
.eq(AcceptanceCheck::getInstanceId,stringObjectMap.get("processInstanceId"));
acceptanceCheckMapper.update(null,wrapper);
}
List<Map<String,Object>> ysEndTime = acceptanceCheckMapper.getYsEndTime();
for (Map<String, Object> stringObjectMap : ysEndTime) {
LambdaUpdateWrapper<AcceptanceCheck> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(AcceptanceCheck::getYsEndTime,stringObjectMap.get("time"))
.eq(AcceptanceCheck::getSequenceNbr,stringObjectMap.get("sequenceNbr"));
acceptanceCheckMapper.update(null,wrapper);
}
log.info("================验收时间更新完成=========================");
}
private void dealBwTime() {
log.info("================开始初始并网时间=========================");
List<Map<String,Object>> bwCreateTime = basicGridRecordMapper.getBwCreateTime();
for (Map<String, Object> stringObjectMap : bwCreateTime) {
LambdaUpdateWrapper<BasicGridRecord> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(BasicGridRecord::getBwCreateTime,stringObjectMap.get("time"))
.eq(BasicGridRecord::getInstanceId,stringObjectMap.get("processInstanceId"));
basicGridRecordMapper.update(null,wrapper);
}
List<Map<String,Object>> bwEndTime = basicGridRecordMapper.getBwEndTime();
for (Map<String, Object> stringObjectMap : bwEndTime) {
LambdaUpdateWrapper<BasicGridRecord> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(BasicGridRecord::getBwEndTime,stringObjectMap.get("time"))
.eq(BasicGridRecord::getSequenceNbr,stringObjectMap.get("sequenceNbr"));
basicGridRecordMapper.update(null,wrapper);
}
log.info("================并网时间更新完成=========================");
}
private void dealSgTime() {
log.info("================开始初始施工时间=========================");
List<Map<String,Object>> sgCreateTime = workOrderPowerStationMapper.getSgCreateTime();
for (Map<String, Object> stringObjectMap : sgCreateTime) {
LambdaUpdateWrapper<WorkOrderPowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(WorkOrderPowerStation::getSgCreateTime,DateUtils.dateParse(String.valueOf(stringObjectMap.get("time"))))
.eq(WorkOrderPowerStation::getWorkOrderId,stringObjectMap.get("workOrderId"));
workOrderPowerStationMapper.update(null,wrapper);
}
List<Map<String,Object>> sgEndTime = workOrderPowerStationMapper.getSgEndTime();
for (Map<String, Object> stringObjectMap : sgEndTime) {
LambdaUpdateWrapper<WorkOrderPowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(WorkOrderPowerStation::getSgEndTime,stringObjectMap.get("time"))
.eq(WorkOrderPowerStation::getSequenceNbr,stringObjectMap.get("sequenceNbr"));
workOrderPowerStationMapper.update(null,wrapper);
}
log.info("================施工时间更新完成=========================");
}
private void dealSjTime() {
log.info("================开始初始设计时间=========================");
List<Map<String,Object>> sjCreateTime = powerStationMapper.getSjCreateTime();
for (Map<String, Object> stringObjectMap : sjCreateTime) {
LambdaUpdateWrapper<PowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(PowerStation::getSjCreateTime,stringObjectMap.get("time"))
.eq(PowerStation::getProcessInstanceId,stringObjectMap.get("processInstanceId"));
powerStationMapper.update(null,wrapper);
}
List<Map<String,Object>> sjEndTime = powerStationMapper.getSjEndTime();
for (Map<String, Object> stringObjectMap : sjEndTime) {
LambdaUpdateWrapper<PowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(PowerStation::getSjEndTime,stringObjectMap.get("time"))
.eq(PowerStation::getProcessInstanceId,stringObjectMap.get("processInstanceId"));
powerStationMapper.update(null,wrapper);
}
log.info("================设计时间更新完成=========================");
}
private void dealDzhtqyTime() {
log.info("================开始初始电子合同时间=========================");
Map<Long, Contract> contractMap = qiyuesuoService.getContractMap();
contractMap.forEach((k,v)->{
LambdaUpdateWrapper<HouseholdContract> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(HouseholdContract::getDzhtqyCreateTime, DateUtils.dateParse(v.getPublishTime()))
.eq(HouseholdContract::getContractLockId,k);
householdContractMapper.update(null,wrapper);
});
List<Map<String,Object>> dzhtqyEndTime = householdContractMapper.getDzhtqyEndTime();
for (Map<String, Object> stringObjectMap : dzhtqyEndTime) {
LambdaUpdateWrapper<HouseholdContract> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(HouseholdContract::getSigningTime,stringObjectMap.get("time"))
.eq(HouseholdContract::getSequenceNbr,stringObjectMap.get("sequenceNbr"));
householdContractMapper.update(null,wrapper);
}
log.info("================电子合同时间更新完成=========================");
}
private void dealKcTime() {
log.info("================开始初始勘察时间=========================");
List<Map<String,Object>> kcCreateTime = powerStationMapper.getKcCreateTime();
for (Map<String, Object> stringObjectMap : kcCreateTime) {
LambdaUpdateWrapper<PowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(PowerStation::getKcCreateTime,stringObjectMap.get("time"))
.eq(PowerStation::getProcessInstanceId,stringObjectMap.get("processInstanceId"));
powerStationMapper.update(null,wrapper);
}
List<Map<String,Object>> kcEndTime = powerStationMapper.getKcEndTime();
for (Map<String, Object> stringObjectMap : kcEndTime) {
LambdaUpdateWrapper<PowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(PowerStation::getKcEndTime,stringObjectMap.get("time"))
.eq(PowerStation::getProcessInstanceId,stringObjectMap.get("processInstanceId"));
powerStationMapper.update(null,wrapper);
}
log.info("================勘察时间更新完成=========================");
dealSjTime();
}
/**
* 新增农户信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/initpw")
@ApiOperation(httpMethod = "GET", value = "新增农户信息", notes = "新增农户信息")
public ResponseModel<Object> initpw() {
// 经销商管理员
List<UnitInfo> list = unitInfoMapper.selectList(null);
for (UnitInfo unitInfo : list) {
try {
int ph = unitInfo.getAdminPhone().length();
String npwd = "Zxnk_" + unitInfo.getAdminPhone().substring(ph - 4, ph);
String npwdm = AesUtil.encode(npwd, "qaz");
unitInfo.setAdminLoginPwd(npwdm);
FeignClientResult<AgencyUserModel> re = Privilege.agencyUserClient
.queryByUserId(unitInfo.getAdminUserId());
AgencyUserModel ag = re.getResult();
ag.setPassword(AesUtil.encode(npwd, "qaz"));
ag.setRePassword(AesUtil.encode(npwd, "qaz"));
Privilege.agencyUserClient.restorePassword(unitInfo.getAdminUserId());
ag.setOriginalPassword(AesUtil.encode("Z2%Op9.q", "qaz"));
Privilege.agencyUserClient.modifyPassword(unitInfo.getAdminUserId(), ag);
unitInfoMapper.updateById(unitInfo);
} catch (Exception e) {
e.printStackTrace();
}
}
// 经销商子人员
List<PublicAgencyUser> list2 = publicAgencyUserMapper.selectList(null);
for (PublicAgencyUser unitInfo : list2) {
try {
int ph = unitInfo.getEmergencyTelephone().length();
String npwd = "Zxnk_" + unitInfo.getEmergencyTelephone().substring(ph - 4, ph);
String npwdm = AesUtil.encode(npwd, "qaz");
unitInfo.setPassword(npwdm);
FeignClientResult<AgencyUserModel> re = Privilege.agencyUserClient
.queryByUserId(unitInfo.getAmosUserId());
AgencyUserModel ag = re.getResult();
ag.setPassword(AesUtil.encode(npwd, "qaz"));
ag.setRePassword(AesUtil.encode(npwd, "qaz"));
Privilege.agencyUserClient.restorePassword(unitInfo.getAmosUserId());
ag.setOriginalPassword(AesUtil.encode("Z2%Op9.q", "qaz"));
Privilege.agencyUserClient.modifyPassword(unitInfo.getAmosUserId(), ag);
publicAgencyUserMapper.updateById(unitInfo);
} catch (Exception e) {
e.printStackTrace();
}
}
return CommonResponseNewUtil.success();
}
private static final String regionRedis = "app_region_redis";
@Autowired
UnitInfoMapper unitInfoMapper;
@Autowired
PublicAgencyUserMapper publicAgencyUserMapper;
@Autowired
PowerStationMapper powerStationMapper;
@Autowired
QiyuesuoServiceImpl qiyuesuoService;
@Autowired
HouseholdContractMapper householdContractMapper;
@Autowired
WorkOrderPowerStationMapper workOrderPowerStationMapper;
@Autowired
BasicGridRecordMapper basicGridRecordMapper;
@Autowired
AcceptanceCheckMapper acceptanceCheckMapper;
@Autowired
FinancingInfoMapper financingInfoMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/initTime")
@ApiOperation(httpMethod = "GET", value = "初始时间", notes = "初始时间")
public ResponseModel<Object> initTime() {
// 创建线程池
ExecutorService executorService = Executors.newFixedThreadPool(5);
// 提交不同的方法
executorService.submit(this::dealKcTime);
executorService.submit(this::dealDzhtqyTime);
executorService.submit(this::dealSgTime);
executorService.submit(this::dealBwTime);
executorService.submit(this::dealYsTime);
executorService.submit(this::dealTrTime);
// 关闭线程池
executorService.shutdown();
return CommonResponseNewUtil.success();
}
private void dealTrTime() {
log.info("================开始初始投融时间=========================");
List<Map<String, Object>> trCreateTime = financingInfoMapper.getTrCreateTime();
for (Map<String, Object> stringObjectMap : trCreateTime) {
LambdaUpdateWrapper<FinancingInfo> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(FinancingInfo::getTrCreateTime, stringObjectMap.get("time"))
.eq(FinancingInfo::getSequenceNbr, stringObjectMap.get("sequenceNbr"));
financingInfoMapper.update(null, wrapper);
}
List<Map<String, Object>> trEndTime = financingInfoMapper.getTrEndTime();
for (Map<String, Object> stringObjectMap : trEndTime) {
LambdaUpdateWrapper<FinancingInfo> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(FinancingInfo::getTrEndTime, stringObjectMap.get("time"))
.eq(FinancingInfo::getSequenceNbr, stringObjectMap.get("sequenceNbr"));
financingInfoMapper.update(null, wrapper);
}
log.info("================投融时间更新完成=========================");
}
private void dealYsTime() {
log.info("================开始初始验收时间=========================");
List<Map<String, Object>> ysCreateTime = acceptanceCheckMapper.getYsCreateTime();
for (Map<String, Object> stringObjectMap : ysCreateTime) {
LambdaUpdateWrapper<AcceptanceCheck> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(AcceptanceCheck::getYsCreateTime, dealHour(stringObjectMap.get("time")))
.eq(AcceptanceCheck::getInstanceId, stringObjectMap.get("processInstanceId"));
acceptanceCheckMapper.update(null, wrapper);
}
List<Map<String, Object>> ysEndTime = acceptanceCheckMapper.getYsEndTime();
for (Map<String, Object> stringObjectMap : ysEndTime) {
LambdaUpdateWrapper<AcceptanceCheck> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(AcceptanceCheck::getYsEndTime, stringObjectMap.get("time"))
.eq(AcceptanceCheck::getSequenceNbr, stringObjectMap.get("sequenceNbr"));
acceptanceCheckMapper.update(null, wrapper);
}
log.info("================验收时间更新完成=========================");
}
private void dealBwTime() {
log.info("================开始初始并网时间=========================");
List<Map<String, Object>> bwCreateTime = basicGridRecordMapper.getBwCreateTime();
for (Map<String, Object> stringObjectMap : bwCreateTime) {
LambdaUpdateWrapper<BasicGridRecord> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(BasicGridRecord::getBwCreateTime, dealHour(stringObjectMap.get("time")))
.eq(BasicGridRecord::getInstanceId, stringObjectMap.get("processInstanceId"));
basicGridRecordMapper.update(null, wrapper);
}
List<Map<String, Object>> bwEndTime = basicGridRecordMapper.getBwEndTime();
for (Map<String, Object> stringObjectMap : bwEndTime) {
LambdaUpdateWrapper<BasicGridRecord> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(BasicGridRecord::getBwEndTime, stringObjectMap.get("time"))
.eq(BasicGridRecord::getSequenceNbr, stringObjectMap.get("sequenceNbr"));
basicGridRecordMapper.update(null, wrapper);
}
log.info("================并网时间更新完成=========================");
}
private void dealSgTime() {
log.info("================开始初始施工时间=========================");
List<Map<String, Object>> sgCreateTime = workOrderPowerStationMapper.getSgCreateTime();
for (Map<String, Object> stringObjectMap : sgCreateTime) {
LambdaUpdateWrapper<WorkOrderPowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(WorkOrderPowerStation::getSgCreateTime, DateUtils.dateParse(String.valueOf(stringObjectMap.get("time"))))
.eq(WorkOrderPowerStation::getWorkOrderId, stringObjectMap.get("workOrderId"));
workOrderPowerStationMapper.update(null, wrapper);
}
List<Map<String, Object>> sgEndTime = workOrderPowerStationMapper.getSgEndTime();
for (Map<String, Object> stringObjectMap : sgEndTime) {
LambdaUpdateWrapper<WorkOrderPowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(WorkOrderPowerStation::getSgEndTime, stringObjectMap.get("time"))
.eq(WorkOrderPowerStation::getSequenceNbr, stringObjectMap.get("sequenceNbr"));
workOrderPowerStationMapper.update(null, wrapper);
}
log.info("================施工时间更新完成=========================");
}
private void dealSjTime() {
log.info("================开始初始设计时间=========================");
List<Map<String, Object>> sjCreateTime = powerStationMapper.getSjCreateTime();
for (Map<String, Object> stringObjectMap : sjCreateTime) {
LambdaUpdateWrapper<PowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(PowerStation::getSjCreateTime, dealHour(stringObjectMap.get("time")))
.eq(PowerStation::getProcessInstanceId, stringObjectMap.get("processInstanceId"));
powerStationMapper.update(null, wrapper);
}
List<Map<String, Object>> sjEndTime = powerStationMapper.getSjEndTime();
for (Map<String, Object> stringObjectMap : sjEndTime) {
LambdaUpdateWrapper<PowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(PowerStation::getSjEndTime, dealHour(stringObjectMap.get("time")))
.eq(PowerStation::getProcessInstanceId, stringObjectMap.get("processInstanceId"));
powerStationMapper.update(null, wrapper);
}
log.info("================设计时间更新完成=========================");
}
private void dealDzhtqyTime() {
log.info("================开始初始电子合同时间=========================");
Map<Long, Contract> contractMap = qiyuesuoService.getContractMap();
contractMap.forEach((k, v) -> {
LambdaUpdateWrapper<HouseholdContract> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(HouseholdContract::getDzhtqyCreateTime, DateUtils.dateParse(v.getPublishTime()))
.eq(HouseholdContract::getContractLockId, k);
householdContractMapper.update(null, wrapper);
});
List<Map<String, Object>> dzhtqyEndTime = householdContractMapper.getDzhtqyEndTime();
for (Map<String, Object> stringObjectMap : dzhtqyEndTime) {
LambdaUpdateWrapper<HouseholdContract> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(HouseholdContract::getSigningTime, stringObjectMap.get("time"))
.eq(HouseholdContract::getSequenceNbr, stringObjectMap.get("sequenceNbr"));
householdContractMapper.update(null, wrapper);
}
log.info("================电子合同时间更新完成=========================");
}
private Date dealHour(Object dateString) {
if(Objects.isNull(dateString)){
return null;
}
// 转换为 LocalDateTime
LocalDateTime localDateTime = LocalDateTime.parse(String.valueOf(dateString));
// 转换为 Date
Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
// 加8小时
calendar.add(Calendar.HOUR_OF_DAY, 8);
return calendar.getTime();
}
private void dealKcTime() {
log.info("================开始初始勘察时间=========================");
List<Map<String, Object>> kcCreateTime = powerStationMapper.getKcCreateTime();
for (Map<String, Object> stringObjectMap : kcCreateTime) {
LambdaUpdateWrapper<PowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(PowerStation::getKcCreateTime, dealHour(stringObjectMap.get("time")))
.eq(PowerStation::getProcessInstanceId, stringObjectMap.get("processInstanceId"));
powerStationMapper.update(null, wrapper);
}
List<Map<String, Object>> kcEndTime = powerStationMapper.getKcEndTime();
for (Map<String, Object> stringObjectMap : kcEndTime) {
LambdaUpdateWrapper<PowerStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(PowerStation::getKcEndTime, dealHour(stringObjectMap.get("time")))
.eq(PowerStation::getProcessInstanceId, stringObjectMap.get("processInstanceId"));
powerStationMapper.update(null, wrapper);
}
log.info("================勘察时间更新完成=========================");
dealSjTime();
}
/**
* 新增农户信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/initpw")
@ApiOperation(httpMethod = "GET", value = "新增农户信息", notes = "新增农户信息")
public ResponseModel<Object> initpw() {
// 经销商管理员
List<UnitInfo> list = unitInfoMapper.selectList(null);
for (UnitInfo unitInfo : list) {
try {
int ph = unitInfo.getAdminPhone().length();
String npwd = "Zxnk_" + unitInfo.getAdminPhone().substring(ph - 4, ph);
String npwdm = AesUtil.encode(npwd, "qaz");
unitInfo.setAdminLoginPwd(npwdm);
FeignClientResult<AgencyUserModel> re = Privilege.agencyUserClient
.queryByUserId(unitInfo.getAdminUserId());
AgencyUserModel ag = re.getResult();
ag.setPassword(AesUtil.encode(npwd, "qaz"));
ag.setRePassword(AesUtil.encode(npwd, "qaz"));
Privilege.agencyUserClient.restorePassword(unitInfo.getAdminUserId());
ag.setOriginalPassword(AesUtil.encode("Z2%Op9.q", "qaz"));
Privilege.agencyUserClient.modifyPassword(unitInfo.getAdminUserId(), ag);
unitInfoMapper.updateById(unitInfo);
} catch (Exception e) {
e.printStackTrace();
}
}
// 经销商子人员
List<PublicAgencyUser> list2 = publicAgencyUserMapper.selectList(null);
for (PublicAgencyUser unitInfo : list2) {
try {
int ph = unitInfo.getEmergencyTelephone().length();
String npwd = "Zxnk_" + unitInfo.getEmergencyTelephone().substring(ph - 4, ph);
String npwdm = AesUtil.encode(npwd, "qaz");
unitInfo.setPassword(npwdm);
FeignClientResult<AgencyUserModel> re = Privilege.agencyUserClient
.queryByUserId(unitInfo.getAmosUserId());
AgencyUserModel ag = re.getResult();
ag.setPassword(AesUtil.encode(npwd, "qaz"));
ag.setRePassword(AesUtil.encode(npwd, "qaz"));
Privilege.agencyUserClient.restorePassword(unitInfo.getAmosUserId());
ag.setOriginalPassword(AesUtil.encode("Z2%Op9.q", "qaz"));
Privilege.agencyUserClient.modifyPassword(unitInfo.getAmosUserId(), ag);
publicAgencyUserMapper.updateById(unitInfo);
} catch (Exception e) {
e.printStackTrace();
}
}
return CommonResponseNewUtil.success();
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.biz.excel.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Map;
@Getter
@AllArgsConstructor
public enum BusinessTypeEnum {
BASIC_INFORMATION("基本信息"),
SURVEY_INFORMATION("勘察信息"),
DESIGN_INFORMATION("设计信息"),
BUSINESS_INFORMATION("商务信息"),
EXTENDED_INFORMATION("扩展信息"),
ARCHIVING_INFORMATION("资料归档"),
ENGINEERING_INFORMATION("工程信息"),
GRID_INFORMATION("并网信息"),
DISPATCH_ORDER_INFORMATION("派工单信息"),
;
private String name;
public static BusinessTypeEnum getEnumByName(String name) {
for (BusinessTypeEnum businessTypeEnum : BusinessTypeEnum.values()) {
if (businessTypeEnum.getName().equals(name)) {
return businessTypeEnum;
}
}
return null;
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ExportPageEnum {
DZJXZ("0", "电站进行中"),
DZBTG("1", "电站不通过"),
DZWC("2", "电站完成"),
TRDTS("3", "投融待推送"),
TRWTG("4", "投融未通过"),
TRYFK("5", "投融已放款"),
TRDFK("6", "投融待放款"),
TRYTS("7", "投融已推送"),
RZDSH("8", "融资待审核"),
RZDFK("9", "融资待放款"),
RZYFK("10", "融资已放款"),
RZWTG("11", "融资未通过"),
SGYS("12", "施工验收"),
BWYS("13", "并网验收"),
YSSH("14", "验收审核"),
FHDFH("15", "发货待发货"),
FHYFH("16", "发货已发货"),
UN_KNOW("","未识别的类型")
;
private String code;
private String remark;
public static ExportPageEnum getEnumByCode(String code) {
for (ExportPageEnum exportPageEnum : ExportPageEnum.values()) {
if (exportPageEnum.getCode().equals(code)) {
return exportPageEnum;
}
}
return UN_KNOW;
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.factory;
import com.yeejoin.amos.boot.module.hygf.biz.excel.Enum.ExportPageEnum;
import com.yeejoin.amos.boot.module.hygf.biz.excel.impl.*;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
@Component
public class ExportPageFactory {
@Autowired
private DzjxzServiceImpl dzjxzService;
@Autowired
private DzbtgServiceImpl dzbtgService;
@Autowired
private DzwcServiceImpl dzwcService;
@Autowired
private TrdtsServiceImpl trdtsService;
@Autowired
private TrwtgServiceImpl trwtgService;
@Autowired
private TryfkServiceImpl tryfkService;
@Autowired
private TrdfkServiceImpl trdfkService;
@Autowired
private TrytsServiceImpl trytsService;
@Autowired
private RzdshServiceImpl rzdshService;
@Autowired
private RzdfkServiceImpl rzdfkService;
@Autowired
private RzyfkServiceImpl rzyfkService;
@Autowired
private RzwtgServiceImpl rzwtgService;
@Autowired
private SgysServiceImpl sgysService;
@Autowired
private BwysServiceImpl bwysService;
@Autowired
private YsshServiceImpl ysshService;
@Autowired
private FhdfhServiceImpl fhdfhService;
@Autowired
private FhyfhServiceImpl fhyfhService;
public IExportPageService getExportPage(ExportPageEnum dataType) {
switch (dataType) {
case DZJXZ:
return dzjxzService;
case DZBTG:
return dzbtgService;
case DZWC:
return dzwcService;
case TRDTS:
return trdtsService;
case TRWTG:
return trwtgService;
case TRYFK:
return tryfkService;
case TRDFK:
return trdfkService;
case TRYTS:
return trytsService;
case RZDSH:
return rzdshService;
case RZDFK:
return rzdfkService;
case RZYFK:
return rzyfkService;
case RZWTG:
return rzwtgService;
case SGYS:
return sgysService;
case BWYS:
return bwysService;
case YSSH:
return ysshService;
case FHDFH:
return fhdfhService;
case FHYFH:
return fhyfhService;
default:
throw new BadRequest("没有找到匹配的页面类型");
}
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.WorkOrderPage;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class BwysServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Value("${admin.engineering.roleId}")
Long engineeringId;
@Value("${admin.area.roleId}")
Long areaId;
@Value("${admin.design.roleId}")
Long designId;
@Value("${admin.delerAdmin.roleId}")
Long delerAdminId;
@Override
public List<String> getStationId(Map<String, Object> filters) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
List<String> basicGridNodes = new ArrayList<>();
List<Long> roleIds = new ArrayList<>();
for (Long aLong : reginParams.getUserModel().getOrgRoleSeqs().keySet()) {
List<Long> longs = reginParams.getUserModel().getOrgRoleSeqs().get(aLong);
roleIds.addAll(longs);
if (longs.contains(areaId)) {
basicGridNodes.add("bw-area");
}
if (longs.contains(engineeringId)) {
basicGridNodes.add("bw-engineering");
}
if (longs.contains(designId)) {
basicGridNodes.add("bw-design");
}
if (longs.contains(delerAdminId)) {
basicGridNodes.add("bw-design");
basicGridNodes.add("bw-engineering");
basicGridNodes.add("bw-area");
}
}
Map<String, Object> map = new HashMap<>();
map.put("basicGridNodes", basicGridNodes);
map.put("type", "1");
if (Objects.nonNull(filters)) {
map.putAll(filters);
}
return businessFieldMapper.getBwysStationId(map);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationProcessStateEnum;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service
public class DzbtgServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Override
public List<String> getStationId(Map<String, Object> filters) {
Map<String, Object> map = new HashMap<>();
map.put("processStatus", PowerStationProcessStateEnum.不通过.getName());
if (Objects.nonNull(filters)) {
map.putAll(filters);
}
return businessFieldMapper.getDzStationIdByProcessStatus(map);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationProcessStateEnum;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class DzjxzServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Override
public List<String> getStationId(Map<String, Object> filters) {
Map<String, Object> map = new HashMap<>();
map.put("processStatus", PowerStationProcessStateEnum.进行中.getName());
if (Objects.nonNull(filters)) {
map.putAll(filters);
}
return businessFieldMapper.getDzStationIdByProcessStatus(map);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationProcessStateEnum;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class DzwcServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Override
public List<String> getStationId(Map<String, Object> filters) {
Map<String, Object> map = new HashMap<>();
map.put("processStatus", PowerStationProcessStateEnum.完成.getName());
if (Objects.nonNull(filters)) {
map.putAll(filters);
}
return businessFieldMapper.getDzStationIdByProcessStatus(map);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service
public class FhdfhServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Override
public List<String> getStationId(Map<String, Object> filters) {
Map<String, Object> map = new HashMap<>();
map.put("preparationMoneyState", "0");
if (Objects.nonNull(filters)) {
map.putAll(filters);
map.put("regionalCompaniesSeq",filters.get("regionalcompaniesSeq"));
}
return businessFieldMapper.getFhStationId(map);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service
public class FhyfhServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Override
public List<String> getStationId(Map<String, Object> filters) {
Map<String, Object> map = new HashMap<>();
map.put("preparationMoneyState", "1");
if (Objects.nonNull(filters)) {
map.putAll(filters);
map.put("regionalCompaniesSeq",filters.get("regionalcompaniesSeq"));
}
return businessFieldMapper.getFhStationId(map);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class RzdfkServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Override
public List<String> getStationId(Map<String, Object> filters) {
StdUserEmpower orgCode = (StdUserEmpower) redisUtils.get("Emp_" + RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
List<String> amosOrgCodes = orgCode.getAmosOrgCode();
Map<String, Object> params = new HashMap<>();
String status = "审核通过";
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
Long sequenceNbr = reginParams.getCompany().getSequenceNbr();
params.put("financingCompaniesSeq", String.valueOf(sequenceNbr));
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
params.put("status", Objects.isNull(filters.get("status")) ? Arrays.asList(status.split(",")) : Arrays.asList(filters.get("status")));
params.put("type", "2");
return businessFieldMapper.getTrStationIdByStatus(params, amosOrgCodes);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class RzdshServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Override
public List<String> getStationId(Map<String, Object> filters) {
StdUserEmpower orgCode = (StdUserEmpower) redisUtils.get("Emp_" + RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
List<String> amosOrgCodes = orgCode.getAmosOrgCode();
Map<String, Object> params = new HashMap<>();
String status="待融资审核";
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
Long sequenceNbr = reginParams.getCompany().getSequenceNbr();
params.put("financingCompaniesSeq", String.valueOf(sequenceNbr));
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
params.put("status", Objects.isNull(filters.get("status")) ? Arrays.asList(status.split(",")) : Arrays.asList(filters.get("status")));
params.put("type", "2");
return businessFieldMapper.getTrStationIdByStatus(params,amosOrgCodes);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class RzwtgServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Override
public List<String> getStationId(Map<String, Object> filters) {
StdUserEmpower orgCode = (StdUserEmpower) redisUtils.get("Emp_" + RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
List<String> amosOrgCodes = orgCode.getAmosOrgCode();
Map<String, Object> params = new HashMap<>();
String status="审核不通过,重新验收";
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
Long sequenceNbr = reginParams.getCompany().getSequenceNbr();
params.put("financingCompaniesSeq", String.valueOf(sequenceNbr));
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
params.put("status", Objects.isNull(filters.get("status")) ? Arrays.asList(status.split(",")) : Arrays.asList(filters.get("status")));
params.put("type", "2");
return businessFieldMapper.getTrStationIdByStatus(params,amosOrgCodes);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class RzyfkServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Override
public List<String> getStationId(Map<String, Object> filters) {
StdUserEmpower orgCode = (StdUserEmpower) redisUtils.get("Emp_" + RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
List<String> amosOrgCodes = orgCode.getAmosOrgCode();
Map<String, Object> params = new HashMap<>();
String status="已放款,放款完成";
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
Long sequenceNbr = reginParams.getCompany().getSequenceNbr();
params.put("financingCompaniesSeq", String.valueOf(sequenceNbr));
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
params.put("status", Objects.isNull(filters.get("status")) ? Arrays.asList(status.split(",")) : Arrays.asList(filters.get("status")));
params.put("type", "2");
return businessFieldMapper.getTrStationIdByStatus(params,amosOrgCodes);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.WorkOrderPage;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class SgysServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Value("${admin.engineering.roleId}")
Long engineeringId;
@Value("${admin.area.roleId}")
Long areaId;
@Value("${admin.design.roleId}")
Long designId;
@Value("${admin.delerAdmin.roleId}")
Long delerAdminId;
@Override
public List<String> getStationId(Map<String, Object> filters) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
List<String> workOrderPowerStationNodes = new ArrayList<>();
Map<String,Object> map =new HashMap<>();
List<Long> roleIds = new ArrayList<>();
for (Long aLong : reginParams.getUserModel().getOrgRoleSeqs().keySet()) {
List<Long> longs = reginParams.getUserModel().getOrgRoleSeqs().get(aLong);
if (longs.contains(areaId)) {
workOrderPowerStationNodes.add("area");
}
if (longs.contains(engineeringId)) {
workOrderPowerStationNodes.add("engineering");
}
if (longs.contains(designId)) {
workOrderPowerStationNodes.add("design");
}
if (longs.contains(delerAdminId)) {
workOrderPowerStationNodes.add("design");
workOrderPowerStationNodes.add("engineering");
workOrderPowerStationNodes.add("area");
}
roleIds.addAll(longs);
}
map.put("workOrderPowerStationNodes",workOrderPowerStationNodes);
if (Objects.nonNull(filters)) {
map.putAll(filters);
}
return businessFieldMapper.getSgysStationId(map);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class TrdfkServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Override
public List<String> getStationId(Map<String, Object> filters) {
StdUserEmpower orgCode = (StdUserEmpower) redisUtils.get("Emp_" + RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
List<String> amosOrgCodes = orgCode.getAmosOrgCode();
Map<String, Object> params = new HashMap<>();
String status = "审核通过";
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
params.put("status", Objects.isNull(filters.get("status")) ? Arrays.asList(status.split(",")) : Arrays.asList(filters.get("status")));
params.put("type", "1");
return businessFieldMapper.getTrStationIdByStatus(params, amosOrgCodes);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class TrdtsServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Override
public List<String> getStationId(Map<String, Object> filters) {
StdUserEmpower orgCode = (StdUserEmpower) redisUtils.get("Emp_" + RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
List<String> amosOrgCodes = orgCode.getAmosOrgCode();
Map<String, Object> params = new HashMap<>();
String status="待推送";
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
params.put("status", Objects.isNull(filters.get("status")) ? Arrays.asList(status.split(",")) : Arrays.asList(filters.get("status")));
params.put("type", "1");
return businessFieldMapper.getTrStationIdByStatus(params,amosOrgCodes);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class TrwtgServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Override
public List<String> getStationId(Map<String, Object> filters) {
StdUserEmpower orgCode = (StdUserEmpower) redisUtils.get("Emp_" + RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
List<String> amosOrgCodes = orgCode.getAmosOrgCode();
Map<String, Object> params = new HashMap<>();
String status="审核不通过,重新验收";
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
params.put("status", Objects.isNull(filters.get("status")) ? Arrays.asList(status.split(",")) : Arrays.asList(filters.get("status")));
params.put("type", "1");
return businessFieldMapper.getTrStationIdByStatus(params,amosOrgCodes);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class TryfkServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Override
public List<String> getStationId(Map<String, Object> filters) {
StdUserEmpower orgCode = (StdUserEmpower) redisUtils.get("Emp_" + RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
List<String> amosOrgCodes = orgCode.getAmosOrgCode();
Map<String, Object> params = new HashMap<>();
String status="放款完成";
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
params.put("status", Objects.isNull(filters.get("status")) ? Arrays.asList(status.split(",")) : Arrays.asList(filters.get("status")));
params.put("type", "1");
return businessFieldMapper.getTrStationIdByStatus(params,amosOrgCodes);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class TrytsServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Override
public List<String> getStationId(Map<String, Object> filters) {
StdUserEmpower orgCode = (StdUserEmpower) redisUtils.get("Emp_" + RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
List<String> amosOrgCodes = orgCode.getAmosOrgCode();
Map<String, Object> params = new HashMap<>();
String status="待融资审核";
if(Objects.nonNull(filters)){
params.putAll(filters);
}
params.put("status", Objects.isNull(filters.get("status")) ? Arrays.asList(status.split(",")) : Arrays.asList(filters.get("status")));
params.put("type", "1");
return businessFieldMapper.getTrStationIdByStatus(params,amosOrgCodes);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.biz.excel.service.IExportPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service
public class YsshServiceImpl implements IExportPageService {
@Autowired
private BusinessFieldMapper businessFieldMapper;
@Autowired
private RedisUtils redisUtils;
@Value("${admin.tourong.roleId}")
Long tourongId;
@Value("${admin.fawu.roleId}")
Long fawuId;
@Value("${admin.area.roleId}")
Long areaId;
@Value("${admin.zichan.roleId}")
Long zichanId;
@Value("${admin.delerAdmin.roleId}")
Long delerAdminId;
@Override
public List<String> getStationId(Map<String, Object> filters) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
List<String> basicGridNodes = new ArrayList<>();
List<Long> roleIds = new ArrayList<>();
for (Long aLong : reginParams.getUserModel().getOrgRoleSeqs().keySet()) {
List<Long> longs = reginParams.getUserModel().getOrgRoleSeqs().get(aLong);
roleIds.addAll(longs);
if (longs.contains(areaId)) {
basicGridNodes.add("ys-area");
}
if (longs.contains(tourongId)) {
basicGridNodes.add("ys-tourong");
}
if (longs.contains(fawuId)) {
basicGridNodes.add("ys-fawu");
}
if (longs.contains(zichanId)) {
basicGridNodes.add("ys-zichan");
}
if (longs.contains(delerAdminId)) {
basicGridNodes.add("ys-tourong");
basicGridNodes.add("ys-area");
basicGridNodes.add("ys-fawu");
basicGridNodes.add("ys-zichan");
}
}
Map<String, Object> map = new HashMap<>();
map.put("basicGridNodes",basicGridNodes);
map.put("type","1");
if(Objects.nonNull(filters)){
map.putAll(filters);
}
return businessFieldMapper.getYsshStationId(map);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.excel.service;
import java.util.List;
import java.util.Map;
public interface IExportPageService {
/**
* 根据条件获取场站Id
* @param filters
* @return
*/
List<String> getStationId(Map<String, Object> filters);
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.CommonEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.BusinessFieldDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.StationFieldDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.HygfBusinessField;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BusinessFieldMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IBusinessFieldService;
import com.yeejoin.amos.boot.module.hygf.api.util.ListUtils;
import com.yeejoin.amos.boot.module.hygf.biz.excel.Enum.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.hygf.biz.excel.Enum.ExportPageEnum;
import com.yeejoin.amos.boot.module.hygf.biz.excel.factory.ExportPageFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
public class BusinessFieldServiceImpl extends BaseService<BusinessFieldDto, HygfBusinessField, BusinessFieldMapper> implements IBusinessFieldService {
@Autowired
private ExportPageFactory exportPageFactory;
@Autowired
private BusinessFieldMapper businessFieldMapper;
public Map<String, List<HygfBusinessField>> getAllField() {
Map<String, List<HygfBusinessField>> map = new HashMap<>();
List<HygfBusinessField> list = list();
if (CollectionUtil.isNotEmpty(list)) {
map = list.stream().collect(Collectors.groupingBy(HygfBusinessField::getBusinessType));
}
return map;
}
public void exportStationExcelByField(StationFieldDto stationFieldDto, HttpServletResponse response) {
dealInitData(stationFieldDto);
List<String> fields = getHeaderFields(stationFieldDto);
List<String> fieldsFlag = getFieldsFlag(stationFieldDto);
List<Map<String, Object>> data = getExcelData(stationFieldDto);
exportFieldExcel(fields, fieldsFlag, data, response);
}
/**
* 获取字段标识
* @param stationFieldDto
* @return
*/
private List<String> getFieldsFlag(StationFieldDto stationFieldDto) {
List<String> fieldsFlag = new ArrayList<>();
List<HygfBusinessField> businessFieldList = stationFieldDto.getBusinessFieldList();
for (HygfBusinessField businessField : businessFieldList) {
fieldsFlag.add(businessField.getFieldName() + "_" + businessField.getBusinessName());
}
return fieldsFlag;
}
/**
* 导出动态字段Excel
* @param fields
* @param fieldsFlag
* @param data
* @param response
*/
private void exportFieldExcel(List<String> fields, List<String> fieldsFlag, List<Map<String, Object>> data, HttpServletResponse response) {
// 创建工作簿和工作表
Workbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet("电站统计");
// 创建表头
Row headerRow = sheet.createRow(0);
for (int i = 0; i < fields.size(); i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(fields.get(i));
}
// 设置表头样式
if (headerRow != null) {
CellStyle headerStyle = workbook.createCellStyle();
Font font = workbook.createFont();
font.setBold(true); // 加粗
headerStyle.setFont(font);
headerStyle.setFillForegroundColor(IndexedColors.SKY_BLUE.getIndex()); // 背景色
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); // 填充模式
// 设置居中对齐
headerStyle.setAlignment(HorizontalAlignment.CENTER);
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
// 设置表头每个单元格的样式
for (int i = 0; i < headerRow.getPhysicalNumberOfCells(); i++) {
Cell cell = headerRow.getCell(i);
if (cell != null) {
cell.setCellStyle(headerStyle);
}
}
}
// 调整列宽
for (int colNum = 0; colNum < sheet.getRow(0).getPhysicalNumberOfCells(); colNum++) {
sheet.setColumnWidth(colNum, 25 * 256);
}
// 填充数据
for (int i = 0; i < data.size(); i++) {
Row row = sheet.createRow(i + 1);
for (int j = 0; j < fieldsFlag.size(); j++) {
Object value = data.get(i).get(fieldsFlag.get(j));
if (Objects.nonNull(value) && value.toString().length() >= 32767) {
value = value.toString().substring(0, 32766);
}
row.createCell(j).setCellValue(value != null ? value.toString() : "");
}
}
try {
String fileName = "电站详情统计" + DateUtils.dateFormat(new Date(), "YYYY-MM-dd-HH-mm") + ".xlsx";
downLoadExcel(fileName, response, workbook);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BadRequest("导出excel失败");
}
}
/**
* 处理初始数据
* @param stationFieldDto
*/
private void dealInitData(StationFieldDto stationFieldDto) {
if (CollectionUtil.isEmpty(stationFieldDto.getStationIdList())) {
stationFieldDto.setStationIdList(exportPageFactory.getExportPage(ExportPageEnum.getEnumByCode(stationFieldDto.getExportPageCode())).getStationId(stationFieldDto.getFilters()));
}
if (CollectionUtil.isEmpty(stationFieldDto.getBusinessIdList())) {
stationFieldDto.setBusinessFieldList(list());
} else {
stationFieldDto.setBusinessFieldList(this.baseMapper.selectBatchIds(stationFieldDto.getBusinessIdList()));
}
}
private void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
workbook.write(response.getOutputStream());
}
/**
* 获取excel第一行数据
* @param stationFieldDto
* @return
*/
private List<String> getHeaderFields(StationFieldDto stationFieldDto) {
List<String> headerFields = new ArrayList<>();
List<HygfBusinessField> businessFieldList = stationFieldDto.getBusinessFieldList();
for (HygfBusinessField businessField : businessFieldList) {
headerFields.add(businessField.getFieldName());
}
return headerFields;
}
/**
* 获取Excel数据
* @param stationFieldDto
* @return
*/
private List<Map<String, Object>> getExcelData(StationFieldDto stationFieldDto) {
List<Map<String, Object>> data = new ArrayList<>();
Map<String, List<HygfBusinessField>> businessTypeMap = stationFieldDto.getBusinessFieldList().stream().collect(Collectors.groupingBy(HygfBusinessField::getBusinessName));
List<String> stationIdList = stationFieldDto.getStationIdList();
if (CollectionUtil.isEmpty(stationIdList)) {
return data;
}
Map<String, Map<String, Object>> basicInformation = new HashMap<>();
Map<String, Map<String, Object>> surveyInformation = new HashMap<>();
Map<String, Map<String, Object>> designInformation = new HashMap<>();
Map<String, Map<String, Object>> businessInformation = new HashMap<>();
Map<String, Map<String, Object>> extendedInformation = new HashMap<>();
Map<String, Map<String, Object>> archivingInformation = new HashMap<>();
Map<String, Map<String, Object>> engineeringInformation = new HashMap<>();
Map<String, Map<String, Object>> gridInformation = new HashMap<>();
Map<String, Map<String, Object>> dispatchOrderInformation = new HashMap<>();
if (stationIdList.size() < 1000) {
basicInformation = getBasicInformation(stationIdList, businessTypeMap.get(BusinessTypeEnum.BASIC_INFORMATION.getName()));
surveyInformation = getSurveyInformation(stationIdList, businessTypeMap.get(BusinessTypeEnum.SURVEY_INFORMATION.getName()));
designInformation = getDesignInformation(stationIdList, businessTypeMap.get(BusinessTypeEnum.DESIGN_INFORMATION.getName()));
businessInformation = getBusinessInformation(stationIdList, businessTypeMap.get(BusinessTypeEnum.BUSINESS_INFORMATION.getName()));
extendedInformation = getExtendedInformation(stationIdList, businessTypeMap.get(BusinessTypeEnum.EXTENDED_INFORMATION.getName()));
archivingInformation = getArchivingInformation(stationIdList, businessTypeMap.get(BusinessTypeEnum.ARCHIVING_INFORMATION.getName()));
engineeringInformation = getEngineeringInformation(stationIdList, businessTypeMap.get(BusinessTypeEnum.ENGINEERING_INFORMATION.getName()));
gridInformation = getGridInformation(stationIdList, businessTypeMap.get(BusinessTypeEnum.GRID_INFORMATION.getName()));
dispatchOrderInformation = getDispatchOrderInformation(stationIdList, businessTypeMap.get(BusinessTypeEnum.DISPATCH_ORDER_INFORMATION.getName()));
} else {
List<List<String>> lists = ListUtils.splitList(stationIdList, 1000);
for (List<String> list : lists) {
basicInformation.putAll(getBasicInformation(list, businessTypeMap.get(BusinessTypeEnum.BASIC_INFORMATION.getName())));
surveyInformation.putAll(getSurveyInformation(list, businessTypeMap.get(BusinessTypeEnum.SURVEY_INFORMATION.getName())));
designInformation.putAll(getDesignInformation(list, businessTypeMap.get(BusinessTypeEnum.DESIGN_INFORMATION.getName())));
businessInformation.putAll(getBusinessInformation(list, businessTypeMap.get(BusinessTypeEnum.BUSINESS_INFORMATION.getName())));
extendedInformation.putAll(getExtendedInformation(list, businessTypeMap.get(BusinessTypeEnum.EXTENDED_INFORMATION.getName())));
archivingInformation.putAll(getArchivingInformation(list, businessTypeMap.get(BusinessTypeEnum.ARCHIVING_INFORMATION.getName())));
engineeringInformation.putAll(getEngineeringInformation(list, businessTypeMap.get(BusinessTypeEnum.ENGINEERING_INFORMATION.getName())));
gridInformation.putAll(getGridInformation(list, businessTypeMap.get(BusinessTypeEnum.GRID_INFORMATION.getName())));
dispatchOrderInformation.putAll(getDispatchOrderInformation(list, businessTypeMap.get(BusinessTypeEnum.DISPATCH_ORDER_INFORMATION.getName())));
}
}
for (String s : stationIdList) {
Map<String, Object> map = new HashMap<>();
if (Objects.nonNull(basicInformation.get(s))) {
map.putAll(basicInformation.get(s));
}
if (Objects.nonNull(surveyInformation.get(s))) {
map.putAll(surveyInformation.get(s));
}
if (Objects.nonNull(designInformation.get(s))) {
map.putAll(designInformation.get(s));
}
if (Objects.nonNull(businessInformation.get(s))) {
map.putAll(businessInformation.get(s));
}
if (Objects.nonNull(extendedInformation.get(s))) {
map.putAll(extendedInformation.get(s));
}
if (Objects.nonNull(archivingInformation.get(s))) {
map.putAll(archivingInformation.get(s));
}
if (Objects.nonNull(engineeringInformation.get(s))) {
map.putAll(engineeringInformation.get(s));
}
if (Objects.nonNull(gridInformation.get(s))) {
map.putAll(gridInformation.get(s));
}
if (Objects.nonNull(dispatchOrderInformation.get(s))) {
map.putAll(dispatchOrderInformation.get(s));
}
data.add(map);
}
return data;
}
/**
* 获取派工单信息
* @param stationIdList
* @param fields
* @return
*/
private Map<String, Map<String, Object>> getDispatchOrderInformation(List<String> stationIdList, List<HygfBusinessField> fields) {
return dealFields(businessFieldMapper.getDispatchOrderInformation(stationIdList), fields);
}
/**
* 获取并网信息
* @param stationIdList
* @param fields
* @return
*/
private Map<String, Map<String, Object>> getGridInformation(List<String> stationIdList, List<HygfBusinessField> fields) {
return dealFields(businessFieldMapper.getGridInformation(stationIdList), fields);
}
/**
* 获取工程信息
* @param stationIdList
* @param fields
* @return
*/
private Map<String, Map<String, Object>> getEngineeringInformation(List<String> stationIdList, List<HygfBusinessField> fields) {
List<Map<String, Object>> dataMap = businessFieldMapper.getEngineeringInformation(stationIdList);
if (CollectionUtil.isNotEmpty(dataMap)) {
for (Map<String, Object> item : dataMap) {
if (Objects.nonNull(item.get("completion_date"))) {
item.put("completion_date", DateUtils.dateStringFormat(item.get("completion_date")));
}
//处理组件序列号
dealConstructionComponentInfo(item);
//处理逆变器序列号
dealConstructionInverterInfo(item);
//处理采集器序列号
dealConstructionCollectorBoxInfo(item);
//处理并网箱序列号
dealConstructionGridBoxInfo(item);
}
}
return dealFields(dataMap, fields);
}
private void dealConstructionGridBoxInfo(Map<String, Object> item) {
if (Objects.nonNull(item.get("construction_grid_box_info"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("construction_grid_box_info")));
StringBuilder stringBuilder = new StringBuilder();
int index = 0;
for (Object o : jsonArray) {
if (o instanceof JSONObject) {
index++;
JSONObject jsonObject = (JSONObject) o;
stringBuilder.append("序号:");
stringBuilder.append(index);
stringBuilder.append("序列号:");
stringBuilder.append(jsonObject.get("xlh") == null ? "" : jsonObject.get("xlh"));
stringBuilder.append("功率:");
stringBuilder.append(jsonObject.get("gl") == null ? "" : jsonObject.get("gl"));
stringBuilder.append("物料编码:");
stringBuilder.append(jsonObject.get("wlbm") == null ? "" : jsonObject.get("wlbm"));
stringBuilder.append("物料名称:");
stringBuilder.append(jsonObject.get("wlmc") == null ? "" : jsonObject.get("wlmc"));
stringBuilder.append("材质:");
stringBuilder.append(jsonObject.get("cz") == null ? "" : jsonObject.get("cz"));
stringBuilder.append("类型:");
stringBuilder.append(jsonObject.get("lx") == null ? "" : jsonObject.get("lx"));
stringBuilder.append("功能:");
stringBuilder.append(jsonObject.get("gn") == null ? "" : jsonObject.get("gn"));
stringBuilder.append("相位:");
stringBuilder.append(jsonObject.get("xw") == null ? "" : jsonObject.get("xw"));
stringBuilder.append("\n");
}
}
item.put("construction_grid_box_info", stringBuilder.toString());
}
}
private void dealConstructionCollectorBoxInfo(Map<String, Object> item) {
if (Objects.nonNull(item.get("construction_collector_box_info"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("construction_collector_box_info")));
StringBuilder stringBuilder = new StringBuilder();
int index = 0;
for (Object o : jsonArray) {
if (o instanceof JSONObject) {
index++;
JSONObject jsonObject = (JSONObject) o;
stringBuilder.append("序号:");
stringBuilder.append(index);
stringBuilder.append("序列号:");
stringBuilder.append(jsonObject.get("xlh") == null ? "" : jsonObject.get("xlh"));
stringBuilder.append("\n");
}
}
item.put("construction_collector_box_info", stringBuilder.toString());
}
}
private void dealConstructionInverterInfo(Map<String, Object> item) {
if (Objects.nonNull(item.get("construction_inverter_info"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("construction_inverter_info")));
StringBuilder stringBuilder = new StringBuilder();
int index = 0;
for (Object o : jsonArray) {
if (o instanceof JSONObject) {
index++;
JSONObject jsonObject = (JSONObject) o;
stringBuilder.append("序号:");
stringBuilder.append(index);
stringBuilder.append("序列号:");
stringBuilder.append(jsonObject.get("xlh") == null ? "" : jsonObject.get("xlh"));
stringBuilder.append("验证码:");
stringBuilder.append(jsonObject.get("yzm") == null ? "" : jsonObject.get("yzm"));
stringBuilder.append("功率:");
stringBuilder.append(jsonObject.get("gl") == null ? "" : jsonObject.get("gl"));
stringBuilder.append("物料编码:");
stringBuilder.append(jsonObject.get("wlbm") == null ? "" : jsonObject.get("wlbm"));
stringBuilder.append("物料名称:");
stringBuilder.append(jsonObject.get("wlmc") == null ? "" : jsonObject.get("wlmc"));
stringBuilder.append("系列:");
stringBuilder.append(jsonObject.get("xl") == null ? "" : jsonObject.get("xl"));
stringBuilder.append("相位:");
stringBuilder.append(jsonObject.get("xw") == null ? "" : jsonObject.get("xw"));
stringBuilder.append("\n");
}
}
item.put("construction_inverter_info", stringBuilder.toString());
}
}
private void dealConstructionComponentInfo(Map<String, Object> item) {
if (Objects.nonNull(item.get("construction_component_info"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("construction_component_info")));
StringBuilder stringBuilder = new StringBuilder();
int index = 0;
for (Object o : jsonArray) {
if (o instanceof JSONObject) {
index++;
JSONObject jsonObject = (JSONObject) o;
stringBuilder.append("序号:");
stringBuilder.append(index);
stringBuilder.append("序列号:");
stringBuilder.append(jsonObject.get("xlh") == null ? "" : jsonObject.get("xlh"));
stringBuilder.append("功率:");
stringBuilder.append(jsonObject.get("gl") == null ? "" : jsonObject.get("gl"));
stringBuilder.append("物料编码:");
stringBuilder.append(jsonObject.get("wlbm") == null ? "" : jsonObject.get("wlbm"));
stringBuilder.append("物料名称:");
stringBuilder.append(jsonObject.get("wlmc") == null ? "" : jsonObject.get("wlmc"));
stringBuilder.append("电池片规格:");
stringBuilder.append(jsonObject.get("dcpgg") == null ? "" : jsonObject.get("dcpgg"));
stringBuilder.append("类型:");
stringBuilder.append(jsonObject.get("lx") == null ? "" : jsonObject.get("lx"));
stringBuilder.append("边框:");
stringBuilder.append(jsonObject.get("bk") == null ? "" : jsonObject.get("bk"));
stringBuilder.append("单/双面:");
stringBuilder.append(jsonObject.get("dsm") == null ? "" : jsonObject.get("dsm"));
stringBuilder.append("\n");
}
}
item.put("construction_component_info", stringBuilder.toString());
}
}
/**
* 获取资料归档信息
* @param stationIdList
* @param fields
* @return
*/
private Map<String, Map<String, Object>> getArchivingInformation(List<String> stationIdList, List<HygfBusinessField> fields) {
return dealFields(businessFieldMapper.getArchivingInformation(stationIdList), fields);
}
/**
* 获取扩展信息
* @param stationIdList
* @param fields
* @return
*/
private Map<String, Map<String, Object>> getExtendedInformation(List<String> stationIdList, List<HygfBusinessField> fields) {
List<Map<String, Object>> dataMap = businessFieldMapper.getExtendedInformation(stationIdList);
if (CollectionUtil.isNotEmpty(dataMap)) {
for (Map<String, Object> item : dataMap) {
//处理联系人
dealContacts(item);
}
}
return dealFields(dataMap, fields);
}
/**
* 处理联系人
* @param item
*/
private void dealContacts(Map<String, Object> item) {
if (Objects.nonNull(item.get("contacts"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("contacts")));
StringBuilder stringBuilder = new StringBuilder();
int index = 0;
for (Object o : jsonArray) {
if (o instanceof JSONObject) {
index++;
JSONObject jsonObject = (JSONObject) o;
stringBuilder.append("序号:");
stringBuilder.append(index);
stringBuilder.append("姓名:");
stringBuilder.append(jsonObject.get("userName") == null ? "" : jsonObject.get("userName"));
stringBuilder.append("关系:");
stringBuilder.append(jsonObject.get("relation") == null ? "" : jsonObject.get("relation"));
stringBuilder.append("联系电话:");
stringBuilder.append(jsonObject.get("telephone") == null ? "" : jsonObject.get("telephone"));
stringBuilder.append("电子邮箱:");
stringBuilder.append(jsonObject.get("mailbox") == null ? "" : jsonObject.get("mailbox"));
stringBuilder.append("QQ:");
stringBuilder.append(jsonObject.get("qq") == null ? "" : jsonObject.get("qq"));
stringBuilder.append("微信:");
stringBuilder.append(jsonObject.get("wechat") == null ? "" : jsonObject.get("wechat"));
stringBuilder.append("\n");
}
}
item.put("contacts", stringBuilder.toString());
}
}
/**
* 获取商务信息
* @param stationIdList
* @param fields
* @return
*/
private Map<String, Map<String, Object>> getBusinessInformation(List<String> stationIdList, List<HygfBusinessField> fields) {
List<Map<String, Object>> businessInformation = businessFieldMapper.getBusinessInformation(stationIdList);
if (CollectionUtil.isNotEmpty(businessInformation)) {
for (Map<String, Object> item : businessInformation) {
if (Objects.nonNull(item.get("type"))) {
item.put("type", CommonEnum.getNameByCode(String.valueOf(item.get("type"))));
}
if (Objects.nonNull(item.get("legal_type"))) {
item.put("legal_type", CommonEnum.getNameByCode(String.valueOf(item.get("legal_type"))));
}
}
}
return dealFields(businessInformation, fields);
}
/**
* 获取设计信息
* @param stationIdList
* @param fields
* @return
*/
private Map<String, Map<String, Object>> getDesignInformation(List<String> stationIdList, List<HygfBusinessField> fields) {
List<Map<String, Object>> dataMap = businessFieldMapper.getDesignInformation(stationIdList);
if (CollectionUtil.isNotEmpty(dataMap)) {
for (Map<String, Object> item : dataMap) {
if (Objects.nonNull(item.get("anti_skiing"))) {
item.put("anti_skiing", CommonEnum.getNameByCode(String.valueOf(item.get("anti_skiing"))));
}
//处理组件
dealAssembly(item);
//处理逆变器
dealInverter(item);
//处理电缆
dealCable(item);
//处理并网箱
dealElectricityMeter(item);
}
}
return dealFields(dataMap, fields);
}
private void dealElectricityMeter(Map<String, Object> item) {
if (Objects.nonNull(item.get("electricity_meter"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("electricity_meter")));
StringBuilder stringBuilder = new StringBuilder();
int index = 0;
for (Object o : jsonArray) {
if (o instanceof JSONObject) {
index++;
JSONObject jsonObject = (JSONObject) o;
stringBuilder.append("序号:");
stringBuilder.append(index);
stringBuilder.append("物料编码:");
stringBuilder.append(jsonObject.get("wlbm") == null ? "" : jsonObject.get("wlbm"));
stringBuilder.append("物料名称:");
stringBuilder.append(jsonObject.get("wlmc") == null ? "" : jsonObject.get("wlmc"));
stringBuilder.append("材质:");
stringBuilder.append(CommonEnum.getNameByCode(jsonObject.getString("cz")));
stringBuilder.append("功率:");
stringBuilder.append(jsonObject.get("gl") == null ? "" : jsonObject.get("gl"));
stringBuilder.append("类型:");
stringBuilder.append(jsonObject.getString("lx") == null ? "" : jsonObject.get("lx"));
stringBuilder.append("功能:");
stringBuilder.append(jsonObject.get("gn") == null ? "" : jsonObject.get("gn"));
stringBuilder.append("相位:");
stringBuilder.append(CommonEnum.getNameByCode(jsonObject.getString("xw")));
stringBuilder.append("上网模式:");
stringBuilder.append(CommonEnum.getNameByCode(jsonObject.getString("swms")));
stringBuilder.append("配置数量:");
stringBuilder.append(jsonObject.get("pzsl") == null ? "" : jsonObject.get("pzsl") + "个");
stringBuilder.append("金额:");
stringBuilder.append(jsonObject.get("price") == null ? "" : jsonObject.get("price") + "元");
stringBuilder.append("\n");
}
}
item.put("electricity_meter", stringBuilder.toString());
}
}
private void dealCable(Map<String, Object> item) {
if (Objects.nonNull(item.get("cable"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("cable")));
StringBuilder stringBuilder = new StringBuilder();
int index = 0;
for (Object o : jsonArray) {
if (o instanceof JSONObject) {
index++;
JSONObject jsonObject = (JSONObject) o;
stringBuilder.append("序号:");
stringBuilder.append(index);
stringBuilder.append("物料编码:");
stringBuilder.append(jsonObject.get("wlbm") == null ? "" : jsonObject.get("wlbm"));
stringBuilder.append("物料名称:");
stringBuilder.append(jsonObject.get("wlmc") == null ? "" : jsonObject.get("wlmc"));
stringBuilder.append("型号:");
stringBuilder.append(jsonObject.get("xh") == null ? "" : jsonObject.get("xh"));
stringBuilder.append("规格:");
stringBuilder.append(jsonObject.get("gg") == null ? "" : jsonObject.get("gg"));
stringBuilder.append("配置数量:");
stringBuilder.append(jsonObject.get("pzsl") == null ? "" : jsonObject.get("pzsl") + "米");
stringBuilder.append("\n");
}
}
item.put("cable", stringBuilder.toString());
}
}
private void dealInverter(Map<String, Object> item) {
if (Objects.nonNull(item.get("inverter"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("inverter")));
StringBuilder stringBuilder = new StringBuilder();
int index = 0;
for (Object o : jsonArray) {
if (o instanceof JSONObject) {
index++;
JSONObject jsonObject = (JSONObject) o;
stringBuilder.append("序号:");
stringBuilder.append(index);
stringBuilder.append("物料编码:");
stringBuilder.append(jsonObject.get("wlbm") == null ? "" : jsonObject.get("wlbm"));
stringBuilder.append("物料名称:");
stringBuilder.append(jsonObject.get("wlmc") == null ? "" : jsonObject.get("wlmc"));
stringBuilder.append("功率:");
stringBuilder.append(jsonObject.get("gl") == null ? "" : jsonObject.get("gl"));
stringBuilder.append("系列:");
stringBuilder.append(CommonEnum.getNameByCode(jsonObject.getString("xl")));
stringBuilder.append("相位:");
stringBuilder.append(CommonEnum.getNameByCode(jsonObject.getString("xw")));
stringBuilder.append("配置数量:");
stringBuilder.append(jsonObject.get("pzsl") == null ? "" : jsonObject.get("pzsl"));
stringBuilder.append("金额:");
stringBuilder.append(jsonObject.get("price") == null ? "" : jsonObject.get("price") + "元");
stringBuilder.append("\n");
}
}
item.put("inverter", stringBuilder.toString());
}
}
private void dealAssembly(Map<String, Object> item) {
if (Objects.nonNull(item.get("assembly"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("assembly")));
StringBuilder stringBuilder = new StringBuilder();
int index = 0;
for (Object o : jsonArray) {
if (o instanceof JSONObject) {
index++;
JSONObject jsonObject = (JSONObject) o;
stringBuilder.append("序号:");
stringBuilder.append(index);
stringBuilder.append("物料编码:");
stringBuilder.append(jsonObject.get("wlbm") == null ? "" : jsonObject.get("wlbm"));
stringBuilder.append("物料名称:");
stringBuilder.append(jsonObject.get("wlmc") == null ? "" : jsonObject.get("wlmc"));
stringBuilder.append("电池片规格:");
stringBuilder.append(jsonObject.get("dcpgg") == null ? "" : jsonObject.get("dcpgg"));
stringBuilder.append("功率:");
stringBuilder.append(jsonObject.get("gl") == null ? "" : jsonObject.get("gl"));
stringBuilder.append("类型:");
stringBuilder.append(CommonEnum.getNameByCode(jsonObject.getString("lx")));
stringBuilder.append("边框:");
stringBuilder.append(jsonObject.get("bk") == null ? "" : jsonObject.get("bk"));
stringBuilder.append("总功率:");
stringBuilder.append(jsonObject.get("zgl") == null ? "" : jsonObject.get("zgl") + "W");
stringBuilder.append("单/双面:");
stringBuilder.append(CommonEnum.getNameByCode(jsonObject.getString("dsm")));
stringBuilder.append("配置数量:");
stringBuilder.append(jsonObject.get("pzsl") == null ? "" : jsonObject.get("pzsl") + "块");
stringBuilder.append("金额:");
stringBuilder.append(jsonObject.get("price") == null ? "" : jsonObject.get("price") + "元");
stringBuilder.append("\n");
}
}
item.put("assembly", stringBuilder.toString());
}
}
/**
* 获取勘察信息
* @param stationIdList
* @param fields
* @return
*/
private Map<String, Map<String, Object>> getSurveyInformation(List<String> stationIdList, List<HygfBusinessField> fields) {
List<Map<String, Object>> surveyInformation = businessFieldMapper.getSurveyInformation(stationIdList);
if (CollectionUtil.isNotEmpty(surveyInformation)) {
for (Map<String, Object> item : surveyInformation) {
if (Objects.nonNull(item.get("house_situation"))) {
item.put("house_situation", CommonEnum.getNameByCode(String.valueOf(item.get("house_situation"))));
}
if (Objects.nonNull(item.get("house_bias"))) {
item.put("house_bias", CommonEnum.getNameByCode(String.valueOf(item.get("house_bias"))));
}
if (Objects.nonNull(item.get("house_property"))) {
item.put("house_property", CommonEnum.getNameByCode(String.valueOf(item.get("house_property"))));
}
if (Objects.nonNull(item.get("house_crack"))) {
item.put("house_crack", String.valueOf(item.get("house_crack")).equals("s") ? "是" : "否");
}
if (Objects.nonNull(item.get("meter_position"))) {
item.put("meter_position", CommonEnum.getNameByCode(String.valueOf(item.get("meter_position"))));
}
if (Objects.nonNull(item.get("surveyor_time"))) {
item.put("surveyor_time", DateUtils.dateStringFormat(item.get("surveyor_time")));
}
if (Objects.nonNull(item.get("roofway"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("roofway")));
List<String> list = new ArrayList<>();
for (Object o : jsonArray) {
list.add(String.valueOf(o));
}
item.put("roofway", CommonEnum.getNameByCodeList(list));
}
if (Objects.nonNull(item.get("obstacle"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("obstacle")));
List<String> list = new ArrayList<>();
for (Object o : jsonArray) {
list.add(String.valueOf(o));
}
item.put("obstacle", CommonEnum.getNameByCodeList(list));
}
if (Objects.nonNull(item.get("screen"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("screen")));
List<String> list = new ArrayList<>();
for (Object o : jsonArray) {
list.add(String.valueOf(o));
}
item.put("screen", CommonEnum.getNameByCodeList(list));
}
if (Objects.nonNull(item.get("house_type"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("house_type")));
List<String> list = new ArrayList<>();
for (Object o : jsonArray) {
list.add(String.valueOf(o));
}
item.put("house_type", CommonEnum.getNameByCodeList(list));
}
if (Objects.nonNull(item.get("solution_measures"))) {
JSONArray jsonArray = JSONArray.parseArray(String.valueOf(item.get("solution_measures")));
List<String> list = new ArrayList<>();
for (Object o : jsonArray) {
list.add(String.valueOf(o));
}
item.put("solution_measures", CommonEnum.getNameByCodeList(list));
}
}
}
return dealFields(surveyInformation, fields);
}
/**
* 获取基本信息
* @param stationIdList
* @param fields
* @return
*/
private Map<String, Map<String, Object>> getBasicInformation(List<String> stationIdList, List<HygfBusinessField> fields) {
List<Map<String, Object>> basicInformation = businessFieldMapper.getBasicInformation(stationIdList);
if (CollectionUtil.isNotEmpty(basicInformation)) {
//对个别类型进行翻译
for (Map<String, Object> item : basicInformation) {
if (Objects.nonNull(item.get("power_station_type"))) {
item.put("power_station_type", CommonEnum.getNameByCode(String.valueOf(item.get("power_station_type"))));
}
if (Objects.nonNull(item.get("owner_type"))) {
item.put("owner_type", CommonEnum.getNameByCode(String.valueOf(item.get("owner_type"))));
}
if (Objects.nonNull(item.get("creator_time"))) {
item.put("creator_time", DateUtils.dateStringFormat(item.get("creator_time")));
}
}
}
return dealFields(basicInformation, fields);
}
/**
* 处理动态字段
* @param selectMapList
* @param fields
* @return
*/
private Map<String, Map<String, Object>> dealFields(List<Map<String, Object>> selectMapList, List<HygfBusinessField> fields) {
Map<String, Map<String, Object>> result = new HashMap<>();
if (CollectionUtil.isNotEmpty(selectMapList) && CollectionUtil.isNotEmpty(fields)) {
for (Map<String, Object> stringObjectMap : selectMapList) {
Map<String, Object> fieldMap = new HashMap<>();
for (HygfBusinessField field : fields) {
fieldMap.put(field.getFieldName() + "_" + field.getBusinessName(), stringObjectMap.get(field.getFieldFlag()));
}
result.put(String.valueOf(stringObjectMap.get("stationId")), fieldMap);
}
}
return result;
}
}
......@@ -1773,7 +1773,6 @@ public class CommonServiceImpl {
result.add(map);
}
}
return result;
}
......
......@@ -87,6 +87,7 @@ public class FinancingInfoHistoryServiceImpl extends BaseService<FinancingInfoHi
e.setDisbursementTime(financingInfoDto.getDisbursementTime());
e.setUnitPrice(financingInfoDto.getUnitPrice());
e.setFinancingCompaniesName(financingInfoDto.getFinancingCompaniesName());
e.setBacthNo(financingInfoDto.getBacthNo());
e.setStatus("放款完成");
if (financingInfoDto.getFiles() != null){
e.setFile(JSON.toJSONString(financingInfoDto.getFiles()));
......
......@@ -187,6 +187,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
financingInfoDto.setSequenceNbr(null);
financingInfoDto.setBatchNo(batcvNo);
financingInfoDto.setRegionalCompaniesSeq(peasantHousehold.getRegionalCompaniesSeq());
financingInfoDto.setTrCreateTime(new Date());
this.createWithModel(financingInfoDto);
//开启工作流 并执行一步
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
......@@ -219,7 +220,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
//批量 兼容审核不通过及整改待推送
else if (financingInfos.getStatus().equals(FinancingAuditEnum.审核不通过.getName()) || financingInfos.getStatus().equals("待推送") ){
financingInfos.setStatus(FinancingAuditEnum.待融资审核.getName());
financingInfos.setTrCreateTime(new Date());
Map<String, Object> orgInfo1 = this.getBaseMapper().selectRZOrgInfo(model.getFinancingCompaniesSeq());
//业务表中无工作流id 需要补充
LambdaQueryWrapper<FinancingAuditing> queryWrapper1 = new LambdaQueryWrapper<>();
......@@ -330,6 +331,9 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
if (params.containsKey("financingCompaniesSeq") && params.get("financingCompaniesSeq")!= null) {
financingInfo.setFinancingCompaniesSeq(Long.valueOf(params.get("financingCompaniesSeq").toString()));
}
if("融资审核".equals(financingAuditingDto.getNextNodeName())){
financingInfo.setTrCreateTime(new Date());
}
//标识对于整改待推送状态
if (params.containsKey("isZG")) {
financingInfo.setStatus("待推送");
......@@ -337,10 +341,12 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
financingInfo.setStatus(statusName);
}
if (params.containsKey("isHistory")) {
financingInfo.setStatus("退回建档");
// if (params.containsKey("isHistory")) {
// financingInfo.setStatus("退回建档");
// }
if("放款完成".equals(financingInfo.getStatus())){
financingInfo.setTrEndTime(new Date());
}
this.updateById(financingInfo);
//更新待办
// workflowResultDto.setInstanceId(financingAuditing.getInstanceId());
......
......@@ -19,13 +19,18 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.MaintenanceMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IHYGFMaintenanceTicketsService;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterWarnMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.SmsRecordModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
......@@ -40,7 +45,8 @@ public class HYGFMaintenanceTicketsServiceImpl extends BaseService<HYGFMaintenan
EmqKeeper emqKeeper;
@Autowired
TdHygfJpInverterWarnMapper tdHygfJpInverterWarnMapper;
@Value("${hygf.sms.tempCode}")
private String smsTempCode;
@Autowired
HYGFMaintenanceTicketsMapper hygfMaintenanceTicketsMapper;
@Autowired
......@@ -81,6 +87,23 @@ public class HYGFMaintenanceTicketsServiceImpl extends BaseService<HYGFMaintenan
public void sendMeassageToMcb(HYGFMaintenanceTicketsDto hygfMaintenanceTicketsDto) {
MaintenanceDto data = maintenanceMapper.selectOneById(Long.valueOf(hygfMaintenanceTicketsDto.getMaintenancePersonId()));
if (ObjectUtil.isNotEmpty(data)) {
HashMap<String, String> params = new HashMap<>(3);
params.put("code","123456");
params.put("mobile",data.getTelephone());
params.put("smsCode", smsTempCode);
try {
Systemctl.smsClient.sendCommonSms(params).getResult();
} catch (Exception e) {
throw new BadRequest("发送短信失败:" + e.getMessage());
}
}
if(hygfMaintenanceTicketsDto.getWarningId()==null){
......@@ -117,6 +140,18 @@ public class HYGFMaintenanceTicketsServiceImpl extends BaseService<HYGFMaintenan
if (ObjectUtil.isNotEmpty(maintenance)) {
hygfMaintenanceTicketsDto.setMaintenancePersonName(maintenance.getName());
hygfMaintenanceTicketsDto.setMaintenancePersonPhone(maintenance.getTelephone());
HashMap<String, String> params = new HashMap<>(3);
params.put("code","123456");
params.put("mobile",maintenance.getTelephone());
params.put("smsCode", smsTempCode);
try {
Systemctl.smsClient.sendCommonSms(params).getResult();
} catch (Exception e) {
throw new BadRequest("发送短信失败:" + e.getMessage());
}
}
HYGFMaintenanceTickets fMaintenanceTickets=new HYGFMaintenanceTickets();
BeanUtils.copyProperties(hygfMaintenanceTicketsDto,fMaintenanceTickets);
......
......@@ -102,8 +102,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Autowired
RegionalCompaniesMapper regionalCompaniesMapper;
private Long TOKEN_TIME = 1209600l;
@Autowired
CommonServiceImpl commonService;
// @Autowired
// CommonServiceImpl commonService;
@Autowired
HygfOnGridServiceImpl hygfOnGridService;
@Autowired
......@@ -1015,344 +1015,344 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
return peasantHouseholdIPage;
}
public void saveHistoryPeasantHousehold(PowerStationEngineeringInfoAllDto surveyInfoAllDto,String operationType) {
SurveyInformationDto model = surveyInfoAllDto.getSurveyInformation();
if (null == model.getDeveloperId()|| null == model.getRegionalCompaniesSeq()){
throw new BadRequest("区域公司及经销商不可为空");
}
if (null == model.getTelephone()){
throw new BadRequest("联系电话不可为空");
}
if (null == model.getOwnersName()){
throw new BadRequest("业主姓名不可为空");
}
if (null == model.getIdCard()){
throw new BadRequest("身份证号码不可为空");
}
if (null == model.getIdCardFront()|| null == model.getIdCardOpposite()){
throw new BadRequest("身份证图片不可为空");
}
if (null == model.getPermanentAddress()){
throw new BadRequest("常住地址不可为空");
}
if ( null == model.getPermanentAddressDetail()){
throw new BadRequest("常住详细地址不可为空");
}
if (null == model.getProjectAddress()){
throw new BadRequest("项目地址不可为空");
}
if (null == model.getProjectAddressDetail()){
throw new BadRequest("项目详细地址不可为空");
}
List<String> ids = new ArrayList<>();
ids.add(String.valueOf(model.getDeveloperId()));
ids.add(String.valueOf(model.getRegionalCompaniesSeq()));
// MobileLoginParamDto mobileLoginParamDto = new MobileLoginParamDto();
// mobileLoginParamDto.setPhoneNo(model.getTelephone());
// // 机器人token
// RequestContext.setAppKey("AMOS_STUDIO");
// RequestContext.setProduct("AMOS_STUDIO_WEB");
// RequestContext.setToken(requestContext.getToken());
// AgencyUserModel registerUserModel = null;
// // region 判断有无在平台内部注册过用户 没有注册则去平台注册
// FeignClientResult<LoginInfoModel> loginInfo = Privilege.agencyUserClient.getLoginInfo(mobileLoginParamDto.getPhoneNo());
// public void saveHistoryPeasantHousehold(PowerStationEngineeringInfoAllDto surveyInfoAllDto,String operationType) {
//
// if (loginInfo != null && 200 == loginInfo.getStatus()) {
// LoginInfoModel loginInfoModel = loginInfo.getResult();
// if (loginInfoModel == null || !StringUtils.isNotBlank(loginInfoModel.getLoginId())) {
// FeignClientResult<AgencyUserModel> registerUserModelRestult = doRegister(mobileLoginParamDto);
// if (registerUserModelRestult == null || registerUserModelRestult.getStatus() != 200) {
// log.error("用户手机号码 => " + mobileLoginParamDto.getPhoneNo() + " 调用平台创建用户信息失败: " + registerUserModelRestult.getDevMessage());
// throw new RuntimeException(registerUserModelRestult.getMessage());
// SurveyInformationDto model = surveyInfoAllDto.getSurveyInformation();
// if (null == model.getDeveloperId()|| null == model.getRegionalCompaniesSeq()){
// throw new BadRequest("区域公司及经销商不可为空");
// }
// if (null == model.getTelephone()){
// throw new BadRequest("联系电话不可为空");
// }
// if (null == model.getOwnersName()){
// throw new BadRequest("业主姓名不可为空");
// }
// if (null == model.getIdCard()){
// throw new BadRequest("身份证号码不可为空");
// }
// if (null == model.getIdCardFront()|| null == model.getIdCardOpposite()){
// throw new BadRequest("身份证图片不可为空");
// }
// if (null == model.getPermanentAddress()){
// throw new BadRequest("常住地址不可为空");
// }
// if ( null == model.getPermanentAddressDetail()){
// throw new BadRequest("常住详细地址不可为空");
// }
// if (null == model.getProjectAddress()){
// throw new BadRequest("项目地址不可为空");
// }
// if (null == model.getProjectAddressDetail()){
// throw new BadRequest("项目详细地址不可为空");
// }
//
//
// List<String> ids = new ArrayList<>();
// ids.add(String.valueOf(model.getDeveloperId()));
// ids.add(String.valueOf(model.getRegionalCompaniesSeq()));
//// MobileLoginParamDto mobileLoginParamDto = new MobileLoginParamDto();
//// mobileLoginParamDto.setPhoneNo(model.getTelephone());
//// // 机器人token
//// RequestContext.setAppKey("AMOS_STUDIO");
//// RequestContext.setProduct("AMOS_STUDIO_WEB");
//// RequestContext.setToken(requestContext.getToken());
//// AgencyUserModel registerUserModel = null;
//// // region 判断有无在平台内部注册过用户 没有注册则去平台注册
//// FeignClientResult<LoginInfoModel> loginInfo = Privilege.agencyUserClient.getLoginInfo(mobileLoginParamDto.getPhoneNo());
////
//// if (loginInfo != null && 200 == loginInfo.getStatus()) {
//// LoginInfoModel loginInfoModel = loginInfo.getResult();
//// if (loginInfoModel == null || !StringUtils.isNotBlank(loginInfoModel.getLoginId())) {
//// FeignClientResult<AgencyUserModel> registerUserModelRestult = doRegister(mobileLoginParamDto);
//// if (registerUserModelRestult == null || registerUserModelRestult.getStatus() != 200) {
//// log.error("用户手机号码 => " + mobileLoginParamDto.getPhoneNo() + " 调用平台创建用户信息失败: " + registerUserModelRestult.getDevMessage());
//// throw new RuntimeException(registerUserModelRestult.getMessage());
//// }
//// registerUserModel = registerUserModelRestult.getResult();
//// }
//// }
//
//
//
//
//
// // 更新勘察基本信息
//
//
// //新增农户电站信息
// SurveyInformation surveyInformation = BeanDtoUtils.convert(model,
// SurveyInformation.class);
// surveyInformation.setSurveyNumber(Optional.ofNullable(surveyInformation).map(SurveyInformation::getSurveyNumber).orElse(this.getkcNo(model.getRegionalCompaniesSeq())));
// PeasantHousehold peasantHousehold = new PeasantHousehold();
// if (model.getSequenceNbr() != null ){
// peasantHousehold.setSequenceNbr(model.getPeasantHouseholdId());
// }
// if (model.getPeasantHouseholdNo() == null ){
// peasantHousehold.setPeasantHouseholdNo(this.getPeasantHouseholdNo(model.getRegionalCompaniesSeq()));
// }
// surveyInformationServiceImpl.saveOrUpdate(surveyInformation);
//
//
//
// peasantHousehold.setIsCertified(1);
// peasantHousehold.setIsHistory("1");
// peasantHousehold.setReview(2);
// peasantHousehold.setSurveyInformationId(surveyInformation.getSequenceNbr());
// if (operationType.equals("apply")){
// peasantHousehold.setConstructionState("验收完成");
// peasantHousehold.setPreparationMoneyState("建档完成");
// if (peasantHousehold.getSequenceNbr() != null ){
// //完成后需对投融数据进行处理。
// LambdaUpdateWrapper<FinancingInfo> wrapper = new LambdaUpdateWrapper<>();
// wrapper.eq(FinancingInfo::getPeasantHouseholdId,peasantHousehold.getSequenceNbr());
// wrapper.set(FinancingInfo::getStatus,"待推送");
// financingInfoService.update(null,wrapper);
//
// LambdaQueryWrapper<FinancingAuditing> finQuery = new LambdaQueryWrapper<>();
// finQuery.eq(FinancingAuditing::getPeasantHouseholdId,peasantHousehold.getSequenceNbr());
// finQuery.orderByDesc(BaseEntity::getRecDate);
// finQuery.last("limit 1");
// FinancingAuditing financingAuditing = financingAuditingService.getBaseMapper().selectOne(finQuery);
// if (!Objects.isNull(financingAuditing)){
// financingInfoService.execueFlow(MapBuilder.<String,Object>create().put("instanceId",financingAuditing.getInstanceId()).put("approvalStatus","0").put("isZG","1").build());
// }
// registerUserModel = registerUserModelRestult.getResult();
// }
//
// }else {
// if (null !=peasantHousehold.getSequenceNbr() ){
// PeasantHousehold peasantHousehold1 = this.getBaseMapper().selectById(peasantHousehold.getSequenceNbr());
// if (peasantHousehold1.getPreparationMoneyState().equals("待提交")){
// }else {
// peasantHousehold.setPreparationMoneyState("暂存中");
// }
// }else {
// peasantHousehold.setPreparationMoneyState("暂存中");
// }
// }
// 更新勘察基本信息
//新增农户电站信息
SurveyInformation surveyInformation = BeanDtoUtils.convert(model,
SurveyInformation.class);
surveyInformation.setSurveyNumber(Optional.ofNullable(surveyInformation).map(SurveyInformation::getSurveyNumber).orElse(this.getkcNo(model.getRegionalCompaniesSeq())));
PeasantHousehold peasantHousehold = new PeasantHousehold();
if (model.getSequenceNbr() != null ){
peasantHousehold.setSequenceNbr(model.getPeasantHouseholdId());
}
if (model.getPeasantHouseholdNo() == null ){
peasantHousehold.setPeasantHouseholdNo(this.getPeasantHouseholdNo(model.getRegionalCompaniesSeq()));
}
surveyInformationServiceImpl.saveOrUpdate(surveyInformation);
peasantHousehold.setIsCertified(1);
peasantHousehold.setIsHistory("1");
peasantHousehold.setReview(2);
peasantHousehold.setSurveyInformationId(surveyInformation.getSequenceNbr());
if (operationType.equals("apply")){
peasantHousehold.setConstructionState("验收完成");
peasantHousehold.setPreparationMoneyState("建档完成");
if (peasantHousehold.getSequenceNbr() != null ){
//完成后需对投融数据进行处理。
LambdaUpdateWrapper<FinancingInfo> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(FinancingInfo::getPeasantHouseholdId,peasantHousehold.getSequenceNbr());
wrapper.set(FinancingInfo::getStatus,"待推送");
financingInfoService.update(null,wrapper);
LambdaQueryWrapper<FinancingAuditing> finQuery = new LambdaQueryWrapper<>();
finQuery.eq(FinancingAuditing::getPeasantHouseholdId,peasantHousehold.getSequenceNbr());
finQuery.orderByDesc(BaseEntity::getRecDate);
finQuery.last("limit 1");
FinancingAuditing financingAuditing = financingAuditingService.getBaseMapper().selectOne(finQuery);
if (!Objects.isNull(financingAuditing)){
financingInfoService.execueFlow(MapBuilder.<String,Object>create().put("instanceId",financingAuditing.getInstanceId()).put("approvalStatus","0").put("isZG","1").build());
}
}
}else {
if (null !=peasantHousehold.getSequenceNbr() ){
PeasantHousehold peasantHousehold1 = this.getBaseMapper().selectById(peasantHousehold.getSequenceNbr());
if (peasantHousehold1.getPreparationMoneyState().equals("待提交")){
}else {
peasantHousehold.setPreparationMoneyState("暂存中");
}
}else {
peasantHousehold.setPreparationMoneyState("暂存中");
}
}
// peasantHousehold.setAmosUserId(registerUserModel.getUserId());
peasantHousehold.setTelephone(model.getTelephone());
peasantHousehold.setCreationTime(new Date());
List<Map<String, Object>> maps = financingInfoService.getBaseMapper().selectCompany(ids);
UnitInfo unitInfo = unitInfoService.getBaseMapper().selectById(model.getDeveloperId());
if (unitInfo != null){
peasantHousehold.setDeveloperCode(unitInfo.getAmosCompanyCode());// 开发方code
peasantHousehold.setDeveloperId(unitInfo.getAmosCompanySeq());// 开发方id
peasantHousehold.setDeveloperName(unitInfo.getName());// 开发方名称
// peasantHousehold.setDeveloper();// 开发人
// peasantHousehold.setDeveloperUserId();
}
maps.stream().forEach(e->{
if (String.valueOf(e.get("SEQUENCE_NBR")) .equals(String.valueOf(model.getRegionalCompaniesSeq()))){
peasantHousehold.setRegionalCompaniesCode(e.get("ORG_CODE").toString());// 开发方code
peasantHousehold.setRegionalCompaniesSeq(model.getRegionalCompaniesSeq());// 开发方id
peasantHousehold.setRegionalCompaniesName(e.get("COMPANY_NAME").toString());// 开发方名称
}
});
// PeasantHouseholdDto peasantHouseholdDto = buildDefaultPeasantHouseholdDto(wxDTO.getAmosUserId(), wxDTO.getQrCodeType(), wxDTO.getPhoneNo());
//
// peasantHousehold.setRegionalCompaniesSeq(Optional.ofNullable(peasantHouseholdDto).map(PeasantHouseholdDto::getRegionalCompaniesSeq).orElse(null));
// peasantHousehold.setRegionalCompaniesCode(Optional.ofNullable(peasantHouseholdDto).map(PeasantHouseholdDto::getRegionalCompaniesCode).orElse(null));
// peasantHousehold.setRegionalCompaniesName(Optional.ofNullable(peasantHouseholdDto).map(PeasantHouseholdDto::getRegionalCompaniesName).orElse(null));
// peasantHousehold.setIsCertified(1);// 这里就实名认证
peasantHousehold.setSurveyOrNot(3);
peasantHousehold.setReview(2);
JSONArray regionName = commonService.getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
// // peasantHousehold.setAmosUserId(registerUserModel.getUserId());
// peasantHousehold.setTelephone(model.getTelephone());
// peasantHousehold.setCreationTime(new Date());
//
// List<Map<String, Object>> maps = financingInfoService.getBaseMapper().selectCompany(ids);
// UnitInfo unitInfo = unitInfoService.getBaseMapper().selectById(model.getDeveloperId());
// if (unitInfo != null){
// peasantHousehold.setDeveloperCode(unitInfo.getAmosCompanyCode());// 开发方code
// peasantHousehold.setDeveloperId(unitInfo.getAmosCompanySeq());// 开发方id
// peasantHousehold.setDeveloperName(unitInfo.getName());// 开发方名称
// // peasantHousehold.setDeveloper();// 开发人
// // peasantHousehold.setDeveloperUserId();
// }
// maps.stream().forEach(e->{
//
// if (String.valueOf(e.get("SEQUENCE_NBR")) .equals(String.valueOf(model.getRegionalCompaniesSeq()))){
// peasantHousehold.setRegionalCompaniesCode(e.get("ORG_CODE").toString());// 开发方code
// peasantHousehold.setRegionalCompaniesSeq(model.getRegionalCompaniesSeq());// 开发方id
// peasantHousehold.setRegionalCompaniesName(e.get("COMPANY_NAME").toString());// 开发方名称
// }
//
// });
//
//// PeasantHouseholdDto peasantHouseholdDto = buildDefaultPeasantHouseholdDto(wxDTO.getAmosUserId(), wxDTO.getQrCodeType(), wxDTO.getPhoneNo());
////
//// peasantHousehold.setRegionalCompaniesSeq(Optional.ofNullable(peasantHouseholdDto).map(PeasantHouseholdDto::getRegionalCompaniesSeq).orElse(null));
//// peasantHousehold.setRegionalCompaniesCode(Optional.ofNullable(peasantHouseholdDto).map(PeasantHouseholdDto::getRegionalCompaniesCode).orElse(null));
//// peasantHousehold.setRegionalCompaniesName(Optional.ofNullable(peasantHouseholdDto).map(PeasantHouseholdDto::getRegionalCompaniesName).orElse(null));
//// peasantHousehold.setIsCertified(1);// 这里就实名认证
// peasantHousehold.setSurveyOrNot(3);
// peasantHousehold.setReview(2);
// JSONArray regionName = commonService.getRegionName();
// List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
//// // 处理项目地址
//// String area = "";
//// if (model.getProjectAddress() != null && model.getProjectAddress().size() != 0) {
//// for (Integer reg : model.getProjectAddress())
//// for (RegionModel re : list) {
//// if (re.getRegionCode().equals(Integer.valueOf(reg))) {
//// area = area + re.getRegionName() + "/";
//// }
//// }
//// model.setProjectAddressName(area.length() > 2 ? area.substring(0, area.length() - 1) : area);
//// if ("1".equals(model.getIsPermanent()) || "true".equals(model.getIsPermanent())) {
//// peasantHousehold.setPermanentAddress(model.getProjectAddress());
//// peasantHousehold.setPermanentAddressDetail(model.getProjectAddressDetail());
//// peasantHousehold.setPermanentAddressName(area.length() > 2 ? area.substring(0, area.length() - 1) : area);
//// } else {
//// // 处理常住地址
//// String permanent = "";
//// if (model.getPermanentAddress() != null && model.getPermanentAddress().size() != 0) {
//// for (Integer reg : model.getPermanentAddress())
//// for (RegionModel re : list) {
//// if (re.getRegionCode().equals(Integer.valueOf(reg))) {
//// permanent = permanent + re.getRegionName() + "/";
//// }
//// }
//// peasantHousehold.setPermanentAddressName(permanent.length() > 2 ? permanent.substring(0, permanent.length() - 1) : permanent);
//// }
//// }
//// }
//
//
//
//
//
// surveyInformation.setReview(0);
// surveyInformation.setCreatorTime(new Date());
// surveyInformationServiceImpl.saveOrUpdate(surveyInformation);
//
// // 更新扩展信息
// ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(),
// ExtendedInformation.class);
// extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr());
// // 避免生成多份数据
// extendedInformationService.saveOrUpdate(extendedInformation, new LambdaQueryWrapper<ExtendedInformation>()
// .eq(ExtendedInformation::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// // extendedInformationService.saveOrUpdate(extendedInformation);
//
// // 更新勘察明细信息
// SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails();
// SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class);
// surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr());
// // 避免生成多份数据
// surveyDetailsService.saveOrUpdate(surveyDetails, new LambdaQueryWrapper<SurveyDetails>()
// .eq(SurveyDetails::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// // surveyDetailsService.saveOrUpdate(surveyDetails);
//
// // 更新商务信息
// CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
// Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class);
// // 处理省市县
// String paddressName = "";
// if (null != surveyInfoAllDto.getSurveyInformation().getProjectAddress()){
// for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
// for (RegionModel re : list) {
// if (re.getRegionCode().equals(Integer.valueOf(reg))) {
// paddressName = paddressName + re.getRegionName() + "/";
// }
// }
// }
// commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 1));
// }
//
// commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
// // 避免生成多份数据
// commercialService.saveOrUpdate(commercial, new LambdaQueryWrapper<Commercial>()
// .eq(Commercial::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// // commercialService.saveOrUpdate(commercial);
// // 勘察后,更新状态
// // QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new
// // QueryWrapper<>();
// // peasantHouseholdQueryWrapper.eq("survey_information_id",
// // surveyInformation.getSequenceNbr());
// // PeasantHousehold peasantHousehold =
// // peasantHouseholdServiceImpl.getBaseMapper()
// // .selectOne(peasantHouseholdQueryWrapper);
//
// // 更新资料归档信息
// Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
// information.setHouseProve(null == commercial ? null
// : (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal()
// : null));
// information.setCardFile(null == commercial ? null
// : (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit() : null));
// information.setCardFile(commercial.getAgentLegal());
// information
// .setArchivesNumber(surveyInformationServiceImpl.getNo(CodeEnum.档案.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
// information.setFileNumber(surveyInformationServiceImpl.getNo(CodeEnum.文件.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
// information.setSurveyInformationId(surveyInformation.getSequenceNbr());
//
// // 避免生成多份数据
// informationService.saveOrUpdate(information, new LambdaQueryWrapper<Information>()
// .eq(Information::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// // informationService.saveOrUpdate(information);
//
// peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName());
// peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone());
// peasantHousehold.setIdCard(surveyInfoAllDto.getSurveyInformation().getIdCard());
// peasantHousehold.setIdCardFront(model.getIdCardFront());
// peasantHousehold.setIdCardOpposite(model.getIdCardOpposite());
// peasantHousehold.setMailbox(surveyInfoAllDto.getSurveyInformation().getMailbox());
// peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress());
// peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail());
// peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress());
// peasantHousehold
// .setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
// peasantHousehold
// .setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
//
// // 处理项目地址
// String area = "";
// if (model.getProjectAddress() != null && model.getProjectAddress().size() != 0) {
// for (Integer reg : model.getProjectAddress())
// String projectAddressName = "";
// if (null != surveyInfoAllDto.getSurveyInformation().getProjectAddress()){
// for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
// for (RegionModel re : list) {
// if (re.getRegionCode().equals(Integer.valueOf(reg))) {
// area = area + re.getRegionName() + "/";
// projectAddressName = projectAddressName + re.getRegionName() + "/";
// }
// }
// model.setProjectAddressName(area.length() > 2 ? area.substring(0, area.length() - 1) : area);
// if ("1".equals(model.getIsPermanent()) || "true".equals(model.getIsPermanent())) {
// peasantHousehold.setPermanentAddress(model.getProjectAddress());
// peasantHousehold.setPermanentAddressDetail(model.getProjectAddressDetail());
// peasantHousehold.setPermanentAddressName(area.length() > 2 ? area.substring(0, area.length() - 1) : area);
// } else {
// // 处理常住地址
// String permanent = "";
// if (model.getPermanentAddress() != null && model.getPermanentAddress().size() != 0) {
// for (Integer reg : model.getPermanentAddress())
// for (RegionModel re : list) {
// if (re.getRegionCode().equals(Integer.valueOf(reg))) {
// permanent = permanent + re.getRegionName() + "/";
// }
// }
// peasantHousehold.setPermanentAddressName(permanent.length() > 2 ? permanent.substring(0, permanent.length() - 1) : permanent);
// }
// peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1));
// }
// if (null != surveyInfoAllDto.getSurveyInformation().getPermanentAddress()){
// // 常住地址
// String permanentAddressName = "";
// for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) {
// for (RegionModel re : list) {
// if (re.getRegionCode().equals(Integer.valueOf(reg))) {
// permanentAddressName = permanentAddressName + re.getRegionName() + "/";
// }
// }
// }
// peasantHousehold
// .setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
//
// }
surveyInformation.setReview(0);
surveyInformation.setCreatorTime(new Date());
surveyInformationServiceImpl.saveOrUpdate(surveyInformation);
// 更新扩展信息
ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(),
ExtendedInformation.class);
extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
extendedInformationService.saveOrUpdate(extendedInformation, new LambdaQueryWrapper<ExtendedInformation>()
.eq(ExtendedInformation::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// extendedInformationService.saveOrUpdate(extendedInformation);
// 更新勘察明细信息
SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails();
SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class);
surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
surveyDetailsService.saveOrUpdate(surveyDetails, new LambdaQueryWrapper<SurveyDetails>()
.eq(SurveyDetails::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// surveyDetailsService.saveOrUpdate(surveyDetails);
// 更新商务信息
CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class);
// 处理省市县
String paddressName = "";
if (null != surveyInfoAllDto.getSurveyInformation().getProjectAddress()){
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
paddressName = paddressName + re.getRegionName() + "/";
}
}
}
commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 1));
}
commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
commercialService.saveOrUpdate(commercial, new LambdaQueryWrapper<Commercial>()
.eq(Commercial::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// commercialService.saveOrUpdate(commercial);
// 勘察后,更新状态
// QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new
// QueryWrapper<>();
// peasantHouseholdQueryWrapper.eq("survey_information_id",
// surveyInformation.getSequenceNbr());
// PeasantHousehold peasantHousehold =
// peasantHouseholdServiceImpl.getBaseMapper()
// .selectOne(peasantHouseholdQueryWrapper);
// 更新资料归档信息
Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
information.setHouseProve(null == commercial ? null
: (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal()
: null));
information.setCardFile(null == commercial ? null
: (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit() : null));
information.setCardFile(commercial.getAgentLegal());
information
.setArchivesNumber(surveyInformationServiceImpl.getNo(CodeEnum.档案.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setFileNumber(surveyInformationServiceImpl.getNo(CodeEnum.文件.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
informationService.saveOrUpdate(information, new LambdaQueryWrapper<Information>()
.eq(Information::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// informationService.saveOrUpdate(information);
peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName());
peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone());
peasantHousehold.setIdCard(surveyInfoAllDto.getSurveyInformation().getIdCard());
peasantHousehold.setIdCardFront(model.getIdCardFront());
peasantHousehold.setIdCardOpposite(model.getIdCardOpposite());
peasantHousehold.setMailbox(surveyInfoAllDto.getSurveyInformation().getMailbox());
peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress());
peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail());
peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
// 处理项目地址
String projectAddressName = "";
if (null != surveyInfoAllDto.getSurveyInformation().getProjectAddress()){
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
projectAddressName = projectAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1));
}
if (null != surveyInfoAllDto.getSurveyInformation().getPermanentAddress()){
// 常住地址
String permanentAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
permanentAddressName = permanentAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold
.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
}
this.saveOrUpdate(peasantHousehold);
//更新施工信息
PowerStationConstructionData powerStationConstructionData = surveyInfoAllDto.getPowerStationConstructionData();
powerStationConstructionData.setWorkOrderPowerStationId(peasantHousehold.getSequenceNbr());
// 避免生成多份数据
powerStationConstructionDataService.saveOrUpdate(powerStationConstructionData, new LambdaQueryWrapper<PowerStationConstructionData>()
.eq(PowerStationConstructionData::getWorkOrderPowerStationId, peasantHousehold.getSequenceNbr()));
//更新工程
PowerStationEngineeringInfo powerStationEngineeringInfo = surveyInfoAllDto.getPowerStationEngineeringInfo();
if(Objects.nonNull(powerStationEngineeringInfo)){
powerStationEngineeringInfo.setWorkOrderPowerStationId(peasantHousehold.getSequenceNbr());
powerStationEngineeringInfoService.saveOrUpdate(powerStationEngineeringInfo, new LambdaQueryWrapper<PowerStationEngineeringInfo>()
.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, peasantHousehold.getSequenceNbr()));
//更新施工组件信息
LambdaUpdateWrapper<PowerStationConstructionData> powerStationConstructionDataWrapper = new LambdaUpdateWrapper<>();
powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionComponentInfo, JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionComponentInfo()));
powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionInverterInfo,JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionInverterInfo()));
powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionCollectorBoxInfo,JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionCollectorBoxInfo()));
powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionGridBoxInfo,JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionGridBoxInfo()));
powerStationConstructionDataWrapper.eq(PowerStationConstructionData::getWorkOrderPowerStationId, peasantHousehold.getSequenceNbr());
powerStationConstructionDataWrapper.eq(PowerStationConstructionData::getSequenceNbr, powerStationConstructionData.getSequenceNbr());
powerStationConstructionDataService.update(null,powerStationConstructionDataWrapper);
}
//更新并网信息
HygfOnGrid hygfOnGrid = surveyInfoAllDto.getHygfOnGrid();
hygfOnGrid.setPeasantHouseholdId( peasantHousehold.getSequenceNbr());
// 避免生成多份数据
hygfOnGridService.saveOrUpdate(hygfOnGrid, new LambdaQueryWrapper<HygfOnGrid>()
.eq(HygfOnGrid::getPeasantHouseholdId, peasantHousehold.getSequenceNbr()));
hygfOnGridService.saveOrUpdate(hygfOnGrid);
//更新设计信息
DesignInformationDto designInformationDto = surveyInfoAllDto.getDesignInformation();
DesignInformation designInformation = BeanDtoUtils.convert(designInformationDto,
DesignInformation.class);
designInformation.setPeasantHouseholdId(String.valueOf(peasantHousehold.getSequenceNbr()));
designInformationService.saveOrUpdate(designInformation, new LambdaQueryWrapper<DesignInformation>()
.eq(DesignInformation::getPeasantHouseholdId, peasantHousehold.getSequenceNbr()));
}
//
//
// this.saveOrUpdate(peasantHousehold);
//
//
//
// //更新施工信息
// PowerStationConstructionData powerStationConstructionData = surveyInfoAllDto.getPowerStationConstructionData();
//
// powerStationConstructionData.setWorkOrderPowerStationId(peasantHousehold.getSequenceNbr());
// // 避免生成多份数据
// powerStationConstructionDataService.saveOrUpdate(powerStationConstructionData, new LambdaQueryWrapper<PowerStationConstructionData>()
// .eq(PowerStationConstructionData::getWorkOrderPowerStationId, peasantHousehold.getSequenceNbr()));
//
// //更新工程
// PowerStationEngineeringInfo powerStationEngineeringInfo = surveyInfoAllDto.getPowerStationEngineeringInfo();
// if(Objects.nonNull(powerStationEngineeringInfo)){
// powerStationEngineeringInfo.setWorkOrderPowerStationId(peasantHousehold.getSequenceNbr());
// powerStationEngineeringInfoService.saveOrUpdate(powerStationEngineeringInfo, new LambdaQueryWrapper<PowerStationEngineeringInfo>()
// .eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, peasantHousehold.getSequenceNbr()));
// //更新施工组件信息
// LambdaUpdateWrapper<PowerStationConstructionData> powerStationConstructionDataWrapper = new LambdaUpdateWrapper<>();
// powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionComponentInfo, JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionComponentInfo()));
// powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionInverterInfo,JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionInverterInfo()));
// powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionCollectorBoxInfo,JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionCollectorBoxInfo()));
// powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionGridBoxInfo,JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionGridBoxInfo()));
// powerStationConstructionDataWrapper.eq(PowerStationConstructionData::getWorkOrderPowerStationId, peasantHousehold.getSequenceNbr());
// powerStationConstructionDataWrapper.eq(PowerStationConstructionData::getSequenceNbr, powerStationConstructionData.getSequenceNbr());
// powerStationConstructionDataService.update(null,powerStationConstructionDataWrapper);
//
// }
// //更新并网信息
// HygfOnGrid hygfOnGrid = surveyInfoAllDto.getHygfOnGrid();
// hygfOnGrid.setPeasantHouseholdId( peasantHousehold.getSequenceNbr());
// // 避免生成多份数据
// hygfOnGridService.saveOrUpdate(hygfOnGrid, new LambdaQueryWrapper<HygfOnGrid>()
// .eq(HygfOnGrid::getPeasantHouseholdId, peasantHousehold.getSequenceNbr()));
// hygfOnGridService.saveOrUpdate(hygfOnGrid);
// //更新设计信息
// DesignInformationDto designInformationDto = surveyInfoAllDto.getDesignInformation();
//
// DesignInformation designInformation = BeanDtoUtils.convert(designInformationDto,
// DesignInformation.class);
// designInformation.setPeasantHouseholdId(String.valueOf(peasantHousehold.getSequenceNbr()));
// designInformationService.saveOrUpdate(designInformation, new LambdaQueryWrapper<DesignInformation>()
// .eq(DesignInformation::getPeasantHouseholdId, peasantHousehold.getSequenceNbr()));
//
//
// }
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationTimeStatisticsBatchDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationTimeStatisticsDto;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper;
import com.yeejoin.amos.boot.module.hygf.api.util.ListUtils;
......@@ -56,6 +57,7 @@ public class PowerStationStatisticsServiceImpl {
Map<Long, List<PowerStationTimeStatisticsDto>> sgMap = getSgTime(sequenceNbrList);
Map<Long, List<PowerStationTimeStatisticsDto>> bwMap = getBwTime(sequenceNbrList);
Map<Long, List<PowerStationTimeStatisticsDto>> ysMap = getYsTime(sequenceNbrList);
Map<Long, List<PowerStationTimeStatisticsDto>> trMap = getTrTime(sequenceNbrList);
for (PowerStationTimeStatisticsDto statisticsDto : statisticsDtos) {
dealKcTime(statisticsDto, kcMap);
dealDzhtqyTime(statisticsDto, dzhtqyMap);
......@@ -64,10 +66,33 @@ public class PowerStationStatisticsServiceImpl {
dealSgTime(statisticsDto, sgMap);
dealBwTime(statisticsDto, bwMap);
dealYsTime(statisticsDto, ysMap);
dealTrTime(statisticsDto, trMap);
}
}
}
private void dealTrTime(PowerStationTimeStatisticsDto statisticsDto, Map<Long, List<PowerStationTimeStatisticsDto>> map) {
List<PowerStationTimeStatisticsDto> time = map.get(statisticsDto.getSequenceNbr());
if (CollectionUtil.isNotEmpty(time)) {
statisticsDto.setTrCreateTime(time.get(0).getTrCreateTime());
statisticsDto.setTrEndTime(time.get(0).getTrEndTime());
statisticsDto.setTrStopTime(dealStopTime(time.get(0).getTrCreateTime(), time.get(0).getTrEndTime()));
}
}
private Map<Long, List<PowerStationTimeStatisticsDto>> getTrTime(List<Long> sequenceNbrList) {
List<PowerStationTimeStatisticsDto> statisticsDtos = new ArrayList<>();
if (sequenceNbrList.size() < 1000) {
statisticsDtos = peasantHouseholdMapper.getTrTime(sequenceNbrList);
} else {
List<List<Long>> lists = ListUtils.splitList(sequenceNbrList, 1000);
for (List<Long> list : lists) {
statisticsDtos.addAll(peasantHouseholdMapper.getTrTime(list));
}
}
return statisticsDtos.stream().collect(Collectors.groupingBy(PowerStationTimeStatisticsDto::getSequenceNbr));
}
private Map<Long, List<PowerStationTimeStatisticsDto>> getYsTime(List<Long> sequenceNbrList) {
List<PowerStationTimeStatisticsDto> statisticsDtos = new ArrayList<>();
if (sequenceNbrList.size() < 1000) {
......@@ -281,8 +306,8 @@ public class PowerStationStatisticsServiceImpl {
}
public void exportPowerStationExcel(List<String> sequenceNbrList, HttpServletResponse response) {
List<PowerStationTimeStatisticsDto> powerStationTimeStatisticsDtoList = getAllDetail(sequenceNbrList);
public void exportPowerStationExcel(PowerStationTimeStatisticsBatchDto statisticsBatchDto, HttpServletResponse response) {
List<PowerStationTimeStatisticsDto> powerStationTimeStatisticsDtoList = getAllDetail(statisticsBatchDto);
if (CollectionUtil.isNotEmpty(powerStationTimeStatisticsDtoList)) {
try {
List<PowerStationTimeStatisticsExcelVO> dataList = new ArrayList<>();
......@@ -302,6 +327,8 @@ public class PowerStationStatisticsServiceImpl {
excelVO.setSjEndTime(DateUtils.dateFormat(statisticsDto.getSjEndTime(), DateUtils.DATE_TIME_PATTERN));
excelVO.setFhbhCreateTime(DateUtils.dateFormat(statisticsDto.getFhbhCreateTime(), DateUtils.DATE_TIME_PATTERN));
excelVO.setFhbhEndTime(DateUtils.dateFormat(statisticsDto.getFhbhEndTime(), DateUtils.DATE_TIME_PATTERN));
excelVO.setTrCreateTime(DateUtils.dateFormat(statisticsDto.getTrCreateTime(), DateUtils.DATE_TIME_PATTERN));
excelVO.setTrEndTime(DateUtils.dateFormat(statisticsDto.getTrEndTime(), DateUtils.DATE_TIME_PATTERN));
dataList.add(excelVO);
}
ExcelUtils.exportExcelDefaultGroundColor(dataList, null, "电站时间统计", PowerStationTimeStatisticsExcelVO.class, "电站时间统计" + DateUtils.dateFormat(new Date(), "YYYY-MM-dd-HH-mm") + ".xlsx", response);
......@@ -314,11 +341,12 @@ public class PowerStationStatisticsServiceImpl {
/**
* 获取全部的详情
* @param sequenceNbrList
* @param statisticsBatchDto
* @return
*/
private List<PowerStationTimeStatisticsDto> getAllDetail(List<String> sequenceNbrList) {
private List<PowerStationTimeStatisticsDto> getAllDetail(PowerStationTimeStatisticsBatchDto statisticsBatchDto) {
List<PowerStationTimeStatisticsDto> statisticsDtos = new ArrayList<>();
List<String> sequenceNbrList = statisticsBatchDto.getSequenceNbrList();
if (CollectionUtil.isNotEmpty(sequenceNbrList)) {
if (sequenceNbrList.size() < 1000) {
statisticsDtos = peasantHouseholdMapper.getPowerStationTimeDetail(sequenceNbrList);
......@@ -329,7 +357,7 @@ public class PowerStationStatisticsServiceImpl {
}
}
} else {
statisticsDtos = peasantHouseholdMapper.getAllPowerStationTimeDetail();
statisticsDtos = peasantHouseholdMapper.getAllPowerStationTimeDetail(statisticsBatchDto.getFilters());
}
addPowerStationTime(statisticsDtos);
return statisticsDtos;
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapBuilder;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sun.org.apache.bcel.internal.generic.SWITCH;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.CommonEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.StatisicsHomePageEnum;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.StatisticsHomepageMapper;
import org.apache.activemq.util.MapHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.RegionUtil;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDrawing;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLEncoder;
import java.util.*;
@Service
public class StatisticsHomepageServiceImpl {
@Autowired
StatisticsHomepageMapper statisticsHomepageMapper;
@Autowired
JpStationMapper jpStationMapper;
public Map<String, Object> statisticsHomepage( String developerCode,String regionalCompaniesCode, String province, String city, String district){
Map<String, Object> resultMap = MapBuilder.<String, Object>create().build();
Map<String, Object> map = MapBuilder.<String, Object>create().build();
List<Map<String, Object>> surveyMaps = statisticsHomepageMapper.surveyStatusTotal(developerCode, regionalCompaniesCode, province, city, district);
if (!CollectionUtil.isEmpty(surveyMaps)){
surveyMaps.get(0).put("未勘察",statisticsHomepageMapper.selectWKC(developerCode, regionalCompaniesCode, province, city, district));
}
this.resuleMapBuild(map,resultMap,surveyMaps,"surey");
List<Map<String, Object>> desionMaps = statisticsHomepageMapper.desionTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,resultMap,desionMaps,"desion");
List<Map<String, Object>> contractMaps = statisticsHomepageMapper.contractStatusTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,resultMap,contractMaps,"contract");
List<Map<String, Object>> preparationMoneyMaps = statisticsHomepageMapper.preparationMoneyTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,resultMap,preparationMoneyMaps,"preparationMoney");
List<Map<String, Object>> workOrderMaps = statisticsHomepageMapper.workOrderTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,resultMap,workOrderMaps,"workOrder");
List<Map<String, Object>> gridMaps = statisticsHomepageMapper.gridStatusTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,resultMap,gridMaps,"grid");
List<Map<String, Object>> acceptanceMaps = statisticsHomepageMapper.acceptanceStatusTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,resultMap,acceptanceMaps,"acceptance");
List<Map<String, Object>> financingMaps = statisticsHomepageMapper.financingStatusTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,resultMap,financingMaps,"financing");
List<String> regionNodeByCode = new ArrayList<>();
if (StringUtils.isNotEmpty(province)){
regionNodeByCode = jpStationMapper.getRegionNodeByCode(province);
}
if (StringUtils.isNotEmpty(city)){
regionNodeByCode = jpStationMapper.getRegionNodeByCode(province);
}
if (StringUtils.isNotEmpty(district)){
regionNodeByCode = jpStationMapper.getRegionNodeByCode(province);
}
List<Map<String, Object>> inverterMaps = statisticsHomepageMapper.inverterTotal(developerCode, regionalCompaniesCode, province, city, district,regionNodeByCode);
List<Map<String, Object>> inverterJpMaps = statisticsHomepageMapper.inverterTotalJp(developerCode, regionalCompaniesCode, province, city, district,regionNodeByCode);
inverterMaps.addAll(inverterJpMaps);
this.resuleMapBuild(map,resultMap,inverterMaps,"inverter");
map.put("stationNum",statisticsHomepageMapper.stationNum(developerCode, regionalCompaniesCode, province, city, district).get("total"));
resultMap.put("above",map);
return resultMap;
}
Map<String,Object> resuleMapBuild(Map<String, Object> li, Map<String, Object> resultMap,List<Map<String, Object>> maps,String type){
long total= 0;
long trtotal= 0;
double trrealScale = 0.00;
double realScale = 0.00;
long sgtotal= 0;
double sgrealScale = 0.00;
long sureyNum = 0;
long workNum = 0;
long preparationNum = 0;
long gridNum = 0;
long acceptanceNum = 0;
long financingNum = 0;
double stationRealScale = 0.00;
double disbursementMoney = 0.00;
LambdaQueryWrapper<PeasantHousehold> wrapper = new LambdaQueryWrapper<>();
List<String> surveKeys = new ArrayList<>(Arrays.asList("未通过","未勘察","已完成(法务审核)","进行中(审核)"));
List<String> contractKeys = new ArrayList<>(Arrays.asList("双方已签署","农户已签署","未签署","已作废"));
List<String> workOrder = new ArrayList<>(Arrays.asList("派工发料","未通过","施工资料已上传","完工登记","完工自审","审核中","已完成","整改待审核" ,"待整改"));
List<String> preparationMoneyKeys = new ArrayList<>(Arrays.asList("待发货","已收货","已发货"));
List<String> desionKeys = new ArrayList<>(Arrays.asList("施工图已上传","典设图已上传"));
List<String> gridKeys = new ArrayList<>(Arrays.asList("待登记","审核中","已完成","未通过","整改待审核" ,"待整改"));
List<String> acceptanceKeys = new ArrayList<>(Arrays.asList("待提交","已完成","审核中","整改待审核","待整改","未通过"));
List<String> financingKeys = new ArrayList<>(Arrays.asList("未通过","已放款","放款完成","待审核","待推送","待放款"));
List<Map<String, Object>> list = new ArrayList<>();
switch(type){
case "surey" :
resultMap.put("sureyComplete",0);
if (Objects.isNull(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,surveKeys);
}else {
Map<String, Object> surey = maps.get(0);
surveKeys.removeAll(surey.keySet());
for (String e : surey.keySet()) {
if (!e.equals("completeTotal")){
list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",surey.get(e)).build());
}
if (!e.equals("未勘察")){
sureyNum += new BigDecimal(surey.get(e).toString()).longValue();
}
}
list = this.nullDataBuildResult(list,surveKeys);
resultMap.put("sureyComplete",surey.containsKey("completeTotal")?surey.get("completeTotal"):0);
}
li.put("surveNum",sureyNum);
resultMap.put("surey",list);
break;
case "desion":
if (Objects.isNull(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,desionKeys);
}else {
Map<String, Object> desion = maps.get(0);
long surveNum = (long) li.get("surveNum");
desionKeys.removeAll(desion.keySet());
for (String e : desion.keySet()) {
list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",desion.get(e)).build());
surveNum += new BigDecimal(desion.get(e).toString()).longValue();
}
li.put("surveNum",surveNum);
list = this.nullDataBuildResult(list,desionKeys);
if (resultMap.containsKey("sureyComplete")){
list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",resultMap.get("sureyComplete")).build());
resultMap.remove("sureyComplete");
}else {
list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",0).build());
}
}
resultMap.put("desion",list);
break;
case "contract":
if (Objects.isNull(maps) || Objects.isNull(maps.get(0)) ){
list = this.nullDataBuildResult(list,contractKeys);
}else {
Map<String, Object> contract = maps.get(0);
contractKeys.removeAll(contract.keySet());
for (String e : contract.keySet()) {
list.add(MapBuilder.<String, Object>create().put("statusText", e).put("total", contract.get(e)).build());
}
list = this.nullDataBuildResult(list,contractKeys);
}
resultMap.put("contract",list);
break;
case "preparationMoney":
if (Objects.isNull(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,preparationMoneyKeys);
}else {
Map<String, Object> preparationMoney = maps.get(0);
preparationMoneyKeys.removeAll(preparationMoney.keySet());
for (String e : preparationMoney.keySet()) {
list.add(MapBuilder.<String, Object>create().put("statusText", e).put("total", preparationMoney.get(e)).build());
preparationNum += new BigDecimal(preparationMoney.get(e).toString()).longValue();
}
list = this.nullDataBuildResult(list,preparationMoneyKeys);
}
resultMap.put("preparationMoney",list);
li.put("preparationNum",preparationNum);
break;
case "workOrder":
if (CollectionUtil.isEmpty(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,workOrder);
resultMap.put("workOrder",list);
}else {
Iterator<Map<String, Object>> iterator = maps.iterator();
while (iterator.hasNext()) {
Map<String, Object> map = iterator.next();
workNum += (long) map.get("total");
stationRealScale += (double) map.get("realScale");
if ("审核中".equals(map.get("statusText"))) {
total += (long) map.get("total");
realScale += (double) map.get("realScale");
iterator.remove();
}
if ("施工资料已上传".equals(map.get("statusText"))) {
sgtotal += (long) map.get("total");
sgrealScale += (double) map.get("realScale");
iterator.remove();
}
}
maps.add(MapBuilder.<String, Object>create().put("statusText","审核中").put("total",total).put("realScale",new BigDecimal(realScale).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()).build());
maps.add(MapBuilder.<String, Object>create().put("statusText","施工资料已上传").put("total",sgtotal).put("realScale",new BigDecimal(sgrealScale).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()).build());
differenceValue(maps,workOrder);
resultMap.put("workOrder",maps);
}
li.put("workNum",workNum);
li.put("stationRealScale",new BigDecimal(stationRealScale/1000).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
break;
case "grid":
if (CollectionUtil.isEmpty(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,gridKeys);
resultMap.put("grid",list);
}else {
Iterator<Map<String, Object>> iterator1 = maps.iterator();
while (iterator1.hasNext()) {
Map<String, Object> map = iterator1.next();
gridNum += (long) map.get("total");
if ("审核中".equals(map.get("statusText"))) {
total += (long) map.get("total");
realScale += (double) map.get("realScale");
iterator1.remove();
}
}
maps.add(MapBuilder.<String, Object>create().put("statusText", "审核中").put("total", total).put("realScale",new BigDecimal(realScale).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()).build());
differenceValue(maps,gridKeys);
resultMap.put("grid",maps);
}
li.put("gridNum",gridNum);
break;
case "acceptance":
if (CollectionUtil.isEmpty(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,acceptanceKeys);
resultMap.put("acceptance",list);
}else {
Iterator<Map<String, Object>> iterator2 = maps.iterator();
while (iterator2.hasNext()) {
Map<String, Object> map = iterator2.next();
acceptanceNum += (long) map.get("total");
if ("审核中".equals(map.get("statusText"))) {
total += (long) map.get("total");
realScale += (double) map.get("realScale");
iterator2.remove();
}
}
maps.add(MapBuilder.<String, Object>create().put("statusText","审核中").put("total",total).put("realScale",new BigDecimal(realScale).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()).build());
differenceValue(maps,acceptanceKeys);
resultMap.put("acceptance",maps);
}
li.put("acceptanceNum",acceptanceNum);
break;
case "financing":
if (CollectionUtil.isEmpty(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,financingKeys);
resultMap.put("financing",list);
}else {
Iterator<Map<String, Object>> iterator2 = maps.iterator();
while (iterator2.hasNext()) {
Map<String, Object> map = iterator2.next();
financingNum += (long) map.get("total");
if ("放款完成".equals(map.get("statusText"))) {
disbursementMoney += (double)map.get("disbursementMoney");
}
if ("待推送".equals(map.get("statusText"))) {
trtotal += (long) map.get("total");
trrealScale += (double) map.get("realScale");
iterator2.remove();
}
}
maps.add(MapBuilder.<String, Object>create().put("statusText","待推送").put("total",trtotal).put("realScale",new BigDecimal(trrealScale).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()).build());
differenceValue(maps,financingKeys);
resultMap.put("financing",maps);
}
li.put("financingNum",financingNum);
li.put("disbursementMoney",new BigDecimal(disbursementMoney).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
break;
default:
resultMap.put("inverter",maps);
break;
}
return resultMap;
}
List<Map<String, Object>> nullDataBuildResult(List<Map<String, Object>> list,List<String> Keys){
if (Keys.size()< 1){
return list ;
}
for (String key : Keys) {
if (key.equals("workOrder") ||key.equals("grid")||key.equals("acceptance")||key.equals("financing")||key.equals("inverter")){
list.add( MapBuilder.<String, Object>create().put("statusText",key).put("total",0).put("realScale",0).build());
}else {
list.add( MapBuilder.<String, Object>create().put("statusText",key).put("total",0).build());
}
}
return list;
}
List<Map<String, Object>> differenceValue (List<Map<String, Object>> list,List<String> Keys) {
List<String> objects = new ArrayList<>();
list.forEach(e->{
objects.add(e.get("statusText").toString());
});
Keys.removeAll(objects);
this.nullDataBuildResult(list,Keys);
return list;
}
public void homePageExport(String developerCode, String regionalCompaniesCode, String province, String city, String district, HttpServletResponse response) throws IOException {
//获取电站数据
List<Map<String, Object>> maps = statisticsHomepageMapper.homePageExport(developerCode, regionalCompaniesCode, province, city, district);
//获取区域公司对应的经销商数量 用来合并表格
List<Map<String, Object>> merCountMap = statisticsHomepageMapper.merCount(developerCode, regionalCompaniesCode, province, city, district);
String templatePath = "templates/homePageExport.xlsx";
Workbook workbook = null;
try ( InputStream fis = new ClassPathResource(templatePath).getInputStream()) {
workbook = new XSSFWorkbook(fis);
Sheet firstSheet = workbook.getSheetAt(0);
fillSheet(firstSheet, maps);
int startNum = 4;
int replenishStartNum = 4+maps.size();
//根据区域公司的省市区进行筛选
List<String> regionNodeByCode = new ArrayList<>();
if (StringUtils.isNotEmpty(province)){
regionNodeByCode = jpStationMapper.getRegionNodeByCode(province);
}
if (StringUtils.isNotEmpty(city)){
regionNodeByCode = jpStationMapper.getRegionNodeByCode(province);
}
if (StringUtils.isNotEmpty(district)){
regionNodeByCode = jpStationMapper.getRegionNodeByCode(province);
}
//查询区域公司的还款计划
List<Map<String, Object>> rent = statisticsHomepageMapper.getRent(regionalCompaniesCode,regionNodeByCode);
for (Map<String, Object> map : merCountMap) {
//此处逻辑针对需要合并表格的数据
if (!map.get("total").toString().equals("1")){
int total = Integer.valueOf(map.get("total").toString()) -1 ;
int endNum = startNum+total;
String regionName = statisticsHomepageMapper.selectProvince(map.get("regionSeq").toString());
if ( firstSheet.getRow(startNum) != null){
Cell cell = firstSheet.getRow(startNum).createCell(1);
cell.setCellValue(regionName);
applyBorder(cell);
boolean flag = true;
//判断是不是区域公司存在还款计划 若不存在则给0
for (Map<String, Object> stringObjectMap : rent) {
if (stringObjectMap.get("regionalCompaniesCode").equals(map.get("regionalCompaniesCode"))){
Cell cell3 = firstSheet.getRow(startNum).createCell(41);
cell3.setCellValue(stringObjectMap.get("yhk").toString());
applyBorder(cell3);
Cell cell1 = firstSheet.getRow(startNum).createCell(42);
cell1.setCellValue(stringObjectMap.get("jnwhk").toString());
applyBorder(cell1);
Cell cell2 = firstSheet.getRow(startNum).createCell(43);
cell2.setCellValue(stringObjectMap.get("sywhk").toString());
applyBorder(cell2);
flag = false;
}
}
if (flag){
Cell cell3 = firstSheet.getRow(startNum).createCell(41);
cell3.setCellValue(0);
applyBorder(cell3);
Cell cell1 = firstSheet.getRow(startNum).createCell(42);
cell1.setCellValue(0);
applyBorder(cell1);
Cell cell2 = firstSheet.getRow(startNum).createCell(43);
cell2.setCellValue(0);
applyBorder(cell2);
}
//合并表格及设置样式
CellRangeAddress cellRangeAddress2 = new CellRangeAddress(startNum, endNum, 1, 1);
CellRangeAddress cellRangeAddress = new CellRangeAddress(startNum, endNum, 2, 2);
CellRangeAddress cellRangeAddress1 = new CellRangeAddress(startNum, endNum, 36, 36);
CellRangeAddress cellRangeAddress3 = new CellRangeAddress(startNum, endNum, 41, 41);
CellRangeAddress cellRangeAddress4 = new CellRangeAddress(startNum, endNum, 42, 42);
CellRangeAddress cellRangeAddress5 = new CellRangeAddress(startNum, endNum, 43, 43);
firstSheet.addMergedRegion(cellRangeAddress);
firstSheet.addMergedRegion(cellRangeAddress1);
firstSheet.addMergedRegion(cellRangeAddress2);
firstSheet.addMergedRegion(cellRangeAddress3);
firstSheet.addMergedRegion(cellRangeAddress4);
firstSheet.addMergedRegion(cellRangeAddress5);
applyBorderToMergedRegion(firstSheet,cellRangeAddress2);
applyBorderToMergedRegion(firstSheet,cellRangeAddress );
applyBorderToMergedRegion(firstSheet,cellRangeAddress1);
applyBorderToMergedRegion(firstSheet,cellRangeAddress3);
applyBorderToMergedRegion(firstSheet,cellRangeAddress4);
applyBorderToMergedRegion(firstSheet,cellRangeAddress5);
startNum = endNum +1;
}
}else {
String regionName = statisticsHomepageMapper.selectProvince(map.get("regionSeq").toString());
if ( firstSheet.getRow(startNum) != null) {
Cell cell = firstSheet.getRow(startNum).createCell(1);
cell.setCellValue(regionName);
applyBorder(cell);
boolean flag = true;
//判断是不是区域公司存在还款计划 若不存在则给0
for (Map<String, Object> stringObjectMap : rent) {
if (stringObjectMap.get("regionalCompaniesCode").equals(map.get("regionalCompaniesCode"))){
Cell cell3 = firstSheet.getRow(startNum).createCell(41);
cell3.setCellValue(stringObjectMap.get("yhk").toString());
applyBorder(cell3);
Cell cell1 = firstSheet.getRow(startNum).createCell(42);
cell1.setCellValue(stringObjectMap.get("jnwhk").toString());
applyBorder(cell1);
Cell cell2 = firstSheet.getRow(startNum).createCell(43);
cell2.setCellValue(stringObjectMap.get("sywhk").toString());
applyBorder(cell2);
flag = false;
}
}
if (flag){
Cell cell3 = firstSheet.getRow(startNum).createCell(41);
cell3.setCellValue(0);
applyBorder(cell3);
Cell cell1 = firstSheet.getRow(startNum).createCell(42);
cell1.setCellValue(0);
applyBorder(cell1);
Cell cell2 = firstSheet.getRow(startNum).createCell(43);
cell2.setCellValue(0);
applyBorder(cell2);
}
startNum +=1;
}
}
}
//导出主体是电站,但可能存在部分区域公司不存在电站但存在还款计划 需将此类数据补充进excel
for (Map<String, Object> map : rent) {
boolean exist = false;
for (Map<String, Object> stringObjectMap : merCountMap) {
if (stringObjectMap.get("regionalCompaniesCode").equals(map.get("regionalCompaniesCode"))){
exist = true;
break;
}
}
if (!exist){
Row row = firstSheet.createRow(replenishStartNum);
Cell cell = row.createCell(0);
cell.setCellValue(maps.size()+1);
applyBorder(cell);
Cell cell1 = row.createCell(1);
String regionName = statisticsHomepageMapper.selectProvince(map.get("regionSeq").toString());
cell1.setCellValue(regionName);
applyBorder(cell1);
Cell cell2 = row.createCell(2);
cell2.setCellValue(map.get("regionalCompaniesName").toString());
applyBorder(cell2);
Cell cell40= row.createCell(41);
cell40.setCellValue(map.get("yhk").toString());
applyBorder(cell40);
Cell cell41 = row.createCell(42);
cell41.setCellValue(map.get("jnwhk").toString());
applyBorder(cell41);
Cell cell42 = row.createCell(43);
cell42.setCellValue(map.get("sywhk").toString());
applyBorder(cell42);
for (int i = 3; i <40; i++) {
Cell celli = row.createCell(i);
celli.setCellValue("");
applyBorder(celli);
}
}
}
// autoSizeColumns(firstSheet);
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("统计数据.xlsx", "UTF-8"));
response.setHeader("content-Type", "application/vnd.ms-excel");
response.flushBuffer();
workbook.write(response.getOutputStream());
workbook.close();
}
}
private void fillSheet(Sheet sheet, List<Map<String, Object>> data) {
if (Objects.isNull(data)){
return;
}
int startRow = 4;
sheet.setDefaultColumnWidth(0);
Map<String, List<Integer>> merList = new HashMap<>();
for (int dataIndex = 0; dataIndex < data.size(); dataIndex++) {
Row dataRow = sheet.createRow(startRow + dataIndex);
Cell cell = dataRow.createCell(0);
cell.setCellValue(dataIndex+1);
applyBorder(cell);
Map<String, Object> result = (Map<String, Object>) data.get(dataIndex);
for (String key : result.keySet()) {
Cell dataCell = dataRow.createCell(StatisicsHomePageEnum.getCodeByName(key));
dataCell.setCellValue(result.get(key).toString());
applyBorder(dataCell);
}
}
}
private void autoSizeColumns(Sheet sheet) {
for (int i = 0; i < sheet.getRow(0).getLastCellNum(); i++) {
if (i<35){
sheet.autoSizeColumn(i);
}
}
}
private void applyBorder(Cell cell) {
Workbook workbook = cell.getSheet().getWorkbook();
CellStyle style = cell.getCellStyle();
if (style == null) {
style = workbook.createCellStyle();
}
style.setBorderTop(BorderStyle.THIN);
style.setBorderBottom(BorderStyle.THIN);
style.setBorderLeft(BorderStyle.THIN);
style.setBorderRight(BorderStyle.THIN);
cell.setCellStyle(style);
}
private void applyBorderToMergedRegion(Sheet sheet, CellRangeAddress mergedRegion) {
RegionUtil.setBorderBottom(BorderStyle.THIN,mergedRegion,sheet);
RegionUtil.setBorderTop(BorderStyle.THIN,mergedRegion,sheet);
RegionUtil.setBorderLeft(BorderStyle.THIN,mergedRegion,sheet);
RegionUtil.setBorderRight(BorderStyle.THIN,mergedRegion,sheet);
}
public Map<String, Object> statisticsTop(String type, String developerCode,String regionalCompaniesCode, String province, String city, String district){
Map<String, Object> resultMap = MapBuilder.<String, Object>create().build();
Map<String, Object> map = MapBuilder.<String, Object>create().build();
Map<String, Object> map1 = MapBuilder.<String, Object>create().build();
switch (type){
case "survey":
Map<String, Object> surveyMaps = statisticsHomepageMapper.statisticsPowerStation(developerCode, regionalCompaniesCode, province, city, district);
for (String key : surveyMaps.keySet()) {
if (!key.contains("rl")){
resultMap.put(key,Arrays.asList(surveyMaps.get(key),"0"));
}
}
resultMap.put("kcywc",Arrays.asList(surveyMaps.get("kcywc"),new BigDecimal((double)surveyMaps.get("kcywcrl")).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
resultMap.put("sfyqs",Arrays.asList(surveyMaps.get("sfyqs"),new BigDecimal((double)surveyMaps.get("sfyqsrl")).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
break;
case "preparationMoney":
Map<String, Object> preparationMoney = statisticsHomepageMapper.statisticsPreparationMoney(developerCode, regionalCompaniesCode, province, city, district);
for (String key : preparationMoney.keySet()) {
if (!key.contains("rl")){
resultMap.put(key,Arrays.asList(preparationMoney.get(key),"0"));
}
}
resultMap.put("ysh",Arrays.asList(preparationMoney.get("ysh"),new BigDecimal((double)preparationMoney.get("yshrl")).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
break;
case "workOrder":
List<Map<String, Object>> workOrderMaps = statisticsHomepageMapper.workOrderTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,map1,workOrderMaps,"workOrder");
List<Map<String, Object>> workOrder = (List<Map<String, Object>>) map1.get("workOrder");
for (Map<String, Object> objectMap : workOrder) {
String key = objectMap.get("statusText").toString();
resultMap.put(key,Arrays.asList(objectMap.get("total"),objectMap.get("realScale")));
}
break;
case "grid":
List<Map<String, Object>> grid = statisticsHomepageMapper.gridStatusTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,map1,grid,"grid");
List<Map<String, Object>> gridMaps = (List<Map<String, Object>>) map1.get("grid");
for (Map<String, Object> objectMap : gridMaps) {
String key = objectMap.get("statusText").toString();
resultMap.put(key,Arrays.asList(objectMap.get("total"),objectMap.get("realScale")));
}
break;
case "acceptance":
List<Map<String, Object>> acceptanceMaps = statisticsHomepageMapper.acceptanceStatusTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,map1,acceptanceMaps,"acceptance");
List<Map<String, Object>> acceptance = (List<Map<String, Object>>) map1.get("acceptance");
for (Map<String, Object> objectMap : acceptance) {
String key = objectMap.get("statusText").toString();
resultMap.put(key,Arrays.asList(objectMap.get("total"),objectMap.get("realScale")));
}
break;
case "financing":
List<Map<String, Object>> financingMaps = statisticsHomepageMapper.financingStatusTotal(developerCode, regionalCompaniesCode, province, city, district);
this.resuleMapBuild(map,map1,financingMaps,"financing");
List<Map<String, Object>> financing = (List<Map<String, Object>>) map1.get("financing");
for (Map<String, Object> objectMap : financing) {
String key = objectMap.get("statusText").toString();
resultMap.put(key,Arrays.asList(objectMap.get("total"),objectMap.get("realScale")));
}
break;
}
return resultMap;
}
}
......@@ -120,4 +120,16 @@ public class PowerStationTimeStatisticsExcelVO implements Serializable {
@Excel(name = "验收停留时间", width = 30, orderNum = "27")
@ApiModelProperty(value = "验收停留时间")
private String ysStopTime;
@Excel(name = "投融开始时间", width = 30, orderNum = "28")
@ApiModelProperty(value = "投融开始时间")
private String trCreateTime;
@Excel(name = "投融结束时间", width = 30, orderNum = "29")
@ApiModelProperty(value = "投融结束时间")
private String trEndTime;
@Excel(name = "投融停留时间", width = 30, orderNum = "30")
@ApiModelProperty(value = "投融停留时间")
private String trStopTime;
}
......@@ -93,7 +93,7 @@ emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://47.92.234.253:1883
emqx.user-name=admin
emqx.password=Yeejoin@1234
emqx.password=Yeejoin@2020
emqx.max-inflight=1000
......@@ -173,16 +173,16 @@ hygf.user.group.empty=1775056568031645697
#qiyuesuo.serverUrl = https://openapi.qiyuesuo.cn
#qiyuesuo.accessKey = a1lcd3WRRV
#qiyuesuo.accessSecret = haqYIOxTP20ZYiDNEN92GVBa6aoJLu
#qiyuesuo.secretKey=Fp2LQAqK5gc68hi5
qiyuesuo.serverUrl = https://openapi.qiyuesuo.cn
qiyuesuo.accessKey = a1lcd3WRRV
qiyuesuo.accessSecret = haqYIOxTP20ZYiDNEN92GVBa6aoJLu
qiyuesuo.secretKey=Fp2LQAqK5gc68hi5
qiyuesuo.serverUrl = https://openapi.qiyuesuo.com
qiyuesuo.accessKey = QcmHQu55pl
qiyuesuo.accessSecret = em0zvOMRNCAXoD1ePNTL7hGR5KpKUs
qiyuesuo.secretKey=B6OYbHyfXikAghB2
#qiyuesuo.serverUrl = https://openapi.qiyuesuo.com
#qiyuesuo.accessKey = QcmHQu55pl
#qiyuesuo.accessSecret = em0zvOMRNCAXoD1ePNTL7hGR5KpKUs
#qiyuesuo.secretKey=B6OYbHyfXikAghB2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment