demand: TMS系统 - 客户管理 - 现金客户-增删改查接口
committer: heyu
This commit is contained in:
parent
d6223ab13b
commit
502dccc0c5
@ -489,6 +489,7 @@ public class EmisCustomerUserController extends EmisBaseController
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisCustomerUser:monthlyShipmentStat')")
|
||||
@GetMapping("/monthlyShipmentStat")
|
||||
public TableDataInfo monthlyShipmentStat(EmisWaybill emisWaybill) throws EmisBizError {
|
||||
emisWaybill.setCustomerType("2");
|
||||
startPage();
|
||||
// 设置权限参数
|
||||
setPrivParams(emisWaybill);
|
||||
@ -497,6 +498,21 @@ public class EmisCustomerUserController extends EmisBaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询现金客户出货统计
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisCustomerUser:moneyShipmentStat')")
|
||||
@GetMapping("/moneyShipmentStat")
|
||||
public TableDataInfo moneyShipmentStat(EmisWaybill emisWaybill) throws EmisBizError {
|
||||
emisWaybill.setCustomerType("1");
|
||||
startPage();
|
||||
// 设置权限参数
|
||||
setPrivParams(emisWaybill);
|
||||
List<MonthlyCustomerShipmentStatVO> list = emisCustomerUserService
|
||||
.selectMoneyCustomerShipmentStat(emisWaybill);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询月结客户出货明细
|
||||
*/
|
||||
@ -517,6 +533,7 @@ public class EmisCustomerUserController extends EmisBaseController
|
||||
@Log(title = "月结客户出货统计", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportMonthlyShipmentStat")
|
||||
public void exportMonthlyShipmentStat(HttpServletResponse response, EmisWaybill emisWaybill) throws EmisBizError {
|
||||
emisWaybill.setCustomerType("2");
|
||||
// 设置权限参数
|
||||
setPrivParams(emisWaybill);
|
||||
List<MonthlyCustomerShipmentStatVO> list = emisCustomerUserService
|
||||
@ -525,6 +542,23 @@ public class EmisCustomerUserController extends EmisBaseController
|
||||
MonthlyShipmentStatExcelUtil.export(response, list, statType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出现金客户出货统计
|
||||
*
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisCustomerUser:exportMoneyShipmentStat')")
|
||||
@Log(title = "现金客户出货统计", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportMoneyShipmentStat")
|
||||
public void exportMoneyShipmentStat(HttpServletResponse response, EmisWaybill emisWaybill) throws EmisBizError {
|
||||
emisWaybill.setCustomerType("1");
|
||||
// 设置权限参数
|
||||
setPrivParams(emisWaybill);
|
||||
List<MonthlyCustomerShipmentStatVO> list = emisCustomerUserService
|
||||
.selectMoneyCustomerShipmentStat(emisWaybill);
|
||||
int statType = resolveStatType(emisWaybill);
|
||||
MonthlyShipmentStatExcelUtil.exportMoney(response, list, statType);
|
||||
}
|
||||
|
||||
private int resolveStatType(EmisWaybill emisWaybill) {
|
||||
if (emisWaybill == null || emisWaybill.getParams() == null) {
|
||||
return 1;
|
||||
|
||||
@ -13,11 +13,15 @@ package com.xdadan.erp.emis.domain;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xdadan.erp.common.annotation.Excel;
|
||||
import com.xdadan.erp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import com.xdadan.erp.common.core.domain.TreeEntity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -13,9 +13,14 @@ package com.xdadan.erp.emis.domain;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xdadan.erp.common.annotation.audit.DataAuditField;
|
||||
import com.xdadan.erp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName EmisMoneyUser
|
||||
|
||||
@ -12,6 +12,8 @@ package com.xdadan.erp.emis.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
//import com.xdadan.erp.common.annotation.audit.DataAuditFilter;
|
||||
import com.xdadan.erp.common.annotation.audit.DataAuditField;
|
||||
@ -737,4 +739,39 @@ public class EmisWaybill extends BaseEntity {
|
||||
/* 销售主管 */
|
||||
private String salesExecutive;
|
||||
|
||||
/* 现金客户公司 */
|
||||
private String moneyUserCompany;
|
||||
|
||||
/* 运单表副表 */
|
||||
@JsonIgnore
|
||||
private EmisWaybillOther waybillOther;
|
||||
|
||||
/**
|
||||
* 获取运单表副表(后端使用,不做null处理)
|
||||
* @return EmisWaybillOther
|
||||
*/
|
||||
public EmisWaybillOther getWaybillOther() {
|
||||
return waybillOther;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置运单表副表
|
||||
* @param waybillOther EmisWaybillOther
|
||||
*/
|
||||
public void setWaybillOther(EmisWaybillOther waybillOther) {
|
||||
this.waybillOther = waybillOther;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取运单表副表(用于JSON序列化返回前端,如果为null则返回空对象)
|
||||
* @return EmisWaybillOther
|
||||
*/
|
||||
@JsonGetter("waybillOther")
|
||||
public EmisWaybillOther getWaybillOtherForJson() {
|
||||
if (waybillOther == null) {
|
||||
return new EmisWaybillOther();
|
||||
}
|
||||
return waybillOther;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -47,8 +47,23 @@ public class EmisWaybillOther extends BaseEntity {
|
||||
/* 销售支持 */
|
||||
@DataAuditField(fieldComment = "销售支持")
|
||||
private String salesSupport;
|
||||
|
||||
/* 现金客户ID */
|
||||
@DataAuditField(fieldComment = "现金客户ID")
|
||||
private Long moneyUserId;
|
||||
|
||||
/* 现金客户公司名称 */
|
||||
private String moneyCompany;
|
||||
|
||||
// /* 回款回款人 */
|
||||
// private String payee;
|
||||
// /* 销售联系人 */
|
||||
// private String salesmen;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
package com.xdadan.erp.emis.domain.vo;
|
||||
|
||||
import com.xdadan.erp.common.annotation.Excel;
|
||||
import com.xdadan.erp.common.annotation.audit.DataAuditField;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
@ -25,9 +26,15 @@ import java.math.BigDecimal;
|
||||
public class MonthlyCustomerShipmentStatVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/* ID */
|
||||
private Long id;
|
||||
|
||||
/* 客户名称 */
|
||||
private String customerName;
|
||||
|
||||
/* 公司 */
|
||||
private String company;
|
||||
|
||||
/* 客户编号 */
|
||||
private String customerCode;
|
||||
|
||||
@ -193,5 +200,8 @@ public class MonthlyCustomerShipmentStatVO implements Serializable {
|
||||
|
||||
/* 首次签约日期 */
|
||||
private String firstSigningDay;
|
||||
|
||||
/* 创建日期(现金客户导出使用,对应 create_time) */
|
||||
private String createTime;
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,9 @@ public class WaybillOrder implements Serializable {
|
||||
// 附件清单
|
||||
private List<Attachment> attachmentList;
|
||||
|
||||
/* 运单表副表 */
|
||||
private EmisWaybillOther waybillOther ;
|
||||
|
||||
private List<DeclareGoods> declareGoodsList;
|
||||
private List<DeclareAttachment> declareAttachmentList;
|
||||
|
||||
@ -715,6 +718,10 @@ public class WaybillOrder implements Serializable {
|
||||
voItem.setDestinationPortName(dbWaybill.getDestinationPortName());
|
||||
voItem.setBoxQuantity(dbWaybill.getBoxQuantity());
|
||||
|
||||
// 运单表副表
|
||||
EmisWaybillOther waybillOther = dbWaybill.getWaybillOther();
|
||||
voItem.setWaybillOther(waybillOther != null ? waybillOther : new EmisWaybillOther());
|
||||
|
||||
return voItem;
|
||||
}
|
||||
|
||||
@ -952,6 +959,14 @@ public class WaybillOrder implements Serializable {
|
||||
dbWaybill.setDestinationPort(this.getDestinationPort());
|
||||
dbWaybill.setBoxQuantity(this.getBoxQuantity());
|
||||
|
||||
// 运单表副表,仅传递需要更新的字段
|
||||
if (this.getWaybillOther() != null) {
|
||||
EmisWaybillOther waybillOther = new EmisWaybillOther();
|
||||
waybillOther.setMoneyUserId(this.getWaybillOther().getMoneyUserId());
|
||||
waybillOther.setSalesSupport(this.getWaybillOther().getSalesSupport());
|
||||
dbWaybill.setWaybillOther(waybillOther);
|
||||
}
|
||||
|
||||
return dbWaybill;
|
||||
|
||||
}
|
||||
|
||||
@ -10,12 +10,10 @@
|
||||
*/
|
||||
package com.xdadan.erp.emis.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xdadan.erp.emis.domain.EmisCustomerUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName EmisCustomerUserMapper
|
||||
* @Description <p> 快递客户用户 Mapper 接口 </p>
|
||||
|
||||
@ -10,11 +10,9 @@
|
||||
*/
|
||||
package com.xdadan.erp.emis.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xdadan.erp.emis.domain.EmisMoneyUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName EmisMoneyUserMapper
|
||||
* @Description <p> 现金用户 Mapper 接口 </p>
|
||||
|
||||
@ -400,6 +400,22 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
*/
|
||||
List<EmisWaybill> selectMonthlyCustomerShipmentDetail(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
* 查询现金客户出货统计
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 统计结果列表
|
||||
*/
|
||||
List<MonthlyCustomerShipmentStatVO> selectMoneyCustomerShipmentStat(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
* 按目的国家查询现金客户出货统计
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 统计结果列表
|
||||
*/
|
||||
List<MonthlyCustomerShipmentStatVO> selectMoneyCustomerShipmentStatByCountry(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
* 跟踪预警:查询未签收且超过指定时间未有扫描记录的运单(分页)
|
||||
*
|
||||
|
||||
@ -3344,7 +3344,7 @@ public class EmisBaseService {
|
||||
* 产生客户编码 规则: siteCode+ 000000
|
||||
* @return
|
||||
*/
|
||||
private String genCustomerCode(){
|
||||
public String genCustomerCode(){
|
||||
Long maxCode=emisCustomerUserMapper.selectMaxCustomerCode();
|
||||
return maxCode.toString();
|
||||
}
|
||||
|
||||
@ -9,14 +9,13 @@
|
||||
*/
|
||||
package com.xdadan.erp.emis.service;
|
||||
|
||||
import com.xdadan.erp.emis.domain.EmisCustomerUser;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO;
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisCustomerUser;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @ClassName EmisCustomerUserService
|
||||
* @Description 快递客户用户
|
||||
* @author linfso
|
||||
@ -100,22 +99,31 @@ public interface IEmisCustomerUserService
|
||||
*/
|
||||
public List<MonthlyCustomerShipmentStatVO> selectMonthlyCustomerShipmentStat(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 查询月结客户出货明细
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 运单明细列表
|
||||
*/
|
||||
public List<EmisWaybill> selectMonthlyCustomerShipmentDetail(EmisWaybill emisWaybill);
|
||||
/**
|
||||
* 查询现金客户出货统计
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 统计结果列表
|
||||
* @throws com.xdadan.erp.emis.domain.exception.EmisBizError 当statType=3或4时,必需的时间参数缺失时抛出异常
|
||||
*/
|
||||
public List<MonthlyCustomerShipmentStatVO> selectMoneyCustomerShipmentStat(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 批量更新客户用户的moneyUserId
|
||||
*
|
||||
* @param ids 客户用户ID数组
|
||||
* @param moneyUserId 现金客户ID
|
||||
* @param updateBy 更新人
|
||||
* @param updateSite 更新站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUpdateMoneyUserId(Long[] ids, Long moneyUserId, String updateBy, String updateSite);
|
||||
}
|
||||
/**
|
||||
* 查询月结客户出货明细
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 运单明细列表
|
||||
*/
|
||||
public List<EmisWaybill> selectMonthlyCustomerShipmentDetail(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
* 批量更新客户用户的moneyUserId
|
||||
*
|
||||
* @param ids 客户用户ID数组
|
||||
* @param moneyUserId 现金客户ID
|
||||
* @param updateBy 更新人
|
||||
* @param updateSite 更新站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUpdateMoneyUserId(Long[] ids, Long moneyUserId, String updateBy, String updateSite);
|
||||
}
|
||||
|
||||
@ -9,11 +9,10 @@
|
||||
*/
|
||||
package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisMoneyUser;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName IEmisMoneyUserService
|
||||
* @Description 现金用户
|
||||
@ -70,6 +69,3 @@ public interface IEmisMoneyUserService
|
||||
public int deleteEmisMoneyUserById(Long id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -77,6 +77,23 @@ public class MonthlyShipmentStatExcelUtil {
|
||||
}
|
||||
|
||||
public static void export(HttpServletResponse response, List<MonthlyCustomerShipmentStatVO> dataList, int statType) {
|
||||
exportInternal(response, dataList, statType, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 现金客户出货统计导出
|
||||
*
|
||||
* 与月结导出的差异:
|
||||
* - 文件/Sheet 名称:现金客户出货统计
|
||||
* - 客户名称列取 company 字段
|
||||
* - 第二列表头由“首次签约日期”改为“创建日期”,取 createTime 字段(对应 create_time)
|
||||
*/
|
||||
public static void exportMoney(HttpServletResponse response, List<MonthlyCustomerShipmentStatVO> dataList, int statType) {
|
||||
exportInternal(response, dataList, statType, true);
|
||||
}
|
||||
|
||||
private static void exportInternal(HttpServletResponse response, List<MonthlyCustomerShipmentStatVO> dataList,
|
||||
int statType, boolean moneyCustomer) {
|
||||
boolean transportLayout = statType == 1 || statType == 3;
|
||||
boolean compareMode = statType == 3 || statType == 4;
|
||||
|
||||
@ -88,9 +105,14 @@ public class MonthlyShipmentStatExcelUtil {
|
||||
List<MonthlyCustomerShipmentStatVO> exportList = new ArrayList<>(safeList);
|
||||
exportList.add(buildTotalRow(safeList));
|
||||
|
||||
String sheetName = moneyCustomer ? "现金客户出货统计" : "月结客户出货统计";
|
||||
String[] headers = moneyCustomer
|
||||
? new String[]{"客户名称", "创建日期", "总票数", "总重量", "销售联系人"}
|
||||
: BASE_HEADERS;
|
||||
|
||||
try {
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook(200);
|
||||
Sheet sheet = workbook.createSheet("月结客户出货统计");
|
||||
Sheet sheet = workbook.createSheet(sheetName);
|
||||
sheet.createFreezePane(0, 2);
|
||||
|
||||
// styles
|
||||
@ -106,7 +128,10 @@ public class MonthlyShipmentStatExcelUtil {
|
||||
Font greenArrowFont = createArrowFont(workbook, IndexedColors.GREEN.getIndex());
|
||||
Font blueArrowFont = createArrowFont(workbook, IndexedColors.BLUE.getIndex());
|
||||
|
||||
createHeader(sheet, transportLayout ? TRANSPORT_GROUPS : COUNTRY_GROUPS, headerStyle);
|
||||
// 样式缓存:避免在对比模式下创建过多样式导致超过Excel样式限制
|
||||
Map<String, CellStyle> styleCache = new HashMap<>();
|
||||
|
||||
createHeader(sheet, headers, transportLayout ? TRANSPORT_GROUPS : COUNTRY_GROUPS, headerStyle);
|
||||
|
||||
int dataStartRow = 2;
|
||||
for (int i = 0; i < exportList.size(); i++) {
|
||||
@ -116,44 +141,49 @@ public class MonthlyShipmentStatExcelUtil {
|
||||
row.setHeightInPoints(20);
|
||||
|
||||
int col = 0;
|
||||
col = writeTextCell(row, col, vo.getCustomerName(), totalRow ? totalTextStyle : textStyle);
|
||||
col = writeTextCell(row, col, vo.getFirstSigningDay(), totalRow ? totalTextStyle : textStyle);
|
||||
// 客户名称:月结用 customerName;现金用 company
|
||||
String customerName = moneyCustomer ? vo.getCompany() : vo.getCustomerName();
|
||||
String dateValue = moneyCustomer ? vo.getCreateTime() : vo.getFirstSigningDay();
|
||||
|
||||
col = writeTextCell(row, col, customerName, totalRow ? totalTextStyle : textStyle);
|
||||
col = writeTextCell(row, col, dateValue, totalRow ? totalTextStyle : textStyle);
|
||||
col = writeIntegerCell(row, col, vo.getTotalTickets(), vo.getTotalTicketsCompareFlag(),
|
||||
totalRow ? totalNumberStyle : numberStyle, compareMode && !totalRow, workbook,
|
||||
redArrowFont, greenArrowFont, blueArrowFont);
|
||||
redArrowFont, greenArrowFont, blueArrowFont, styleCache);
|
||||
col = writeDecimalCell(row, col, vo.getTotalWeight(), vo.getTotalWeightCompareFlag(),
|
||||
totalRow ? totalDecimalStyle : decimalStyle, compareMode && !totalRow, workbook,
|
||||
redArrowFont, greenArrowFont, blueArrowFont);
|
||||
redArrowFont, greenArrowFont, blueArrowFont, styleCache);
|
||||
col = writeTextCell(row, col, vo.getSalesmen(), totalRow ? totalTextStyle : textStyle);
|
||||
|
||||
List<MetricGroup> groups = transportLayout ? TRANSPORT_GROUPS : COUNTRY_GROUPS;
|
||||
for (MetricGroup group : groups) {
|
||||
col = writeIntegerCell(row, col, group.ticketGetter.apply(vo), group.ticketFlagGetter.apply(vo),
|
||||
totalRow ? totalNumberStyle : numberStyle, compareMode && !totalRow, workbook,
|
||||
redArrowFont, greenArrowFont, blueArrowFont);
|
||||
redArrowFont, greenArrowFont, blueArrowFont, styleCache);
|
||||
col = writeDecimalCell(row, col, group.weightGetter.apply(vo), group.weightFlagGetter.apply(vo),
|
||||
totalRow ? totalDecimalStyle : decimalStyle, compareMode && !totalRow, workbook,
|
||||
redArrowFont, greenArrowFont, blueArrowFont);
|
||||
redArrowFont, greenArrowFont, blueArrowFont, styleCache);
|
||||
}
|
||||
}
|
||||
|
||||
autoSize(sheet);
|
||||
writeToResponse(response, workbook, "月结客户出货统计");
|
||||
writeToResponse(response, workbook, sheetName);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("导出月结客户出货统计失败:" + e.getMessage(), e);
|
||||
String msg = moneyCustomer ? "导出现金客户出货统计失败:" : "导出月结客户出货统计失败:";
|
||||
throw new RuntimeException(msg + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createHeader(Sheet sheet, List<MetricGroup> groups, CellStyle headerStyle) {
|
||||
private static void createHeader(Sheet sheet, String[] baseHeaders, List<MetricGroup> groups, CellStyle headerStyle) {
|
||||
Row topRow = sheet.createRow(0);
|
||||
Row subRow = sheet.createRow(1);
|
||||
topRow.setHeightInPoints(22);
|
||||
subRow.setHeightInPoints(22);
|
||||
|
||||
int col = 0;
|
||||
for (int i = 0; i < BASE_HEADERS.length; i++) {
|
||||
for (int i = 0; i < baseHeaders.length; i++) {
|
||||
Cell cell = topRow.createCell(col);
|
||||
cell.setCellValue(BASE_HEADERS[i]);
|
||||
cell.setCellValue(baseHeaders[i]);
|
||||
cell.setCellStyle(headerStyle);
|
||||
sheet.addMergedRegion(new CellRangeAddress(0, 1, col, col));
|
||||
sheet.setColumnWidth(col, BASE_WIDTHS[i] * 256);
|
||||
@ -189,25 +219,25 @@ public class MonthlyShipmentStatExcelUtil {
|
||||
|
||||
private static int writeIntegerCell(Row row, int colIndex, Integer value, Integer compareFlag, CellStyle style,
|
||||
boolean compareMode, Workbook workbook, Font redArrowFont,
|
||||
Font greenArrowFont, Font blueArrowFont) {
|
||||
Font greenArrowFont, Font blueArrowFont, Map<String, CellStyle> styleCache) {
|
||||
String text = value == null ? "" : value.toString();
|
||||
applyRichText(row.createCell(colIndex), text, compareFlag, style, compareMode, workbook,
|
||||
redArrowFont, greenArrowFont, blueArrowFont);
|
||||
redArrowFont, greenArrowFont, blueArrowFont, styleCache);
|
||||
return colIndex + 1;
|
||||
}
|
||||
|
||||
private static int writeDecimalCell(Row row, int colIndex, BigDecimal value, Integer compareFlag, CellStyle style,
|
||||
boolean compareMode, Workbook workbook, Font redArrowFont,
|
||||
Font greenArrowFont, Font blueArrowFont) {
|
||||
Font greenArrowFont, Font blueArrowFont, Map<String, CellStyle> styleCache) {
|
||||
String text = formatDecimal(value);
|
||||
applyRichText(row.createCell(colIndex), text, compareFlag, style, compareMode, workbook,
|
||||
redArrowFont, greenArrowFont, blueArrowFont);
|
||||
redArrowFont, greenArrowFont, blueArrowFont, styleCache);
|
||||
return colIndex + 1;
|
||||
}
|
||||
|
||||
private static void applyRichText(Cell cell, String valueText, Integer compareFlag, CellStyle style,
|
||||
boolean compareMode, Workbook workbook, Font redArrowFont,
|
||||
Font greenArrowFont, Font blueArrowFont) {
|
||||
Font greenArrowFont, Font blueArrowFont, Map<String, CellStyle> styleCache) {
|
||||
if (!compareMode) {
|
||||
cell.setCellStyle(style);
|
||||
cell.setCellValue(valueText);
|
||||
@ -221,10 +251,17 @@ public class MonthlyShipmentStatExcelUtil {
|
||||
}
|
||||
|
||||
// 为兼容 SXSSFWorkbook,这里不再使用富文本局部着色,而是整格字体着色
|
||||
// 使用样式缓存避免创建过多样式导致超过Excel的64000样式限制
|
||||
Font arrowFont = arrow.pickFont(redArrowFont, greenArrowFont, blueArrowFont);
|
||||
CellStyle coloredStyle = workbook.createCellStyle();
|
||||
coloredStyle.cloneStyleFrom(style);
|
||||
coloredStyle.setFont(arrowFont);
|
||||
String cacheKey = style.hashCode() + "_" + arrowFont.getColor();
|
||||
CellStyle coloredStyle = styleCache.get(cacheKey);
|
||||
|
||||
if (coloredStyle == null) {
|
||||
coloredStyle = workbook.createCellStyle();
|
||||
coloredStyle.cloneStyleFrom(style);
|
||||
coloredStyle.setFont(arrowFont);
|
||||
styleCache.put(cacheKey, coloredStyle);
|
||||
}
|
||||
|
||||
String display = (valueText == null || valueText.isEmpty())
|
||||
? arrow.symbol
|
||||
|
||||
@ -170,10 +170,39 @@ public class EmisCustomerUserServiceImpl extends EmisBaseService implements IEmi
|
||||
// 按目的国家统计
|
||||
result = emisWaybillMapper.selectMonthlyCustomerShipmentStatByCountry(emisWaybill);
|
||||
} else if ("3".equals(emisWaybill.getParams().get("statType"))) {
|
||||
// 按运输方式统计,增加与上一个时间段的票数、重量对比标记
|
||||
// 按运输方式统计,增加与上一个时间段的票数、重量对比标记(根据客户类型自动选择 key)
|
||||
result = buildShipmentStatWithCompare(emisWaybill, true);
|
||||
} else if ("4".equals(emisWaybill.getParams().get("statType"))) {
|
||||
// 按目的国家统计,增加与上一个时间段的票数、重量对比标记
|
||||
// 按目的国家统计,增加与上一个时间段的票数、重量对比标记(根据客户类型自动选择 key)
|
||||
result = buildShipmentStatWithCompare(emisWaybill, false);
|
||||
} else {
|
||||
result = Collections.emptyList();
|
||||
}
|
||||
|
||||
sortShipmentStat(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询现金客户出货统计
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 统计结果列表
|
||||
*/
|
||||
@Override
|
||||
public List<MonthlyCustomerShipmentStatVO> selectMoneyCustomerShipmentStat(EmisWaybill emisWaybill) throws EmisBizError {
|
||||
List<MonthlyCustomerShipmentStatVO> result;
|
||||
if ("1".equals(emisWaybill.getParams().get("statType"))) {
|
||||
// 按运输方式统计
|
||||
result = emisWaybillMapper.selectMoneyCustomerShipmentStat(emisWaybill);
|
||||
} else if ("2".equals(emisWaybill.getParams().get("statType"))) {
|
||||
// 按目的国家统计
|
||||
result = emisWaybillMapper.selectMoneyCustomerShipmentStatByCountry(emisWaybill);
|
||||
} else if ("3".equals(emisWaybill.getParams().get("statType"))) {
|
||||
// 按运输方式统计,增加与上一个时间段的票数、重量对比标记(根据客户类型自动选择 key)
|
||||
result = buildShipmentStatWithCompare(emisWaybill, true);
|
||||
} else if ("4".equals(emisWaybill.getParams().get("statType"))) {
|
||||
// 按目的国家统计,增加与上一个时间段的票数、重量对比标记(根据客户类型自动选择 key)
|
||||
result = buildShipmentStatWithCompare(emisWaybill, false);
|
||||
} else {
|
||||
result = Collections.emptyList();
|
||||
@ -190,7 +219,8 @@ public class EmisCustomerUserServiceImpl extends EmisBaseService implements IEmi
|
||||
* @param byTransType true=按运输方式统计;false=按目的国家统计
|
||||
* @throws EmisBizError 当必需的时间参数缺失时抛出异常
|
||||
*/
|
||||
private List<MonthlyCustomerShipmentStatVO> buildShipmentStatWithCompare(EmisWaybill emisWaybill, boolean byTransType) throws EmisBizError {
|
||||
private List<MonthlyCustomerShipmentStatVO> buildShipmentStatWithCompare(EmisWaybill emisWaybill,
|
||||
boolean byTransType) throws EmisBizError {
|
||||
if (emisWaybill.getParams() == null) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "比对参数不能为空");
|
||||
}
|
||||
@ -222,19 +252,41 @@ public class EmisCustomerUserServiceImpl extends EmisBaseService implements IEmi
|
||||
String beginCompareDate = ((String) beginCompareObj).trim();
|
||||
String endCompareDate = ((String) endCompareObj).trim();
|
||||
|
||||
// 客户类型:1-普通客户(现金客户);2-月结客户
|
||||
String customerType = emisWaybill.getCustomerType();
|
||||
boolean isMoneyCustomer = "1".equals(customerType);
|
||||
|
||||
// 当前时间段统计
|
||||
List<MonthlyCustomerShipmentStatVO> currentList = byTransType
|
||||
? emisWaybillMapper.selectMonthlyCustomerShipmentStat(emisWaybill)
|
||||
: emisWaybillMapper.selectMonthlyCustomerShipmentStatByCountry(emisWaybill);
|
||||
List<MonthlyCustomerShipmentStatVO> currentList;
|
||||
if (byTransType) {
|
||||
// 按运输方式统计
|
||||
currentList = isMoneyCustomer
|
||||
? emisWaybillMapper.selectMoneyCustomerShipmentStat(emisWaybill)
|
||||
: emisWaybillMapper.selectMonthlyCustomerShipmentStat(emisWaybill);
|
||||
} else {
|
||||
// 按目的国家统计
|
||||
currentList = isMoneyCustomer
|
||||
? emisWaybillMapper.selectMoneyCustomerShipmentStatByCountry(emisWaybill)
|
||||
: emisWaybillMapper.selectMonthlyCustomerShipmentStatByCountry(emisWaybill);
|
||||
}
|
||||
|
||||
try {
|
||||
// 使用前端传入的对比时间段参数
|
||||
emisWaybill.getParams().put("beginSendDate", beginCompareDate);
|
||||
emisWaybill.getParams().put("endSendDate", endCompareDate);
|
||||
|
||||
List<MonthlyCustomerShipmentStatVO> prevList = byTransType
|
||||
? emisWaybillMapper.selectMonthlyCustomerShipmentStat(emisWaybill)
|
||||
: emisWaybillMapper.selectMonthlyCustomerShipmentStatByCountry(emisWaybill);
|
||||
List<MonthlyCustomerShipmentStatVO> prevList;
|
||||
if (byTransType) {
|
||||
// 按运输方式统计
|
||||
prevList = isMoneyCustomer
|
||||
? emisWaybillMapper.selectMoneyCustomerShipmentStat(emisWaybill)
|
||||
: emisWaybillMapper.selectMonthlyCustomerShipmentStat(emisWaybill);
|
||||
} else {
|
||||
// 按目的国家统计
|
||||
prevList = isMoneyCustomer
|
||||
? emisWaybillMapper.selectMoneyCustomerShipmentStatByCountry(emisWaybill)
|
||||
: emisWaybillMapper.selectMonthlyCustomerShipmentStatByCountry(emisWaybill);
|
||||
}
|
||||
|
||||
// 还原时间参数
|
||||
emisWaybill.getParams().put("beginSendDate", beginSendDate);
|
||||
@ -245,19 +297,27 @@ public class EmisCustomerUserServiceImpl extends EmisBaseService implements IEmi
|
||||
return currentList;
|
||||
}
|
||||
|
||||
// 以 custNo 作为 key 进行对比
|
||||
// 根据客户类型选择以 custNo 或 id 作为 key 进行对比:
|
||||
// - customerType = 2(月结客户):使用 custNo
|
||||
// - customerType = 1(现金客户):使用 id
|
||||
Map<String, MonthlyCustomerShipmentStatVO> prevMap = new HashMap<>();
|
||||
for (MonthlyCustomerShipmentStatVO item : prevList) {
|
||||
if (item.getCustNo() != null) {
|
||||
prevMap.put(item.getCustNo(), item);
|
||||
String key = isMoneyCustomer
|
||||
? (item.getId() != null ? String.valueOf(item.getId()) : null)
|
||||
: item.getCustNo();
|
||||
if (key != null) {
|
||||
prevMap.put(key, item);
|
||||
}
|
||||
}
|
||||
|
||||
for (MonthlyCustomerShipmentStatVO cur : currentList) {
|
||||
if (cur.getCustNo() == null) {
|
||||
String key = isMoneyCustomer
|
||||
? (cur.getId() != null ? String.valueOf(cur.getId()) : null)
|
||||
: cur.getCustNo();
|
||||
if (key == null) {
|
||||
continue;
|
||||
}
|
||||
MonthlyCustomerShipmentStatVO prev = prevMap.get(cur.getCustNo());
|
||||
MonthlyCustomerShipmentStatVO prev = prevMap.get(key);
|
||||
if (prev == null) {
|
||||
continue;
|
||||
}
|
||||
@ -396,4 +456,5 @@ public class EmisCustomerUserServiceImpl extends EmisBaseService implements IEmi
|
||||
}
|
||||
return emisCustomerUserMapper.batchUpdateMoneyUserId(ids, moneyUserId, updateBy, updateSite);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -10,16 +10,15 @@
|
||||
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import com.xdadan.erp.emis.domain.EmisMoneyUser;
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.mapper.EmisMoneyUserMapper;
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import com.xdadan.erp.emis.service.IEmisMoneyUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisMoneyUser;
|
||||
import com.xdadan.erp.emis.mapper.EmisMoneyUserMapper;
|
||||
import com.xdadan.erp.emis.service.IEmisMoneyUserService;
|
||||
|
||||
/**
|
||||
* 现金用户Service业务层处理
|
||||
|
||||
@ -160,6 +160,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
@Autowired
|
||||
private EmisSalesmenRelMapper emisSalesmenRelMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisMoneyUserMapper emisMoneyUserMapper;
|
||||
|
||||
/**
|
||||
* 保存或更新运单其他信息副表
|
||||
* @param emisWaybillSave
|
||||
@ -169,10 +172,23 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
return;
|
||||
}
|
||||
|
||||
String salesSupport = emisWaybillSave.getSalesSupport();
|
||||
String billCode = emisWaybillSave.getBillCode();
|
||||
Long waybillId = emisWaybillSave.getId();
|
||||
|
||||
// 从waybillOther中获取moneyUserId
|
||||
Long moneyUserId = null;
|
||||
String salesSupport = null;
|
||||
if (emisWaybillSave.getWaybillOther() != null) {
|
||||
moneyUserId = emisWaybillSave.getWaybillOther().getMoneyUserId();
|
||||
salesSupport = emisWaybillSave.getWaybillOther().getSalesSupport();
|
||||
if (moneyUserId == null) {
|
||||
moneyUserId = 0L;
|
||||
}
|
||||
if (salesSupport == null) {
|
||||
salesSupport ="";
|
||||
}
|
||||
}
|
||||
|
||||
// 查询是否已存在
|
||||
EmisWaybillOther existing = emisWaybillOtherMapper.selectEmisWaybillOtherByWaybillId(waybillId);
|
||||
|
||||
@ -180,6 +196,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// 更新
|
||||
existing.setSalesSupport(salesSupport);
|
||||
existing.setBillCode(billCode);
|
||||
existing.setMoneyUserId(moneyUserId);
|
||||
existing.preUpdate();
|
||||
emisWaybillOtherMapper.updateEmisWaybillOther(existing);
|
||||
} else {
|
||||
@ -188,6 +205,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
waybillOtherEntity.setWaybillId(waybillId);
|
||||
waybillOtherEntity.setBillCode(billCode);
|
||||
waybillOtherEntity.setSalesSupport(salesSupport);
|
||||
waybillOtherEntity.setMoneyUserId(moneyUserId);
|
||||
waybillOtherEntity.preInsert();
|
||||
emisWaybillOtherMapper.insertEmisWaybillOther(waybillOtherEntity);
|
||||
}
|
||||
@ -1112,6 +1130,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
emisWaybillSave.setCustNo(emisCustomerUser.getMonthlyPayCode());
|
||||
emisWaybillSave.setPayee(emisCustomerUser.getPayee());
|
||||
emisWaybillSave.setSalesmen(emisCustomerUser.getSalesmen());
|
||||
EmisWaybillOther emisWaybillOther = new EmisWaybillOther();
|
||||
emisWaybillOther.setSalesSupport(emisCustomerUser.getSalesSupport());
|
||||
emisWaybillSave.setWaybillOther(emisWaybillOther);
|
||||
|
||||
|
||||
}else{
|
||||
@ -1126,6 +1147,19 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
if (salesmen == null) {
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "销售联系人不存在");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(emisWaybillSave.getMoneyUserCompany())) {
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "现金客户名称不能为空");
|
||||
}
|
||||
// 根据moneyUserCompany查询现金客户
|
||||
EmisMoneyUser emisMoneyUser = emisMoneyUserMapper.selectEmisMoneyUserByCompany(emisWaybillSave.getMoneyUserCompany());
|
||||
if (Objects.isNull(emisMoneyUser)) {
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "客户名称不存在");
|
||||
}
|
||||
EmisWaybillOther emisWaybillOther = new EmisWaybillOther();
|
||||
emisWaybillOther.setMoneyUserId(emisMoneyUser.getId());
|
||||
emisWaybillOther.setSalesSupport(emisMoneyUser.getSalesSupport());
|
||||
emisWaybillSave.setWaybillOther(emisWaybillOther);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -247,6 +247,17 @@
|
||||
<resultMap id="EmisWaybillResult" extends="BaseEmisWaybillResult" type="EmisWaybill">
|
||||
<!-- 获取订单最后一条扫描记录 -->
|
||||
<!-- <association property="lastScanRecord" column="bill_code" select="com.xdadan.erp.emis.mapper.EmisTmsScanRecordMapper.selectLastRecordBaseInfoByBillCode"/>-->
|
||||
<!-- 运单表副表 -->
|
||||
<association property="waybillOther" javaType="EmisWaybillOther">
|
||||
<result property="id" column="waybill_other_id"/>
|
||||
<result property="waybillId" column="waybill_other_waybill_id"/>
|
||||
<result property="billCode" column="waybill_other_bill_code"/>
|
||||
<result property="salesSupport" column="waybill_other_sales_support"/>
|
||||
<result property="moneyUserId" column="waybill_other_money_user_id"/>
|
||||
<result property="moneyCompany" column="waybill_other_money_company"/>
|
||||
<!-- <result property="payee" column="waybill_other_payee"/>-->
|
||||
<!-- <result property="salesmen" column="waybill_other_salesmen"/>-->
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<!-- 获取运单统计条数-->
|
||||
@ -341,7 +352,15 @@
|
||||
a3.phone as customer_phone,
|
||||
a3.nick_name as customer_nick_name,
|
||||
a3.avatar as customer_avatar,
|
||||
COALESCE(wss.sales_support, a4.sales_support) as sales_support,
|
||||
-- COALESCE(wss.sales_support, a4.sales_support) as sales_support,
|
||||
wss.id as waybill_other_id,
|
||||
wss.waybill_id as waybill_other_waybill_id,
|
||||
wss.bill_code as waybill_other_bill_code,
|
||||
COALESCE(wss.sales_support, mu2.sales_support, a4.sales_support) as waybill_other_sales_support,
|
||||
COALESCE(wss.money_user_id, a3.money_user_id) as waybill_other_money_user_id,
|
||||
COALESCE(mu.company, mu2.company) as waybill_other_money_company,
|
||||
-- COALESCE(mu2.payee, a.payee) as waybill_other_payee,
|
||||
-- COALESCE(mu2.salesmen, a.salesmen) as waybill_other_salesmen,
|
||||
|
||||
p.emp_name as dispatch_man_name,q.site_name as print_site_name,
|
||||
r.emp_name as print_man_name,
|
||||
@ -394,6 +413,8 @@
|
||||
left join emis_customer_user a3 on a.customer_code=a3.customer_code and a3.del_flag='0'
|
||||
left join emis_customer_user a4 on a.cust_no=a4.monthly_pay_code and a4.del_flag='0'
|
||||
left join emis_waybill_other wss on a.id=wss.waybill_id and wss.del_flag='0'
|
||||
left join emis_money_user mu on wss.money_user_id=mu.id and mu.del_flag='0'
|
||||
left join emis_money_user mu2 on a3.money_user_id=mu2.id and mu2.del_flag='0'
|
||||
left join emis_site seaway1 on a.departure_port=seaway1.site_code and seaway1.del_flag='0'
|
||||
left join emis_site seaway2 on a.destination_port=seaway2.site_code and seaway2.del_flag='0'
|
||||
|
||||
@ -424,7 +445,8 @@
|
||||
a.register_site_code, a.register_date, a.register_man_code, a.take_piece_employee_code, a.send_site_code, a.send_center_code,
|
||||
a.send_date, a.dispatch_man_code, a.dispatch_date, a.dispatch_site_code, a.produce_bill_date, a.produce_bill_site_code,
|
||||
a.produce_bill_man_code, a.destination_code, a.destination_province, a.destination_city, a.destination_county,
|
||||
a.dispatch_underling_site_code, a.destination_center_code, a.market_man_code, a.payee, a.salesmen, a.operate_employee_code,
|
||||
a.dispatch_underling_site_code, a.destination_center_code, a.market_man_code,
|
||||
a.operate_employee_code,
|
||||
a.bl_is_question, a.problem_type, a.problem_cause, a.problem_delay_days, a.bl_message, a.bl_accept_message, a.bl_gen_subbill,
|
||||
a.bl_sign, a.sign_man, a.sign_man_code, a.sign_site_code, a.sign_date, a.bill_pic_send_rmk, a.bill_pic_dispatch_rmk, a.timezone_offset,
|
||||
a.payment_status, a.payment_date, a.payment_remark, a.order_remark, a.data_from, a.bl_special_goods,a.ext_info,
|
||||
@ -445,7 +467,17 @@
|
||||
a3.phone as customer_phone,
|
||||
a3.nick_name as customer_nick_name,
|
||||
a3.avatar as customer_avatar,
|
||||
COALESCE(wss.sales_support, a4.sales_support) as sales_support ,
|
||||
COALESCE(a.payee, mu2.payee) as payee,
|
||||
COALESCE(a.salesmen, mu2.salesmen) as salesmen,
|
||||
-- COALESCE(wss.sales_support,mu2.sales_support, a4.sales_support) as sales_support ,
|
||||
wss.id as waybill_other_id,
|
||||
wss.waybill_id as waybill_other_waybill_id,
|
||||
wss.bill_code as waybill_other_bill_code,
|
||||
COALESCE(wss.sales_support, mu2.sales_support, a4.sales_support) as waybill_other_sales_support,
|
||||
COALESCE(wss.money_user_id, a3.money_user_id) as waybill_other_money_user_id,
|
||||
COALESCE(mu.company, mu2.company) as waybill_other_money_company,
|
||||
-- COALESCE(mu2.payee, a.payee) as waybill_other_payee,
|
||||
-- COALESCE(mu2.salesmen, a.salesmen) as waybill_other_salesmen,
|
||||
a3.sales_executive ,
|
||||
a3.customer_type as customer_type,
|
||||
a3.main_user_id ,
|
||||
@ -501,6 +533,8 @@
|
||||
left join emis_customer_user a3 on a.customer_code=a3.customer_code and a3.del_flag='0'
|
||||
left join emis_customer_user a4 on a.cust_no=a4.monthly_pay_code and a4.del_flag='0'
|
||||
left join emis_waybill_other wss on a.id=wss.waybill_id and wss.del_flag='0'
|
||||
left join emis_money_user mu on wss.money_user_id=mu.id and mu.del_flag='0'
|
||||
left join emis_money_user mu2 on a3.money_user_id=mu2.id and mu2.del_flag='0'
|
||||
left join emis_site seaway1 on a.departure_port=seaway1.site_code and seaway1.del_flag='0'
|
||||
left join emis_site seaway2 on a.destination_port=seaway2.site_code and seaway2.del_flag='0'
|
||||
left join emis_site start on a.start_site_code=start.site_code and start.del_flag='0'
|
||||
@ -4676,6 +4710,7 @@
|
||||
<!-- 查询月结客户出货统计 -->
|
||||
<select id="selectMonthlyCustomerShipmentStat" parameterType="EmisWaybill" resultType="com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO">
|
||||
SELECT
|
||||
cu.id AS id,
|
||||
cu.customer_code AS customerCode,
|
||||
cu.customer_name AS customerName,
|
||||
cu.monthly_pay_code AS custNo,
|
||||
@ -4781,6 +4816,7 @@
|
||||
<!-- 按目的国家查询月结客户出货统计 -->
|
||||
<select id="selectMonthlyCustomerShipmentStatByCountry" parameterType="EmisWaybill" resultType="com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO">
|
||||
SELECT
|
||||
cu.id AS id,
|
||||
cu.customer_code AS customerCode,
|
||||
cu.customer_name AS customerName,
|
||||
cu.monthly_pay_code AS custNo,
|
||||
@ -4893,8 +4929,6 @@
|
||||
a.del_flag = '0'
|
||||
AND a.order_status !='0'
|
||||
AND a.order_status!='2'
|
||||
AND a.cust_no IS NOT NULL
|
||||
AND a.cust_no != ''
|
||||
<!-- 剔除问题件类型为面单删除、出口虚拟单、返货虚拟单的运单 -->
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM emis_waybill_problem_info ewpi
|
||||
@ -4942,6 +4976,10 @@
|
||||
<if test="salesmen != null and salesmen != ''">
|
||||
AND a4.salesmen LIKE CONCAT('%', #{salesmen}, '%')
|
||||
</if>
|
||||
<!-- 现金客户ID -->
|
||||
<if test="params.moneyUserId != null and params.moneyUserId != ''">
|
||||
AND wss.money_user_id = #{params.moneyUserId}
|
||||
</if>
|
||||
<!-- 运输方式筛选 -->
|
||||
<if test="transType != null and transType != ''">
|
||||
<if test="transType == 'other'">
|
||||
@ -4993,4 +5031,219 @@
|
||||
</where>
|
||||
ORDER BY a.order_date DESC, a.send_date DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询现金客户出货统计 -->
|
||||
<select id="selectMoneyCustomerShipmentStat" parameterType="EmisWaybill" resultType="com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO">
|
||||
SELECT
|
||||
mu.id AS id,
|
||||
a.customer_code AS customerCode,
|
||||
mu.company AS customerName,
|
||||
NULL AS custNo,
|
||||
mu.salesmen AS salesmen,
|
||||
NULL AS firstSigningDay,
|
||||
mu.company AS company,
|
||||
mu.create_time AS createTime,
|
||||
COUNT(DISTINCT a.bill_code) AS totalTickets,
|
||||
IFNULL(SUM(a.bill_weight), 0) AS totalWeight,
|
||||
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '1' THEN 1 ELSE 0 END) AS expressTickets,
|
||||
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '1' THEN a.bill_weight ELSE 0 END), 0) AS expressWeight,
|
||||
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '2' THEN 1 ELSE 0 END) AS airTickets,
|
||||
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '2' THEN a.bill_weight ELSE 0 END), 0) AS airWeight,
|
||||
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type in ('3','5') THEN 1 ELSE 0 END) AS landTickets,
|
||||
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type in ('3','5') THEN a.bill_weight ELSE 0 END), 0) AS landWeight,
|
||||
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '4' THEN 1 ELSE 0 END) AS seaTickets,
|
||||
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '4' THEN a.bill_weight ELSE 0 END), 0) AS seaWeight,
|
||||
SUM(CASE WHEN a.receive_country = '0086' THEN 1 ELSE 0 END) AS importTickets,
|
||||
IFNULL(SUM(CASE WHEN a.receive_country = '0086' THEN a.bill_weight ELSE 0 END), 0) AS importWeight,
|
||||
SUM(CASE WHEN a.receive_country != '0086' AND NOT (a.send_country = '0086' AND tl.trans_type IN ('1','2','3','4','5')) THEN 1 ELSE 0 END) AS otherTickets,
|
||||
IFNULL(SUM(CASE WHEN a.receive_country != '0086' AND NOT (a.send_country = '0086' AND tl.trans_type IN ('1','2','3','4','5')) THEN a.bill_weight ELSE 0 END), 0) AS otherWeight
|
||||
FROM emis_money_user mu
|
||||
LEFT JOIN emis_waybill_other ewo ON mu.id = ewo.money_user_id AND ewo.del_flag = '0'
|
||||
LEFT JOIN emis_waybill a ON ewo.waybill_id = a.id
|
||||
AND a.del_flag = '0'
|
||||
AND a.order_status != '0'
|
||||
AND a.order_status != '2'
|
||||
<!-- 剔除问题件类型为面单删除、出口虚拟单、返货虚拟单的运单 -->
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM emis_waybill_problem_info ewpi
|
||||
WHERE ewpi.bill_code = a.bill_code
|
||||
AND ewpi.del_flag = '0'
|
||||
AND ewpi.problem_type IN (151, 170, 173)
|
||||
)
|
||||
<!-- 寄件日期范围 -->
|
||||
<if test="params.beginSendDate != null and params.beginSendDate != ''">
|
||||
AND a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
|
||||
</if>
|
||||
<if test="params.endSendDate != null and params.endSendDate != ''">
|
||||
AND a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
||||
</if>
|
||||
<!-- 寄件国家 -->
|
||||
<if test="sendCountry != null and sendCountry != ''">
|
||||
AND a.send_country = #{sendCountry}
|
||||
</if>
|
||||
<!-- 目的国家 -->
|
||||
<if test="receiveCountry != null and receiveCountry != ''">
|
||||
<choose>
|
||||
<when test="receiveCountry == 'other'">
|
||||
AND a.receive_country NOT IN ('0086','0084','0855','0095','0880','0856','0066')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND a.receive_country = #{receiveCountry}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
LEFT JOIN emis_trans_line tl ON a.trans_line_type = tl.line_code AND tl.del_flag = '0'
|
||||
<where>
|
||||
mu.del_flag = '0'
|
||||
<!-- 客户名称 -->
|
||||
<if test="moneyUserCompany != null and moneyUserCompany != ''">
|
||||
AND (mu.company LIKE CONCAT('%', #{moneyUserCompany}, '%') )
|
||||
</if>
|
||||
<if test="params.moneyUserId != null and params.moneyUserId != ''">
|
||||
AND mu.id = #{params.moneyUserId}
|
||||
</if>
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
AND a.customer_code = #{customerCode}
|
||||
</if>
|
||||
<!-- 销售主管 -->
|
||||
<if test="salesExecutive != null and salesExecutive != ''">
|
||||
AND mu.sales_executive LIKE CONCAT('%', #{salesExecutive}, '%')
|
||||
</if>
|
||||
<!-- 销售支持 -->
|
||||
<if test="salesSupport != null and salesSupport != ''">
|
||||
AND mu.sales_support LIKE CONCAT('%', #{salesSupport}, '%')
|
||||
</if>
|
||||
<!-- 销售联系人 -->
|
||||
<if test="salesmen != null and salesmen != ''">
|
||||
AND mu.salesmen LIKE CONCAT('%', #{salesmen}, '%')
|
||||
</if>
|
||||
<!-- 权限控制 -->
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
AND (
|
||||
mu.sales_executive = #{params.privEmpName}
|
||||
OR mu.sales_support = #{params.privEmpName}
|
||||
OR mu.salesmen = #{params.privEmpName}
|
||||
OR mu.salesmen IN (
|
||||
SELECT salesmen FROM emis_salesmen_rel esr
|
||||
WHERE esr.del_flag = '0'
|
||||
AND esr.bl_open = '1'
|
||||
AND NOW() <![CDATA[ >= ]]> esr.start_date
|
||||
AND NOW() <![CDATA[ <= ]]> esr.end_date
|
||||
AND esr.sales_ass = #{params.privEmpName}
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY mu.id, mu.company
|
||||
ORDER BY totalWeight DESC, totalTickets DESC, company ASC
|
||||
</select>
|
||||
|
||||
<!-- 按目的国家查询现金客户出货统计 -->
|
||||
<select id="selectMoneyCustomerShipmentStatByCountry" parameterType="EmisWaybill" resultType="com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO">
|
||||
SELECT
|
||||
mu.id AS id,
|
||||
a.customer_code AS customerCode,
|
||||
mu.company AS customerName,
|
||||
NULL AS custNo,
|
||||
mu.salesmen AS salesmen,
|
||||
NULL AS firstSigningDay,
|
||||
mu.company AS company,
|
||||
mu.create_time AS createTime,
|
||||
COUNT(DISTINCT a.bill_code) AS totalTickets,
|
||||
IFNULL(SUM(a.bill_weight), 0) AS totalWeight,
|
||||
SUM(CASE WHEN a.receive_country = '0086' THEN 1 ELSE 0 END) AS chinaTickets,
|
||||
IFNULL(SUM(CASE WHEN a.receive_country = '0086' THEN a.bill_weight ELSE 0 END), 0) AS chinaWeight,
|
||||
SUM(CASE WHEN a.receive_country = '0084' THEN 1 ELSE 0 END) AS vietnamTickets,
|
||||
IFNULL(SUM(CASE WHEN a.receive_country = '0084' THEN a.bill_weight ELSE 0 END), 0) AS vietnamWeight,
|
||||
SUM(CASE WHEN a.receive_country = '0855' THEN 1 ELSE 0 END) AS cambodiaTickets,
|
||||
IFNULL(SUM(CASE WHEN a.receive_country = '0855' THEN a.bill_weight ELSE 0 END), 0) AS cambodiaWeight,
|
||||
SUM(CASE WHEN a.receive_country = '0095' THEN 1 ELSE 0 END) AS myanmarTickets,
|
||||
IFNULL(SUM(CASE WHEN a.receive_country = '0095' THEN a.bill_weight ELSE 0 END), 0) AS myanmarWeight,
|
||||
SUM(CASE WHEN a.receive_country = '0880' THEN 1 ELSE 0 END) AS bangladeshTickets,
|
||||
IFNULL(SUM(CASE WHEN a.receive_country = '0880' THEN a.bill_weight ELSE 0 END), 0) AS bangladeshWeight,
|
||||
SUM(CASE WHEN a.receive_country = '0856' THEN 1 ELSE 0 END) AS laosTickets,
|
||||
IFNULL(SUM(CASE WHEN a.receive_country = '0856' THEN a.bill_weight ELSE 0 END), 0) AS laosWeight,
|
||||
SUM(CASE WHEN a.receive_country = '0066' THEN 1 ELSE 0 END) AS thailandTickets,
|
||||
IFNULL(SUM(CASE WHEN a.receive_country = '0066' THEN a.bill_weight ELSE 0 END), 0) AS thailandWeight,
|
||||
SUM(CASE WHEN a.receive_country NOT IN ('0086','0084','0855','0095','0880','0856','0066') THEN 1 ELSE 0 END) AS otherTickets,
|
||||
IFNULL(SUM(CASE WHEN a.receive_country NOT IN ('0086','0084','0855','0095','0880','0856','0066') THEN a.bill_weight ELSE 0 END), 0) AS otherWeight
|
||||
FROM emis_money_user mu
|
||||
LEFT JOIN emis_waybill_other ewo ON mu.id = ewo.money_user_id AND ewo.del_flag = '0'
|
||||
LEFT JOIN emis_waybill a ON ewo.waybill_id = a.id
|
||||
AND a.del_flag = '0'
|
||||
AND a.order_status != '0'
|
||||
AND a.order_status != '2'
|
||||
<!-- 剔除问题件类型为面单删除、出口虚拟单、返货虚拟单的运单 -->
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM emis_waybill_problem_info ewpi
|
||||
WHERE ewpi.bill_code = a.bill_code
|
||||
AND ewpi.del_flag = '0'
|
||||
AND ewpi.problem_type IN (151, 170, 173)
|
||||
)
|
||||
<!-- 寄件日期范围 -->
|
||||
<if test="params.beginSendDate != null and params.beginSendDate != ''">
|
||||
AND a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
|
||||
</if>
|
||||
<if test="params.endSendDate != null and params.endSendDate != ''">
|
||||
AND a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
||||
</if>
|
||||
<!-- 寄件国家 -->
|
||||
<if test="sendCountry != null and sendCountry != ''">
|
||||
AND a.send_country = #{sendCountry}
|
||||
</if>
|
||||
<!-- 目的国家 -->
|
||||
<if test="receiveCountry != null and receiveCountry != ''">
|
||||
<choose>
|
||||
<when test="receiveCountry == 'other'">
|
||||
AND a.receive_country NOT IN ('0086','0084','0855','0095','0880','0856','0066')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND a.receive_country = #{receiveCountry}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<where>
|
||||
mu.del_flag = '0'
|
||||
<!-- 客户名称 -->
|
||||
<if test="moneyUserCompany != null and moneyUserCompany != ''">
|
||||
AND (mu.company LIKE CONCAT('%', #{moneyUserCompany}, '%') )
|
||||
</if>
|
||||
<if test="customerName != null and customerName != ''">
|
||||
AND (mu.company LIKE CONCAT('%', #{customerName}, '%') )
|
||||
</if>
|
||||
<if test="params.moneyUserId != null and params.moneyUserId != ''">
|
||||
AND mu.id = #{params.moneyUserId}
|
||||
</if>
|
||||
<!-- 销售主管 -->
|
||||
<if test="salesExecutive != null and salesExecutive != ''">
|
||||
AND mu.sales_executive LIKE CONCAT('%', #{salesExecutive}, '%')
|
||||
</if>
|
||||
<!-- 销售支持 -->
|
||||
<if test="salesSupport != null and salesSupport != ''">
|
||||
AND mu.sales_support LIKE CONCAT('%', #{salesSupport}, '%')
|
||||
</if>
|
||||
<!-- 销售联系人 -->
|
||||
<if test="salesmen != null and salesmen != ''">
|
||||
AND mu.salesmen LIKE CONCAT('%', #{salesmen}, '%')
|
||||
</if>
|
||||
<!-- 权限控制 -->
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
AND (
|
||||
mu.sales_executive = #{params.privEmpName}
|
||||
OR mu.sales_support = #{params.privEmpName}
|
||||
OR mu.salesmen = #{params.privEmpName}
|
||||
OR mu.salesmen IN (
|
||||
SELECT salesmen FROM emis_salesmen_rel esr
|
||||
WHERE esr.del_flag = '0'
|
||||
AND esr.bl_open = '1'
|
||||
AND NOW() <![CDATA[ >= ]]> esr.start_date
|
||||
AND NOW() <![CDATA[ <= ]]> esr.end_date
|
||||
AND esr.sales_ass = #{params.privEmpName}
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY mu.id, mu.company
|
||||
ORDER BY totalWeight DESC, totalTickets DESC, company ASC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -9,27 +9,44 @@
|
||||
<result property="waybillId" column="waybill_id" />
|
||||
<result property="billCode" column="bill_code" />
|
||||
<result property="salesSupport" column="sales_support" />
|
||||
<result property="moneyUserId" column="money_user_id" />
|
||||
<result property="moneyCompany" column="money_company" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisWaybillOtherVo">
|
||||
select id, waybill_id, bill_code, sales_support, del_flag, create_by, create_time, update_by, update_time, create_site, update_site, remark
|
||||
from emis_waybill_other
|
||||
select
|
||||
a.id,
|
||||
a.waybill_id,
|
||||
a.bill_code,
|
||||
a.sales_support,
|
||||
a.money_user_id,
|
||||
mu.company as money_company,
|
||||
a.del_flag,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.create_site,
|
||||
a.update_site,
|
||||
a.remark
|
||||
from emis_waybill_other a
|
||||
left join emis_money_user mu on a.money_user_id = mu.id and mu.del_flag = '0'
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisWaybillOtherById" parameterType="Long" resultMap="EmisWaybillOtherResult">
|
||||
<include refid="selectEmisWaybillOtherVo"/>
|
||||
where id = #{id} and del_flag = '0'
|
||||
where a.id = #{id} and a.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectEmisWaybillOtherByWaybillId" parameterType="Long" resultMap="EmisWaybillOtherResult">
|
||||
<include refid="selectEmisWaybillOtherVo"/>
|
||||
where waybill_id = #{waybillId} and del_flag = '0'
|
||||
where a.waybill_id = #{waybillId} and a.del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectEmisWaybillOtherByBillCode" parameterType="String" resultMap="EmisWaybillOtherResult">
|
||||
<include refid="selectEmisWaybillOtherVo"/>
|
||||
where bill_code = #{billCode} and del_flag = '0'
|
||||
where a.bill_code = #{billCode} and a.del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
@ -39,6 +56,7 @@
|
||||
<if test="waybillId != null">waybill_id,</if>
|
||||
<if test="billCode != null and billCode != ''">bill_code,</if>
|
||||
<if test="salesSupport != null and salesSupport != ''">sales_support,</if>
|
||||
<if test="moneyUserId != null">money_user_id,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
@ -52,6 +70,7 @@
|
||||
<if test="waybillId != null">#{waybillId},</if>
|
||||
<if test="billCode != null and billCode != ''">#{billCode},</if>
|
||||
<if test="salesSupport != null and salesSupport != ''">#{salesSupport},</if>
|
||||
<if test="moneyUserId != null">#{moneyUserId},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
@ -69,6 +88,7 @@
|
||||
<if test="waybillId != null">waybill_id = #{waybillId},</if>
|
||||
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
|
||||
<if test="salesSupport != null">sales_support = #{salesSupport},</if>
|
||||
<if test="moneyUserId != null">money_user_id = #{moneyUserId},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user