Commit d6536d73 by 林冲

Merge branch 'v5.7.4' into 'master'

上线合并

See merge request !20
2 parents 0ba32751 69a5470b
Showing 75 changed files with 1222 additions and 82 deletions
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<name>rpc-dj-smartcarlife-api</name> <name>rpc-dj-smartcarlife-api</name>
<properties> <properties>
<deploy.scanPackage>cn.com.glsx.dj.smartcarlife.remote</deploy.scanPackage> <deploy.scanPackage>cn.com.glsx.dj.smartcarlife.remote</deploy.scanPackage>
<smartcarlife.api.version>5.7.1-SNAPSHOT</smartcarlife.api.version> <smartcarlife.api.version>5.7.4-SNAPSHOT</smartcarlife.api.version>
<shopamll.api.version>5.6.4-SNAPSHOT</shopamll.api.version> <shopamll.api.version>5.6.4-SNAPSHOT</shopamll.api.version>
</properties> </properties>
<dependencies> <dependencies>
......
...@@ -80,4 +80,7 @@ public class GoodsWarehousingInfoDTO extends GoodsWarehousingInfo{ ...@@ -80,4 +80,7 @@ public class GoodsWarehousingInfoDTO extends GoodsWarehousingInfo{
@ApiModelProperty(notes= "退料入库数量") @ApiModelProperty(notes= "退料入库数量")
private BigDecimal totalOrderIncreaseStockNum; private BigDecimal totalOrderIncreaseStockNum;
@ApiModelProperty(notes= "商品id集合")
private List<Integer> upgradeGoodsIdList;
} }
package cn.com.glsx.dj.smartcarlife.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 运营批量审核单项DTO
*/
@Data
public class ManagerBatchAuditItemDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "订单编号", required = true)
private String orderCode;
@ApiModelProperty(value = "审核备注")
private String remark;
@ApiModelProperty(value = "发货主体id", required = true)
private Integer sendOutMerchantId;
}
...@@ -11,6 +11,7 @@ import lombok.ToString; ...@@ -11,6 +11,7 @@ import lombok.ToString;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
@AllArgsConstructor @AllArgsConstructor
...@@ -96,4 +97,7 @@ public class MerchantGoodsStockMonthReportDTO extends MerchantGoodsStockMonthRep ...@@ -96,4 +97,7 @@ public class MerchantGoodsStockMonthReportDTO extends MerchantGoodsStockMonthRep
private String specificationData; private String specificationData;
private String specificationTypeSequence; private String specificationTypeSequence;
@ApiModelProperty(notes="查询时间")
private String queryDate;
} }
package cn.com.glsx.dj.smartcarlife.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 订单处理上下文实体
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrderProcessDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单编号
*/
private String orderCode;
/**
* 调拨单号
*/
private String allocateCode;
/**
* 员工类型(对应 ReviewNodeEnum)
*/
private Integer staffType;
/**
* 更新人
*/
private String updatedBy;
/**
* 是否发送库存调拨消息
*/
private Boolean sendStockAllocateMessage;
/**
* 是否发送采购单消息
*/
private Boolean sendPurchaseOrderMessage;
}
\ No newline at end of file \ No newline at end of file
...@@ -147,4 +147,9 @@ public class PurchaseOrderDeliveryDTO extends PurchaseOrderDelivery { ...@@ -147,4 +147,9 @@ public class PurchaseOrderDeliveryDTO extends PurchaseOrderDelivery {
@ApiModelProperty(notes = "调出仓库-调出园区店名称") @ApiModelProperty(notes = "调出仓库-调出园区店名称")
private String callOutYqMerchantName; private String callOutYqMerchantName;
@ApiModelProperty(notes="入库状态")
private List<Integer> putStatusList;
private String putStatusStr;
} }
...@@ -176,4 +176,25 @@ public class PurchaseOrderDeliveryDetailDTO extends PurchaseOrderDeliveryDetail ...@@ -176,4 +176,25 @@ public class PurchaseOrderDeliveryDetailDTO extends PurchaseOrderDeliveryDetail
@ApiModelProperty(notes = "膜卷号(来自调拨商品详情中)") @ApiModelProperty(notes = "膜卷号(来自调拨商品详情中)")
private String filmRollNo; private String filmRollNo;
@ApiModelProperty(notes = "商品名称或编码")
private String upgradeGoodsNameOrType;
@ApiModelProperty(notes = "待签收数量(putStatus=0)")
private long pendingSignCount;
@ApiModelProperty(notes = "待入库数量(putStatus=1)")
private long pendingStockCount;
@ApiModelProperty(notes = "已入库数量(putStatus=2)")
private long inStockCount;
@ApiModelProperty(notes = "全部数量")
private long totalCount;
@ApiModelProperty(notes = "采购商品id列表")
private Long purchaseOrderGoodsIdList;
@ApiModelProperty(notes="入库状态")
private List<Integer> putStatusList;
private String putStatusStr;
} }
...@@ -100,7 +100,7 @@ public class PurchaseOrderPageDTO extends PurchaseOrder { ...@@ -100,7 +100,7 @@ public class PurchaseOrderPageDTO extends PurchaseOrder {
private List<PurchaseOrderAuditDetail> auditDetailList; private List<PurchaseOrderAuditDetail> auditDetailList;
// auditDetaiList // auditDetaiList
@ApiModelProperty(notes="驳回节点 1-采购商户 2-运营审核 3-商务审核") @ApiModelProperty(notes="驳回节点 1-采购商户 2-运营审核 3-商务审核 4-采购发货审核 5-总监审核 6-经理审核")
private Integer rejectNode; private Integer rejectNode;
......
...@@ -34,6 +34,15 @@ public class StaffDailyReportHuaweiExportDTO implements Serializable { ...@@ -34,6 +34,15 @@ public class StaffDailyReportHuaweiExportDTO implements Serializable {
@ApiModelProperty(notes = "权益实际售前触客数") @ApiModelProperty(notes = "权益实际售前触客数")
private Integer realEquityToShopCount; private Integer realEquityToShopCount;
@ApiModelProperty(notes = "实际售后触客数")
private Integer afterSaleEquityToShopCount;
@ApiModelProperty(notes = "延保实际售后触客数")
private Integer afterSaleExtendedWarrantyToShopCount;
@ApiModelProperty(notes = "权益实际售后触客数")
private Integer afterSaleRealEquityToShopCount;
@ApiModelProperty(notes = "触客率") @ApiModelProperty(notes = "触客率")
private String toShopRate; private String toShopRate;
...@@ -139,6 +148,12 @@ public class StaffDailyReportHuaweiExportDTO implements Serializable { ...@@ -139,6 +148,12 @@ public class StaffDailyReportHuaweiExportDTO implements Serializable {
@ApiModelProperty(notes = "广联权益渗透率") @ApiModelProperty(notes = "广联权益渗透率")
private String equityCountRate; private String equityCountRate;
@ApiModelProperty(notes = "原厂权益成交数")
private Integer originalFactoryEquityCount;
@ApiModelProperty(notes = "原厂权益渗透率")
private String originalFactoryEquityCountRate;
@ApiModelProperty(notes = "北汽无忧成交数") @ApiModelProperty(notes = "北汽无忧成交数")
private Integer baicDeliverCount; private Integer baicDeliverCount;
......
...@@ -7,6 +7,7 @@ import lombok.NoArgsConstructor; ...@@ -7,6 +7,7 @@ import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* 调拨发货列表分页请求 * 调拨发货列表分页请求
...@@ -67,4 +68,9 @@ public class StockAllocateDeliveryPageDTO implements Serializable { ...@@ -67,4 +68,9 @@ public class StockAllocateDeliveryPageDTO implements Serializable {
@ApiModelProperty(notes = "商品编号") @ApiModelProperty(notes = "商品编号")
private String productCode; private String productCode;
/**
* 调出方园区店商户ID列表
*/
private List<Integer> callOutYqMerchantIdList;
} }
...@@ -93,4 +93,6 @@ public class StockAllocateRecordDTO extends StockAllocateRecord implements Seria ...@@ -93,4 +93,6 @@ public class StockAllocateRecordDTO extends StockAllocateRecord implements Seria
* 调拨单详情id,调拨单详情映射 * 调拨单详情id,调拨单详情映射
*/ */
Map<Long, StockAllocateDetailDTO> orderGoodsIdMap; Map<Long, StockAllocateDetailDTO> orderGoodsIdMap;
private List<Integer> callInYqMerchantIdList;
} }
...@@ -26,6 +26,13 @@ public class StockFlowDTO implements Serializable { ...@@ -26,6 +26,13 @@ public class StockFlowDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 操作时间
*/
@ApiModelProperty(notes = "操作时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date operateTime;
/**
* 出入库时间 * 出入库时间
*/ */
@ApiModelProperty(notes = "出入库时间") @ApiModelProperty(notes = "出入库时间")
......
...@@ -43,7 +43,7 @@ public class OADJOnShelvesProductSettleDistributeRuleDTO implements Serializable ...@@ -43,7 +43,7 @@ public class OADJOnShelvesProductSettleDistributeRuleDTO implements Serializable
private BigDecimal serviceProfitRateBD; private BigDecimal serviceProfitRateBD;
@ExcelMergeRow(columIndex = 14) @ExcelMergeRow(columIndex = 14)
@ExcelValueReplace(replace={"毛利_1","收入_2"},repeatValue=true) @ExcelValueReplace(replace={"毛利_1","收入_2","固定金额_3","园区店总金额_4","园区店毛利(不扣除产品成本)_5","园区店毛利_6","收入-自定义其他费用_8","收入-其他费用_9","固定金额*购买数量_10"},repeatValue=true)
@ExcelProperty(value = "嘀加分润类型", converter = ReplaceByteToStringConvert.class) @ExcelProperty(value = "嘀加分润类型", converter = ReplaceByteToStringConvert.class)
private Byte djProfitType; private Byte djProfitType;
......
...@@ -35,4 +35,6 @@ public class OrderGoodsDTO extends PurchaseOrderGoods { ...@@ -35,4 +35,6 @@ public class OrderGoodsDTO extends PurchaseOrderGoods {
private List<PurchaseOrderGoodsCarType> suitCarTypeList; private List<PurchaseOrderGoodsCarType> suitCarTypeList;
private List<Long> idList; private List<Long> idList;
private String uploadFileUrls;
} }
...@@ -152,4 +152,16 @@ public class PurchaseOrderGoodsPageDTO extends PurchaseOrderGoods { ...@@ -152,4 +152,16 @@ public class PurchaseOrderGoodsPageDTO extends PurchaseOrderGoods {
* 发货时间-结束 * 发货时间-结束
*/ */
private String deliveryEndDateStr; private String deliveryEndDateStr;
/**
* 上传文件地址 所有发货单凭证,多个文件用英文逗号分隔
*/
private String uploadFileUrls;
/**
* 签收状态
*/
private List<Integer> signStatusList;
private String signStatusStr;
} }
...@@ -9,6 +9,7 @@ import lombok.ToString; ...@@ -9,6 +9,7 @@ import lombok.ToString;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
@AllArgsConstructor @AllArgsConstructor
...@@ -89,4 +90,8 @@ public class MerchantShopGoodsStockDTO extends MerchantShopGoodsStock { ...@@ -89,4 +90,8 @@ public class MerchantShopGoodsStockDTO extends MerchantShopGoodsStock {
@ApiModelProperty(notes="退货出库总数") @ApiModelProperty(notes="退货出库总数")
private BigDecimal refundReduceNum; private BigDecimal refundReduceNum;
@ApiModelProperty(notes="查询时间")
private String queryDate;
} }
...@@ -156,6 +156,10 @@ public enum ActionReportTypeEnum { ...@@ -156,6 +156,10 @@ public enum ActionReportTypeEnum {
* uuid-temp-025 2.3运营主管日报模版 * uuid-temp-025 2.3运营主管日报模版
*/ */
EQUITY_OPERATION_MANAGER_DAILY_REPORT_4_2_3((byte) 49, "2.3运营主管日报模版"), EQUITY_OPERATION_MANAGER_DAILY_REPORT_4_2_3((byte) 49, "2.3运营主管日报模版"),
NO_DAILY_REPORT_MERCHANT_OUTPUT_REPORT((byte) 50, "无日报门店产值表"),
NO_DAILY_REPORT_MERCHANT_OUTPUT_REPORT_TEXT((byte) 51, "无日报门店产值表文本"),
; ;
private byte value; private byte value;
......
...@@ -112,7 +112,11 @@ public class PurchaseOrderEnum { ...@@ -112,7 +112,11 @@ public class PurchaseOrderEnum {
/** 总监审核 **/ /** 总监审核 **/
DIRECTOR_CHECKED((byte)8), DIRECTOR_CHECKED((byte)8),
/** 总监驳回 **/ /** 总监驳回 **/
DIRECTOR_REJECT((byte)9) DIRECTOR_REJECT((byte)9),
/** 经理已审核 **/
MANAGER_CHECKED((byte) 10),
/** 经理已驳回 **/
MANAGER_REJECTED((byte) 11),
; ;
private final byte value; private final byte value;
......
...@@ -2,7 +2,7 @@ package cn.com.glsx.dj.smartcarlife.enums.purchaseGoods; ...@@ -2,7 +2,7 @@ package cn.com.glsx.dj.smartcarlife.enums.purchaseGoods;
/** /**
* 驳回节点 1-采购商户 2-运营审核 3-商务审核 4-采购发货审核 5-总监审核 * 驳回节点 1-采购商户 2-运营审核 3-商务审核 4-采购发货审核 5-总监审核 6-经理审核
*/ */
public enum ReviewNodeEnum { public enum ReviewNodeEnum {
/** 采购商户 (调拨单时为调拨商户)**/ /** 采购商户 (调拨单时为调拨商户)**/
...@@ -14,7 +14,9 @@ public enum ReviewNodeEnum { ...@@ -14,7 +14,9 @@ public enum ReviewNodeEnum {
/** 采购发货审核 **/ /** 采购发货审核 **/
DELIVERY(4), DELIVERY(4),
/** 总监审核 (调拨单时为商务已审核)**/ /** 总监审核 (调拨单时为商务已审核)**/
DIRECTOR(5); DIRECTOR(5),
/** 经理审核 **/
MANAGER(6);
private final Integer value; private final Integer value;
......
...@@ -74,7 +74,7 @@ public class MerchantGoodsStockReduceRecord implements Serializable { ...@@ -74,7 +74,7 @@ public class MerchantGoodsStockReduceRecord implements Serializable {
private Integer upgradeGoodsId; private Integer upgradeGoodsId;
/** /**
* 出库时间 * 操作时间
*/ */
@Column(name = "reduce_date") @Column(name = "reduce_date")
private Date reduceDate; private Date reduceDate;
...@@ -153,7 +153,7 @@ public class MerchantGoodsStockReduceRecord implements Serializable { ...@@ -153,7 +153,7 @@ public class MerchantGoodsStockReduceRecord implements Serializable {
private String createdBy; private String createdBy;
/** /**
* 创建时间 * 创建时间/出库时间
*/ */
@Column(name = "created_date") @Column(name = "created_date")
private Date createdDate; private Date createdDate;
......
...@@ -123,7 +123,7 @@ public class PurchaseOrder implements Serializable{ ...@@ -123,7 +123,7 @@ public class PurchaseOrder implements Serializable{
private String putMerchantName; private String putMerchantName;
/** /**
* 订单状态(1.待审核,2.运营已审核,3.已取消,4运营已驳回,5商务已审核,6商务已驳回,7发货已驳回,8.总监已审核,9.总监已驳回) * 订单状态(1.待审核,2.运营已审核,3.已取消,4.运营已驳回,5.商务已审核,6.商务已驳回,7.发货已驳回,8.总监已审核,9.总监已驳回,10.经理已审核,11.经理已驳回)
*/ */
private Byte status; private Byte status;
......
...@@ -7,9 +7,9 @@ import lombok.Data; ...@@ -7,9 +7,9 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.*;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
...@@ -33,15 +33,15 @@ public class PurchaseOrderAuditDetail implements Serializable { ...@@ -33,15 +33,15 @@ public class PurchaseOrderAuditDetail implements Serializable {
private String orderCode; private String orderCode;
/** /**
* 状态(1.待审核,2.运营已审核,3.已取消,4.运营已驳回,5.商务已审核,6.商务已驳回) * 状态(1.待审核,2.运营已审核,3.已取消,4.运营已驳回,5.商务已审核,6.商务已驳回,7.发货已驳回,8.总监已审核,9.总监已驳回,10.经理已审核,11.经理已驳回)
*/ */
@ApiModelProperty(notes = "状态(1.待审核,2.运营已审核,3.已取消,4.运营已驳回,5.商务已审核,6.商务已驳回,7.发货已驳回,8.总监已审核,9.总监已驳回)") @ApiModelProperty(notes = "状态(1.待审核,2.运营已审核,3.已取消,4.运营已驳回,5.商务已审核,6.商务已驳回,7.发货已驳回,8.总监已审核,9.总监已驳回,10.经理已审核,11.经理已驳回)")
private Byte status; private Byte status;
/** /**
* 驳回节点(0.采购商户,1.运营审核,8.商务审核) * 驳回节点(1-采购商户 2-运营审核 3-商务审核 4-采购发货审核 5-总监审核 6-经理审核)
*/ */
@ApiModelProperty(notes = "驳回节点 1-采购商户 2-运营审核 3-商务审核") @ApiModelProperty(notes = "驳回节点 1-采购商户 2-运营审核 3-商务审核 4-采购发货审核 5-总监审核 6-经理审核")
@Column(name = "rejected_status") @Column(name = "rejected_status")
private Byte rejectedStatus; private Byte rejectedStatus;
......
...@@ -252,4 +252,10 @@ public class PurchaseOrderGoods implements Serializable{ ...@@ -252,4 +252,10 @@ public class PurchaseOrderGoods implements Serializable{
*/ */
@Column(name = "deleted_flag") @Column(name = "deleted_flag")
private String deletedFlag; private String deletedFlag;
/**
* 0待签收 1部分签收 2全部签收
*/
@Column(name = "sign_status")
private Integer signStatus ;
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.smartcarlife.remote;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
public interface GoodsAutoOffShelfNotifyRemote {
RpcResponse<Boolean> goodsAutoOffShelfNotify();
}
package cn.com.glsx.dj.smartcarlife.remote;
import cn.com.glsx.dj.smartcarlife.dto.ManagerBatchAuditItemDTO;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderPageDTO;
import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import java.util.List;
@ApiService(value = "运营经理审核", owner = "")
public interface ManagerReviewRemote {
@ApiMethod("运营经理审核分页查询")
@ApiParam(name = "rpcPagination", notes = "分页条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("运营经理审核列表")
RpcResponse<RpcPagination<PurchaseOrderPageDTO>> listWithPage(RpcPagination<PurchaseOrderPageDTO> rpcPagination);
@ApiMethod("审核")
@ApiParam(name = "dto", notes = "审核状态", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("true")
RpcResponse<Boolean> managerAudit(PurchaseOrderPageDTO dto);
@ApiMethod("运营经理驳回")
@ApiParam(name = "dto", notes = "驳回原因", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("true")
RpcResponse<Boolean> managerReject(PurchaseOrderPageDTO dto);
@ApiMethod("运营批量审核")
@ApiParams({
@ApiParam(name = "auditList", notes = "批量审核列表", dataType = ApiParam.DataTypeEnum.LIST, required = true),
@ApiParam(name = "updatedBy", notes = "操作人账号", dataType = ApiParam.DataTypeEnum.STRING, required = true),
@ApiParam(name = "managerName", notes = "操作人姓名", dataType = ApiParam.DataTypeEnum.STRING, required = true)
})
@ApiResponse("true")
RpcResponse<Boolean> managerBatchAudit(List<ManagerBatchAuditItemDTO> auditList, String updatedBy, String managerName);
}
...@@ -32,4 +32,14 @@ public interface MerchantAndStaffDailyReportExcelRemote { ...@@ -32,4 +32,14 @@ public interface MerchantAndStaffDailyReportExcelRemote {
@ApiParam(name="condition",notes="查询参数",dataType= ApiParam.DataTypeEnum.OBJECT,required=true) @ApiParam(name="condition",notes="查询参数",dataType= ApiParam.DataTypeEnum.OBJECT,required=true)
@ApiResponse("是否存在") @ApiResponse("是否存在")
RpcResponse<Boolean> existMerchantDailyReportExcelData(MerchantDailyReportHuaweiExportDTO condition); RpcResponse<Boolean> existMerchantDailyReportExcelData(MerchantDailyReportHuaweiExportDTO condition);
@ApiMethod("未填写日报服务商门店产值日报")
@ApiParam(name="condition",notes="查询参数",dataType= ApiParam.DataTypeEnum.OBJECT,required=true)
@ApiResponse("返回未填写日报服务商门店产值日报")
RpcResponse<List<MerchantDailyReportHuaweiExportDTO>> listNotFilledMerchantDailyReportExcelData(MerchantDailyReportHuaweiExportDTO condition);
@ApiMethod("判断是否存在未填写日报门店产值数据")
@ApiParam(name="condition",notes="查询参数",dataType= ApiParam.DataTypeEnum.OBJECT,required=true)
@ApiResponse("是否存在")
RpcResponse<Boolean> existNotFilledMerchantDailyReportExcelData(MerchantDailyReportHuaweiExportDTO condition);
} }
...@@ -22,4 +22,9 @@ public interface PurchaseOrderDeliveryDetailRemote { ...@@ -22,4 +22,9 @@ public interface PurchaseOrderDeliveryDetailRemote {
@ApiParam(name = "查询条件", notes = "dto", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "查询条件", notes = "dto", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("采购发货详情") @ApiResponse("采购发货详情")
RpcResponse<PurchaseOrderDeliveryDetailDTO> getDetail(@NotNull PurchaseOrderDeliveryDetailDTO dto); RpcResponse<PurchaseOrderDeliveryDetailDTO> getDetail(@NotNull PurchaseOrderDeliveryDetailDTO dto);
@ApiMethod("统计各入库状态的发货详情数量")
@ApiParam(name = "condition", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("各状态数量统计")
RpcResponse<PurchaseOrderDeliveryDetailDTO> countByStatus(@NotNull PurchaseOrderDeliveryDetailDTO condition);
} }
...@@ -185,8 +185,11 @@ public interface PurchaseOrderRemote { ...@@ -185,8 +185,11 @@ public interface PurchaseOrderRemote {
@ApiResponse("退货结果") @ApiResponse("退货结果")
RpcResponse<Boolean> goodsRefund(PurchaseOrderDTO condition); RpcResponse<Boolean> goodsRefund(PurchaseOrderDTO condition);
@ApiResponse("send result")
RpcResponse<Boolean> sendWechatMessageByFlags(OrderProcessDTO condition);
@ApiMethod("采购订单24h总监催审通知") @ApiMethod("采购订单24h总监催审通知")
@ApiResponse("催审通知结果") @ApiResponse("催审通知结果")
RpcResponse<Void> remindAuditOverTime(); RpcResponse<Void> remindAuditOverTime();
} }
\ No newline at end of file \ No newline at end of file
...@@ -121,4 +121,9 @@ public interface StaffDailyReportRemote { ...@@ -121,4 +121,9 @@ public interface StaffDailyReportRemote {
@ApiParam(name="condition",notes="日报填报参数",dataType= ApiParam.DataTypeEnum.STRING,required=true) @ApiParam(name="condition",notes="日报填报参数",dataType= ApiParam.DataTypeEnum.STRING,required=true)
@ApiResponse("品牌是否校验通过list") @ApiResponse("品牌是否校验通过list")
RpcResponse<List<StaffDailyReportBrandDTO>> checkStaffDailyReportData(StaffDailyReportDTO condition); RpcResponse<List<StaffDailyReportBrandDTO>> checkStaffDailyReportData(StaffDailyReportDTO condition);
@ApiMethod("推送无日报门店产值表图片到群聊")
@ApiParam(name="jobParameter",notes="推送入参",dataType= ApiParam.DataTypeEnum.STRING,required=true)
@ApiResponse("无需返回")
void sendNoDailyReportMerchantOutputReportJob(String jobParameter);
} }
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
</parent> </parent>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-smartcarlife</artifactId> <artifactId>rpc-dj-smartcarlife</artifactId>
<version>5.6.4-SNAPSHOT</version> <version>5.7.4-SNAPSHOT</version>
<name>rpc-dj-smartcarlife</name> <name>rpc-dj-smartcarlife</name>
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>
<skipTests>true</skipTests> <skipTests>true</skipTests>
<shopmall.api.version>5.6.4-SNAPSHOT</shopmall.api.version> <shopmall.api.version>5.6.4-SNAPSHOT</shopmall.api.version>
<stoassistant.api.version>5.6.4-SNAPSHOT</stoassistant.api.version> <stoassistant.api.version>5.6.4-SNAPSHOT</stoassistant.api.version>
<smartcarlife.api.version>5.7.1-SNAPSHOT</smartcarlife.api.version> <smartcarlife.api.version>5.7.4-SNAPSHOT</smartcarlife.api.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
......
...@@ -274,4 +274,6 @@ public interface GoodsOrderMapper extends OreMapper<GoodsOrder> { ...@@ -274,4 +274,6 @@ public interface GoodsOrderMapper extends OreMapper<GoodsOrder> {
List<GoodsOrderDTO> listAbnormalOrderInfo(GoodsOrderDTO condition); List<GoodsOrderDTO> listAbnormalOrderInfo(GoodsOrderDTO condition);
List<GoodsOrderDTO> listBaseInfo(GoodsOrderDTO oldOrderCondition); List<GoodsOrderDTO> listBaseInfo(GoodsOrderDTO oldOrderCondition);
List<GoodsOrderDTO> listCarTypeGoodsOrder(GoodsOrderDTO goodsOrderDTO);
} }
...@@ -23,4 +23,11 @@ public interface GoodsWarehousingInfoMapper extends OreMapper<GoodsWarehousingIn ...@@ -23,4 +23,11 @@ public interface GoodsWarehousingInfoMapper extends OreMapper<GoodsWarehousingIn
// GoodsWarehousingInfoDTO seletByUpgradeGoodsId(@Param("upgradeGoodsId") Integer upgradeGoodsId,@Param("yqMerchantId")Integer yqMerchantId); // GoodsWarehousingInfoDTO seletByUpgradeGoodsId(@Param("upgradeGoodsId") Integer upgradeGoodsId,@Param("yqMerchantId")Integer yqMerchantId);
GoodsWarehousingInfoDTO countList(GoodsWarehousingInfoDTO condition); GoodsWarehousingInfoDTO countList(GoodsWarehousingInfoDTO condition);
/**
* 条件查询商品入库数量总和
* @param condition
* @return
*/
List<GoodsWarehousingInfoDTO> countTotalIncreaseStockNumGroupByGoods(GoodsWarehousingInfoDTO condition);
} }
...@@ -15,4 +15,11 @@ public interface MerchantGoodsStockReduceRecordMapper extends OreMapper<Merchant ...@@ -15,4 +15,11 @@ public interface MerchantGoodsStockReduceRecordMapper extends OreMapper<Merchant
MerchantGoodsStockReduceRecordDTO count(MerchantGoodsStockReduceRecordDTO dto); MerchantGoodsStockReduceRecordDTO count(MerchantGoodsStockReduceRecordDTO dto);
MerchantGoodsStockReduceRecordDTO countList(MerchantGoodsStockReduceRecordDTO condition); MerchantGoodsStockReduceRecordDTO countList(MerchantGoodsStockReduceRecordDTO condition);
/**
* 条件查询商品出库数量总和
* @param condition
* @return
*/
List<MerchantGoodsStockReduceRecordDTO> countTotalReduceStockNumGroupByGoods(MerchantGoodsStockReduceRecordDTO condition);
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.smartcarlife.mapper; package cn.com.glsx.dj.smartcarlife.mapper;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDTO;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDetailDTO; import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDetailDTO;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderDeliveryDetail; import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderDeliveryDetail;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -31,4 +32,14 @@ public interface PurchaseOrderDeliveryDetailMapper extends OreMapper<PurchaseOrd ...@@ -31,4 +32,14 @@ public interface PurchaseOrderDeliveryDetailMapper extends OreMapper<PurchaseOrd
List<PurchaseOrderDeliveryDetail> selectByCondition(PurchaseOrderDeliveryDetail purchaseOrderDeliveryDetail); List<PurchaseOrderDeliveryDetail> selectByCondition(PurchaseOrderDeliveryDetail purchaseOrderDeliveryDetail);
List<PurchaseOrderDeliveryDetailDTO> list(PurchaseOrderDeliveryDetailDTO condition); List<PurchaseOrderDeliveryDetailDTO> list(PurchaseOrderDeliveryDetailDTO condition);
PurchaseOrderDeliveryDetailDTO countByStatus(PurchaseOrderDeliveryDetailDTO condition);
/**
* 根据商品id列表查询采购订单发货信息
* @param goodsIdList
* @return
*/
List<PurchaseOrderDeliveryDTO> queryDeliveryByGoodsIdList( @Param("goodsIdList") List<Long> goodsIdList);
} }
...@@ -107,5 +107,12 @@ public interface PurchaseOrderGoodsMapper extends OreMapper<PurchaseOrderGoods> ...@@ -107,5 +107,12 @@ public interface PurchaseOrderGoodsMapper extends OreMapper<PurchaseOrderGoods>
*/ */
void deliveryTerminate(PurchaseOrderGoods condition); void deliveryTerminate(PurchaseOrderGoods condition);
/**
* 更新签收状态
* @param id
* @param updatedBy
*/
void updatePurchaseOrderGoodsPutStatus(@Param("id") Long id, @Param("updatedBy") String updatedBy);
} }
...@@ -27,6 +27,13 @@ public interface PurchaseOrderMapper extends OreMapper<PurchaseOrder> { ...@@ -27,6 +27,13 @@ public interface PurchaseOrderMapper extends OreMapper<PurchaseOrder> {
/** /**
* 运营审核列表
* @param condition
* @return
*/
List<PurchaseOrderPageDTO> managerReviewList(PurchaseOrderPageDTO condition);
/**
* 商务审核列表 * 商务审核列表
* @param condition * @param condition
* @return * @return
...@@ -72,4 +79,11 @@ public interface PurchaseOrderMapper extends OreMapper<PurchaseOrder> { ...@@ -72,4 +79,11 @@ public interface PurchaseOrderMapper extends OreMapper<PurchaseOrder> {
* @return 采购订单列表 * @return 采购订单列表
*/ */
List<PurchaseOrderPageDTO> listDirectorAuditOverTime(@Param("deadlineDate") Date deadlineDate); List<PurchaseOrderPageDTO> listDirectorAuditOverTime(@Param("deadlineDate") Date deadlineDate);
/**
* 查询总监审核节点超过时间未审核的采购订单列表
* @param deadlineDate 截止时间
* @return 采购订单列表
*/
List<PurchaseOrderPageDTO> listManagerAuditOverTime(@Param("deadlineDate") Date deadlineDate);
} }
...@@ -237,4 +237,15 @@ public interface SceneMerchantRefMapper extends OreMapper<SceneMerchantRef> { ...@@ -237,4 +237,15 @@ public interface SceneMerchantRefMapper extends OreMapper<SceneMerchantRef> {
List<MerchantListDTO> query4sMerchantListByName(SceneMerchantRefDTO sceneMerchantRefDTO); List<MerchantListDTO> query4sMerchantListByName(SceneMerchantRefDTO sceneMerchantRefDTO);
List<Integer> query4sMerchantIdList(ServiceMerchantPageWithBrandDTO condition); List<Integer> query4sMerchantIdList(ServiceMerchantPageWithBrandDTO condition);
/**
* 根据商户id 查询精品升级4s店 1.1区域经理
*/
List<String> query4sMerchantDirectorByMerchantId(@Param("merchantId") Integer merchantId);
/**
* 根据商户id(4店商户号、或者园区店商户号) 查询精品升级4s店 1.1区域经理
*/
List<String> query4sMerchantDirectorBy4sMerchantIdOrYqMerchantId(@Param("merchantId") Integer merchantId);
} }
...@@ -40,6 +40,7 @@ public class BusinessReviewRemoteImpl implements BusinessReviewRemote { ...@@ -40,6 +40,7 @@ public class BusinessReviewRemoteImpl implements BusinessReviewRemote {
} }
} }
// todz 商务驳回 新增经理审核节点
@Override @Override
public RpcResponse<Boolean> businessReject(PurchaseOrderPageDTO dto) { public RpcResponse<Boolean> businessReject(PurchaseOrderPageDTO dto) {
try { try {
......
package cn.com.glsx.dj.smartcarlife.remote;
import cn.com.glsx.dj.smartcarlife.dto.ManagerBatchAuditItemDTO;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderPageDTO;
import cn.com.glsx.dj.smartcarlife.service.ManagerReviewService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
@DubboService(validation = "true",version = "1.0.0")
public class ManagerReviewRemoteImpl implements ManagerReviewRemote {
@Autowired
private ManagerReviewService managerReviewService;
@Override
public RpcResponse<RpcPagination<PurchaseOrderPageDTO>> listWithPage(RpcPagination<PurchaseOrderPageDTO> rpcPagination) {
try {
return RpcResponse.success(RpcPagination.copyPage(managerReviewService.listWithPage(rpcPagination)));
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<Boolean> managerAudit(PurchaseOrderPageDTO dto) {
try {
return RpcResponse.success(managerReviewService.managerAudit(dto));
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<Boolean> managerReject(PurchaseOrderPageDTO dto) {
try {
return RpcResponse.success(managerReviewService.managerReject(dto));
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<Boolean> managerBatchAudit(List<ManagerBatchAuditItemDTO> auditList, String updatedBy, String operatorName) {
try {
return RpcResponse.success(managerReviewService.managerBatchAudit(auditList, updatedBy, operatorName));
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
}
...@@ -55,4 +55,24 @@ public class MerchantAndStaffDailyReportExcelRemoteImpl implements MerchantAndSt ...@@ -55,4 +55,24 @@ public class MerchantAndStaffDailyReportExcelRemoteImpl implements MerchantAndSt
return RpcResponse.error(e); return RpcResponse.error(e);
} }
} }
@Override
public RpcResponse<List<MerchantDailyReportHuaweiExportDTO>> listNotFilledMerchantDailyReportExcelData(MerchantDailyReportHuaweiExportDTO condition) {
try{
return RpcResponse.success(staffDailyReportHuaweiService.listNotFilledMerchantDailyReportExcelData(condition));
}catch(RpcServiceException e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<Boolean> existNotFilledMerchantDailyReportExcelData(MerchantDailyReportHuaweiExportDTO condition) {
try{
return RpcResponse.success(staffDailyReportHuaweiService.existNotFilledMerchantDailyReportExcelData(condition));
}catch(RpcServiceException e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
} }
...@@ -35,4 +35,14 @@ public class PurchaseOrderDeliveryDetailRemoteImpl implements PurchaseOrderDeliv ...@@ -35,4 +35,14 @@ public class PurchaseOrderDeliveryDetailRemoteImpl implements PurchaseOrderDeliv
return RpcResponse.error(e); return RpcResponse.error(e);
} }
} }
@Override
public RpcResponse<PurchaseOrderDeliveryDetailDTO> countByStatus(PurchaseOrderDeliveryDetailDTO condition) {
try {
return RpcResponse.success(purchaseOrderDeliveryDetailService.countByStatus(condition));
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
} }
package cn.com.glsx.dj.smartcarlife.remote; package cn.com.glsx.dj.smartcarlife.remote;
import javax.validation.constraints.NotNull;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDTO; import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDTO;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderPageDTO; import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderPageDTO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderDelivery; import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderDelivery;
import cn.com.glsx.dj.smartcarlife.service.PurchaseOrderDeliveryService; import cn.com.glsx.dj.smartcarlife.service.PurchaseOrderDeliveryService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import javax.validation.constraints.NotNull;
@Slf4j @Slf4j
@DubboService(validation = "true") @DubboService(validation = "true")
public class PurchaseOrderDeliveryRemoteImpl implements PurchaseOrderDeliveryRemote { public class PurchaseOrderDeliveryRemoteImpl implements PurchaseOrderDeliveryRemote {
...@@ -38,7 +37,6 @@ public class PurchaseOrderDeliveryRemoteImpl implements PurchaseOrderDeliveryRem ...@@ -38,7 +37,6 @@ public class PurchaseOrderDeliveryRemoteImpl implements PurchaseOrderDeliveryRem
} }
} }
@Override @Override
public RpcResponse<Boolean> deliveryReject(PurchaseOrderPageDTO purchaseOrderPageDTO) { public RpcResponse<Boolean> deliveryReject(PurchaseOrderPageDTO purchaseOrderPageDTO) {
try{ try{
......
...@@ -10,11 +10,14 @@ import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderDelivery; ...@@ -10,11 +10,14 @@ import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderDelivery;
import cn.com.glsx.dj.smartcarlife.service.PurchaseOrderDeliveryService; import cn.com.glsx.dj.smartcarlife.service.PurchaseOrderDeliveryService;
import cn.com.glsx.dj.smartcarlife.service.PurchaseOrderGoodsService; import cn.com.glsx.dj.smartcarlife.service.PurchaseOrderGoodsService;
import cn.com.glsx.dj.smartcarlife.service.PurchaseOrderService; import cn.com.glsx.dj.smartcarlife.service.PurchaseOrderService;
import cn.com.glsx.dj.smartcarlife.service.StockAllocateReviewService;
import cn.com.glsx.dj.smartcarlife.service.stock.StockAllocateRecordService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.exception.ServiceException; import cn.com.glsx.framework.core.exception.ServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService; import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -31,6 +34,10 @@ public class PurchaseOrderRemoteImpl implements PurchaseOrderRemote { ...@@ -31,6 +34,10 @@ public class PurchaseOrderRemoteImpl implements PurchaseOrderRemote {
private PurchaseOrderGoodsService purchaseOrderGoodsService; private PurchaseOrderGoodsService purchaseOrderGoodsService;
@Autowired @Autowired
private PurchaseOrderDeliveryService purchaseOrderDeliveryService; private PurchaseOrderDeliveryService purchaseOrderDeliveryService;
@Autowired
private StockAllocateReviewService stockAllocateReviewService;
@Autowired
private StockAllocateRecordService stockAllocateRecordService;
@Override @Override
...@@ -355,6 +362,35 @@ public class PurchaseOrderRemoteImpl implements PurchaseOrderRemote { ...@@ -355,6 +362,35 @@ public class PurchaseOrderRemoteImpl implements PurchaseOrderRemote {
} }
} }
@Override
public RpcResponse<Boolean> sendWechatMessageByFlags(OrderProcessDTO condition) {
String orderCode = condition.getOrderCode();
String allocateCode = condition.getAllocateCode();
Integer staffType = condition.getStaffType();
String updatedBy = condition.getUpdatedBy();
Boolean sendStockAllocateMessage = condition.getSendStockAllocateMessage();
Boolean sendPurchaseOrderMessage = condition.getSendPurchaseOrderMessage();
try {
if (Boolean.TRUE.equals(sendStockAllocateMessage)) {
RpcAssert.assertNotEmpty(allocateCode, DefaultErrorEnum.DATA_NULL, "allocateCode not be empty");
StockAllocateRecordDTO stockAllocateRecord = stockAllocateRecordService.getByAllocateCode(allocateCode);
RpcAssert.assertNotNull(stockAllocateRecord, DefaultErrorEnum.DATA_NULL, "stock allocate record not exist");
stockAllocateReviewService.sendStockAllocateWechatMessage(stockAllocateRecord, staffType, updatedBy, false);
}
if (Boolean.TRUE.equals(sendPurchaseOrderMessage)) {
RpcAssert.assertNotEmpty(orderCode, DefaultErrorEnum.DATA_NULL, "orderCode not be empty");
purchaseOrderService.sendPurchaseOrderWechatMessage(orderCode, staffType, updatedBy, false);
}
return RpcResponse.success(Boolean.TRUE);
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
@Override @Override
public RpcResponse<Void> remindAuditOverTime() { public RpcResponse<Void> remindAuditOverTime() {
try { try {
......
...@@ -240,6 +240,15 @@ public class StaffDailyReportRemoteImpl implements StaffDailyReportRemote{ ...@@ -240,6 +240,15 @@ public class StaffDailyReportRemoteImpl implements StaffDailyReportRemote{
} }
@Override @Override
public void sendNoDailyReportMerchantOutputReportJob(String jobParameter) {
try {
staffDailyReportService.sendNoDailyReportMerchantOutputReportJob(jobParameter);
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
}
}
@Override
public RpcResponse<Boolean> isPopupNeededOfSecondHandCar(StaffDailyReportDTO condition) { public RpcResponse<Boolean> isPopupNeededOfSecondHandCar(StaffDailyReportDTO condition) {
try{ try{
return RpcResponse.success(staffDailyReportService.isPopupNeededOfSecondHandCar(condition)); return RpcResponse.success(staffDailyReportService.isPopupNeededOfSecondHandCar(condition));
......
...@@ -111,6 +111,9 @@ public class BusinessReviewService { ...@@ -111,6 +111,9 @@ public class BusinessReviewService {
byte orderStatus; byte orderStatus;
if (Objects.equals(rejectNode, ReviewNodeEnum.OPERATOR_VIEW.getValue())) { if (Objects.equals(rejectNode, ReviewNodeEnum.OPERATOR_VIEW.getValue())) {
orderStatus = PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue(); orderStatus = PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue();
} else if(Objects.equals(rejectNode, ReviewNodeEnum.MANAGER.getValue())) {
// 驳回到运营已审核-待经理审核
orderStatus = PurchaseOrderEnum.OrderStatus.OPERATOR_CHECKED.getValue();
} else { } else {
orderStatus = PurchaseOrderEnum.OrderStatus.BUSINESS_REJECT.getValue(); orderStatus = PurchaseOrderEnum.OrderStatus.BUSINESS_REJECT.getValue();
} }
...@@ -126,10 +129,13 @@ public class BusinessReviewService { ...@@ -126,10 +129,13 @@ public class BusinessReviewService {
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
@Override @Override
public void afterCommit() { public void afterCommit() {
//驳回到运营审核节点,推送企微消息给所有运营 // 驳回到运营审核节点,推送企微消息给所有运营
if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue())) { if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue())) {
purchaseOrderService.sendPurchaseOrderWechatMessage(dto.getOrderCode(), ReviewNodeEnum.OPERATOR_VIEW.getValue(), dto.getUpdatedBy(), false); purchaseOrderService.sendPurchaseOrderWechatMessage(dto.getOrderCode(), ReviewNodeEnum.OPERATOR_VIEW.getValue(), dto.getUpdatedBy(), false);
}
// 驳回到经理审核节点,推送企微消息给所有经理
if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.OPERATOR_CHECKED.getValue())) {
purchaseOrderService.sendPurchaseOrderWechatMessage(dto.getOrderCode(), ReviewNodeEnum.MANAGER.getValue(), dto.getUpdatedBy(), false);
} }
if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.BUSINESS_REJECT.getValue())) { if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.BUSINESS_REJECT.getValue())) {
String messageContent = purchaseOrderService.getRejectMessageContent(dto.getOrderCode(), dto.getRejectCause(), "商务审核"); String messageContent = purchaseOrderService.getRejectMessageContent(dto.getOrderCode(), dto.getRejectCause(), "商务审核");
......
package cn.com.glsx.dj.smartcarlife.service; package cn.com.glsx.dj.smartcarlife.service;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDTO; import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDTO;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderGoodsDTO;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderPageDTO; import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderPageDTO;
import cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO;
import cn.com.glsx.dj.smartcarlife.enums.PurchaseOrderEnum; import cn.com.glsx.dj.smartcarlife.enums.PurchaseOrderEnum;
import cn.com.glsx.dj.smartcarlife.enums.RpcErrorEnum; import cn.com.glsx.dj.smartcarlife.enums.RpcErrorEnum;
import cn.com.glsx.dj.smartcarlife.enums.purchaseGoods.ReviewNodeEnum; import cn.com.glsx.dj.smartcarlife.enums.purchaseGoods.ReviewNodeEnum;
import cn.com.glsx.dj.smartcarlife.mapper.PurchaseOrderMapper; import cn.com.glsx.dj.smartcarlife.mapper.PurchaseOrderMapper;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrder; import cn.com.glsx.dj.smartcarlife.model.PurchaseOrder;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderAuditDetail; import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderAuditDetail;
import cn.com.glsx.dj.smartcarlife.model.ShippingEntityInfo;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
...@@ -30,7 +27,6 @@ import org.springframework.transaction.support.TransactionSynchronizationManager ...@@ -30,7 +27,6 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
...@@ -68,7 +64,7 @@ public class DirectorReviewService { ...@@ -68,7 +64,7 @@ public class DirectorReviewService {
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public boolean directorAudit(PurchaseOrderPageDTO dto) { public boolean directorAudit(PurchaseOrderPageDTO dto) {
try { try {
thiz.checkForOperatorAuditOrReject(dto); thiz.checkForDirectorAuditOrReject(dto);
operatorReviewService.checkSendOutMerchantForOperatorAudit(dto); operatorReviewService.checkSendOutMerchantForOperatorAudit(dto);
// 更新订单状态 // 更新订单状态
PurchaseOrderDTO purchaseOrderDTO = PurchaseOrderDTO.builder().orderCode(dto.getOrderCode()) PurchaseOrderDTO purchaseOrderDTO = PurchaseOrderDTO.builder().orderCode(dto.getOrderCode())
...@@ -107,7 +103,7 @@ public class DirectorReviewService { ...@@ -107,7 +103,7 @@ public class DirectorReviewService {
if (purchaseOrder == null) { if (purchaseOrder == null) {
throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "不存在的采购订单信息, orderCode:"+dto.getOrderCode()); throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "不存在的采购订单信息, orderCode:"+dto.getOrderCode());
} }
if (!Objects.equals(purchaseOrder.getStatus(), PurchaseOrderEnum.OrderStatus.OPERATOR_CHECKED.getValue())) { if (!Objects.equals(purchaseOrder.getStatus(), PurchaseOrderEnum.OrderStatus.MANAGER_CHECKED.getValue())) {
throw new RpcServiceException(RpcErrorEnum.STATUS_CHANGED, "状态已更新,无法操作"); throw new RpcServiceException(RpcErrorEnum.STATUS_CHANGED, "状态已更新,无法操作");
} }
return purchaseOrder; return purchaseOrder;
...@@ -121,6 +117,8 @@ public class DirectorReviewService { ...@@ -121,6 +117,8 @@ public class DirectorReviewService {
byte orderStatus; byte orderStatus;
if (Objects.equals(rejectNode, ReviewNodeEnum.OPERATOR_VIEW.getValue())) { if (Objects.equals(rejectNode, ReviewNodeEnum.OPERATOR_VIEW.getValue())) {
orderStatus = PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue(); orderStatus = PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue();
} else if (Objects.equals(rejectNode, ReviewNodeEnum.MANAGER.getValue())) {
orderStatus = PurchaseOrderEnum.OrderStatus.OPERATOR_CHECKED.getValue();
} else { } else {
orderStatus = PurchaseOrderEnum.OrderStatus.DIRECTOR_REJECT.getValue(); orderStatus = PurchaseOrderEnum.OrderStatus.DIRECTOR_REJECT.getValue();
} }
...@@ -136,10 +134,10 @@ public class DirectorReviewService { ...@@ -136,10 +134,10 @@ public class DirectorReviewService {
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
@Override @Override
public void afterCommit() { public void afterCommit() {
//驳回到运营审核节点,推送企微消息给所有运营 // 驳回到运营审核/经理审核节点,推送企微消息相关人员
if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue())) { if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue())
purchaseOrderService.sendPurchaseOrderWechatMessage(dto.getOrderCode(), ReviewNodeEnum.OPERATOR_VIEW.getValue(), dto.getUpdatedBy(), false); || Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.OPERATOR_CHECKED.getValue())) {
purchaseOrderService.sendPurchaseOrderWechatMessage(dto.getOrderCode(), rejectNode, dto.getUpdatedBy(), false);
} }
if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.DIRECTOR_REJECT.getValue())) { if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.DIRECTOR_REJECT.getValue())) {
String messageContent = purchaseOrderService.getRejectMessageContent(dto.getOrderCode(), dto.getRejectCause(), "总监审核"); String messageContent = purchaseOrderService.getRejectMessageContent(dto.getOrderCode(), dto.getRejectCause(), "总监审核");
...@@ -166,7 +164,7 @@ public class DirectorReviewService { ...@@ -166,7 +164,7 @@ public class DirectorReviewService {
if (purchaseOrder == null) { if (purchaseOrder == null) {
throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "不存在的采购订单信息, orderCode:" + dto.getOrderCode()); throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "不存在的采购订单信息, orderCode:" + dto.getOrderCode());
} }
if (!Objects.equals(purchaseOrder.getStatus(), PurchaseOrderEnum.OrderStatus.OPERATOR_CHECKED.getValue())) { if (!Objects.equals(purchaseOrder.getStatus(), PurchaseOrderEnum.OrderStatus.MANAGER_CHECKED.getValue())) {
throw new RpcServiceException(RpcErrorEnum.STATUS_CHANGED, "状态已更新,无法操作"); throw new RpcServiceException(RpcErrorEnum.STATUS_CHANGED, "状态已更新,无法操作");
} }
} }
......
...@@ -6662,6 +6662,34 @@ public class GoodsOrderService { ...@@ -6662,6 +6662,34 @@ public class GoodsOrderService {
} }
} }
public List<GoodsOrderDTO> listBaseInfo(GoodsOrderDTO goodsOrderDTO) {
try {
return goodsOrderMapper.listBaseInfo(goodsOrderDTO);
} catch (RpcServiceException e) {
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR);
}
}
/**
* @description: 查询不同车型订单信息
* @param: [goodsOrderDTO]
* @return: java.util.List<cn.com.glsx.dj.smartcarlife.dto.GoodsOrderDTO>
* @author: lqWang
* @date: 2026/4/14 10:47
*/
public List<GoodsOrderDTO> listCarTypeGoodsOrder(GoodsOrderDTO goodsOrderDTO) {
try {
return goodsOrderMapper.listCarTypeGoodsOrder(goodsOrderDTO);
} catch (RpcServiceException e) {
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR);
}
}
} }
...@@ -179,8 +179,9 @@ public class GoodsWarehousingInfoService { ...@@ -179,8 +179,9 @@ public class GoodsWarehousingInfoService {
* @author caiym * @author caiym
* @date 2023年02月09日 15:09:09 * @date 2023年02月09日 15:09:09
*/ */
public GoodsWarehousingInfoDTO count(Integer yqMerchantId, Integer upgradeGoodsId, String dataMonthStr){ public GoodsWarehousingInfoDTO count(Integer yqMerchantId, Integer upgradeGoodsId, String dataMonthStr, Byte inventoryType){
GoodsWarehousingInfoDTO dto = GoodsWarehousingInfoDTO.builder().yqMerchantId(yqMerchantId).upgradeGoodsId(upgradeGoodsId).build(); GoodsWarehousingInfoDTO dto = GoodsWarehousingInfoDTO.builder().yqMerchantId(yqMerchantId).upgradeGoodsId(upgradeGoodsId)
.inventoryType(inventoryType).build();
String monthFirstAndLastDayTime = DateUtils.getMonthFirstAndLastDayTime(dataMonthStr); String monthFirstAndLastDayTime = DateUtils.getMonthFirstAndLastDayTime(dataMonthStr);
if (StringUtils.isNotBlank(monthFirstAndLastDayTime)) { if (StringUtils.isNotBlank(monthFirstAndLastDayTime)) {
String[] split = monthFirstAndLastDayTime.split(","); String[] split = monthFirstAndLastDayTime.split(",");
...@@ -339,4 +340,10 @@ public class GoodsWarehousingInfoService { ...@@ -339,4 +340,10 @@ public class GoodsWarehousingInfoService {
public GoodsWarehousingInfoDTO countList(GoodsWarehousingInfoDTO condition) { public GoodsWarehousingInfoDTO countList(GoodsWarehousingInfoDTO condition) {
return goodsWarehousingInfoMapper.countList(condition); return goodsWarehousingInfoMapper.countList(condition);
} }
public List<GoodsWarehousingInfoDTO> countTotalIncreaseStockNumGroupByGoods(GoodsWarehousingInfoDTO condition){
RpcAssert.assertNotNull(condition, DefaultErrorEnum.DATA_NULL, "goodsWarehousingInfoDTO not be null");
RpcAssert.assertNotEmpty(condition.getUpgradeGoodsIdList(), DefaultErrorEnum.DATA_NULL, "goodsWarehousingInfoDTO.upgradeGoodsIdList not be empty");
return goodsWarehousingInfoMapper.countTotalIncreaseStockNumGroupByGoods(condition);
}
} }
...@@ -25,6 +25,7 @@ import com.github.pagehelper.Page; ...@@ -25,6 +25,7 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
...@@ -250,6 +251,9 @@ public class PurchaseOrderDeliveryDetailService { ...@@ -250,6 +251,9 @@ public class PurchaseOrderDeliveryDetailService {
public Page<PurchaseOrderDeliveryDetailDTO> page(RpcPagination<PurchaseOrderDeliveryDetailDTO> pagination){ public Page<PurchaseOrderDeliveryDetailDTO> page(RpcPagination<PurchaseOrderDeliveryDetailDTO> pagination){
try{ try{
Page<PurchaseOrderDeliveryDetailDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(),pagination.isNeedCount()); Page<PurchaseOrderDeliveryDetailDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(),pagination.isNeedCount());
if(StringUtils.isNotBlank(pagination.getCondition().getPutStatusStr())){
pagination.getCondition().setPutStatusList(Arrays.stream(pagination.getCondition().getPutStatusStr().split(",")).map(Integer::valueOf).collect(Collectors.toList()));
}
purchaseOrderDeliveryDetailMapper.list(pagination.getCondition()); purchaseOrderDeliveryDetailMapper.list(pagination.getCondition());
if(CollectionUtils.isNotEmpty(page.getResult())) { if(CollectionUtils.isNotEmpty(page.getResult())) {
page.getResult().stream().forEach(item->{ page.getResult().stream().forEach(item->{
...@@ -365,6 +369,15 @@ public class PurchaseOrderDeliveryDetailService { ...@@ -365,6 +369,15 @@ public class PurchaseOrderDeliveryDetailService {
} }
} }
public PurchaseOrderDeliveryDetailDTO countByStatus(PurchaseOrderDeliveryDetailDTO condition) {
try {
return purchaseOrderDeliveryDetailMapper.countByStatus(condition);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR, e);
}
}
public Boolean updatePutStatusToNoByOrderDeliveryId(Long orderDeliveryId, String updatedBy){ public Boolean updatePutStatusToNoByOrderDeliveryId(Long orderDeliveryId, String updatedBy){
RpcAssert.assertNotNull(orderDeliveryId, DefaultErrorEnum.DATA_NULL,"orderDeliveryId not be null"); RpcAssert.assertNotNull(orderDeliveryId, DefaultErrorEnum.DATA_NULL,"orderDeliveryId not be null");
RpcAssert.assertNotEmpty(updatedBy, DefaultErrorEnum.DATA_NULL,"updatedBy not be empty"); RpcAssert.assertNotEmpty(updatedBy, DefaultErrorEnum.DATA_NULL,"updatedBy not be empty");
...@@ -379,4 +392,11 @@ public class PurchaseOrderDeliveryDetailService { ...@@ -379,4 +392,11 @@ public class PurchaseOrderDeliveryDetailService {
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR); throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
} }
} }
public List<PurchaseOrderDeliveryDTO> queryDeliveryByGoodsIdList(List<Long> goodsIdList) {
if(CollectionUtils.isEmpty(goodsIdList)){
return new ArrayList<>();
}
return purchaseOrderDeliveryDetailMapper.queryDeliveryByGoodsIdList(goodsIdList);
}
} }
...@@ -1014,8 +1014,7 @@ public class PurchaseOrderDeliveryService { ...@@ -1014,8 +1014,7 @@ public class PurchaseOrderDeliveryService {
List<PurchaseOrderDeliveryDetail> deliveryRecordDetailList = purchaseOrderDeliveryDetailService.getDeliveryRecord(condition); List<PurchaseOrderDeliveryDetail> deliveryRecordDetailList = purchaseOrderDeliveryDetailService.getDeliveryRecord(condition);
RpcAssert.assertNotEmpty(deliveryRecordDetailList, DefaultErrorEnum.PARAMETER_NULL, "发货单商品无可用库存"); RpcAssert.assertNotEmpty(deliveryRecordDetailList, DefaultErrorEnum.PARAMETER_NULL, "发货单商品无可用库存");
PurchaseOrderDeliveryDetail purchaseOrderDeliveryDetail = deliveryRecordDetailList.get(0); PurchaseOrderDeliveryDetail purchaseOrderDeliveryDetail = deliveryRecordDetailList.get(0);
RpcAssert.assertIsTrue(!Objects.equals(orderType, DeliveryOrderTypeEnum.ALLOCATE_ORDER.getValue()) RpcAssert.assertIsTrue(Objects.equals(purchaseOrderDeliveryDetail.getPutStatus(), PurchaseOrderEnum.PutStatus.NO.getValue()), DefaultErrorEnum.PARAMETER_NULL, "调拨发货单商品非未入库状态");
|| Objects.equals(purchaseOrderDeliveryDetail.getPutStatus(), PurchaseOrderEnum.PutStatus.NO.getValue()), DefaultErrorEnum.PARAMETER_NULL, "调拨发货单商品非未入库状态");
//商品可用库存 //商品可用库存
BigDecimal stockNum = purchaseOrderDeliveryDetail.getStockNum(); BigDecimal stockNum = purchaseOrderDeliveryDetail.getStockNum();
RpcAssert.assertIsTrue(stockNum.compareTo(increaseStockNum) == 0, DefaultErrorEnum.DATA_INVALID, "商品入库数量必须等于该商品的可用库存数量"); RpcAssert.assertIsTrue(stockNum.compareTo(increaseStockNum) == 0, DefaultErrorEnum.DATA_INVALID, "商品入库数量必须等于该商品的可用库存数量");
...@@ -1220,6 +1219,9 @@ public class PurchaseOrderDeliveryService { ...@@ -1220,6 +1219,9 @@ public class PurchaseOrderDeliveryService {
RpcAssert.assertNotNull(pagination, DefaultErrorEnum.DATA_NULL, "RpcPagination not be null"); RpcAssert.assertNotNull(pagination, DefaultErrorEnum.DATA_NULL, "RpcPagination not be null");
try { try {
log.info("condition:{}", pagination.getCondition()); log.info("condition:{}", pagination.getCondition());
if(StringUtils.isNotBlank(pagination.getCondition().getPutStatusStr())){
pagination.getCondition().setPutStatusList(Arrays.stream(pagination.getCondition().getPutStatusStr().split(",")).map(Integer::valueOf).collect(Collectors.toList()));
}
Page<PurchaseOrderDeliveryDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(), pagination.isNeedCount()); Page<PurchaseOrderDeliveryDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(), pagination.isNeedCount());
if (Objects.equals(pagination.getCondition().getOrderType(), DeliveryOrderTypeEnum.ALLOCATE_ORDER.getValue())) { if (Objects.equals(pagination.getCondition().getOrderType(), DeliveryOrderTypeEnum.ALLOCATE_ORDER.getValue())) {
purchaseOrderDeliveryMapper.listAllocateDeliveryPage(pagination.getCondition()); purchaseOrderDeliveryMapper.listAllocateDeliveryPage(pagination.getCondition());
...@@ -2075,6 +2077,8 @@ public class PurchaseOrderDeliveryService { ...@@ -2075,6 +2077,8 @@ public class PurchaseOrderDeliveryService {
orderStatus = PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue(); orderStatus = PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue();
} else if (Objects.equals(rejectNode, ReviewNodeEnum.BUSINESS_VIEW.getValue())) { } else if (Objects.equals(rejectNode, ReviewNodeEnum.BUSINESS_VIEW.getValue())) {
orderStatus = PurchaseOrderEnum.OrderStatus.DIRECTOR_CHECKED.getValue(); orderStatus = PurchaseOrderEnum.OrderStatus.DIRECTOR_CHECKED.getValue();
} else if (Objects.equals(rejectNode, ReviewNodeEnum.MANAGER.getValue())) {
orderStatus = PurchaseOrderEnum.OrderStatus.OPERATOR_CHECKED.getValue();
} else { } else {
orderStatus = PurchaseOrderEnum.OrderStatus.DELIVERY_REJECT.getValue(); orderStatus = PurchaseOrderEnum.OrderStatus.DELIVERY_REJECT.getValue();
} }
...@@ -2091,9 +2095,10 @@ public class PurchaseOrderDeliveryService { ...@@ -2091,9 +2095,10 @@ public class PurchaseOrderDeliveryService {
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
@Override @Override
public void afterCommit() { public void afterCommit() {
if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue()) || Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.DIRECTOR_CHECKED.getValue())) { if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue())
int reviewType = Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.WAIT_CHECK.getValue()) ? ReviewNodeEnum.OPERATOR_VIEW.getValue() : ReviewNodeEnum.BUSINESS_VIEW.getValue(); || Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.OPERATOR_CHECKED.getValue())
purchaseOrderService.sendPurchaseOrderWechatMessage(dto.getOrderCode(), reviewType, dto.getUpdatedBy(), false); || Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.DIRECTOR_CHECKED.getValue())) {
purchaseOrderService.sendPurchaseOrderWechatMessage(dto.getOrderCode(), rejectNode, dto.getUpdatedBy(), false);
} }
if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.DELIVERY_REJECT.getValue())) { if (Objects.equals(orderStatus, PurchaseOrderEnum.OrderStatus.DELIVERY_REJECT.getValue())) {
String messageContent = purchaseOrderService.getRejectMessageContent(dto.getOrderCode(), dto.getRejectCause(), "采购发货"); String messageContent = purchaseOrderService.getRejectMessageContent(dto.getOrderCode(), dto.getRejectCause(), "采购发货");
...@@ -2218,6 +2223,7 @@ public class PurchaseOrderDeliveryService { ...@@ -2218,6 +2223,7 @@ public class PurchaseOrderDeliveryService {
return true; return true;
} }
@Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
@GlsxDistributeLockable(name="'PurchaseOrderDeliveryService_deliverySign_' + #dto.id",timeoutException=RpcServiceException.class) @GlsxDistributeLockable(name="'PurchaseOrderDeliveryService_deliverySign_' + #dto.id",timeoutException=RpcServiceException.class)
public Boolean deliverySign(PurchaseOrderDeliveryDTO dto) { public Boolean deliverySign(PurchaseOrderDeliveryDTO dto) {
RpcAssert.assertNotNull(dto, DefaultErrorEnum.DATA_NULL,"dto not be null"); RpcAssert.assertNotNull(dto, DefaultErrorEnum.DATA_NULL,"dto not be null");
...@@ -2233,12 +2239,24 @@ public class PurchaseOrderDeliveryService { ...@@ -2233,12 +2239,24 @@ public class PurchaseOrderDeliveryService {
if (!Objects.equals(record.getPutStatus(), PurchaseOrderEnum.PutStatus.NO_SIGN.getValue())) { if (!Objects.equals(record.getPutStatus(), PurchaseOrderEnum.PutStatus.NO_SIGN.getValue())) {
throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "仅状态=“待签收”的发货单可签收"); throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "仅状态=“待签收”的发货单可签收");
} }
PurchaseOrderDelivery updateRecord = PurchaseOrderDelivery.builder().id(dto.getId()).signFileUrl(dto.getSignFileUrl()) try {
.putStatus(PurchaseOrderEnum.PutStatus.NO.getValue()).signDate(new Date()).signBy(dto.getUpdatedBy()) PurchaseOrderDelivery updateRecord = PurchaseOrderDelivery.builder().id(dto.getId()).signFileUrl(dto.getSignFileUrl())
.signName(dto.getSignName()).updatedBy(dto.getUpdatedBy()).updatedDate(new Date()) .putStatus(PurchaseOrderEnum.PutStatus.NO.getValue()).signDate(new Date()).signBy(dto.getUpdatedBy())
.orderType(dto.getOrderType()).uploadFileUrl(dto.getUploadFileUrl()).build(); .signName(dto.getSignName()).updatedBy(dto.getUpdatedBy()).updatedDate(new Date())
purchaseOrderDeliveryMapper.updateByPrimaryKeySelective(updateRecord); .orderType(dto.getOrderType()).uploadFileUrl(dto.getUploadFileUrl()).build();
purchaseOrderDeliveryDetailService.updatePutStatusToNoByOrderDeliveryId(dto.getId(), dto.getUpdatedBy()); purchaseOrderDeliveryMapper.updateByPrimaryKeySelective(updateRecord);
purchaseOrderDeliveryDetailService.updatePutStatusToNoByOrderDeliveryId(dto.getId(), dto.getUpdatedBy());
//更新采购商品签收状态
PurchaseOrderDeliveryDetail purchaseOrderDeliveryDetail = new PurchaseOrderDeliveryDetail();
purchaseOrderDeliveryDetail.setOrderDeliveryId(dto.getId());
List<PurchaseOrderDeliveryDetail> deliveryDetails = purchaseOrderDeliveryDetailService.getDeliveryRecord(purchaseOrderDeliveryDetail);
deliveryDetails.forEach(detail ->{
purchaseOrderGoodsService.updatePurchaseOrderGoodsPutStatus(detail.getPurchaseOrderGoodsId(), dto.getUpdatedBy());
});
}catch (Exception e){
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR, e);
}
return true; return true;
} }
......
...@@ -70,6 +70,7 @@ public class PurchaseOrderGoodsService { ...@@ -70,6 +70,7 @@ public class PurchaseOrderGoodsService {
item.setUpdatedDate(now); item.setUpdatedDate(now);
item.setDeletedFlag(DeletedFlagEnum.N.name()); item.setDeletedFlag(DeletedFlagEnum.N.name());
item.setRefundStatus(StatusEnum.NO.getValue()); item.setRefundStatus(StatusEnum.NO.getValue());
item.setSignStatus(0);//默认待签收
} }
purchaseOrderGoodsMapper.insertList(orderGoodsList); purchaseOrderGoodsMapper.insertList(orderGoodsList);
return totalPrice; return totalPrice;
...@@ -98,6 +99,7 @@ public class PurchaseOrderGoodsService { ...@@ -98,6 +99,7 @@ public class PurchaseOrderGoodsService {
item.setUpdatedDate(now); item.setUpdatedDate(now);
item.setDeletedFlag(DeletedFlagEnum.N.name()); item.setDeletedFlag(DeletedFlagEnum.N.name());
item.setRefundStatus(StatusEnum.NO.getValue()); item.setRefundStatus(StatusEnum.NO.getValue());
item.setSignStatus(0);//默认待签收
} }
purchaseOrderGoodsMapper.insertList(orderGoodsList); purchaseOrderGoodsMapper.insertList(orderGoodsList);
purchaseOrderGoodsFilmRollInfoService.insertList(orderGoodsList,createdBy); purchaseOrderGoodsFilmRollInfoService.insertList(orderGoodsList,createdBy);
...@@ -385,6 +387,9 @@ public class PurchaseOrderGoodsService { ...@@ -385,6 +387,9 @@ public class PurchaseOrderGoodsService {
public Page<PurchaseOrderGoodsPageDTO> shipmentListWithPage(RpcPagination<PurchaseOrderGoodsPageDTO> rpcPagination) { public Page<PurchaseOrderGoodsPageDTO> shipmentListWithPage(RpcPagination<PurchaseOrderGoodsPageDTO> rpcPagination) {
RpcAssert.assertNotNull(rpcPagination, DefaultErrorEnum.DATA_NULL, "RpcPagination not be null"); RpcAssert.assertNotNull(rpcPagination, DefaultErrorEnum.DATA_NULL, "RpcPagination not be null");
try { try {
if(StringUtils.isNotBlank(rpcPagination.getCondition().getSignStatusStr())){
rpcPagination.getCondition().setSignStatusList(Arrays.stream(rpcPagination.getCondition().getSignStatusStr().split(",")).map(Integer::valueOf).collect(Collectors.toList()));
}
Page<PurchaseOrderGoodsPageDTO> page = PageHelper.startPage(rpcPagination.getPageNum(), rpcPagination.getPageSize()); Page<PurchaseOrderGoodsPageDTO> page = PageHelper.startPage(rpcPagination.getPageNum(), rpcPagination.getPageSize());
purchaseOrderGoodsMapper.shipmentListWithPageNew(rpcPagination.getCondition()); purchaseOrderGoodsMapper.shipmentListWithPageNew(rpcPagination.getCondition());
...@@ -449,6 +454,12 @@ public class PurchaseOrderGoodsService { ...@@ -449,6 +454,12 @@ public class PurchaseOrderGoodsService {
//商品筛选日期范围内发货数量 //商品筛选日期范围内发货数量
Integer totalDeliveryCount = purchaseOrderDeliveryDetailList.stream().map(PurchaseOrderDeliveryDetailDTO::getPurchaseNumber).reduce(BigDecimal::add).map(BigDecimal::intValue).orElse(0); Integer totalDeliveryCount = purchaseOrderDeliveryDetailList.stream().map(PurchaseOrderDeliveryDetailDTO::getPurchaseNumber).reduce(BigDecimal::add).map(BigDecimal::intValue).orElse(0);
i.setPurchaseNumber(totalDeliveryCount); i.setPurchaseNumber(totalDeliveryCount);
//合并发货单凭证
String uploadFileUrls = purchaseOrderDeliveryList.stream()
.map(PurchaseOrderDelivery::getUploadFileUrl)
.filter(StringUtils::isNotBlank)
.collect(Collectors.joining(","));
i.setUploadFileUrls(uploadFileUrls);
} }
}); });
return page; return page;
...@@ -474,4 +485,9 @@ public class PurchaseOrderGoodsService { ...@@ -474,4 +485,9 @@ public class PurchaseOrderGoodsService {
} }
return null; return null;
} }
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public void updatePurchaseOrderGoodsPutStatus(Long id, String updatedBy) {
purchaseOrderGoodsMapper.updatePurchaseOrderGoodsPutStatus(id, updatedBy);
}
} }
...@@ -5478,6 +5478,15 @@ public class StaffDailyReportService { ...@@ -5478,6 +5478,15 @@ public class StaffDailyReportService {
} }
} }
public void sendNoDailyReportMerchantOutputReportJob(String jobParameter) {
try {
sendWorkWechatMessageService.sendNoDailyReportMerchantOutputReportJob(jobParameter);
} catch (Exception e) {
log.error("推送无日报门店产值表到企微消息异常:{}", e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
/** /**
* @description: 校验日报填报数据是否校验通过 * @description: 校验日报填报数据是否校验通过
* @param: [condition] * @param: [condition]
......
...@@ -58,6 +58,7 @@ import cn.com.glsx.dj.smartcarlife.dto.goods.MerchantPackageGoodsInfoDTO; ...@@ -58,6 +58,7 @@ import cn.com.glsx.dj.smartcarlife.dto.goods.MerchantPackageGoodsInfoDTO;
import cn.com.glsx.dj.smartcarlife.enums.CarLifeEnum; import cn.com.glsx.dj.smartcarlife.enums.CarLifeEnum;
import cn.com.glsx.dj.smartcarlife.enums.CarLifeEnum.SupplyMode; import cn.com.glsx.dj.smartcarlife.enums.CarLifeEnum.SupplyMode;
import cn.com.glsx.dj.smartcarlife.enums.DistributionRuleTypeEnum; import cn.com.glsx.dj.smartcarlife.enums.DistributionRuleTypeEnum;
import cn.com.glsx.dj.smartcarlife.enums.ExpenseCategoryCalculateTypeEnum;
import cn.com.glsx.dj.smartcarlife.enums.ExpenseCategroyRulesBuildTypeEnum; import cn.com.glsx.dj.smartcarlife.enums.ExpenseCategroyRulesBuildTypeEnum;
import cn.com.glsx.dj.smartcarlife.enums.FeeCategoryEnum; import cn.com.glsx.dj.smartcarlife.enums.FeeCategoryEnum;
import cn.com.glsx.dj.smartcarlife.enums.GoodsSourceEnum; import cn.com.glsx.dj.smartcarlife.enums.GoodsSourceEnum;
...@@ -389,7 +390,16 @@ public class CreateBusinessProductService { ...@@ -389,7 +390,16 @@ public class CreateBusinessProductService {
|| result.getServiceProfitRateBD() == null) { || result.getServiceProfitRateBD() == null) {
return; return;
} }
if (Objects.equals(result.getShopProfitType(), result.getServiceProfitType())) { List<Byte> profitTypes = Arrays.asList(
ExpenseCategoryCalculateTypeEnum.GROSS_PROFIT_PROPORTION.getValue(),
ExpenseCategoryCalculateTypeEnum.INCOME_PROPORTION.getValue(),
ExpenseCategoryCalculateTypeEnum.EXCLUDE_SHOPPROFIT_PROPORTION.getValue(),
ExpenseCategoryCalculateTypeEnum.EXCLUDE_SHOPPROFIT_COMMONCOST_INCLUDE_COST_PROPORTION.getValue(),
ExpenseCategoryCalculateTypeEnum.EXCLUDE_SHOPPROFIT_COMMONCOST_PROPORTION.getValue(),
ExpenseCategoryCalculateTypeEnum.INCOME_SUBTRACT_CUSTOM_COMMON_COST_PROPORTION.getValue(),
ExpenseCategoryCalculateTypeEnum.INCOME_SUBTRACT_COMMON_COST_PROPORTION.getValue()
);
if (Objects.equals(result.getShopProfitType(), result.getServiceProfitType()) && profitTypes.contains(result.getShopProfitType())) {
result.setDjProfitType(result.getShopProfitType()); result.setDjProfitType(result.getShopProfitType());
result.setDjProfitRate(CommonConstants.ONEHUNDRED_BIGDECIMAL.subtract(result.getShopProfitRateBD()).subtract(result.getServiceProfitRateBD())+"%"); result.setDjProfitRate(CommonConstants.ONEHUNDRED_BIGDECIMAL.subtract(result.getShopProfitRateBD()).subtract(result.getServiceProfitRateBD())+"%");
}else{ }else{
......
...@@ -5,6 +5,7 @@ import cn.com.glsx.dj.smartcarlife.dto.*; ...@@ -5,6 +5,7 @@ import cn.com.glsx.dj.smartcarlife.dto.*;
import cn.com.glsx.dj.smartcarlife.dto.businessassistant.MerchantPurchaseInfoDTO; import cn.com.glsx.dj.smartcarlife.dto.businessassistant.MerchantPurchaseInfoDTO;
import cn.com.glsx.dj.smartcarlife.dto.goods.MerchantGoodsInfoDTO; import cn.com.glsx.dj.smartcarlife.dto.goods.MerchantGoodsInfoDTO;
import cn.com.glsx.dj.smartcarlife.dto.stock.MerchantShopGoodsStockDTO; import cn.com.glsx.dj.smartcarlife.dto.stock.MerchantShopGoodsStockDTO;
import cn.com.glsx.dj.smartcarlife.dto.stock.MerchantShopGoodsStockExportDTO;
import cn.com.glsx.dj.smartcarlife.enums.*; import cn.com.glsx.dj.smartcarlife.enums.*;
import cn.com.glsx.dj.smartcarlife.mapper.MerchantGoodsStockMonthReportMapper; import cn.com.glsx.dj.smartcarlife.mapper.MerchantGoodsStockMonthReportMapper;
import cn.com.glsx.dj.smartcarlife.model.MerchantGoodsInfo; import cn.com.glsx.dj.smartcarlife.model.MerchantGoodsInfo;
...@@ -25,6 +26,7 @@ import cn.com.glsx.framework.core.util.DateUtils; ...@@ -25,6 +26,7 @@ import cn.com.glsx.framework.core.util.DateUtils;
import cn.com.glsx.framework.core.util.RpcAssert; import cn.com.glsx.framework.core.util.RpcAssert;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -37,14 +39,13 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -37,14 +39,13 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.Period; import java.time.Period;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalAdjusters;
import java.util.Arrays; import java.util.*;
import java.util.Date; import java.util.stream.Collectors;
import java.util.List;
import java.util.Optional;
@Slf4j @Slf4j
@Service @Service
...@@ -80,6 +81,7 @@ public class MerchantGoodsStockMonthReportService { ...@@ -80,6 +81,7 @@ public class MerchantGoodsStockMonthReportService {
public static final String DATA_MONTH_PATTERN = "^\\d{4}(-)(1[0-2]|0\\d)$"; public static final String DATA_MONTH_PATTERN = "^\\d{4}(-)(1[0-2]|0\\d)$";
public static final String DATA_MONTH_FORMAT = "yyyy-MM"; public static final String DATA_MONTH_FORMAT = "yyyy-MM";
public static final String DATA_FORMAT = "yyyy-MM-dd"; public static final String DATA_FORMAT = "yyyy-MM-dd";
public static final String DATE_TIME_FORMATTER = "yyyy-MM-dd HH:mm:ss";
public static final DateTimeFormatter DATA_MONTH_FORMATTER = DateTimeFormatter.ofPattern(DATA_MONTH_FORMAT); public static final DateTimeFormatter DATA_MONTH_FORMATTER = DateTimeFormatter.ofPattern(DATA_MONTH_FORMAT);
public static final DateTimeFormatter DATA_FORMATTER = DateTimeFormatter.ofPattern(DATA_FORMAT); public static final DateTimeFormatter DATA_FORMATTER = DateTimeFormatter.ofPattern(DATA_FORMAT);
...@@ -87,6 +89,8 @@ public class MerchantGoodsStockMonthReportService { ...@@ -87,6 +89,8 @@ public class MerchantGoodsStockMonthReportService {
try { try {
Page<MerchantGoodsStockMonthReportDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(), pagination.isNeedCount()); Page<MerchantGoodsStockMonthReportDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(), pagination.isNeedCount());
merchantGoodsStockMonthReportMapper.list(pagination.getCondition()); merchantGoodsStockMonthReportMapper.list(pagination.getCondition());
//查询后续天数的出入库记录
queryGoodsIncreaseAndReduceRecord(page.getResult(), pagination.getCondition());
return page; return page;
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
...@@ -95,6 +99,86 @@ public class MerchantGoodsStockMonthReportService { ...@@ -95,6 +99,86 @@ public class MerchantGoodsStockMonthReportService {
} }
/**
* 查询商品出入库记录
* @param resultList
* @param conditionDto
*/
private void queryGoodsIncreaseAndReduceRecord(List<MerchantGoodsStockMonthReportDTO> resultList, MerchantGoodsStockMonthReportDTO conditionDto) {
String queryDateStr = conditionDto.getQueryDate();
if(StringUtils.isBlank(queryDateStr) || CollectionUtils.isEmpty(resultList)){
return;
}
List<Integer> upgradeGoodsIds = resultList.stream()
.map(MerchantGoodsStockMonthReportDTO::getUpgradeGoodsId)
.filter(Objects::nonNull).distinct().collect(Collectors.toList());
List<Integer> yqMerchantIds = conditionDto.getYqMerchantIds();
if(CollectionUtils.isEmpty(upgradeGoodsIds)){
return;
}
//入库记录
List<GoodsWarehousingInfoDTO> increaseStockList = merchantShopGoodsStockService.queryIncreaseStock(queryDateStr,yqMerchantIds, upgradeGoodsIds);
//出库记录
List<MerchantGoodsStockReduceRecordDTO> reduceStockList = merchantShopGoodsStockService.queryReduceStock(queryDateStr,yqMerchantIds, upgradeGoodsIds);
Map<String, Map<String, BigDecimal>> increaseStockMap = CollectionUtils.isEmpty(increaseStockList)
? Collections.emptyMap()
: increaseStockList.stream()
.collect(Collectors.groupingBy(
dto -> dto.getUpgradeGoodsId() + "_" + dto.getYqMerchantId(),
Collectors.toMap(
dto -> dto.getMerchantId() + "_" + dto.getFilmRollNo(),
dto -> dto.getTotalIncreaseStockNum() != null ? dto.getTotalIncreaseStockNum() : BigDecimal.ZERO,
BigDecimal::add
)
));
Map<String, Map<String, BigDecimal>> reduceStockMap = CollectionUtils.isEmpty(reduceStockList)
? Collections.emptyMap()
: reduceStockList.stream()
.collect(Collectors.groupingBy(
dto -> dto.getUpgradeGoodsId() + "_" + dto.getYqMerchantId(),
Collectors.toMap(
dto -> dto.getMerchantId() + "_" + dto.getFilmRollNo(),
dto -> dto.getTotalReduceStockNum() != null ? dto.getTotalReduceStockNum() : BigDecimal.ZERO,
BigDecimal::add
)
));
for (MerchantGoodsStockMonthReportDTO report : resultList) {
Integer upgradeGoodsId = report.getUpgradeGoodsId();
Integer yqMerchantId = report.getYqMerchantId();
String key = upgradeGoodsId + "_" + yqMerchantId;
//入库数据
Map<String, BigDecimal> increaseMap = increaseStockMap.getOrDefault(key, Collections.emptyMap());
//出库数据
Map<String, BigDecimal> reduceMap = reduceStockMap.getOrDefault(key, Collections.emptyMap());
BigDecimal fianlStock = BigDecimal.ZERO;
//门店库存
for (MerchantShopGoodsStockExportDTO shopStockDTO : report.getMerchantShopGoodsStockList()) {
Integer merchantId = shopStockDTO.getMerchantId();
String filmRollNo = shopStockDTO.getFilmRollNo();
BigDecimal shopStock = shopStockDTO.getStock();
String shopKey = merchantId + "_" + filmRollNo;
BigDecimal increaseStock = increaseMap.get(shopKey);
BigDecimal reduceStock = reduceMap.get(shopKey);
//入库减库存 出库加库存
if (Objects.nonNull(increaseStock)) {
shopStock = shopStock.subtract(increaseStock);
}
if (Objects.nonNull(reduceStock)) {
shopStock = shopStock.add(reduceStock);
}
shopStockDTO.setStock(shopStock);
fianlStock = fianlStock.add(shopStock);
}
report.setStock(fianlStock);
}
}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public void onNewYqGoodsRef(MerchantGoodsInfo merchantGoodsInfo) { public void onNewYqGoodsRef(MerchantGoodsInfo merchantGoodsInfo) {
RpcAssert.assertNotNull(merchantGoodsInfo.getUpgradeGoodsId(), DefaultErrorEnum.DATA_NULL,"merchantGoodsInfoDTO.getUpgradeGoodsId() not be null"); RpcAssert.assertNotNull(merchantGoodsInfo.getUpgradeGoodsId(), DefaultErrorEnum.DATA_NULL,"merchantGoodsInfoDTO.getUpgradeGoodsId() not be null");
...@@ -521,7 +605,7 @@ public class MerchantGoodsStockMonthReportService { ...@@ -521,7 +605,7 @@ public class MerchantGoodsStockMonthReportService {
private MerchantGoodsStockMonthReportDTO buildByLastMonthReport(String dataMonthStr, MerchantGoodsStockMonthReportDTO report) { private MerchantGoodsStockMonthReportDTO buildByLastMonthReport(String dataMonthStr, MerchantGoodsStockMonthReportDTO report) {
MerchantGoodsStockMonthReportDTO record = MerchantGoodsStockMonthReportDTO.builder().yqMerchantId(report.getYqMerchantId()).yqMerchantName(report.getYqMerchantName()).upgradeGoodsId(report.getUpgradeGoodsId()).upgradeGoodsName(report.getUpgradeGoodsName()).goodsType(report.getGoodsType()).goodsTypeName(report.getGoodsTypeName()).goodsSeries(report.getGoodsSeries()).lastMonthRemainMoney(report.getRemainMoney()).lastMonthRemainStock(report.getStock()).dataMonth(dataMonthStr).updatedBy(CommonConstants.DEFAULT_UPDATE_BY).build(); MerchantGoodsStockMonthReportDTO record = MerchantGoodsStockMonthReportDTO.builder().yqMerchantId(report.getYqMerchantId()).yqMerchantName(report.getYqMerchantName()).upgradeGoodsId(report.getUpgradeGoodsId()).upgradeGoodsName(report.getUpgradeGoodsName()).goodsType(report.getGoodsType()).goodsTypeName(report.getGoodsTypeName()).goodsSeries(report.getGoodsSeries()).lastMonthRemainMoney(report.getRemainMoney()).lastMonthRemainStock(report.getStock()).dataMonth(dataMonthStr).updatedBy(CommonConstants.DEFAULT_UPDATE_BY).build();
// 统计入库数量 // 统计入库数量
GoodsWarehousingInfoDTO addStockStat = goodsWarehousingInfoService.count(report.getYqMerchantId(), report.getUpgradeGoodsId(), dataMonthStr); GoodsWarehousingInfoDTO addStockStat = goodsWarehousingInfoService.count(report.getYqMerchantId(), report.getUpgradeGoodsId(), dataMonthStr, InventoryTypeEnum.PHYSICAL.getValue());
BigDecimal addStockNum = addStockStat.getTotalIncreaseStockNum(); BigDecimal addStockNum = addStockStat.getTotalIncreaseStockNum();
// 统计出库数量 // 统计出库数量
MerchantGoodsStockReduceRecordDTO reduceStockStat = merchantGoodsStockReduceRecordService.count(report.getYqMerchantId(), report.getUpgradeGoodsId(), dataMonthStr); MerchantGoodsStockReduceRecordDTO reduceStockStat = merchantGoodsStockReduceRecordService.count(report.getYqMerchantId(), report.getUpgradeGoodsId(), dataMonthStr);
...@@ -550,7 +634,7 @@ public class MerchantGoodsStockMonthReportService { ...@@ -550,7 +634,7 @@ public class MerchantGoodsStockMonthReportService {
*/ */
@Transactional(propagation = Propagation.NESTED, rollbackFor = RpcServiceException.class) @Transactional(propagation = Propagation.NESTED, rollbackFor = RpcServiceException.class)
public void updateRemainStock(MerchantGoodsStockMonthReport report) { public void updateRemainStock(MerchantGoodsStockMonthReport report) {
GoodsWarehousingInfoDTO addStockStat = goodsWarehousingInfoService.count(report.getYqMerchantId(), report.getUpgradeGoodsId(), report.getDataMonth()); GoodsWarehousingInfoDTO addStockStat = goodsWarehousingInfoService.count(report.getYqMerchantId(), report.getUpgradeGoodsId(), report.getDataMonth(), InventoryTypeEnum.PHYSICAL.getValue());
BigDecimal addStockNum = addStockStat.getTotalIncreaseStockNum(); BigDecimal addStockNum = addStockStat.getTotalIncreaseStockNum();
BigDecimal addStockMoney = addStockStat.getTotalIncreaseStockMoney(); BigDecimal addStockMoney = addStockStat.getTotalIncreaseStockMoney();
MerchantGoodsStockReduceRecordDTO reduceStockStat = merchantGoodsStockReduceRecordService.count(report.getYqMerchantId(), report.getUpgradeGoodsId(), report.getDataMonth()); MerchantGoodsStockReduceRecordDTO reduceStockStat = merchantGoodsStockReduceRecordService.count(report.getYqMerchantId(), report.getUpgradeGoodsId(), report.getDataMonth());
......
...@@ -103,7 +103,8 @@ public class MerchantGoodsStockReduceRecordService { ...@@ -103,7 +103,8 @@ public class MerchantGoodsStockReduceRecordService {
public void reduceStock(MerchantGoodsStockReduceRecordDTO dto, StockUpdateTypeEnum stockUpdateTypeEnum, Byte inventoryType){ public void reduceStock(MerchantGoodsStockReduceRecordDTO dto, StockUpdateTypeEnum stockUpdateTypeEnum, Byte inventoryType){
thiz.checkForReduceStock(dto, stockUpdateTypeEnum); thiz.checkForReduceStock(dto, stockUpdateTypeEnum);
if (StringUtils.isNotBlank(dto.getBusinessCode())) { if (StringUtils.isNotBlank(dto.getBusinessCode())) {
if(!Objects.equals(dto.getEventType(),ReduceStockEventTypeEnum.ORDER.getValue()) && !Objects.equals(dto.getEventType(),ReduceStockEventTypeEnum.REFUND.getValue())){ if(!Objects.equals(dto.getEventType(),ReduceStockEventTypeEnum.ORDER.getValue()) && !Objects.equals(dto.getEventType(),ReduceStockEventTypeEnum.REFUND.getValue()) &&
!Objects.equals(dto.getEventType(),ReduceStockEventTypeEnum.ALLOCATE.getValue())){
MerchantGoodsStockReduceRecordDTO reduceRecordDTO = MerchantGoodsStockReduceRecordDTO.builder().yqMerchantId(dto.getYqMerchantId()).upgradeGoodsId(dto.getUpgradeGoodsId()).businessCode(dto.getBusinessCode()).filmRollNo(dto.getFilmRollNo()).build(); MerchantGoodsStockReduceRecordDTO reduceRecordDTO = MerchantGoodsStockReduceRecordDTO.builder().yqMerchantId(dto.getYqMerchantId()).upgradeGoodsId(dto.getUpgradeGoodsId()).businessCode(dto.getBusinessCode()).filmRollNo(dto.getFilmRollNo()).build();
List<MerchantGoodsStockReduceRecordDTO> list = merchantGoodsStockReduceRecordMapper.list(reduceRecordDTO); List<MerchantGoodsStockReduceRecordDTO> list = merchantGoodsStockReduceRecordMapper.list(reduceRecordDTO);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
...@@ -113,7 +114,7 @@ public class MerchantGoodsStockReduceRecordService { ...@@ -113,7 +114,7 @@ public class MerchantGoodsStockReduceRecordService {
} }
} }
thiz.compileForReduceStock(dto); thiz.compileForReduceStock(dto);
// 实物库存 + type 维度:预先选择应扣哪个门店的哪个商品 // 实物库存 + type 维度:预先选择应扣哪个门店的哪个商品 所有类型的出库都需要预先选择出库门店和商品
if (InventoryTypeEnum.PHYSICAL.getValue() == inventoryType) { if (InventoryTypeEnum.PHYSICAL.getValue() == inventoryType) {
log.info("开始处理实物库存扣减,yqMerchantId:{},upgradeGoodsId:{},businessCode:{},", dto.getYqMerchantId(), dto.getUpgradeGoodsId(), dto.getBusinessCode()); log.info("开始处理实物库存扣减,yqMerchantId:{},upgradeGoodsId:{},businessCode:{},", dto.getYqMerchantId(), dto.getUpgradeGoodsId(), dto.getBusinessCode());
String inventoryDimension = env.getProperty( String inventoryDimension = env.getProperty(
...@@ -268,7 +269,10 @@ public class MerchantGoodsStockReduceRecordService { ...@@ -268,7 +269,10 @@ public class MerchantGoodsStockReduceRecordService {
public MerchantGoodsStockReduceRecordDTO count(Integer yqMerchantId, Integer upgradeGoodsId, String dataMonthStr){ public MerchantGoodsStockReduceRecordDTO count(Integer yqMerchantId, Integer upgradeGoodsId, String dataMonthStr){
try{ try{
MerchantGoodsStockReduceRecordDTO dto = MerchantGoodsStockReduceRecordDTO.builder() MerchantGoodsStockReduceRecordDTO dto = MerchantGoodsStockReduceRecordDTO.builder()
.yqMerchantId(yqMerchantId).upgradeGoodsId(upgradeGoodsId).build(); .yqMerchantId(yqMerchantId)
.upgradeGoodsId(upgradeGoodsId)
.inventoryType(InventoryTypeEnum.PHYSICAL.getValue())
.build();
if (StringUtils.isNotBlank(dataMonthStr)) { if (StringUtils.isNotBlank(dataMonthStr)) {
RpcAssert.assertIsTrue(dataMonthStr.matches(MerchantGoodsStockMonthReportService.DATA_MONTH_PATTERN), DefaultErrorEnum.DATA_INVALID, "dataMonthStartStr正确格式如2023-02"); RpcAssert.assertIsTrue(dataMonthStr.matches(MerchantGoodsStockMonthReportService.DATA_MONTH_PATTERN), DefaultErrorEnum.DATA_INVALID, "dataMonthStartStr正确格式如2023-02");
LocalDate dataMonthDate = LocalDate.parse(dataMonthStr.concat("-01"), MerchantGoodsStockMonthReportService.DATA_FORMATTER); LocalDate dataMonthDate = LocalDate.parse(dataMonthStr.concat("-01"), MerchantGoodsStockMonthReportService.DATA_FORMATTER);
...@@ -421,4 +425,10 @@ public class MerchantGoodsStockReduceRecordService { ...@@ -421,4 +425,10 @@ public class MerchantGoodsStockReduceRecordService {
thiz.compileForReduceStock(dto); thiz.compileForReduceStock(dto);
thiz.updateStock(dto, stockUpdateTypeEnum); thiz.updateStock(dto, stockUpdateTypeEnum);
} }
public List<MerchantGoodsStockReduceRecordDTO> countTotalReduceStockNumGroupByGoods(MerchantGoodsStockReduceRecordDTO condition){
RpcAssert.assertNotNull(condition, DefaultErrorEnum.DATA_NULL, "merchantGoodsStockReduceRecordDTO not be null");
RpcAssert.assertNotEmpty(condition.getUpgradeGoodsIdList(), DefaultErrorEnum.DATA_NULL, "merchantGoodsStockReduceRecordDTO.upgradeGoodsIdList not be empty");
return merchantGoodsStockReduceRecordMapper.countTotalReduceStockNumGroupByGoods(condition);
}
} }
...@@ -3,6 +3,7 @@ package cn.com.glsx.dj.smartcarlife.service.stock; ...@@ -3,6 +3,7 @@ package cn.com.glsx.dj.smartcarlife.service.stock;
import cn.com.glsx.dj.smartcarlife.constant.CommonConstants; import cn.com.glsx.dj.smartcarlife.constant.CommonConstants;
import cn.com.glsx.dj.smartcarlife.dto.*; import cn.com.glsx.dj.smartcarlife.dto.*;
import cn.com.glsx.dj.smartcarlife.dto.stock.MerchantShopGoodsStockDTO; import cn.com.glsx.dj.smartcarlife.dto.stock.MerchantShopGoodsStockDTO;
import cn.com.glsx.dj.smartcarlife.dto.stock.MerchantShopGoodsStockExportDTO;
import cn.com.glsx.dj.smartcarlife.enums.SavePolicyEnum; import cn.com.glsx.dj.smartcarlife.enums.SavePolicyEnum;
import cn.com.glsx.dj.smartcarlife.enums.SceneTypeEnum; import cn.com.glsx.dj.smartcarlife.enums.SceneTypeEnum;
import cn.com.glsx.dj.smartcarlife.enums.StockShopTypeEnum; import cn.com.glsx.dj.smartcarlife.enums.StockShopTypeEnum;
...@@ -20,6 +21,7 @@ import cn.com.glsx.framework.core.exception.RpcServiceException; ...@@ -20,6 +21,7 @@ import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert; import cn.com.glsx.framework.core.util.RpcAssert;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -31,6 +33,8 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -31,6 +33,8 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -55,6 +59,9 @@ public class MerchantShopGoodsStockService { ...@@ -55,6 +59,9 @@ public class MerchantShopGoodsStockService {
private MerchantGoodsStockReduceRecordService merchantGoodsStockReduceRecordService; private MerchantGoodsStockReduceRecordService merchantGoodsStockReduceRecordService;
@Autowired @Autowired
private Environment environment; private Environment environment;
public static final String DATA_FORMAT = "yyyy-MM-dd";
public static final String DATE_TIME_FORMATTER = "yyyy-MM-dd HH:mm:ss";
/** /**
* 获取商户门店商品库存 * 获取商户门店商品库存
* *
...@@ -103,6 +110,7 @@ public class MerchantShopGoodsStockService { ...@@ -103,6 +110,7 @@ public class MerchantShopGoodsStockService {
} }
if (record.getStock().compareTo(BigDecimal.ZERO) == -1) { if (record.getStock().compareTo(BigDecimal.ZERO) == -1) {
thiz.chooseMerchant(record); thiz.chooseMerchant(record);
thiz.assertEnoughStockForAccumulate(record);
} }
thiz.updateStock2DB(record); thiz.updateStock2DB(record);
break; break;
...@@ -219,6 +227,26 @@ public class MerchantShopGoodsStockService { ...@@ -219,6 +227,26 @@ public class MerchantShopGoodsStockService {
} }
} }
public void assertEnoughStockForAccumulate(MerchantShopGoodsStockDTO record) {
if (!Boolean.parseBoolean(environment.getProperty("stock.insufficient.check.enabled", "true"))) {
return;
}
BigDecimal reduceAmount = record.getStock().abs();
MerchantShopGoodsStockDTO finalRecord = null;
if (record.getId() != null) {
finalRecord = get(record.getYqMerchantId(), record.getMerchantId(), record.getUpgradeGoodsId(), record.getFilmRollNo());
if (finalRecord == null && record.getFilmRollNo() != null) {
finalRecord = get(record.getYqMerchantId(), record.getMerchantId(), record.getUpgradeGoodsId(), null);
}
}
BigDecimal finalStock = finalRecord != null ? finalRecord.getStock() : BigDecimal.ZERO;
if (finalStock.compareTo(reduceAmount) < 0) {
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, CommonConstants.STOCK_INSUFFICIENT);
}
}
@Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class) @Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public MerchantShopGoodsStockDTO checkForUpdateStock(MerchantGoodsStockMonthReportDTO dto, SavePolicyEnum savePolicyEnum) { public MerchantShopGoodsStockDTO checkForUpdateStock(MerchantGoodsStockMonthReportDTO dto, SavePolicyEnum savePolicyEnum) {
...@@ -268,6 +296,7 @@ public class MerchantShopGoodsStockService { ...@@ -268,6 +296,7 @@ public class MerchantShopGoodsStockService {
try{ try{
Page<MerchantShopGoodsStockDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(),pagination.isNeedCount()); Page<MerchantShopGoodsStockDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(),pagination.isNeedCount());
merchantShopGoodsStockMapper.list(pagination.getCondition()); merchantShopGoodsStockMapper.list(pagination.getCondition());
calculateStockWithIncreaseAndReduce(page.getResult(),pagination.getCondition());
return page; return page;
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
...@@ -284,6 +313,116 @@ public class MerchantShopGoodsStockService { ...@@ -284,6 +313,116 @@ public class MerchantShopGoodsStockService {
} }
} }
private void calculateStockWithIncreaseAndReduce(List<MerchantShopGoodsStockDTO> resultList, MerchantShopGoodsStockDTO stockDTO) {
List<GoodsWarehousingInfoDTO> increaseStockList = queryIncreaseStock(stockDTO.getQueryDate(), Lists.newArrayList(stockDTO.getYqMerchantId()), Lists.newArrayList(stockDTO.getUpgradeGoodsId()));
List<MerchantGoodsStockReduceRecordDTO> reduceStockList = queryReduceStock(stockDTO.getQueryDate(), Lists.newArrayList(stockDTO.getYqMerchantId()), Lists.newArrayList(stockDTO.getUpgradeGoodsId()));
Map<String, BigDecimal> increaseStockMap = CollectionUtils.isEmpty(increaseStockList)
? Collections.emptyMap()
: increaseStockList.stream().collect(Collectors.toMap(
dto -> dto.getMerchantId() + "_" + dto.getFilmRollNo(),
GoodsWarehousingInfoDTO::getTotalIncreaseStockNum,
BigDecimal::add
));
Map<String, BigDecimal> reduceStockMap = CollectionUtils.isEmpty(reduceStockList)
? Collections.emptyMap()
: reduceStockList.stream().collect(Collectors.toMap(
dto -> dto.getMerchantId() + "_" + dto.getFilmRollNo(),
MerchantGoodsStockReduceRecordDTO::getTotalReduceStockNum,
BigDecimal::add
));
for (MerchantShopGoodsStockDTO shopGoodsStockDTO : resultList) {
Integer shopMerchantId = shopGoodsStockDTO.getMerchantId();
String filmRollNo = shopGoodsStockDTO.getFilmRollNo();
String detailKey = shopMerchantId + "_" + filmRollNo;
BigDecimal stock = shopGoodsStockDTO.getStock();
//入库数据
BigDecimal increaseStock = increaseStockMap.get(detailKey);
//出库数据
BigDecimal reduceStock = reduceStockMap.get(detailKey);
//入库减库存 出库加库存
if (Objects.nonNull(increaseStock)) {
stock = stock.subtract(increaseStock);
}
if (Objects.nonNull(reduceStock)) {
stock = stock.add(reduceStock);
}
shopGoodsStockDTO.setStock(stock);
}
}
/**
* 查询入库记录
*/
public List<GoodsWarehousingInfoDTO> queryIncreaseStock(String queryDateStr, List<Integer> yqMerchantIdList, List<Integer> upgradeGoodsIdList) {
if (StringUtils.isBlank(queryDateStr) || CollectionUtils.isEmpty(upgradeGoodsIdList)) {
return Collections.emptyList();
}
Date queryDate = parseQueryDate(queryDateStr);
Calendar calendar = Calendar.getInstance();
calendar.setTime(queryDate);
calendar.add(Calendar.DAY_OF_MONTH, 1);
String startDate = new SimpleDateFormat(DATA_FORMAT).format(calendar.getTime());
String endDate = new SimpleDateFormat(DATA_FORMAT).format(new Date());
GoodsWarehousingInfoDTO condition = new GoodsWarehousingInfoDTO();
condition.setStartDate(startDate);
condition.setEndDate(endDate);
condition.setYqMerchantIds(yqMerchantIdList);
condition.setUpgradeGoodsIdList(upgradeGoodsIdList);
List<GoodsWarehousingInfoDTO> result = goodsWarehousingInfoService.countTotalIncreaseStockNumGroupByGoods(condition);
return result != null ? result : Collections.emptyList();
}
/**
* 解析查询日期
*/
private Date parseQueryDate(String queryDateStr) {
try {
return new SimpleDateFormat(DATA_FORMAT).parse(queryDateStr);
} catch (ParseException e) {
throw new RpcServiceException("不正确的时间格式");
}
}
/**
* 查询出库记录
*/
public List<MerchantGoodsStockReduceRecordDTO> queryReduceStock(String queryDateStr, List<Integer> yqMerchantIdList, List<Integer> upgradeGoodsIdList) {
if (StringUtils.isBlank(queryDateStr) || CollectionUtils.isEmpty(upgradeGoodsIdList)) {
return Collections.emptyList();
}
Date queryDate = parseQueryDate(queryDateStr);
Calendar calendar = Calendar.getInstance();
calendar.setTime(queryDate);
calendar.add(Calendar.DAY_OF_MONTH, 1);
String reduceStartDate = new SimpleDateFormat(DATE_TIME_FORMATTER).format(calendar.getTime());
Calendar endCalendar = Calendar.getInstance();
endCalendar.set(Calendar.HOUR_OF_DAY, 23);
endCalendar.set(Calendar.MINUTE, 59);
endCalendar.set(Calendar.SECOND, 59);
endCalendar.set(Calendar.MILLISECOND, 999);
String reduceEndDate = new SimpleDateFormat(DATE_TIME_FORMATTER).format(endCalendar.getTime());
MerchantGoodsStockReduceRecordDTO reduceCondition = new MerchantGoodsStockReduceRecordDTO();
reduceCondition.setReduceStartDateStr(reduceStartDate);
reduceCondition.setReduceEndDateStr(reduceEndDate);
reduceCondition.setYqMerchantIds(yqMerchantIdList);
reduceCondition.setUpgradeGoodsIdList(upgradeGoodsIdList);
List<MerchantGoodsStockReduceRecordDTO> result = merchantGoodsStockReduceRecordService.countTotalReduceStockNumGroupByGoods(reduceCondition);
return result != null ? result : Collections.emptyList();
}
public Page<MerchantShopGoodsStockDTO> pageForSettlementExport(RpcPagination<MerchantShopGoodsStockDTO> pagination){ public Page<MerchantShopGoodsStockDTO> pageForSettlementExport(RpcPagination<MerchantShopGoodsStockDTO> pagination){
try{ try{
......
...@@ -3632,6 +3632,82 @@ ...@@ -3632,6 +3632,82 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="merchantIdList !=null and merchantIdList.size() > 0">
and go.merchant_id in
<foreach item="item" collection="merchantIdList" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="sceneType != null">
and go.scene_type = #{sceneType}
</if>
<if test="installUpgradeBeginTimeStr != null and installUpgradeBeginTimeStr != ''">
and go.install_upgrade_time <![CDATA[>=]]> #{installUpgradeBeginTimeStr}
</if>
<if test="installUpgradeEndTimeStr != null and installUpgradeEndTimeStr != ''">
and go.install_upgrade_time <![CDATA[<=]]> #{installUpgradeEndTimeStr}
</if>
<if test="statusList != null and statusList.size()>0">
and go.status in
<foreach collection="statusList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="listCarTypeGoodsOrder" parameterType="cn.com.glsx.dj.smartcarlife.dto.GoodsOrderDTO" resultMap="DTOResultMap">
SELECT go.scene_type,go.merchant_id,go.seller_user_id,go.seller_name,go.seller_merchant_id,go.seller_merchant_name
from dj_car_life_goods_order go
left join dj_car_life_goods_order_customer goc on go.order_code = goc.order_code and goc.deleted_flag = 'N'
where go.deleted_flag = 'N'
<if test="sceneType != null">
and go.scene_type = #{sceneType,jdbcType=TINYINT}
</if>
<if test="businessType != null">
and go.business_type = #{businessType,jdbcType=TINYINT}
</if>
<if test="sellerUserId != null and sellerUserId != ''">
and go.seller_user_id = #{sellerUserId,jdbcType=VARCHAR}
</if>
<if test="statusList != null and statusList.size()>0">
and go.status in
<foreach collection="statusList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="merchantId != null">
and go.merchant_id = #{merchantId,jdbcType=INTEGER}
</if>
<if test="merchantIdList !=null and merchantIdList.size() > 0">
and go.merchant_id in
<foreach item="item" collection="merchantIdList" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="installUpgradeBeginTime != null">
and go.install_upgrade_time <![CDATA[>=]]> #{installUpgradeBeginTime,jdbcType=TIMESTAMP}
</if>
<if test="installUpgradeEndTime != null">
and go.install_upgrade_time <![CDATA[<=]]> #{installUpgradeEndTime,jdbcType=TIMESTAMP}
</if>
<if test="carTypeSplitShowFlag != null and carTypeSplitShowFlag == 2">
<if test="carChildsBrandTypeFlag != null and carChildsBrandTypeFlag in {0,3,4,5,6}">
and goc.car_brand_id = #{firstBrandId,jdbcType=INTEGER}
and goc.car_childs_brand_id = #{carChildsBrandId,jdbcType=INTEGER}
</if>
<if test="carChildsBrandTypeFlag != null and carChildsBrandTypeFlag == 1">
and goc.car_brand_id = #{firstBrandId,jdbcType=INTEGER}
and goc.car_childs_brand_id <![CDATA[<>]]> #{carChildsBrandId,jdbcType=INTEGER}
</if>
</if>
<if test="carTypeSplitShowFlag != null and carTypeSplitShowFlag == 1">
<if test="carChildsBrandTypeFlag != null and carChildsBrandTypeFlag in {0,3,4,5,6}">
and goc.car_brand_id = #{firstBrandId,jdbcType=INTEGER}
</if>
<if test="carChildsBrandTypeFlag != null and carChildsBrandTypeFlag == 2">
and goc.car_brand_id <![CDATA[<>]]> #{firstBrandId,jdbcType=INTEGER}
</if>
</if>
</select> </select>
</mapper> </mapper>
...@@ -146,6 +146,12 @@ ...@@ -146,6 +146,12 @@
<if test="allocateOrderGoodsId != null"> <if test="allocateOrderGoodsId != null">
and dclgwi.allocate_order_goods_id=#{allocateOrderGoodsId} and dclgwi.allocate_order_goods_id=#{allocateOrderGoodsId}
</if> </if>
<if test="upgradeGoodsIdList != null and upgradeGoodsIdList.size() > 0">
and dclgwi.upgrade_goods_id in
<foreach collection="upgradeGoodsIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
</sql> </sql>
...@@ -202,6 +208,12 @@ ...@@ -202,6 +208,12 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="inventoryType != null and inventoryType == 2">
and (inventory_type = #{inventoryType} or inventory_type is null)
</if>
<if test="inventoryType != null and inventoryType == 1">
and inventory_type = #{inventoryType}
</if>
</where> </where>
</select> </select>
<select id="listAllocateWithBusiness" parameterType="cn.com.glsx.dj.smartcarlife.dto.GoodsWarehousingInfoDTO" resultMap="DTOResultMap"> <select id="listAllocateWithBusiness" parameterType="cn.com.glsx.dj.smartcarlife.dto.GoodsWarehousingInfoDTO" resultMap="DTOResultMap">
...@@ -252,4 +264,19 @@ ...@@ -252,4 +264,19 @@
left join dj_car_life_goods_info dclgi on dclgi.deleted_flag = 'N' and dclgi.goods_code = dclug.goods_code left join dj_car_life_goods_info dclgi on dclgi.deleted_flag = 'N' and dclgi.goods_code = dclug.goods_code
<include refid="listCondition"/> <include refid="listCondition"/>
</select> </select>
<select id="countTotalIncreaseStockNumGroupByGoods" resultType="cn.com.glsx.dj.smartcarlife.dto.GoodsWarehousingInfoDTO">
select
dclgwi.upgrade_goods_id as upgradeGoodsId,
dclgwi.yq_merchant_id AS yqMerchantId,
dclgwi.merchant_id AS merchantId,
IFNULL(SUM(increase_stock_num), 0) as totalIncreaseStockNum,
dclgwi.film_roll_no AS filmRollNo
from dj_car_life_goods_warehousing_info dclgwi
<include refid="listCondition"/>
group by dclgwi.upgrade_goods_id,dclgwi.yq_merchant_id,dclgwi.merchant_id,dclgwi.film_roll_no
</select>
</mapper> </mapper>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<where> <where>
dclmgsrr.deleted_flag = 'N' dclmgsrr.deleted_flag = 'N'
<if test="reduceStartDateStr != null and reduceStartDateStr != ''"> <if test="reduceStartDateStr != null and reduceStartDateStr != ''">
and dclmgsrr.reduce_date &gt;= #{reduceStartDateStr} and dclmgsrr.created_date &gt;= #{reduceStartDateStr}
</if> </if>
<if test="storeUsage !=null"> <if test="storeUsage !=null">
and dclmgsrr.store_usage like CONCAT('%', #{storeUsage},'%') and dclmgsrr.store_usage like CONCAT('%', #{storeUsage},'%')
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
and dclug.type like CONCAT('%', #{productCode},'%') and dclug.type like CONCAT('%', #{productCode},'%')
</if> </if>
<if test="reduceEndDateStr != null and reduceEndDateStr != ''"> <if test="reduceEndDateStr != null and reduceEndDateStr != ''">
and dclmgsrr.reduce_date &lt;= #{reduceEndDateStr} and dclmgsrr.created_date &lt;= #{reduceEndDateStr}
</if> </if>
<if test="eventType != null"> <if test="eventType != null">
and dclmgsrr.event_type = #{eventType} and dclmgsrr.event_type = #{eventType}
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
left join dj_car_life_upgrade_goods dclug on dclmgsrr.upgrade_goods_id = dclug.id left join dj_car_life_upgrade_goods dclug on dclmgsrr.upgrade_goods_id = dclug.id
left join dj_car_life_goods_info dclgi on dclgi.deleted_flag = 'N' and dclgi.goods_code = dclug.goods_code left join dj_car_life_goods_info dclgi on dclgi.deleted_flag = 'N' and dclgi.goods_code = dclug.goods_code
<include refid="listCondition" /> <include refid="listCondition" />
order by reduce_date desc order by created_date desc
</select> </select>
<select id="count" parameterType="cn.com.glsx.dj.smartcarlife.dto.MerchantGoodsStockReduceRecordDTO" resultType="cn.com.glsx.dj.smartcarlife.dto.MerchantGoodsStockReduceRecordDTO"> <select id="count" parameterType="cn.com.glsx.dj.smartcarlife.dto.MerchantGoodsStockReduceRecordDTO" resultType="cn.com.glsx.dj.smartcarlife.dto.MerchantGoodsStockReduceRecordDTO">
select select
...@@ -143,14 +143,17 @@ ...@@ -143,14 +143,17 @@
<where> <where>
deleted_flag = 'N' deleted_flag = 'N'
<if test="reduceStartDateStr != null and reduceStartDateStr != ''"> <if test="reduceStartDateStr != null and reduceStartDateStr != ''">
and reduce_date &gt;= #{reduceStartDateStr} and created_date &gt;= #{reduceStartDateStr}
</if> </if>
<if test="reduceEndDateStr != null and reduceEndDateStr != ''"> <if test="reduceEndDateStr != null and reduceEndDateStr != ''">
and reduce_date &lt;= #{reduceEndDateStr} and created_date &lt;= #{reduceEndDateStr}
</if> </if>
<if test="eventType != null"> <if test="eventType != null">
and event_type = #{eventType} and event_type = #{eventType}
</if> </if>
<if test="inventoryType != null">
and inventory_type = #{inventoryType}
</if>
<if test="upgradeGoodsId != null"> <if test="upgradeGoodsId != null">
and upgrade_goods_id = #{upgradeGoodsId} and upgrade_goods_id = #{upgradeGoodsId}
</if> </if>
...@@ -192,4 +195,17 @@ ...@@ -192,4 +195,17 @@
left join dj_car_life_goods_info dclgi on dclgi.deleted_flag = 'N' and dclgi.goods_code = dclug.goods_code left join dj_car_life_goods_info dclgi on dclgi.deleted_flag = 'N' and dclgi.goods_code = dclug.goods_code
<include refid="listCondition" /> <include refid="listCondition" />
</select> </select>
<select id="countTotalReduceStockNumGroupByGoods" resultType="cn.com.glsx.dj.smartcarlife.dto.MerchantGoodsStockReduceRecordDTO">
select
dclmgsrr.upgrade_goods_id as upgradeGoodsId,
dclmgsrr.yq_merchant_id AS yqMerchantId,
dclmgsrr.merchant_id AS merchantId,
IFNULL(SUM(reduce_stock_num), 0) as totalReduceStockNum,
dclmgsrr.film_roll_no AS filmRollNo
from dj_car_life_merchant_goods_stock_reduce_record dclmgsrr
<include refid="listCondition" />
group by dclmgsrr.upgrade_goods_id, dclmgsrr.yq_merchant_id, dclmgsrr.merchant_id,dclmgsrr.film_roll_no
</select>
</mapper> </mapper>
...@@ -58,6 +58,10 @@ ...@@ -58,6 +58,10 @@
<result column="call_in_merchant_name" property="callInMerchantName" jdbcType="VARCHAR"/> <result column="call_in_merchant_name" property="callInMerchantName" jdbcType="VARCHAR"/>
<result column="upload_file" property="uploadFileUrl" jdbcType="VARCHAR"/> <result column="upload_file" property="uploadFileUrl" jdbcType="VARCHAR"/>
<result column="film_roll_no" property="filmRollNo" jdbcType="VARCHAR"/> <result column="film_roll_no" property="filmRollNo" jdbcType="VARCHAR"/>
<result column="pendingSignCount" property="pendingSignCount" jdbcType="BIGINT"/>
<result column="pendingStockCount" property="pendingStockCount" jdbcType="BIGINT"/>
<result column="inStockCount" property="inStockCount" jdbcType="BIGINT"/>
<result column="totalCount" property="totalCount" jdbcType="BIGINT"/>
</resultMap> </resultMap>
...@@ -161,6 +165,10 @@ ...@@ -161,6 +165,10 @@
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and dclpodd.type like CONCAT('%', #{type},'%') and dclpodd.type like CONCAT('%', #{type},'%')
</if> </if>
<if test="upgradeGoodsNameOrType != null and upgradeGoodsNameOrType != ''">
and (dclpodd.upgrade_goods_name like CONCAT('%', #{upgradeGoodsNameOrType},'%')
or dclpodd.type like CONCAT('%', #{upgradeGoodsNameOrType},'%'))
</if>
<if test="goodsName != null and goodsName != ''"> <if test="goodsName != null and goodsName != ''">
and dclpodd.goods_name like CONCAT('%', #{goodsName},'%') and dclpodd.goods_name like CONCAT('%', #{goodsName},'%')
</if> </if>
...@@ -189,6 +197,12 @@ ...@@ -189,6 +197,12 @@
<if test="putStatus != null"> <if test="putStatus != null">
and dclpodd.put_status = #{putStatus} and dclpodd.put_status = #{putStatus}
</if> </if>
<if test="putStatusList != null and putStatusList.size() != 0">
and dclpodd.put_status in
<foreach collection="putStatusList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="upgradeGoodsId != null"> <if test="upgradeGoodsId != null">
and dclpodd.upgrade_goods_id = #{upgradeGoodsId} and dclpodd.upgrade_goods_id = #{upgradeGoodsId}
</if> </if>
...@@ -207,4 +221,55 @@ ...@@ -207,4 +221,55 @@
</where> </where>
order by dclpod.delivery_date desc, dclpodd.id desc order by dclpod.delivery_date desc, dclpodd.id desc
</select> </select>
<select id="queryDeliveryByGoodsIdList" resultType="cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDTO">
SELECT
dd.purchase_order_goods_id AS purchaseOrderGoodsId,
od.upload_file AS uploadFileUrl
FROM
dj_car_life_purchase_order_delivery od
LEFT JOIN dj_car_life_purchase_order_delivery_detail dd ON od.id = dd.order_delivery_id
WHERE
dd.deleted_flag = 'N'
AND od.deleted_flag = 'N'
and od.upload_file is not null
AND dd.purchase_order_goods_id IN
<foreach collection="goodsIdList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
<select id="countByStatus" parameterType="cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDetailDTO" resultMap="DTOResultMap">
select
IFNULL(SUM(CASE WHEN dclpodd.put_status = 0 THEN 1 ELSE 0 END), 0) as pendingSignCount,
IFNULL(SUM(CASE WHEN dclpodd.put_status = 1 THEN 1 ELSE 0 END), 0) as pendingStockCount,
IFNULL(SUM(CASE WHEN dclpodd.put_status = 2 THEN 1 ELSE 0 END), 0) as inStockCount,
COUNT(*) as totalCount
from dj_car_life_purchase_order_delivery_detail dclpodd
left join dj_car_life_purchase_order_delivery dclpod on dclpodd.order_delivery_id = dclpod.id and dclpod.deleted_flag = 'N'
left join dj_car_life_purchase_order dclpo on dclpo.order_code = dclpodd.order_code and dclpo.deleted_flag = 'N'
left join dj_car_life_purchase_order_goods dclpog on dclpog.order_code = dclpodd.order_code and dclpog.id = dclpodd.purchase_order_goods_id and dclpog.deleted_flag = 'N'
left join dj_car_life_stock_allocate_detail sad on sad.deleted_flag = 'N' and sad.id = dclpodd.allocate_order_goods_id
left join dj_car_life_stock_allocate_record sar on sar.allocate_code = sad.allocate_code and sar.deleted_flag = 'N'
<where>
dclpodd.deleted_flag = 'N'
<if test="yqMerchantIds != null and yqMerchantIds.size()>0">
and (dclpo.merchant_id in
<foreach collection="yqMerchantIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
or sar.call_in_yq_merchant_id in
<foreach collection="yqMerchantIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>)
</if>
<if test="upgradeGoodsNameOrType != null and upgradeGoodsNameOrType != ''">
and (dclpodd.upgrade_goods_name like CONCAT('%', #{upgradeGoodsNameOrType},'%')
or dclpodd.type like CONCAT('%', #{upgradeGoodsNameOrType},'%'))
</if>
<if test="orderType != null">
and dclpod.order_type = #{orderType}
</if>
</where>
</select>
</mapper> </mapper>
...@@ -332,6 +332,13 @@ ...@@ -332,6 +332,13 @@
<if test="putStatus != null"> <if test="putStatus != null">
and od.put_status = #{putStatus} and od.put_status = #{putStatus}
</if> </if>
<if test="putStatusList != null and putStatusList.size() != 0">
and od.put_status in
<foreach collection="putStatusList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="merchantIdList != null and merchantIdList.size() != 0"> <if test="merchantIdList != null and merchantIdList.size() != 0">
<choose> <choose>
<when test="orderType == 1"> <when test="orderType == 1">
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" /> <result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate" /> <result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate" />
<result column="deleted_flag" jdbcType="CHAR" property="deletedFlag" /> <result column="deleted_flag" jdbcType="CHAR" property="deletedFlag" />
<result column="sign_status" jdbcType="INTEGER" property="signStatus" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!-- <!--
...@@ -52,7 +53,7 @@ ...@@ -52,7 +53,7 @@
upgrade_goods_position, position_deduction_value, type, goods_number, goods_total_price, delivery_status, upgrade_goods_position, position_deduction_value, type, goods_number, goods_total_price, delivery_status,
purchase_number, input_number, put_yq_merchant_id, put_yq_merchant_name, put_merchant_id, purchase_number, input_number, put_yq_merchant_id, put_yq_merchant_name, put_merchant_id,
put_merchant_name, shipper_uuid, shipper, allocate_date, refund_status, shopping_car_id, delivery_remark, put_merchant_name, shipper_uuid, shipper, allocate_date, refund_status, shopping_car_id, delivery_remark,
created_by, created_date, updated_by, updated_date,deleted_flag created_by, created_date, updated_by, updated_date,deleted_flag,sign_status
</sql> </sql>
...@@ -114,6 +115,7 @@ ...@@ -114,6 +115,7 @@
<result column="od_delivery_company" property="deliveryCompany" jdbcType="VARCHAR" /> <result column="od_delivery_company" property="deliveryCompany" jdbcType="VARCHAR" />
<result column="od_delivery_date" property="deliveryDate" jdbcType="TIMESTAMP" /> <result column="od_delivery_date" property="deliveryDate" jdbcType="TIMESTAMP" />
<result column="shipping_warehouse_name" property="shippingWarehouseName" jdbcType="VARCHAR" /> <result column="shipping_warehouse_name" property="shippingWarehouseName" jdbcType="VARCHAR" />
<result column="upload_file" property="uploadFileUrl" jdbcType="VARCHAR" />
</collection> </collection>
<collection property="purchaseOrderDeliveryDetailList" ofType="cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDetailDTO"> <collection property="purchaseOrderDeliveryDetailList" ofType="cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDetailDTO">
...@@ -399,7 +401,7 @@ ...@@ -399,7 +401,7 @@
/*采购订单审核信息*/ /*采购订单审核信息*/
ad.id as audit_id, ad.status as audit_status, ad.reviewed_by as audit_reviewed_by, ad.reviewed_date as audit_reviewed_date, ad.remark as audit_remark, ad.id as audit_id, ad.status as audit_status, ad.reviewed_by as audit_reviewed_by, ad.reviewed_date as audit_reviewed_date, ad.remark as audit_remark,
/*发货单信息*/ /*发货单信息*/
od.id as od_id, od.delivery_date as od_delivery_date, od.delivery_company as od_delivery_company, od.delivery_number as od_delivery_number, od.shipping_warehouse_name, od.id as od_id, od.delivery_date as od_delivery_date, od.delivery_company as od_delivery_company, od.delivery_number as od_delivery_number, od.shipping_warehouse_name,od.upload_file,
/*发货单商品详情信息*/ /*发货单商品详情信息*/
dd.id as dd_id, dd.order_delivery_id as dd_order_delivery_id, dd.purchase_number as dd_purchase_number, dd.upgrade_goods_id as dd_upgrade_goods_id, dd.id as dd_id, dd.order_delivery_id as dd_order_delivery_id, dd.purchase_number as dd_purchase_number, dd.upgrade_goods_id as dd_upgrade_goods_id,
dd.purchase_order_goods_id as dd_purchase_order_goods_id dd.purchase_order_goods_id as dd_purchase_order_goods_id
...@@ -418,7 +420,7 @@ ...@@ -418,7 +420,7 @@
og.id , og.goods_name , og.goods_code, og.goods_type , og.goods_type_name , og.type , og.id , og.goods_name , og.goods_code, og.goods_type , og.goods_type_name , og.type ,
og.upgrade_goods_id , og.upgrade_goods_name , og.goods_number , og.purchase_number , og.shipper_uuid, og.shipper , og.goods_total_price , og.upgrade_goods_id , og.upgrade_goods_name , og.goods_number , og.purchase_number , og.shipper_uuid, og.shipper , og.goods_total_price ,
og.conversion_value , og.specification_data , og.refund_status ,og.remark ,og.shopping_car_id, og.delivery_status, og.delivery_remark, og.conversion_value , og.specification_data , og.refund_status ,og.remark ,og.shopping_car_id, og.delivery_status, og.delivery_remark,
og.allocate_date, og.allocate_date,og.sign_status,
( (
select max(reviewed_date) from dj_car_life_purchase_order_audit_detail ad where ad.order_code = po.order_code select max(reviewed_date) from dj_car_life_purchase_order_audit_detail ad where ad.order_code = po.order_code
) as max_review_date ) as max_review_date
...@@ -466,6 +468,12 @@ ...@@ -466,6 +468,12 @@
<if test="orderTimeEnd != null and orderTimeEnd !=''"> <if test="orderTimeEnd != null and orderTimeEnd !=''">
<![CDATA[ and po.order_time <= #{orderTimeEnd} ]]> <![CDATA[ and po.order_time <= #{orderTimeEnd} ]]>
</if> </if>
<if test="signStatusList != null and signStatusList.size()>0">
and og.sign_status in
<foreach collection="signStatusList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="reviewedStartDateStr != null and reviewedStartDateStr != ''"> <if test="reviewedStartDateStr != null and reviewedStartDateStr != ''">
and exists(select 1 and exists(select 1
...@@ -593,4 +601,30 @@ ...@@ -593,4 +601,30 @@
</if> </if>
</where> </where>
</sql> </sql>
<update id="updatePurchaseOrderGoodsPutStatus">
UPDATE dj_car_life_purchase_order_goods og
JOIN (
SELECT
od.id,
od.goods_number,
COALESCE(SUM(dd.purchase_number), 0) AS sign_num
FROM dj_car_life_purchase_order_goods od
INNER JOIN dj_car_life_purchase_order_delivery_detail dd
ON od.id = dd.purchase_order_goods_id
AND dd.deleted_flag = 'N'
AND dd.put_status IN (1, 2) and od.id = #{id}
WHERE od.deleted_flag = 'N'
GROUP BY od.id, od.goods_number
) AS t ON og.id = t.id
SET
og.updated_date = now(),
og.updated_by = #{updatedBy},
og.sign_status = CASE
WHEN t.goods_number = t.sign_num THEN 2
WHEN t.goods_number > t.sign_num AND t.sign_num > 0 THEN 1
ELSE og.sign_status
END
WHERE og.deleted_flag = 'N';
</update>
</mapper> </mapper>
...@@ -300,7 +300,7 @@ ...@@ -300,7 +300,7 @@
po.id,po.order_code, po.total_price,po.order_time,po.merchant_id,po.merchant_name,po.purchasing_pattern,po.send_out_merchant_id,po.send_out_merchant_name,po.purchase_type, po.id,po.order_code, po.total_price,po.order_time,po.merchant_id,po.merchant_name,po.purchasing_pattern,po.send_out_merchant_id,po.send_out_merchant_name,po.purchase_type,
po.delivery_status,po.status,po.contact_phone,po.contact_name,if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address po.delivery_status,po.status,po.contact_phone,po.contact_name,if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address
from dj_car_life_purchase_order po from dj_car_life_purchase_order po
where po.deleted_flag = 'N' and po.status in (1,2,4,5,6,7,8,9) and po.purchase_type = 1 where po.deleted_flag = 'N' and po.status in (1,2,4,5,6,7,8,9,10,11) and po.purchase_type = 1
<include refid="List_Condition"></include> <include refid="List_Condition"></include>
<if test="sortType!=null"> <if test="sortType!=null">
<choose> <choose>
...@@ -309,8 +309,38 @@ ...@@ -309,8 +309,38 @@
</when> </when>
<when test="sortType==2"> <when test="sortType==2">
order by (case when po.status = 1 then 3 order by (case when po.status = 1 then 3
when po.status in (2,5,8) then 2 when po.status in (2,5,8,10) then 2
when po.status in (4,6,7,9) then 1 when po.status in (4,6,7,9,11) then 1
else -1 end) desc,
po.order_time desc
</when>
<when test="sortType==3">
order by field(po.delivery_status,1,3,2) ,po.order_time desc
</when>
<otherwise>
order by po.id desc
</otherwise>
</choose>
</if>
</select>
<select id="managerReviewList" resultMap="DTOResultMap" parameterType="cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderPageDTO">
select
po.id,po.order_code, po.total_price,po.order_time,po.merchant_id,po.merchant_name,po.purchasing_pattern,po.send_out_merchant_id,po.send_out_merchant_name,po.purchase_type,
po.delivery_status,po.status,po.contact_phone,po.contact_name,if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address
from dj_car_life_purchase_order po
where po.deleted_flag = 'N' and po.status in (2,5,6,7,8,9,10,11) and po.purchase_type = 1
<include refid="List_Condition"></include>
<if test="sortType!=null">
<choose>
<when test="sortType==1">
order by po.order_time desc
</when>
<when test="sortType==2">
order by (case when po.status = 2 then 3
when po.status in (5,8,10) then 2
when po.status in (6,7,9,11) then 1
else -1 end) desc, else -1 end) desc,
po.order_time desc po.order_time desc
</when> </when>
...@@ -338,7 +368,7 @@ ...@@ -338,7 +368,7 @@
and ad2.order_code = po.order_code and ad2.order_code = po.order_code
order by ad2.id desc order by ad2.id desc
limit 1) limit 1)
where po.deleted_flag = 'N' and po.status in(8,5,6,7) and po.purchase_type =1 where po.deleted_flag = 'N' and po.status in(5,6,7,8) and po.purchase_type =1
<include refid="List_Condition"></include> <include refid="List_Condition"></include>
<if test="sortType!=null"> <if test="sortType!=null">
<choose> <choose>
...@@ -368,7 +398,7 @@ ...@@ -368,7 +398,7 @@
po.id,po.order_code, po.total_price,po.order_time,po.merchant_id,po.merchant_name,po.purchasing_pattern,po.send_out_merchant_id,po.send_out_merchant_name,po.purchase_type, po.id,po.order_code, po.total_price,po.order_time,po.merchant_id,po.merchant_name,po.purchasing_pattern,po.send_out_merchant_id,po.send_out_merchant_name,po.purchase_type,
po.delivery_status,po.status,po.contact_phone,po.contact_name,if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address po.delivery_status,po.status,po.contact_phone,po.contact_name,if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address
from dj_car_life_purchase_order po from dj_car_life_purchase_order po
where po.deleted_flag = 'N' and po.status in(2,8,9,5,6,7) and po.purchase_type =1 where po.deleted_flag = 'N' and po.status in(5,6,7,8,9,10) and po.purchase_type =1
<include refid="List_Condition"></include> <include refid="List_Condition"></include>
<if test="sortType!=null"> <if test="sortType!=null">
<choose> <choose>
...@@ -376,7 +406,7 @@ ...@@ -376,7 +406,7 @@
order by po.order_time desc order by po.order_time desc
</when> </when>
<when test="sortType==2"> <when test="sortType==2">
order by (case when po.status = 2 then 4 order by (case when po.status = 10 then 4
when po.status = 8 then 3 when po.status = 8 then 3
when po.status = 5 then 2 when po.status = 5 then 2
when po.status in (6,7,9) then 1 when po.status in (6,7,9) then 1
...@@ -517,8 +547,8 @@ ...@@ -517,8 +547,8 @@
</if> </if>
</where> </where>
order by (case when po.status = 1 then 3 order by (case when po.status = 1 then 3
when po.status in (2,5,8) then 2 when po.status in (2,5,8,10) then 2
when po.status in (4,6,7,9) then 1 when po.status in (4,6,7,9,11) then 1
else -1 end) desc, else -1 end) desc,
po.order_time desc po.order_time desc
</select> </select>
...@@ -532,6 +562,24 @@ ...@@ -532,6 +562,24 @@
dclpo.send_out_merchant_name dclpo.send_out_merchant_name
from dj_car_life_purchase_order dclpo from dj_car_life_purchase_order dclpo
where dclpo.deleted_flag = 'N' where dclpo.deleted_flag = 'N'
and dclpo.status = 10
and exists(select 1
from dj_car_life_purchase_order_audit_detail t1
where t1.order_code = dclpo.order_code
and t1.STATUS = 10
group by t1.order_code
having max(reviewed_date) &lt; #{deadlineDate})
</select>
<select id="listManagerAuditOverTime" resultMap="DTOResultMap">
select distinct dclpo.order_code,
dclpo.total_price,
dclpo.order_time,
dclpo.merchant_name,
dclpo.purchasing_pattern,
dclpo.send_out_merchant_name
from dj_car_life_purchase_order dclpo
where dclpo.deleted_flag = 'N'
and dclpo.status = 2 and dclpo.status = 2
and exists(select 1 and exists(select 1
from dj_car_life_purchase_order_audit_detail t1 from dj_car_life_purchase_order_audit_detail t1
......
...@@ -1044,4 +1044,68 @@ ...@@ -1044,4 +1044,68 @@
</if> </if>
group by ref.main_merchant_id group by ref.main_merchant_id
</select> </select>
<select id="query4sMerchantDirectorByMerchantId" resultType="java.lang.String">
SELECT DISTINCT d.director_phone AS phoneNumber
FROM dj_car_life_service_merchant m
LEFT JOIN dj_car_life_scene_merchant_ref r
ON r.sub_merchant_id = m.merchant_id
AND r.deleted_flag = 'N'
AND (
(m.merchant_type IN ('6', '8') AND r.sub_merchant_type IN (6, 8))
OR
(m.merchant_type = '7' AND r.sub_merchant_type = 7)
)
JOIN dj_car_life_shop_merchant_director_config d
ON d.merchant_id = IF(m.merchant_type IN ('1', '2', '3', '4', '5'), m.merchant_id, r.main_merchant_id)
AND d.deleted_flag = 'N'
AND d.director_type = 8
AND d.director_phone IS NOT NULL
AND d.director_phone != ''
WHERE m.deleted_flag = 'N'
AND m.merchant_id = #{merchantId}
AND (
m.merchant_type IN ('1', '2', '3', '4', '5')
OR (r.scene = 1 AND r.main_merchant_id IS NOT NULL)
)
</select>
<select id="query4sMerchantDirectorBy4sMerchantIdOrYqMerchantId" resultType="java.lang.String">
-- 1) 传入商户是4s店:直接查该4s店的区域运营
SELECT d.director_phone AS phoneNumber
FROM dj_smartcarlife.dj_car_life_service_merchant m
JOIN dj_smartcarlife.dj_car_life_shop_merchant_director_config d
ON d.merchant_id = m.merchant_id
AND d.deleted_flag = 'N'
AND d.director_type = 8
AND d.director_phone IS NOT NULL
AND d.director_phone != ''
WHERE m.deleted_flag = 'N'
AND m.merchant_id = #{merchantId}
AND m.merchant_type IN ('1', '2', '3', '4', '5')
UNION
-- 2) 传入商户是园区店:查场景1下该园区店关联的4s店的区域运营
SELECT d.director_phone AS phoneNumber
FROM dj_smartcarlife.dj_car_life_service_merchant m
JOIN dj_smartcarlife.dj_car_life_scene_merchant_ref r
ON r.sub_merchant_id = m.merchant_id
AND r.scene = 1
AND r.deleted_flag = 'N'
AND r.sub_merchant_type IN (6, 8)
AND r.main_merchant_type IN (1, 2, 3, 4, 5)
JOIN dj_smartcarlife.dj_car_life_shop_merchant_director_config d
ON d.merchant_id = r.main_merchant_id
AND d.deleted_flag = 'N'
AND d.director_type = 8
AND d.director_phone IS NOT NULL
AND d.director_phone != ''
WHERE m.deleted_flag = 'N'
AND m.merchant_id = #{merchantId}
AND m.merchant_type IN ('6', '8')
</select>
</mapper> </mapper>
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
<result column="totalEquityToShopCount" property="totalEquityToShopCount" jdbcType="INTEGER"/> <result column="totalEquityToShopCount" property="totalEquityToShopCount" jdbcType="INTEGER"/>
<result column="realEquityToShopCount" property="realEquityToShopCount" jdbcType="INTEGER"/> <result column="realEquityToShopCount" property="realEquityToShopCount" jdbcType="INTEGER"/>
<result column="extendedWarrantyToShopCount" property="extendedWarrantyToShopCount" jdbcType="INTEGER"/> <result column="extendedWarrantyToShopCount" property="extendedWarrantyToShopCount" jdbcType="INTEGER"/>
<result column="afterSaleEquityToShopCount" property="afterSaleEquityToShopCount" jdbcType="INTEGER"/>
<result column="afterSaleExtendedWarrantyToShopCount" property="afterSaleExtendedWarrantyToShopCount" jdbcType="INTEGER"/>
<result column="afterSaleRealEquityToShopCount" property="afterSaleRealEquityToShopCount" jdbcType="INTEGER"/>
<result column="totalExtendedWarrantyCount" property="totalExtendedWarrantyCount" jdbcType="INTEGER"/> <result column="totalExtendedWarrantyCount" property="totalExtendedWarrantyCount" jdbcType="INTEGER"/>
<result column="totalOrderCount" property="totalOrderCount" jdbcType="INTEGER"/> <result column="totalOrderCount" property="totalOrderCount" jdbcType="INTEGER"/>
<result column="tireWarrantyCount" property="tireWarrantyCount" jdbcType="INTEGER"/> <result column="tireWarrantyCount" property="tireWarrantyCount" jdbcType="INTEGER"/>
...@@ -296,6 +299,8 @@ ...@@ -296,6 +299,8 @@
<select id="getMerchantStaffAccumulate" parameterType="cn.com.glsx.dj.smartcarlife.dto.StaffDailyReportHuaweiDTO" resultMap="StaffDailyReportDTOMap"> <select id="getMerchantStaffAccumulate" parameterType="cn.com.glsx.dj.smartcarlife.dto.StaffDailyReportHuaweiDTO" resultMap="StaffDailyReportDTOMap">
select drh.staff_uuid,sum(drh.equity_to_shop_count) AS totalEquityToShopCount, sum(drh.extended_warranty_to_shop_count) AS extendedWarrantyToShopCount, sum(drh.real_equity_to_shop_count) AS realEquityToShopCount, select drh.staff_uuid,sum(drh.equity_to_shop_count) AS totalEquityToShopCount, sum(drh.extended_warranty_to_shop_count) AS extendedWarrantyToShopCount, sum(drh.real_equity_to_shop_count) AS realEquityToShopCount,
sum(drh.after_sale_equity_to_shop_count) AS afterSaleEquityToShopCount,sum(drh.after_sale_extended_warranty_to_shop_count) AS afterSaleExtendedWarrantyToShopCount,
sum(drh.after_sale_real_equity_to_shop_count) AS afterSaleRealEquityToShopCount,
sum(drh.extended_warranty_count) AS totalExtendedWarrantyCount, sum(drh.tire_warranty_count) AS tireWarrantyCount, sum(drh.extended_warranty_count) AS totalExtendedWarrantyCount, sum(drh.tire_warranty_count) AS tireWarrantyCount,
sum(drh.ax_package_count) AS axPackageCount,sum(drh.battery_extended_warranty_count) AS batteryExtendedWarrantyCount,sum(drh.battery_extended_warranty_money) AS batteryExtendedWarrantyMoney, sum(drh.ax_package_count) AS axPackageCount,sum(drh.battery_extended_warranty_count) AS batteryExtendedWarrantyCount,sum(drh.battery_extended_warranty_money) AS batteryExtendedWarrantyMoney,
sum(drh.not_delivery_count) AS totalNotDeliveryCount,sum(drh.total_order_count) AS totalOrderCount sum(drh.not_delivery_count) AS totalNotDeliveryCount,sum(drh.total_order_count) AS totalOrderCount
......
...@@ -51,12 +51,12 @@ ...@@ -51,12 +51,12 @@
<select id="listStockAllocateDetailPage" resultMap="StockAllocateDetailDTOMap"> <select id="listStockAllocateDetailPage" resultMap="StockAllocateDetailDTOMap">
select select
sad.id,sad.allocate_code, sad.goods_id, ug.upgrade_goods_name as goods_name,sad.source_material_id,gi.goods_name as source_material_name, sad.id,sad.allocate_code, sad.goods_id, sad.product_code, ug.upgrade_goods_name as goods_name,sad.source_material_id,gi.goods_name as source_material_name,
sad.conversion_value,sad.upgrade_purchase_price,sad.input_number, sad.conversion_value,sad.upgrade_purchase_price,sad.input_number,
<!--specification_data,--> <!--specification_data,-->
sad.out_stock_qty,sad.in_stock_qty, sad.out_stock_qty,sad.in_stock_qty,
gi.goods_type,gi.goods_type_name,sad.allocate_number,sad.deleted_flag,sad.created_by,sad.created_date, gi.goods_type,gi.goods_type_name,sad.allocate_number,sad.deleted_flag,sad.created_by,sad.created_date,
sad.updated_by, sad.updated_date, ug.type as product_code, sad.film_roll_no, sad.delivery_number, sad.input_number, sad.delivery_status, sad.updated_by, sad.updated_date, sad.film_roll_no, sad.delivery_number, sad.input_number, sad.delivery_status,
ug.specification_data,ug.specification_type_sequence ug.specification_data,ug.specification_type_sequence
from dj_car_life_stock_allocate_detail sad from dj_car_life_stock_allocate_detail sad
left join dj_car_life_upgrade_goods ug on sad.goods_id = ug.id and ug.deleted_flag ='N' left join dj_car_life_upgrade_goods ug on sad.goods_id = ug.id and ug.deleted_flag ='N'
......
...@@ -80,6 +80,13 @@ ...@@ -80,6 +80,13 @@
<if test="callInMerchantId != null"> <if test="callInMerchantId != null">
and ar.call_in_merchant_id = #{callInMerchantId} and ar.call_in_merchant_id = #{callInMerchantId}
</if> </if>
<if test="callInYqMerchantIdList != null and callInYqMerchantIdList.size()>0">
and ar.call_in_yq_merchant_id in
<foreach collection="callInYqMerchantIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="callInName != null and callInName !=''"> <if test="callInName != null and callInName !=''">
and ( and (
ar.call_in_merchant_name like concat('%',#{callInName},'%') or ar.call_in_merchant_name like concat('%',#{callInName},'%') or
...@@ -228,6 +235,13 @@ ...@@ -228,6 +235,13 @@
<if test="callOutName != null and callOutName != ''"> <if test="callOutName != null and callOutName != ''">
and (b.call_out_merchant_name like concat('%',#{callOutName},'%') or b.call_out_yq_merchant_name like concat('%',#{callOutName},'%')) and (b.call_out_merchant_name like concat('%',#{callOutName},'%') or b.call_out_yq_merchant_name like concat('%',#{callOutName},'%'))
</if> </if>
<if test="callOutYqMerchantIdList != null and callOutYqMerchantIdList.size()>0">
and b.call_out_yq_merchant_id in
<foreach collection="callOutYqMerchantIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and b.bill_status in (5, 7) and b.bill_status in (5, 7)
order by b.allocate_time desc order by b.allocate_time desc
</select> </select>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<mapper namespace="cn.com.glsx.dj.smartcarlife.mapper.StockFlowMapper"> <mapper namespace="cn.com.glsx.dj.smartcarlife.mapper.StockFlowMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.smartcarlife.dto.StockFlowDTO"> <resultMap id="BaseResultMap" type="cn.com.glsx.dj.smartcarlife.dto.StockFlowDTO">
<result column="operate_time" property="operateTime" jdbcType="TIMESTAMP"/>
<result column="flow_time" property="flowTime" jdbcType="TIMESTAMP"/> <result column="flow_time" property="flowTime" jdbcType="TIMESTAMP"/>
<result column="upgrade_goods_name" property="upgradeGoodsName" jdbcType="VARCHAR"/> <result column="upgrade_goods_name" property="upgradeGoodsName" jdbcType="VARCHAR"/>
<result column="product_code" property="productCode" jdbcType="VARCHAR"/> <result column="product_code" property="productCode" jdbcType="VARCHAR"/>
...@@ -30,7 +31,8 @@ ...@@ -30,7 +31,8 @@
<trim suffixOverrides="UNION ALL"> <trim suffixOverrides="UNION ALL">
<!-- 入库子查询:将公共过滤条件下推,便于索引命中 --> <!-- 入库子查询:将公共过滤条件下推,便于索引命中 -->
SELECT SELECT
i.increase_time AS flow_time, i.created_date AS flow_time,
i.increase_time AS operate_time,
ug.upgrade_goods_name, ug.upgrade_goods_name,
ug.type AS product_code, ug.type AS product_code,
ug.specification_data, ug.specification_data,
...@@ -90,7 +92,8 @@ ...@@ -90,7 +92,8 @@
<!-- 出库子查询:将公共过滤条件下推,便于索引命中 --> <!-- 出库子查询:将公共过滤条件下推,便于索引命中 -->
SELECT SELECT
r.reduce_date AS flow_time, r.created_date AS flow_time,
r.reduce_date AS operate_time,
ug.upgrade_goods_name, ug.upgrade_goods_name,
ug.`type` AS product_code, ug.`type` AS product_code,
ug.specification_data, ug.specification_data,
...@@ -129,10 +132,10 @@ ...@@ -129,10 +132,10 @@
AND ug.type LIKE CONCAT('%', #{productCode}, '%') AND ug.type LIKE CONCAT('%', #{productCode}, '%')
</if> </if>
<if test="startDate != null"> <if test="startDate != null">
AND r.reduce_date &gt;= #{startDate} AND r.created_date &gt;= #{startDate}
</if> </if>
<if test="endDate != null"> <if test="endDate != null">
AND r.reduce_date &lt;= #{endDate} AND r.created_date &lt;= #{endDate}
</if> </if>
<if test="businessCode != null and businessCode != ''"> <if test="businessCode != null and businessCode != ''">
AND r.business_code LIKE CONCAT('%', #{businessCode}, '%') AND r.business_code LIKE CONCAT('%', #{businessCode}, '%')
......
...@@ -60,7 +60,7 @@ public class MerchantGoodsStockMonthReportServiceTest extends BaseServiceTest { ...@@ -60,7 +60,7 @@ public class MerchantGoodsStockMonthReportServiceTest extends BaseServiceTest {
// reduceRecordDTO = MerchantGoodsStockReduceRecordDTO.builder().yqMerchantId(44209887).yqMerchantName("明明长岭园区店").upgradeGoodsId(934).eventType(ReduceStockEventTypeEnum.CHECK.getValue()).businessCode("2325558444454444").reduceStockNum(BigDecimal.valueOf(29.99)).reduceDate(date).updatedBy(CommonConstants.DEFAULT_UPDATE_BY).build(); // reduceRecordDTO = MerchantGoodsStockReduceRecordDTO.builder().yqMerchantId(44209887).yqMerchantName("明明长岭园区店").upgradeGoodsId(934).eventType(ReduceStockEventTypeEnum.CHECK.getValue()).businessCode("2325558444454444").reduceStockNum(BigDecimal.valueOf(29.99)).reduceDate(date).updatedBy(CommonConstants.DEFAULT_UPDATE_BY).build();
// merchantGoodsStockReduceRecordService.reduceStock(reduceRecordDTO, StockUpdateTypeEnum.REDUCE); // merchantGoodsStockReduceRecordService.reduceStock(reduceRecordDTO, StockUpdateTypeEnum.REDUCE);
String paramJsonStr = ",,2023-01"; String paramJsonStr = "44209880,102785,2026-04";
merchantGoodsStockMonthReportService.rangeStockSettlement(paramJsonStr); merchantGoodsStockMonthReportService.rangeStockSettlement(paramJsonStr);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!