refactor(sales): 重构销售出库报表导出逻辑

- 新增 sceneType 参数区分库存和交易场景
- 更新 queryBasicArchivesStock 方法以支持不同场景的处理逻辑
- 新增 TOB 和 TOC 销售报表导出的 DTO 类
- 扩展 TocofsSaleoutDetailedDao 接口,添加新的查询方法
- 优化错误日志处理逻辑,根据场景类型选择不同的处理方式
This commit is contained in:
liuy 2024-10-30 17:46:23 +08:00
parent 4bdbe61e0e
commit ba44b5a4ef
12 changed files with 828 additions and 24 deletions

View File

@ -849,7 +849,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) {
try { try {
// 查询基本档案 // 查询基本档案
List<SonDetailsDto> sonDetailsDtoList = queryBasicArchivesStock(headerDetailsDtos); String sceneType = "stock";
List<SonDetailsDto> sonDetailsDtoList = queryBasicArchivesStock(headerDetailsDtos, sceneType);
// 分组汇总 // 分组汇总
Map<String, List<SonDetailsDto>> summaryDimensionMap = groupSummaryStock(sonDetailsDtoList); Map<String, List<SonDetailsDto>> summaryDimensionMap = groupSummaryStock(sonDetailsDtoList);
// 查询U8C业务流程 // 查询U8C业务流程
@ -1201,7 +1202,10 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
* *
* @author liuyang * @author liuyang
*/ */
private List<SonDetailsDto> queryBasicArchivesStock(List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList) { private List<SonDetailsDto> queryBasicArchivesStock(List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList, String sceneType) {
Assert.notNull(headerDetailsDtoList, "headerDetailsDtoList不能为空!");
Assert.notNull(sceneType, "sceneType不能为空");
List<SonDetailsDto> sonDetailsDtoList = new ArrayList<>(); List<SonDetailsDto> sonDetailsDtoList = new ArrayList<>();
List<ErrorHeaderDetailsDtoDto> errorHeaderDetailsDtoDtoList = new ArrayList<>(); List<ErrorHeaderDetailsDtoDto> errorHeaderDetailsDtoDtoList = new ArrayList<>();
@ -1243,7 +1247,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
// String corpName = "上海丽知品牌管理有限公司"; // String corpName = "上海丽知品牌管理有限公司";
String companyCode = header.getCompanyCode(); String companyCode = header.getCompanyCode();
Assert.notNull(companyCode, "O出库单表头货主不能为空"); Assert.notNull(companyCode, "O出库单表头货主不能为空");
//查找是否替换公司 //查找是否替换公司
String targetCorp = comparisonCompanyArchives.get(companyCode); String targetCorp = comparisonCompanyArchives.get(companyCode);
if (targetCorp != null) { if (targetCorp != null) {
@ -1407,10 +1411,16 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
} else { } else {
logger.info("queryBasicArchives方法headerDetailsDtoList.size为0"); logger.info("queryBasicArchives方法headerDetailsDtoList.size为0");
} }
//批量把错误写入到日志信息表 //批量把错误写入到日志信息表
if (errorHeaderDetailsDtoDtoList.size() > 0) { if (errorHeaderDetailsDtoDtoList.size() > 0) {
updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiryV2(errorHeaderDetailsDtoDtoList); if (sceneType.equals("stock")) {
updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiry(errorHeaderDetailsDtoDtoList);
} else if (sceneType.equals("tran")) {
updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiryV2(errorHeaderDetailsDtoDtoList);
} else {
Assert.state(false, "无法识别的场景类型stock、tran");
}
} }
return sonDetailsDtoList; return sonDetailsDtoList;
} }
@ -1801,7 +1811,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) {
try { try {
//查询基本档案 //查询基本档案
List<SonDetailsDto> sonDetailsDtoList = queryBasicArchivesStock(headerDetailsDtos); String sceneType = "tran";
List<SonDetailsDto> sonDetailsDtoList = queryBasicArchivesStock(headerDetailsDtos, sceneType);
//分组汇总红蓝 //分组汇总红蓝
Map<String, List<SonDetailsDto>> summaryDimensionMap = groupSummaryStock(sonDetailsDtoList); Map<String, List<SonDetailsDto>> summaryDimensionMap = groupSummaryStock(sonDetailsDtoList);
//分组汇总 //分组汇总

View File

@ -109,8 +109,8 @@ class SoSaleOutPluginInitializerToCTest {
// String aaa = "LETS-SH2024101900022025"; // String aaa = "LETS-SH2024101900022025";
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran"); // soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
String aaa = "LETS-SH2024102200217857"; String aaa = "LETS-SH2024102900016893";
soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "stock"); soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
// soSaleOutPluginInitializerToC.startImplementTranByTime("2024-10-26 18:20:09","2024-10-26 18:20:09"); // soSaleOutPluginInitializerToC.startImplementTranByTime("2024-10-26 18:20:09","2024-10-26 18:20:09");
} catch (Exception e) { } catch (Exception e) {

View File

@ -1,6 +1,8 @@
package com.hzya.frame.report.lets.dao; package com.hzya.frame.report.lets.dao;
import com.hzya.frame.basedao.dao.IBaseDao; import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.report.lets.dto.TobofsSaleoutDetailedDto;
import com.hzya.frame.report.lets.dto.TocofsSaleoutDetailedDto;
import com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity;
import java.util.List; import java.util.List;
@ -12,5 +14,18 @@ import java.util.List;
* @since 2024-09-04 17:48:28 * @since 2024-09-04 17:48:28
*/ */
public interface ITocofsSaleoutDetailedDao extends IBaseDao<TocofsSaleoutDetailedEntity, String> { public interface ITocofsSaleoutDetailedDao extends IBaseDao<TocofsSaleoutDetailedEntity, String> {
/**
* TOC销售报表导出
*
* @author liuyang
*/
List<TocofsSaleoutDetailedDto> queryEntityListBaseToc(TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity) throws Exception;
/**
* TOB销售报表导出
*
* @author liuyang
*/
List<TobofsSaleoutDetailedDto> queryEntityListBaseTob(TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity) throws Exception;
} }

View File

@ -2,9 +2,13 @@ package com.hzya.frame.report.lets.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao; import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.report.lets.dao.ITocofsSaleoutDetailedDao; import com.hzya.frame.report.lets.dao.ITocofsSaleoutDetailedDao;
import com.hzya.frame.report.lets.dto.TobofsSaleoutDetailedDto;
import com.hzya.frame.report.lets.dto.TocofsSaleoutDetailedDto;
import com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* O出库单明细表(TOCTOB业务底表)(TocofsSaleoutDetailed)表数据库访问层 * O出库单明细表(TOCTOB业务底表)(TocofsSaleoutDetailed)表数据库访问层
* *
@ -13,4 +17,13 @@ import org.springframework.stereotype.Repository;
*/ */
@Repository(value = "tocofsSaleoutDetailedDaoImplReport") @Repository(value = "tocofsSaleoutDetailedDaoImplReport")
public class TocofsSaleoutDetailedDaoImpl extends MybatisGenericDao<TocofsSaleoutDetailedEntity, String> implements ITocofsSaleoutDetailedDao { public class TocofsSaleoutDetailedDaoImpl extends MybatisGenericDao<TocofsSaleoutDetailedEntity, String> implements ITocofsSaleoutDetailedDao {
@Override
public List<TocofsSaleoutDetailedDto> queryEntityListBaseToc(TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity) throws Exception {
return (List<TocofsSaleoutDetailedDto>) selectList("com.hzya.frame.report.lets.dao.impl.TocofsSaleoutDetailedDaoImpl.entity_list_base_toc", tocofsSaleoutDetailedEntity);
}
@Override
public List<TobofsSaleoutDetailedDto> queryEntityListBaseTob(TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity) throws Exception {
return (List<TobofsSaleoutDetailedDto>) selectList("com.hzya.frame.report.lets.dao.impl.TocofsSaleoutDetailedDaoImpl.entity_list_base_tob", tocofsSaleoutDetailedEntity);
}
} }

View File

@ -0,0 +1,82 @@
package com.hzya.frame.report.lets.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* TOB销售Excel报表导出
*
* @Authorliuyang
* @Packagecom.hzya.frame.report.lets.dto
* @ProjectkangarooDataCenterV3
* @nameTocofsSaleoutDetailedDto
* @Date2024/10/30 14:59
* @FilenameTocofsSaleoutDetailedDto
*/
@Data
public class TobofsSaleoutDetailedDto {
@ExcelProperty(value = "O出库明细主键")
private String id;
@ExcelProperty(value = "O货主编码")
private String headCompanyCode;
@ExcelProperty(value = "O仓库编码")
private String headFacilityCode;
@ExcelProperty(value = "O平台编码")
private String headSourcePlatformCode;
@ExcelProperty(value = "O店铺编码")
private String headStoreCode;
@ExcelProperty(value = "O销售出库编码")
private String headCode;
@ExcelProperty(value = "O货品sku")
private String skucode;
@ExcelProperty(value = "O货品名称")
private String skuname;
@ExcelProperty(value = "O实发数量")
private String shipqty;
@ExcelProperty(value = "O中台业务类型")
private String businesstype;
//库存 开始
@ExcelProperty(value = "库存-推送状态")
private String newstate;
@ExcelProperty(value = "库存-推送时间")
private String newpushdate;
@ExcelProperty(value = "库存-报错详情")
private String newtransmitinfo;
@ExcelProperty(value = "库存-U8C单号")
private String newsystemnumber;
@ExcelProperty(value = "库存-U8C主键")
private String newsystemprimary;
//库存 结束
//TOB交易红 开始
@ExcelProperty(value = "交易-推送状态")
private String newstate4;
@ExcelProperty(value = "交易-推送时间")
private String def5;
@ExcelProperty(value = "交易-报错详情")
private String def6;
@ExcelProperty(value = "交易-U8C单号")
private String newsystemnumber4;
@ExcelProperty(value = "交易-U8C主键")
private String newsystemprimary4;
//TOB交易红 结束
}

View File

@ -0,0 +1,99 @@
package com.hzya.frame.report.lets.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* TOC销售Excel报表导出
*
* @Authorliuyang
* @Packagecom.hzya.frame.report.lets.dto
* @ProjectkangarooDataCenterV3
* @nameTocofsSaleoutDetailedDto
* @Date2024/10/30 14:59
* @FilenameTocofsSaleoutDetailedDto
*/
@Data
public class TocofsSaleoutDetailedDto {
@ExcelProperty(value = "O出库明细主键")
private String id;
@ExcelProperty(value = "O货主编码")
private String headCompanyCode;
@ExcelProperty(value = "O仓库编码")
private String headFacilityCode;
@ExcelProperty(value = "O平台编码")
private String headSourcePlatformCode;
@ExcelProperty(value = "O店铺编码")
private String headStoreCode;
@ExcelProperty(value = "O销售出库编码")
private String headCode;
@ExcelProperty(value = "O货品sku")
private String skucode;
@ExcelProperty(value = "O货品名称")
private String skuname;
@ExcelProperty(value = "O实发数量")
private String shipqty;
@ExcelProperty(value = "O中台业务类型")
private String businesstype;
//库存 开始
@ExcelProperty(value = "库存-推送状态")
private String newstate;
@ExcelProperty(value = "库存-推送时间")
private String newpushdate;
@ExcelProperty(value = "库存-报错详情")
private String newtransmitinfo;
@ExcelProperty(value = "库存-U8C单号")
private String newsystemnumber;
@ExcelProperty(value = "库存-U8C主键")
private String newsystemprimary;
//库存 结束
//交易红 开始
@ExcelProperty(value = "交易红-推送状态")
private String newstate2;
@ExcelProperty(value = "交易红-推送时间")
private String def1;
@ExcelProperty(value = "交易红-报错详情")
private String def2;
@ExcelProperty(value = "交易红-U8C单号")
private String newsystemnumber2;
@ExcelProperty(value = "交易红-U8C主键")
private String newsystemprimary2;
//交易红 结束
//交易蓝 开始
@ExcelProperty(value = "交易蓝-推送状态")
private String newstate3;
@ExcelProperty(value = "交易蓝-推送时间")
private String def3;
@ExcelProperty(value = "交易蓝-报错详情")
private String def4;
@ExcelProperty(value = "交易蓝-U8C单号")
private String newsystemnumber4;
@ExcelProperty(value = "交易蓝-U8C主键")
private String newsystemprimary4;
//交易蓝 结束
}

View File

@ -1,5 +1,6 @@
package com.hzya.frame.report.lets.entity; package com.hzya.frame.report.lets.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.hzya.frame.web.entity.BaseEntity; import com.hzya.frame.web.entity.BaseEntity;
import lombok.Data; import lombok.Data;

View File

@ -191,7 +191,9 @@
,def39 ,def39
,def40 ,def40
</sql> </sql>
<!-- 查询 采用==查询 -->
<!-- TOC、TOB通用查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-TocofsSaleoutDetailedEntity-result" parameterType = "com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity"> <select id="entity_list_base" resultMap="get-TocofsSaleoutDetailedEntity-result" parameterType = "com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity">
select select
a.id a.id
@ -409,6 +411,498 @@
<!-- <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>--> <!-- <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>-->
</select> </select>
<resultMap id="get-TocofsSaleoutDetailedEntity-result-toc" type="com.hzya.frame.report.lets.dto.TocofsSaleoutDetailedDto" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="headCompanyCode" column="headCompanyCode" jdbcType="VARCHAR"/>
<result property="headFacilityCode" column="headFacilityCode" jdbcType="VARCHAR"/>
<result property="headSourcePlatformCode" column="headSourcePlatformCode" jdbcType="VARCHAR"/>
<result property="headStoreCode" column="headStoreCode" jdbcType="VARCHAR"/>
<result property="headCode" column="headCode" jdbcType="VARCHAR"/>
<result property="skucode" column="skuCode" jdbcType="VARCHAR"/>
<result property="skuname" column="skuName" jdbcType="VARCHAR"/>
<result property="shipqty" column="shipQty" jdbcType="VARCHAR"/>
<result property="businesstype" column="businessDate" jdbcType="VARCHAR"/>
<result property="newstate" column="newState" jdbcType="VARCHAR"/>
<result property="newpushdate" column="newPushDate" jdbcType="VARCHAR"/>
<result property="newtransmitinfo" column="newTransmitInfo" jdbcType="VARCHAR"/>
<result property="newsystemnumber" column="newSystemNumber" jdbcType="VARCHAR"/>
<result property="newsystemprimary" column="newSystemPrimary" jdbcType="VARCHAR"/>
<result property="newstate2" column="newState2" jdbcType="VARCHAR"/>
<result property="def1" column="def1" jdbcType="VARCHAR"/>
<result property="def2" column="def2" jdbcType="VARCHAR"/>
<result property="newsystemnumber2" column="newSystemNumber2" jdbcType="VARCHAR"/>
<result property="newsystemprimary2" column="newSystemPrimary2" jdbcType="VARCHAR"/>
<result property="newstate3" column="newState3" jdbcType="VARCHAR"/>
<result property="def3" column="def3" jdbcType="VARCHAR"/>
<result property="def4" column="def4" jdbcType="VARCHAR"/>
<result property="newsystemnumber4" column="newSystemNumber4" jdbcType="VARCHAR"/>
<result property="newsystemprimary4" column="newSystemPrimary4" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="get-TocofsSaleoutDetailedEntity-result-tob" type="com.hzya.frame.report.lets.dto.TocofsSaleoutDetailedDto" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="headCompanyCode" column="headCompanyCode" jdbcType="VARCHAR"/>
<result property="headFacilityCode" column="headFacilityCode" jdbcType="VARCHAR"/>
<result property="headSourcePlatformCode" column="headSourcePlatformCode" jdbcType="VARCHAR"/>
<result property="headStoreCode" column="headStoreCode" jdbcType="VARCHAR"/>
<result property="headCode" column="headCode" jdbcType="VARCHAR"/>
<result property="skucode" column="skuCode" jdbcType="VARCHAR"/>
<result property="skuname" column="skuName" jdbcType="VARCHAR"/>
<result property="shipqty" column="shipQty" jdbcType="VARCHAR"/>
<result property="businesstype" column="businessDate" jdbcType="VARCHAR"/>
<result property="newstate" column="newState" jdbcType="VARCHAR"/>
<result property="newpushdate" column="newPushDate" jdbcType="VARCHAR"/>
<result property="newtransmitinfo" column="newTransmitInfo" jdbcType="VARCHAR"/>
<result property="newsystemnumber" column="newSystemNumber" jdbcType="VARCHAR"/>
<result property="newsystemprimary" column="newSystemPrimary" jdbcType="VARCHAR"/>
<result property="newstate4" column="newState4" jdbcType="VARCHAR"/>
<result property="def5" column="def5" jdbcType="VARCHAR"/>
<result property="def6" column="def6" jdbcType="VARCHAR"/>
<result property="newsystemnumber4" column="newSystemNumber4" jdbcType="VARCHAR"/>
<result property="newsystemprimary4" column="newSystemPrimary4" jdbcType="VARCHAR"/>
</resultMap>
<!-- TOC通用查询 采用==查询 -->
<select id="entity_list_base_toc" resultMap="get-TocofsSaleoutDetailedEntity-result-toc" parameterType = "com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity">
select
a.id
,a.clientCode
,a.companyCode
,a.facilityCode
,a.shipmentCode
,a.refOrderId
,a.refOrderDetailId
,a.refOrderCode
,a.allocInvId
,a.skuCode
,a.skuName
,a.sourceOrderCode
,a.sourceLineNum
,a.inventorySts
,a.isGift
,a.requestQty
,a.shipQty
,a.shipAt
,a.quantityUM
,a.listPrice
,a.itemTotalAmount
,a.totalPayAmount
,a.totalWeight
,a.totalVolume
,a.totalVolumeWeight
,a.weightUM
,a.volumeUM
,a.created
,a.createdBy
,a.lastUpdated
,a.lastUpdatedBy
,a.mainTableId
,a.newPushDate
,a.newTransmitInfo
,a.newState
,a.newState2
,a.newState3
,a.newState4
,a.newSystemNumber
,a.newSystemPrimary
,a.newSystemNumber2
,a.newSystemPrimary2
,a.newSystemNumber3
,a.newSystemPrimary3
,a.newSystemNumber4
,a.newSystemPrimary4
,a.businessDate
,a.successfulTradeDate
,a.businessType
,a.def1
,a.def2
,a.def3
,a.def4
,a.def5
,a.def6
,a.def7
,a.def8
,a.def9
,a.def10
,a.def11
,a.def12
,a.def13
,a.def14
,a.def15
,a.def16
,a.def17
,a.def18
,a.def19
,a.def20
,a.def21
,a.def22
,a.def23
,a.def24
,a.def25
,a.def26
,a.def27
,a.def28
,a.def29
,a.def30
,a.def31
,a.def32
,a.def33
,a.def34
,a.def35
,a.def36
,a.def37
,a.def38
,a.def39
,a.def40
,b.companyCode headCompanyCode
,b.facilityCode headFacilityCode
,b.sourcePlatformCode headSourcePlatformCode
,b.storeCode headStoreCode
,b.code headCode
from tocofs_saleout_detailed a left join tocofs_saleout b on a.mainTableId = b.id
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id!=''"> and a.id = #{id} </if>
<if test="clientcode != null and clientcode != ''"> and a.clientCode = #{clientcode} </if>
<if test="companycode != null and companycode != ''"> and a.companyCode = #{companycode} </if>
<if test="facilitycode != null and facilitycode != ''"> and a.facilityCode = #{facilitycode} </if>
<if test="shipmentcode != null and shipmentcode != ''"> and a.shipmentCode = #{shipmentcode} </if>
<if test="reforderid != null and reforderid!=null"> and a.refOrderId = #{reforderid} </if>
<if test="reforderdetailid != null and reforderdetailid!=''"> and a.refOrderDetailId = #{reforderdetailid} </if>
<if test="refordercode != null and refordercode != ''"> and a.refOrderCode = #{refordercode} </if>
<if test="allocinvid != null and allocinvid!=''"> and a.allocInvId = #{allocinvid} </if>
<if test="skucode != null and skucode != ''"> and a.skuCode = #{skucode} </if>
<if test="skuname != null and skuname != ''"> and a.skuName = #{skuname} </if>
<if test="sourceordercode != null and sourceordercode != ''"> and a.sourceOrderCode = #{sourceordercode} </if>
<if test="sourcelinenum != null and sourcelinenum != ''"> and a.sourceLineNum = #{sourcelinenum} </if>
<if test="inventorysts != null and inventorysts != ''"> and a.inventorySts = #{inventorysts} </if>
<if test="isgift != null and isgift!=''"> and a.isGift = #{isgift} </if>
<if test="requestqty != null and requestqty!=''"> and a.requestQty = #{requestqty} </if>
<if test="shipqty != null and shipqty!=''"> and a.shipQty = #{shipqty} </if>
<if test="shipat != null and shipat != ''"> and a.shipAt = #{shipat} </if>
<if test="quantityum != null and quantityum != ''"> and a.quantityUM = #{quantityum} </if>
<if test="listprice != null and listprice!=''"> and a.listPrice = #{listprice} </if>
<if test="itemtotalamount != null and itemtotalamount!=''"> and a.itemTotalAmount = #{itemtotalamount} </if>
<if test="totalpayamount != null and totalpayamount!=''"> and a.totalPayAmount = #{totalpayamount} </if>
<if test="totalweight != null and totalweight!=''"> and a.totalWeight = #{totalweight} </if>
<if test="totalvolume != null and totalvolume!=''"> and a.totalVolume = #{totalvolume} </if>
<if test="totalvolumeweight != null and totalvolumeweight!=''"> and a.totalVolumeWeight = #{totalvolumeweight} </if>
<if test="weightum != null and weightum != ''"> and a.weightUM = #{weightum} </if>
<if test="volumeum != null and volumeum != ''"> and a.volumeUM = #{volumeum} </if>
<if test="created != null and created != ''"> and a.created = #{created} </if>
<if test="createdby != null and createdby != ''"> and a.createdBy = #{createdby} </if>
<if test="lastupdated != null and lastupdated != ''"> and a.lastUpdated = #{lastupdated} </if>
<if test="lastupdatedby != null and lastupdatedby != ''"> and a.lastUpdatedBy = #{lastupdatedby} </if>
<if test="maintableid != null and maintableid != ''"> and a.mainTableId = #{maintableid} </if>
<if test="newpushdate != null and newpushdate != ''"> and LEFT(a.newPushDate,10) = #{newpushdate} </if>
<if test="newtransmitinfo != null and newtransmitinfo != ''"> and a.newTransmitInfo = #{newtransmitinfo} </if>
<if test="newstate != null and newstate != ''"> and a.newState = #{newstate} </if>
<if test="newstate2 != null and newstate2 != ''"> and a.newState2 = #{newstate2} </if>
<if test="newstate3 != null and newstate3 != ''"> and a.newState3 = #{newstate3} </if>
<if test="newstate4 != null and newstate4 != ''"> and a.newState4 = #{newstate4} </if>
<if test="newsystemnumber != null and newsystemnumber != ''"> and a.newSystemNumber = #{newsystemnumber} </if>
<if test="newsystemprimary != null and newsystemprimary != ''"> and a.newSystemPrimary = #{newsystemprimary} </if>
<if test="newsystemnumber2 != null and newsystemnumber2 != ''"> and a.newSystemNumber2 = #{newsystemnumber2} </if>
<if test="newsystemprimary2 != null and newsystemprimary2 != ''"> and a.newSystemPrimary2 = #{newsystemprimary2} </if>
<if test="newsystemnumber3 != null and newsystemnumber3 != ''"> and a.newSystemNumber3 = #{newsystemnumber3} </if>
<if test="newsystemprimary3 != null and newsystemprimary3 != ''"> and a.newSystemPrimary3 = #{newsystemprimary3} </if>
<if test="newsystemnumber4 != null and newsystemnumber4 != ''"> and a.newSystemNumber4 = #{newsystemnumber4} </if>
<if test="newsystemprimary4 != null and newsystemprimary4 != ''"> and a.newSystemPrimary4 = #{newsystemprimary4} </if>
<if test="businessdate != null and businessdate != ''"> and a.businessDate = #{businessdate} </if>
<if test="successfultradedate != null and successfultradedate != ''"> and a.successfulTradeDate = #{successfultradedate} </if>
<if test="businesstype != null and businesstype != ''"> and a.businessType = #{businesstype} </if>
<if test="def1 != null and def1 != ''"> and LEFT(a.def1,10) = #{def1} </if>
<if test="def2 != null and def2 != ''"> and a.def2 = #{def2} </if>
<if test="def3 != null and def3 != ''"> and LEFT(a.def3,10) = #{def3} </if>
<if test="def4 != null and def4 != ''"> and a.def4 = #{def4} </if>
<if test="def5 != null and def5 != ''"> and LEFT(a.def5,10) = #{def5} </if>
<if test="def6 != null and def6 != ''"> and a.def6 = #{def6} </if>
<if test="def7 != null and def7 != ''"> and a.def7 = #{def7} </if>
<if test="def8 != null and def8 != ''"> and a.def8 = #{def8} </if>
<if test="def9 != null and def9 != ''"> and a.def9 = #{def9} </if>
<if test="def10 != null and def10 != ''"> and a.def10 = #{def10} </if>
<if test="def11 != null and def11 != ''"> and a.def11 = #{def11} </if>
<if test="def12 != null and def12 != ''"> and a.def12 = #{def12} </if>
<if test="def13 != null and def13 != ''"> and a.def13 = #{def13} </if>
<if test="def14 != null and def14 != ''"> and a.def14 = #{def14} </if>
<if test="def15 != null and def15 != ''"> and a.def15 = #{def15} </if>
<if test="def16 != null and def16 != ''"> and a.def16 = #{def16} </if>
<if test="def17 != null and def17 != ''"> and a.def17 = #{def17} </if>
<if test="def18 != null and def18 != ''"> and a.def18 = #{def18} </if>
<if test="def19 != null and def19 != ''"> and a.def19 = #{def19} </if>
<if test="def20 != null and def20 != ''"> and a.def20 = #{def20} </if>
<if test="def21 != null and def21 != ''"> and a.def21 = #{def21} </if>
<if test="def22 != null and def22 != ''"> and a.def22 = #{def22} </if>
<if test="def23 != null and def23 != ''"> and a.def23 = #{def23} </if>
<if test="def24 != null and def24 != ''"> and a.def24 = #{def24} </if>
<if test="def25 != null and def25 != ''"> and a.def25 = #{def25} </if>
<if test="def26 != null and def26 != ''"> and a.def26 = #{def26} </if>
<if test="def27 != null and def27 != ''"> and a.def27 = #{def27} </if>
<if test="def28 != null and def28 != ''"> and a.def28 = #{def28} </if>
<if test="def29 != null and def29 != ''"> and a.def29 = #{def29} </if>
<if test="def30 != null and def30 != ''"> and a.def30 = #{def30} </if>
<if test="def31 != null and def31 != ''"> and a.def31 = #{def31} </if>
<if test="def32 != null and def32 != ''"> and a.def32 = #{def32} </if>
<if test="def33 != null and def33 != ''"> and a.def33 = #{def33} </if>
<if test="def34 != null and def34 != ''"> and a.def34 = #{def34} </if>
<if test="def35 != null and def35 != ''"> and a.def35 = #{def35} </if>
<if test="def36 != null and def36 != ''"> and a.def36 = #{def36} </if>
<if test="def37 != null and def37 != ''"> and a.def37 = #{def37} </if>
<if test="def38 != null and def38 != ''"> and a.def38 = #{def38} </if>
<if test="def39 != null and def39 != ''"> and a.def39 = #{def39} </if>
<if test="def40 != null and def40 != ''"> and a.def40 = #{def40} </if>
<if test="ids!=null and ids!=''">and a.id in (${ids})</if>
-- and sts='Y'
<if test="businessdate_start!=null and businessdate_start!=''">
and a.businessDate >= #{businessdate_start}
</if>
<if test="businessdate_end!=null and businessdate_end!=''">
and a.businessDate &lt;= #{businessdate_end}
</if>
<if test="successfultradedate_start!=null and successfultradedate_start!=''">
and a.successfulTradeDate >= #{successfultradedate_start}
</if>
<if test="successfultradedate_end!=null and successfultradedate_end!=''">
and a.successfulTradeDate &lt;= #{successfultradedate_end}
</if>
<if test="headCode!=null and headCode!=''">
and b.code = #{headCode}
</if>
</trim>
<!-- <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->
<!-- <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>-->
</select>
<!-- TOC通用查询 采用==查询 -->
<select id="entity_list_base_tob" resultMap="get-TocofsSaleoutDetailedEntity-result-tob" parameterType = "com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity">
select
a.id
,a.clientCode
,a.companyCode
,a.facilityCode
,a.shipmentCode
,a.refOrderId
,a.refOrderDetailId
,a.refOrderCode
,a.allocInvId
,a.skuCode
,a.skuName
,a.sourceOrderCode
,a.sourceLineNum
,a.inventorySts
,a.isGift
,a.requestQty
,a.shipQty
,a.shipAt
,a.quantityUM
,a.listPrice
,a.itemTotalAmount
,a.totalPayAmount
,a.totalWeight
,a.totalVolume
,a.totalVolumeWeight
,a.weightUM
,a.volumeUM
,a.created
,a.createdBy
,a.lastUpdated
,a.lastUpdatedBy
,a.mainTableId
,a.newPushDate
,a.newTransmitInfo
,a.newState
,a.newState2
,a.newState3
,a.newState4
,a.newSystemNumber
,a.newSystemPrimary
,a.newSystemNumber2
,a.newSystemPrimary2
,a.newSystemNumber3
,a.newSystemPrimary3
,a.newSystemNumber4
,a.newSystemPrimary4
,a.businessDate
,a.successfulTradeDate
,a.businessType
,a.def1
,a.def2
,a.def3
,a.def4
,a.def5
,a.def6
,a.def7
,a.def8
,a.def9
,a.def10
,a.def11
,a.def12
,a.def13
,a.def14
,a.def15
,a.def16
,a.def17
,a.def18
,a.def19
,a.def20
,a.def21
,a.def22
,a.def23
,a.def24
,a.def25
,a.def26
,a.def27
,a.def28
,a.def29
,a.def30
,a.def31
,a.def32
,a.def33
,a.def34
,a.def35
,a.def36
,a.def37
,a.def38
,a.def39
,a.def40
,b.companyCode headCompanyCode
,b.facilityCode headFacilityCode
,b.sourcePlatformCode headSourcePlatformCode
,b.storeCode headStoreCode
,b.code headCode
from tocofs_saleout_detailed a left join tocofs_saleout b on a.mainTableId = b.id
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id!=''"> and a.id = #{id} </if>
<if test="clientcode != null and clientcode != ''"> and a.clientCode = #{clientcode} </if>
<if test="companycode != null and companycode != ''"> and a.companyCode = #{companycode} </if>
<if test="facilitycode != null and facilitycode != ''"> and a.facilityCode = #{facilitycode} </if>
<if test="shipmentcode != null and shipmentcode != ''"> and a.shipmentCode = #{shipmentcode} </if>
<if test="reforderid != null and reforderid!=null"> and a.refOrderId = #{reforderid} </if>
<if test="reforderdetailid != null and reforderdetailid!=''"> and a.refOrderDetailId = #{reforderdetailid} </if>
<if test="refordercode != null and refordercode != ''"> and a.refOrderCode = #{refordercode} </if>
<if test="allocinvid != null and allocinvid!=''"> and a.allocInvId = #{allocinvid} </if>
<if test="skucode != null and skucode != ''"> and a.skuCode = #{skucode} </if>
<if test="skuname != null and skuname != ''"> and a.skuName = #{skuname} </if>
<if test="sourceordercode != null and sourceordercode != ''"> and a.sourceOrderCode = #{sourceordercode} </if>
<if test="sourcelinenum != null and sourcelinenum != ''"> and a.sourceLineNum = #{sourcelinenum} </if>
<if test="inventorysts != null and inventorysts != ''"> and a.inventorySts = #{inventorysts} </if>
<if test="isgift != null and isgift!=''"> and a.isGift = #{isgift} </if>
<if test="requestqty != null and requestqty!=''"> and a.requestQty = #{requestqty} </if>
<if test="shipqty != null and shipqty!=''"> and a.shipQty = #{shipqty} </if>
<if test="shipat != null and shipat != ''"> and a.shipAt = #{shipat} </if>
<if test="quantityum != null and quantityum != ''"> and a.quantityUM = #{quantityum} </if>
<if test="listprice != null and listprice!=''"> and a.listPrice = #{listprice} </if>
<if test="itemtotalamount != null and itemtotalamount!=''"> and a.itemTotalAmount = #{itemtotalamount} </if>
<if test="totalpayamount != null and totalpayamount!=''"> and a.totalPayAmount = #{totalpayamount} </if>
<if test="totalweight != null and totalweight!=''"> and a.totalWeight = #{totalweight} </if>
<if test="totalvolume != null and totalvolume!=''"> and a.totalVolume = #{totalvolume} </if>
<if test="totalvolumeweight != null and totalvolumeweight!=''"> and a.totalVolumeWeight = #{totalvolumeweight} </if>
<if test="weightum != null and weightum != ''"> and a.weightUM = #{weightum} </if>
<if test="volumeum != null and volumeum != ''"> and a.volumeUM = #{volumeum} </if>
<if test="created != null and created != ''"> and a.created = #{created} </if>
<if test="createdby != null and createdby != ''"> and a.createdBy = #{createdby} </if>
<if test="lastupdated != null and lastupdated != ''"> and a.lastUpdated = #{lastupdated} </if>
<if test="lastupdatedby != null and lastupdatedby != ''"> and a.lastUpdatedBy = #{lastupdatedby} </if>
<if test="maintableid != null and maintableid != ''"> and a.mainTableId = #{maintableid} </if>
<if test="newpushdate != null and newpushdate != ''"> and LEFT(a.newPushDate,10) = #{newpushdate} </if>
<if test="newtransmitinfo != null and newtransmitinfo != ''"> and a.newTransmitInfo = #{newtransmitinfo} </if>
<if test="newstate != null and newstate != ''"> and a.newState = #{newstate} </if>
<if test="newstate2 != null and newstate2 != ''"> and a.newState2 = #{newstate2} </if>
<if test="newstate3 != null and newstate3 != ''"> and a.newState3 = #{newstate3} </if>
<if test="newstate4 != null and newstate4 != ''"> and a.newState4 = #{newstate4} </if>
<if test="newsystemnumber != null and newsystemnumber != ''"> and a.newSystemNumber = #{newsystemnumber} </if>
<if test="newsystemprimary != null and newsystemprimary != ''"> and a.newSystemPrimary = #{newsystemprimary} </if>
<if test="newsystemnumber2 != null and newsystemnumber2 != ''"> and a.newSystemNumber2 = #{newsystemnumber2} </if>
<if test="newsystemprimary2 != null and newsystemprimary2 != ''"> and a.newSystemPrimary2 = #{newsystemprimary2} </if>
<if test="newsystemnumber3 != null and newsystemnumber3 != ''"> and a.newSystemNumber3 = #{newsystemnumber3} </if>
<if test="newsystemprimary3 != null and newsystemprimary3 != ''"> and a.newSystemPrimary3 = #{newsystemprimary3} </if>
<if test="newsystemnumber4 != null and newsystemnumber4 != ''"> and a.newSystemNumber4 = #{newsystemnumber4} </if>
<if test="newsystemprimary4 != null and newsystemprimary4 != ''"> and a.newSystemPrimary4 = #{newsystemprimary4} </if>
<if test="businessdate != null and businessdate != ''"> and a.businessDate = #{businessdate} </if>
<if test="successfultradedate != null and successfultradedate != ''"> and a.successfulTradeDate = #{successfultradedate} </if>
<if test="businesstype != null and businesstype != ''"> and a.businessType = #{businesstype} </if>
<if test="def1 != null and def1 != ''"> and LEFT(a.def1,10) = #{def1} </if>
<if test="def2 != null and def2 != ''"> and a.def2 = #{def2} </if>
<if test="def3 != null and def3 != ''"> and LEFT(a.def3,10) = #{def3} </if>
<if test="def4 != null and def4 != ''"> and a.def4 = #{def4} </if>
<if test="def5 != null and def5 != ''"> and LEFT(a.def5,10) = #{def5} </if>
<if test="def6 != null and def6 != ''"> and a.def6 = #{def6} </if>
<if test="def7 != null and def7 != ''"> and a.def7 = #{def7} </if>
<if test="def8 != null and def8 != ''"> and a.def8 = #{def8} </if>
<if test="def9 != null and def9 != ''"> and a.def9 = #{def9} </if>
<if test="def10 != null and def10 != ''"> and a.def10 = #{def10} </if>
<if test="def11 != null and def11 != ''"> and a.def11 = #{def11} </if>
<if test="def12 != null and def12 != ''"> and a.def12 = #{def12} </if>
<if test="def13 != null and def13 != ''"> and a.def13 = #{def13} </if>
<if test="def14 != null and def14 != ''"> and a.def14 = #{def14} </if>
<if test="def15 != null and def15 != ''"> and a.def15 = #{def15} </if>
<if test="def16 != null and def16 != ''"> and a.def16 = #{def16} </if>
<if test="def17 != null and def17 != ''"> and a.def17 = #{def17} </if>
<if test="def18 != null and def18 != ''"> and a.def18 = #{def18} </if>
<if test="def19 != null and def19 != ''"> and a.def19 = #{def19} </if>
<if test="def20 != null and def20 != ''"> and a.def20 = #{def20} </if>
<if test="def21 != null and def21 != ''"> and a.def21 = #{def21} </if>
<if test="def22 != null and def22 != ''"> and a.def22 = #{def22} </if>
<if test="def23 != null and def23 != ''"> and a.def23 = #{def23} </if>
<if test="def24 != null and def24 != ''"> and a.def24 = #{def24} </if>
<if test="def25 != null and def25 != ''"> and a.def25 = #{def25} </if>
<if test="def26 != null and def26 != ''"> and a.def26 = #{def26} </if>
<if test="def27 != null and def27 != ''"> and a.def27 = #{def27} </if>
<if test="def28 != null and def28 != ''"> and a.def28 = #{def28} </if>
<if test="def29 != null and def29 != ''"> and a.def29 = #{def29} </if>
<if test="def30 != null and def30 != ''"> and a.def30 = #{def30} </if>
<if test="def31 != null and def31 != ''"> and a.def31 = #{def31} </if>
<if test="def32 != null and def32 != ''"> and a.def32 = #{def32} </if>
<if test="def33 != null and def33 != ''"> and a.def33 = #{def33} </if>
<if test="def34 != null and def34 != ''"> and a.def34 = #{def34} </if>
<if test="def35 != null and def35 != ''"> and a.def35 = #{def35} </if>
<if test="def36 != null and def36 != ''"> and a.def36 = #{def36} </if>
<if test="def37 != null and def37 != ''"> and a.def37 = #{def37} </if>
<if test="def38 != null and def38 != ''"> and a.def38 = #{def38} </if>
<if test="def39 != null and def39 != ''"> and a.def39 = #{def39} </if>
<if test="def40 != null and def40 != ''"> and a.def40 = #{def40} </if>
<if test="ids!=null and ids!=''">and a.id in (${ids})</if>
-- and sts='Y'
<if test="businessdate_start!=null and businessdate_start!=''">
and a.businessDate >= #{businessdate_start}
</if>
<if test="businessdate_end!=null and businessdate_end!=''">
and a.businessDate &lt;= #{businessdate_end}
</if>
<if test="successfultradedate_start!=null and successfultradedate_start!=''">
and a.successfulTradeDate >= #{successfultradedate_start}
</if>
<if test="successfultradedate_end!=null and successfultradedate_end!=''">
and a.successfulTradeDate &lt;= #{successfultradedate_end}
</if>
<if test="headCode!=null and headCode!=''">
and b.code = #{headCode}
</if>
</trim>
<!-- <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->
<!-- <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>-->
</select>
<!-- 查询符合条件的数量 --> <!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity"> <select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity">
select count(1) from tocofs_saleout_detailed select count(1) from tocofs_saleout_detailed

View File

@ -13,16 +13,23 @@ import com.hzya.frame.web.entity.JsonResultEntity;
*/ */
public interface ITocofsSaleoutService extends IBaseService<TocofsSaleoutEntity, String> { public interface ITocofsSaleoutService extends IBaseService<TocofsSaleoutEntity, String> {
/** /**
* 查询TOCTOB销售正向流程报表数据 * 查询TOC/TOB销售正向流程报表数据
* *
* @author liuyang * @author liuyang
*/ */
JsonResultEntity queryToCSalesReport(JSONObject jsonObject) throws Exception; JsonResultEntity queryToCSalesReport(JSONObject jsonObject) throws Exception;
/** /**
* 查询TOCTOB退货反向流程报表数据 * 导出TOC/TOB销售正向流程报表数据
*/
JsonResultEntity ToCSalesReportExcel(JSONObject jsonObject) throws Exception;
/**
* 查询TOC/TOB退货反向流程报表数据
* *
* @author liuyang * @author liuyang
*/ */
JsonResultEntity queryToCReturnReport(JSONObject jsonObject) throws Exception; JsonResultEntity queryToCReturnReport(JSONObject jsonObject) throws Exception;
} }

View File

@ -1,6 +1,7 @@
package com.hzya.frame.report.lets.service.impl; package com.hzya.frame.report.lets.service.impl;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -9,16 +10,21 @@ import com.hzya.frame.page.PageAttribute;
import com.hzya.frame.report.lets.dao.ITocofsReturngoodsDetailedDao; import com.hzya.frame.report.lets.dao.ITocofsReturngoodsDetailedDao;
import com.hzya.frame.report.lets.dao.ITocofsSaleoutDao; import com.hzya.frame.report.lets.dao.ITocofsSaleoutDao;
import com.hzya.frame.report.lets.dao.ITocofsSaleoutDetailedDao; import com.hzya.frame.report.lets.dao.ITocofsSaleoutDetailedDao;
import com.hzya.frame.report.lets.dto.TobofsSaleoutDetailedDto;
import com.hzya.frame.report.lets.dto.TocofsSaleoutDetailedDto;
import com.hzya.frame.report.lets.entity.TocofsReturngoodsDetailedEntity; import com.hzya.frame.report.lets.entity.TocofsReturngoodsDetailedEntity;
import com.hzya.frame.report.lets.entity.TocofsReturngoodsEntity; import com.hzya.frame.report.lets.entity.TocofsReturngoodsEntity;
import com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.report.lets.entity.TocofsSaleoutDetailedEntity;
import com.hzya.frame.report.lets.entity.TocofsSaleoutEntity; import com.hzya.frame.report.lets.entity.TocofsSaleoutEntity;
import com.hzya.frame.report.lets.service.ITocofsSaleoutService; import com.hzya.frame.report.lets.service.ITocofsSaleoutService;
import com.hzya.frame.uuid.UUIDLong;
import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File;
import java.io.InputStream;
import java.util.List; import java.util.List;
/** /**
@ -48,15 +54,10 @@ public class TocofsSaleoutServiceImpl extends BaseService<TocofsSaleoutEntity, S
public JsonResultEntity queryToCSalesReport(JSONObject jsonObject) throws Exception { public JsonResultEntity queryToCSalesReport(JSONObject jsonObject) throws Exception {
JSONObject jsonStr = getstrObj("jsonStr", jsonObject); JSONObject jsonStr = getstrObj("jsonStr", jsonObject);
//分页参数 //提供两种模式查询模式 query导出模式 excel
String pageNum = jsonStr.getString("pageNum"); String qType = jsonStr.getString("qType");
String pageSize = jsonStr.getString("pageSize");
Assert.notNull(pageNum, "pageNum不能为空");
Assert.notNull(pageSize, "pageSize不能为空");
//表头编码 //表头编码
String headCode = jsonStr.getString("headCode"); String headCode = jsonStr.getString("headCode");
//业务类型TOBTOC //业务类型TOBTOC
String businessType = jsonStr.getString("businessType"); String businessType = jsonStr.getString("businessType");
Assert.notNull(businessType, "businessType不能为空!"); Assert.notNull(businessType, "businessType不能为空!");
@ -128,17 +129,93 @@ public class TocofsSaleoutServiceImpl extends BaseService<TocofsSaleoutEntity, S
tocofsSaleoutDetailedEntity.setHeadCode(headCode); tocofsSaleoutDetailedEntity.setHeadCode(headCode);
tocofsSaleoutDetailedEntity.setPageNum(Integer.valueOf(pageNum)); //默认查询模式开发分页获取分页参数
tocofsSaleoutDetailedEntity.setPageSize(Integer.valueOf(pageSize)); if (qType == null || "".equals(qType.trim()) || "query".equals(qType)) {
String pageNum = jsonStr.getString("pageNum");
String pageSize = jsonStr.getString("pageSize");
Assert.notNull(pageNum, "pageNum不能为空");
Assert.notNull(pageSize, "pageSize不能为空");
tocofsSaleoutDetailedEntity.setPageNum(Integer.valueOf(pageNum));
tocofsSaleoutDetailedEntity.setPageSize(Integer.valueOf(pageSize));
PageHelper.startPage(tocofsSaleoutDetailedEntity.getPageNum(), tocofsSaleoutDetailedEntity.getPageSize());
List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntityPageAttribute = iTocofsSaleoutDetailedDao.query(tocofsSaleoutDetailedEntity);
PageInfo pageInfo = new PageInfo(tocofsSaleoutDetailedEntityPageAttribute);
return BaseResult.getSuccessMessageEntity("查询成功", pageInfo);
} else if ("excel".equals(qType)) {
//Excel导出模式加载全部的数据交给上层方法最终转换为Excel文件提供给前端下载
if (businessType.equals("TOC_ORDER")) {
//TOC销售
List<TocofsSaleoutDetailedDto> tocofsSaleoutDetailedDtos = iTocofsSaleoutDetailedDao.queryEntityListBaseToc(tocofsSaleoutDetailedEntity);
return BaseResult.getSuccessMessageEntity("查询成功", tocofsSaleoutDetailedDtos);
} else if (businessType.equals("TOB_ORDER")) {
//TOB销售
List<TobofsSaleoutDetailedDto> tobofsSaleoutDetailedDtos = iTocofsSaleoutDetailedDao.queryEntityListBaseTob(tocofsSaleoutDetailedEntity);
return BaseResult.getSuccessMessageEntity("查询成功", tobofsSaleoutDetailedDtos);
} else {
return BaseResult.getFailureMessageEntity("查询失败无法确定TOB、TOC请选择TOC_ORDER、或者TOB_ORDER");
}
} else {
return BaseResult.getFailureMessageEntity("查询失败,无法确定查询模式!请选择:查询模式 query、导出模式 excel");
}
}
PageHelper.startPage(tocofsSaleoutDetailedEntity.getPageNum(), tocofsSaleoutDetailedEntity.getPageSize()); @Override
List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntityPageAttribute = iTocofsSaleoutDetailedDao.query(tocofsSaleoutDetailedEntity); public JsonResultEntity ToCSalesReportExcel(JSONObject jsonObject) throws Exception {
PageInfo pageInfo = new PageInfo(tocofsSaleoutDetailedEntityPageAttribute); Assert.notNull(jsonObject, "jsonObject不能为空");
return BaseResult.getSuccessMessageEntity("查询成功", pageInfo); jsonObject.put("qType", "excel");
String businessType = jsonObject.getString("businessType");
Assert.notNull(businessType, "businessType不能为空!");
JsonResultEntity jsonResultEntity = queryToCSalesReport(jsonObject);
if (jsonResultEntity != null && jsonResultEntity.getAttribute() != null) {
InputStream templateFileName = this.getClass().getClassLoader().getResourceAsStream("template/TOCTOB正向流程导出模版.xlsx");
String[] excelFile = createExcelFile();
if (businessType.equals("TOC_ORDER")) {
List<TocofsSaleoutDetailedDto> tocofsSaleoutDetailedEntityList = (List<TocofsSaleoutDetailedDto>) jsonResultEntity.getAttribute();
EasyExcel.write(excelFile[0], TocofsSaleoutDetailedDto.class).withTemplate(templateFileName).sheet().doWrite(tocofsSaleoutDetailedEntityList);
} else if (businessType.equals("TOB_ORDER")) {
List<TobofsSaleoutDetailedDto> tobofsSaleoutDetailedEntityList = (List<TobofsSaleoutDetailedDto>) jsonResultEntity.getAttribute();
EasyExcel.write(excelFile[0], TobofsSaleoutDetailedDto.class).withTemplate(templateFileName).sheet().doWrite(tobofsSaleoutDetailedEntityList);
} else {
return BaseResult.getFailureMessageEntity("查询失败无法确定TOB、TOC请选择TOC_ORDER、或者TOB_ORDER");
}
}
return BaseResult.getFailureMessageEntity("生成TOC、TOB销售业务对应的Excel文件失败");
}
/**
* 2024年7月19日 11:11:55 生成新Excel文件的路径
*
* @author liuyang
*/
private String[] createExcelFile() {
String projectPath = System.getProperty("user.dir");
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(projectPath);
String path = stringBuffer.toString();
Long randomLong = UUIDLong.longUUID();
String newName = randomLong + ".xlsx";
//不存在则创建
File dir = new File(path + File.separator + "excelfile");
if (!dir.exists()) {
dir.mkdirs();
}
String filePath = path + File.separator + "excelfile" + File.separator + newName;
String[] strings = new String[2];
strings[0] = filePath;
strings[1] = newName;
return strings;
} }
@Override @Override
public JsonResultEntity queryToCReturnReport(JSONObject jsonObject) throws Exception { public JsonResultEntity queryToCReturnReport(JSONObject jsonObject) throws Exception {
long startTime = System.currentTimeMillis();
JSONObject jsonStr = getstrObj("jsonStr", jsonObject); JSONObject jsonStr = getstrObj("jsonStr", jsonObject);
//分页参数 //分页参数
@ -228,9 +305,12 @@ public class TocofsSaleoutServiceImpl extends BaseService<TocofsSaleoutEntity, S
tocofsSaleoutDetailedEntity.setPageNum(Integer.valueOf(pageNum)); tocofsSaleoutDetailedEntity.setPageNum(Integer.valueOf(pageNum));
tocofsSaleoutDetailedEntity.setPageSize(Integer.valueOf(pageSize)); tocofsSaleoutDetailedEntity.setPageSize(Integer.valueOf(pageSize));
//开启分页
PageHelper.startPage(tocofsSaleoutDetailedEntity.getPageNum(), tocofsSaleoutDetailedEntity.getPageSize()); PageHelper.startPage(tocofsSaleoutDetailedEntity.getPageNum(), tocofsSaleoutDetailedEntity.getPageSize());
List<TocofsReturngoodsDetailedEntity> tocofsSaleoutDetailedEntityPageAttribute = iTocofsReturngoodsDetailedDao.query(tocofsSaleoutDetailedEntity); List<TocofsReturngoodsDetailedEntity> tocofsSaleoutDetailedEntityPageAttribute = iTocofsReturngoodsDetailedDao.query(tocofsSaleoutDetailedEntity);
PageInfo pageInfo = new PageInfo(tocofsSaleoutDetailedEntityPageAttribute); PageInfo pageInfo = new PageInfo(tocofsSaleoutDetailedEntityPageAttribute);
long endTime = System.currentTimeMillis();
logger.info("报表导出查询耗时:{}", (endTime - startTime));
return BaseResult.getSuccessMessageEntity("查询成功", pageInfo); return BaseResult.getSuccessMessageEntity("查询成功", pageInfo);
} }
} }

View File

@ -233,4 +233,6 @@ public class EntranceController {
response.sendRedirect(bipSsoService.erpSso(request,ticket)); response.sendRedirect(bipSsoService.erpSso(request,ticket));
return null; return null;
} }
} }