Commit 5e1dfd3f authored by chenzhao's avatar chenzhao

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

parents a120e928 83cd2a2d
...@@ -16,7 +16,7 @@ public enum CommonEnum { ...@@ -16,7 +16,7 @@ public enum CommonEnum {
经销商代建("经销商代建","fzx","电站类型"), 经销商代建("经销商代建","fzx","电站类型"),
平顶屋("平顶屋","pdw","屋顶类型"), 平顶屋("平顶屋","pdw","屋顶类型"),
斜顶屋("斜顶屋","xdw","屋顶类型"), 斜顶屋("斜顶屋","xdw","屋顶类型"),
庭院("ty","other","屋顶类型"), 庭院("庭院","ty","屋顶类型"),
别墅("别墅","bs","房屋整体情况"), 别墅("别墅","bs","房屋整体情况"),
普通民房("普通民房","pymf","房屋整体情况"), 普通民房("普通民房","pymf","房屋整体情况"),
单门独院("单门独院","dmdy","房屋整体情况"), 单门独院("单门独院","dmdy","房屋整体情况"),
...@@ -62,6 +62,8 @@ public enum CommonEnum { ...@@ -62,6 +62,8 @@ public enum CommonEnum {
SMC("SMC","smc","材质"), SMC("SMC","smc","材质"),
不锈钢("不锈钢","bxg","材质"), 不锈钢("不锈钢","bxg","材质"),
钢板喷塑("钢板喷塑","gbps","材质"), 钢板喷塑("钢板喷塑","gbps","材质"),
单面("单面","dm","组件类型"),
双面("双面","sm","组件类型"),
其他("其他","other","公用"); 其他("其他","other","公用");
/** /**
...@@ -80,7 +82,7 @@ public enum CommonEnum { ...@@ -80,7 +82,7 @@ public enum CommonEnum {
public static String getNameByCode(String code) { public static String getNameByCode(String code) {
String name = null; String name = "";
for(CommonEnum obj: CommonEnum.values()) { for(CommonEnum obj: CommonEnum.values()) {
if (obj.getCode().equals(code)) { if (obj.getCode().equals(code)) {
name = obj.getName(); name = obj.getName();
......
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;
}
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;
}
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);
}
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.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>
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.yeejoin.amos.boot.module.hygf.api.dto.BasicGridRecordDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationTimeStatisticsBatchDto;
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.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);
}
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);
}
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="审核通过";
if (null != status ){
params.put("status", Arrays.asList(status.split(",")));
}
params.put("type", "2");
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);
}
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="待融资审核";
if (null != status ){
params.put("status", Arrays.asList(status.split(",")));
}
params.put("type", "2");
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);
}
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="审核不通过,重新验收";
if (null != status ){
params.put("status", Arrays.asList(status.split(",")));
}
params.put("type", "2");
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);
}
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="已放款,放款完成";
if (null != status ){
params.put("status", Arrays.asList(status.split(",")));
}
params.put("type", "2");
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);
}
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 (null != status ){
params.put("status", Arrays.asList(status.split(",")));
}
params.put("type", "1");
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
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 (null != status ){
params.put("status", Arrays.asList(status.split(",")));
}
params.put("type", "1");
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
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 (null != status ){
params.put("status", Arrays.asList(status.split(",")));
}
params.put("type", "1");
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
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 (null != status ){
params.put("status", Arrays.asList(status.split(",")));
}
params.put("type", "1");
if (Objects.nonNull(filters)) {
params.putAll(filters);
}
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 (null != status ){
params.put("status", Arrays.asList(status.split(",")));
}
params.put("type", "1");
if(Objects.nonNull(filters)){
params.putAll(filters);
}
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<Map<String, Object>> data = getExcelData(stationFieldDto);
exportFieldExcel(fields, data, response);
}
/**
* 导出动态字段Excel
* @param fields
* @param data
* @param response
*/
private void exportFieldExcel(List<String> fields, 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 < fields.size(); j++) {
Object value = data.get(i).get(fields.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) {
//处理组件序列号
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) {
return dealFields(businessFieldMapper.getExtendedInformation(stationIdList), fields);
}
/**
* 获取商务信息
* @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("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("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"))));
}
}
}
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(), stringObjectMap.get(field.getFieldFlag()));
}
result.put(String.valueOf(stringObjectMap.get("stationId")), fieldMap);
}
}
return result;
}
}
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