Commit 432e521b authored by lisong's avatar lisong

更新接口

parent e9d81d5d
package com.yeejoin.amos.boot.module.jxiop.api.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.util.List;
@Data
public class HouseholdPvExport {
private Long id;
/**
* 基础信息
*/
private String platformCompanyId;
private String number;
private String name;
private String sex;
private String idNumber;
private String expiryTime;
private String issuingAuthority;
private String residenceAddress;
private String phone;
private String address;
private String postcode;
private String serviceAddress;
/**
* 合同信息
*/
private String contactNumber;
private String period;
private String description;
/**
* 设备信息
*/
private String equipmentMessage;
/**
* 租赁物信息
*/
private String installAddress;
private String installDate;
private String estimatedPower;
private String monolithicPower;
private String installCount;
private String actualCapacity;
private String stationType;
private String moduleType;
/**
* 安装信息
*/
private String installDescription;
private String installStation;
}
package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDeviceDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvExport;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport;
import com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -16,5 +18,7 @@ import java.util.List;
*/
public interface HouseholdPvMapper extends BaseMapper<HouseholdPv> {
List<HouseholdPvImport> selectExportList(@Param("dto")HouseholdPvDto dto );
List<HouseholdPvExport> selectExportList(@Param("dto")HouseholdPvDto dto );
List<HouseholdPvDeviceDto> selectEquipList(@Param("id")Long id );
}
......@@ -5,6 +5,7 @@ import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvExport;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport;
import com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv;
......@@ -18,7 +19,7 @@ public interface IHouseholdPvService extends IService<HouseholdPv>{
void importData(List<HouseholdPvImport> list);
List<HouseholdPvImport> selectExportList(HouseholdPvDto dto);
List<HouseholdPvExport> selectExportList(HouseholdPvDto dto);
void deleteBatch(List<Long> ids);
......
......@@ -2,8 +2,40 @@
<!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.jxiop.api.mapper.HouseholdPvMapper">
<select id="selectExportList" resultType="com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport">
SELECT * FROM `household_pv` hp
<select id="selectExportList" resultType="com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvExport">
SELECT
hp.sequence_nbr as id,
hp.platform_company_id AS platformCompanyId,
hp.number,
hp.`name`,
hp.sex,
hp.ID_number AS idNumber,
hp.expiry_time AS expiryTime,
hp.issuing_authority AS issuingAuthority,
hp.residence_address AS residenceAddress,
hp.phone,
hp.address,
hp.postcode,
hp.service_address AS serviceAddress,
hpc.number AS contactNumber,
hpc.period,
hpc.description ,
hpl.install_address as installAddress,
hpl.install_date as installDate,
hpl.estimated_power as estimatedPower,
hpl.monolithic_power as monolithicPower,
hpl.actual_capacity as actualCapacity,
hpl.station_type as stationType,
hpl.module_type as moduleType,
hpl.install_count as installCount,
hpi.description as installDescription,
hpi.platform_company_id AS installStation
FROM
household_pv hp
LEFT JOIN household_pv_contact hpc on hp.sequence_nbr = hpc.household_pv_id
LEFT JOIN household_pv_lease hpl on hp.sequence_nbr = hpl.household_pv_id
LEFT JOIN household_pv_install hpi on hp.sequence_nbr = hpi.household_pv_id
<where>
<if test="dto.name != null and dto.name != ''">
and hp.name like concat('%',#{dto.name},'%')
......@@ -19,4 +51,7 @@
</if>
</where>
</select>
<select id="selectEquipList" resultType="com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDeviceDto">
SELECT * from household_pv_device hpd WHERE hpd.household_pv_id = #{id}
</select>
</mapper>
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.module.jxiop.api.dto.*;
import org.apache.commons.lang3.ObjectUtils;
import org.joda.time.LocalDateTime;
import org.springframework.beans.BeanUtils;
......@@ -17,11 +18,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvContactDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvInstallDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvLeaseDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv;
import com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPvContact;
import com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPvInstall;
......@@ -103,8 +99,43 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
}
@Override
public List<HouseholdPvImport> selectExportList(HouseholdPvDto dto) {
return householdPvMapper.selectExportList(dto);
public List<HouseholdPvExport> selectExportList(HouseholdPvDto dto) {
List<HouseholdPvExport> householdPvExports = householdPvMapper.selectExportList(dto);
householdPvExports.forEach(item -> {
if (!ObjectUtils.isEmpty(item.getPeriod())) {
JSONArray objects = JSON.parseArray(item.getPeriod());
if (!ObjectUtils.isEmpty(objects) && objects.size() >= 2) {
item.setPeriod(objects.get(0) + "-" + objects.get(1));
}
}
List<HouseholdPvDeviceDto> equipList = householdPvMapper.selectEquipList(item.getId());
if (!ObjectUtils.isEmpty(equipList)) {
StringBuilder stringBuilder = equipMessage(equipList);
item.setEquipmentMessage(stringBuilder.toString());
}
});
return householdPvExports;
}
private StringBuilder equipMessage(List<HouseholdPvDeviceDto> list) {
StringBuilder stringBuilder = new StringBuilder();
list.forEach(item -> {
stringBuilder.append("类型:").append(ObjectUtils.isEmpty(item.getType()) ? "" : item.getType());
stringBuilder.append(" 名称:").append(ObjectUtils.isEmpty(item.getName()) ? "" : item.getName());
stringBuilder.append(" 品牌:").append(ObjectUtils.isEmpty(item.getBrand()) ? "" : item.getBrand());
stringBuilder.append(" SN编码:").append(ObjectUtils.isEmpty(item.getSnCode()) ? "" : item.getSnCode());
if (!ObjectUtils.isEmpty(item.getType()) && item.getType().equals("逆变器")) {
stringBuilder.append(" 序列号:").append(ObjectUtils.isEmpty(item.getSerialNumber()) ? "" : item.getSerialNumber());
stringBuilder.append(" 功率:").append(ObjectUtils.isEmpty(item.getPower()) ? "" : item.getPower());
}
if (!ObjectUtils.isEmpty(item.getType()) && item.getType().equals("其他")) {
stringBuilder.append(" 描述:").append(ObjectUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
}
stringBuilder.append("\r\n");
});
return stringBuilder;
}
@Override
......
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