Merge #91 into master from cc_20230331_device

feat:添加阶段状态

* cc_20230331_device: (21 commits squashed)

  - feat:添加采购审批

  - Merge branch 'master' into cc_20230331_device

  - feat:设备发货阶段

  - feat:设备发货

  - feat:设备发货

  - feat:接口调整

  - feat:接口调整

  - feat:接口调整

  - feat:接口调整

  - feat:接口调整

  - feat:接口调整

  - feat:接口调整

  - feat:接口调整

  - feat:查询订单设备明细

  - feat:测试

  - feat:短信模板切换

  - feat:getPendingList

  - feat:代办调整

  - feat:处理人

  - feat:添加阶段状态

  - Merge branch 'master' into cc_20230331_device
    
    # Conflicts:
    #	coolstore-partner-service/src/main/java/com/cool/store/service/order/impl/MiniStoreOrderServiceImpl.java
    #	coolstore-partner-web/src/main/java/com/cool/store/controller/webc/TestController.java

Signed-off-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>
Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>

CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/91
This commit is contained in:
正新
2026-04-12 09:16:48 +00:00
parent 77ca18b6fc
commit 1a77d8fc37
48 changed files with 1874 additions and 106 deletions

View File

@@ -0,0 +1,36 @@
package com.cool.store.enums;
/**
* 发货项类型枚举
*/
public enum DeliveryItemTypeEnum {
PURCHASE_DEVICE(1, "采购设备"),
FIRE_CODE_DEVICE(2, "火码设备");
private final Integer code;
private final String desc;
DeliveryItemTypeEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public String getDesc() {
return desc;
}
public static DeliveryItemTypeEnum getByCode(Integer code) {
for (DeliveryItemTypeEnum item : values()) {
if (item.getCode().equals(code)) {
return item;
}
}
return null;
}
}

View File

@@ -0,0 +1,37 @@
package com.cool.store.enums;
/**
* 门店发货阶段枚举
*/
public enum DeliveryPlanStageEnum {
PENDING_DELIVERY(1, "待发货"),
PARTIAL_DELIVERY(2, "部分发货"),
COMPLETED(3, "已完成");
private final Integer code;
private final String desc;
DeliveryPlanStageEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public String getDesc() {
return desc;
}
public static DeliveryPlanStageEnum getByCode(Integer code) {
for (DeliveryPlanStageEnum item : values()) {
if (item.getCode().equals(code)) {
return item;
}
}
return null;
}
}

View File

@@ -0,0 +1,36 @@
package com.cool.store.enums;
/**
* 发货状态枚举
*/
public enum DeliveryStatusEnum {
NOT_DELIVERED(0, "未发货"),
DELIVERED(1, "已发货");
private final Integer code;
private final String desc;
DeliveryStatusEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public String getDesc() {
return desc;
}
public static DeliveryStatusEnum getByCode(Integer code) {
for (DeliveryStatusEnum item : values()) {
if (item.getCode().equals(code)) {
return item;
}
}
return null;
}
}

View File

@@ -364,7 +364,8 @@ public enum ErrorCodeEnum {
CURRENT_ORDER_STATUS_NOT_SUPPORT_CHANGE(1610111, "当前订单状态不支持变换心愿单!", null),
CURRENT_WISHLIST_BIND_OTHER_POINT(1610112, "当前心愿单绑定了其他铺位!", null),
ORDER_DATA_EXCEPTION(1610113, "心愿单数据异常!", null),
CURRENT_WISHLIST_NOT_EXIST(1610112, "当前心愿单不存在!", null),
CURRENT_WISHLIST_NOT_EXIST(1610114, "当前心愿单不存在!", null),
AMOUNT_GEN_ZERO(1610115, "分账金额必须大于0", null),

View File

@@ -22,7 +22,7 @@ public enum FileTypeEnum {
IMPORT_OA_OLD_SHOP_DATA("importOaOldShopData", "导入OA旧数据"),
ZXJP_OPEN_SHOP_REPORT("zxjpOpenShopReport","正新鸡排开店"),
IMPORT_OA_OLD_SHOP_STAGE_DATA("importOaOldShopStageData", "导入OA旧阶段数据"),
IMPORT_OA_OLD_SHOP_STAGE_DATA_ERROR("OaOldShopStageDataError", "导入OA旧数据阶段错误列表"),
IMPORT_OA_OLD_SHOP_STAGE_DATA_ERROR("OaOldShopStageDataErrorList", "导入OA旧数据阶段错误列表 "),
IMPORT_FITMENT_SHOP_STAGE("importFitmentShopStage", "导入装修阶段完成数据"),
IMPORT_FITMENT_SHOP_STAGE_DATA_ERROR_LIST("OaOldShopStageDataErrorList", "导入装修阶段完成数据错误列表 "),
SELLING_DETAILS_REPORT("sellingDetailsReport", "开店明细报表"),
@@ -33,6 +33,7 @@ public enum FileTypeEnum {
ORDER_RECORD_EXPORT("orderRecordExport", "订单记录列表"),
POINT_EXPORT("pointExport", "铺位管理列表"),
MY_POINT_EXPORT("myPointExport", "我的铺位管理列表"),
ORDER_DEVICE_DETAIL_EXPORT("orderDeviceDetailExport", "订单设备明细导出"),
;
private String fileType;
private String desc;

View File

@@ -12,6 +12,9 @@ public enum SMSMsgEnum {
DESIGN_STAGE("设计阶段", "", "SMS_498750214"),
CONSTRUCTION_STAGE("施工阶段", "", "SMS_498870170"),
PLATFORM_BUILD_STORE("平台建店", "", "SMS_498730163"),
DEVICE_NOTICE("设备发货通知", "${partnerName}-门店${shopName}可安排设备发货,期望发货日期为${shippingDate}请核对订单后安排发货详情明细请登录CRM酷店掌-CRM首页-开店管理查看。", "SMS_504735256"),
;
private String title;

View File

@@ -76,6 +76,8 @@ public enum UserRoleEnum {
OPERATION_GENERAL_CONSULTANT(1764642515446L,"运营片区总顾问"),
ORDER_GROUP(1766387359609L,"订单组"),
AI_STORE_TYPE_APPROVE(1774252055402L,"AI店型订单审核"),
DEVICE_SHIPMENT_HM(1775108261858L,"设备发货-火码"),
DEVICE_SHIPMENT_CG(1775108280524L,"设备发货-采购")
;
private Long code;

View File

@@ -12,6 +12,7 @@ public enum StoreOrderStatusEnum {
DRAFT(0, "草稿"),
WAIT_CONFIRM(5, "待立规确认"),
DEVICE_CONFIRM(6, "待采购设备确认"),
INVEST_MANAGER_CONFIRM(7, "待加盟商确认"),
FINANCIAL_CONFIRM(8, "待内勤确认"),
WAIT_ADJUST(10, "待调整"),
@@ -37,14 +38,6 @@ public enum StoreOrderStatusEnum {
}
/**
* 可撤回阶段
* @param code
* @return
*/
public static boolean canWithdraw(Integer code) {
return WAIT_CONFIRM.getCode().equals(code) || WAIT_PAY.getCode().equals(code)||INVEST_MANAGER_CONFIRM.getCode().equals(code);
}
/**
* 待审核状态
@@ -52,6 +45,15 @@ public enum StoreOrderStatusEnum {
* @return
*/
public static boolean approve(Integer code) {
return WAIT_CONFIRM.getCode().equals(code) || INVEST_MANAGER_CONFIRM.getCode().equals(code);
return WAIT_CONFIRM.getCode().equals(code) || INVEST_MANAGER_CONFIRM.getCode().equals(code) || DEVICE_CONFIRM.getCode().equals(code);
}
/**
* 后台管理订单 只有立规确认或者设备确认的时候可以修改
* @param code
* @return
*/
public static boolean managerOrder(Integer code) {
return WAIT_CONFIRM.getCode().equals(code) || DEVICE_CONFIRM.getCode().equals(code);
}
}

View File

@@ -45,6 +45,7 @@ public enum ShopSubStageEnum {
SHOP_STAGE_27(ShopStageEnum.SHOP_STAGE_2, 270, "开业验收", 1),
SHOP_STAGE_28(ShopStageEnum.SHOP_STAGE_2, 280, "生成预定订单", 1),
SHOP_STAGE_29(ShopStageEnum.SHOP_STAGE_2, 290, "设备发货", 1),
SHOP_STAGE_30(ShopStageEnum.SHOP_STAGE_2, 300, "开业日期报备", 1),
@@ -159,6 +160,7 @@ public enum ShopSubStageEnum {
return ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00;
}
case SHOP_STAGE_28:
case SHOP_STAGE_29:
if (userStrandard==1){
//是标准店 需要选择店型 其他情况不需要选择店型
return ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00;

View File

@@ -169,6 +169,7 @@ public enum ShopSubStageStatusEnum {
SHOP_SUB_STAGE_STATUS_280(ShopSubStageEnum.SHOP_STAGE_28, 2800, "待选购", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_281(ShopSubStageEnum.SHOP_STAGE_28, 2810, "待立规确认", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_281_2(ShopSubStageEnum.SHOP_STAGE_28, 2812, "待采购设备确认", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_281_5(ShopSubStageEnum.SHOP_STAGE_28, 2815, "待加盟商确认", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_282(ShopSubStageEnum.SHOP_STAGE_28, 2820, "待内勤确认分账", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_283(ShopSubStageEnum.SHOP_STAGE_28, 2830, "审批拒绝", Boolean.FALSE),
@@ -176,6 +177,10 @@ public enum ShopSubStageStatusEnum {
SHOP_SUB_STAGE_STATUS_284_5(ShopSubStageEnum.SHOP_STAGE_28, 2845, "对账中", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_285(ShopSubStageEnum.SHOP_STAGE_28, 2850, "已完成", Boolean.TRUE),
SHOP_SUB_STAGE_STATUS_290(ShopSubStageEnum.SHOP_STAGE_29, 2900, "待通知发货", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_291(ShopSubStageEnum.SHOP_STAGE_29, 2910, "已通知发货", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_292(ShopSubStageEnum.SHOP_STAGE_29, 2920, "部分发货", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_294(ShopSubStageEnum.SHOP_STAGE_29, 2940, "已完成", Boolean.TRUE),
//开业日期报备
SHOP_SUB_STAGE_STATUS_300(ShopSubStageEnum.SHOP_STAGE_30, 3000, "待填写", Boolean.FALSE),

View File

@@ -0,0 +1,77 @@
package com.cool.store.dao;
import com.cool.store.entity.plan.ShopDeliveryPlanDO;
import com.cool.store.mapper.ShopDeliveryPlanMapper;
import com.cool.store.vo.desk.DeliveryPendingVO;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Repository
public class ShopDeliveryPlanDAO {
@Resource
private ShopDeliveryPlanMapper shopDeliveryPlanMapper;
/**
* 根据ID查询
*/
public ShopDeliveryPlanDO getById(Long id) {
if (id == null) {
return null;
}
return shopDeliveryPlanMapper.getById(id);
}
/**
* 根据门店ID查询
*/
public ShopDeliveryPlanDO getByShopId(Long shopId) {
if (shopId == null) {
return null;
}
return shopDeliveryPlanMapper.getByShopId(shopId);
}
/**
* 插入
*/
public int insert(ShopDeliveryPlanDO record) {
record.setCreateTime(new Date());
record.setUpdateTime(new Date());
return shopDeliveryPlanMapper.insert(record);
}
/**
* 更新
*/
public int update(ShopDeliveryPlanDO record) {
record.setUpdateTime(new Date());
return shopDeliveryPlanMapper.update(record);
}
/**
* 删除
*/
public int deleteById(Long id) {
if (id == null) {
return 0;
}
return shopDeliveryPlanMapper.deleteById(id);
}
public List<DeliveryPendingVO> getPendingList(String keyword, Integer type) {
return shopDeliveryPlanMapper.getPendingList(keyword,type);
}
/**
* 查询所有
*/
public List<ShopDeliveryPlanDO> listAll() {
return shopDeliveryPlanMapper.listAll();
}
}

View File

@@ -0,0 +1,93 @@
package com.cool.store.dao;
import com.cool.store.entity.plan.ShopDeliveryPlanItemDO;
import com.cool.store.mapper.ShopDeliveryPlanItemMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@Repository
public class ShopDeliveryPlanItemDAO {
@Resource
private ShopDeliveryPlanItemMapper shopDeliveryPlanItemMapper;
/**
* 根据ID查询
*/
public ShopDeliveryPlanItemDO getById(Long id) {
if (id == null) {
return null;
}
return shopDeliveryPlanItemMapper.getById(id);
}
/**
* 根据主表ID查询明细列表
*/
public List<ShopDeliveryPlanItemDO> listByPlanId(Long planId) {
if (planId == null) {
return null;
}
return shopDeliveryPlanItemMapper.listByPlanId(planId);
}
/**
* 根据主表ID和类型查询明细
*/
public ShopDeliveryPlanItemDO getByPlanIdAndItemType(Long planId, Integer itemType) {
if (planId == null || itemType == null) {
return null;
}
return shopDeliveryPlanItemMapper.getByPlanIdAndItemType(planId, itemType);
}
/**
* 插入
*/
public int insert(ShopDeliveryPlanItemDO record) {
record.setCreateTime(new Date());
record.setUpdateTime(new Date());
return shopDeliveryPlanItemMapper.insert(record);
}
public int batchInsert(List<ShopDeliveryPlanItemDO> recordList) {
if (CollectionUtils.isEmpty(recordList)){
return 0;
}
return shopDeliveryPlanItemMapper.batchInsert(recordList);
}
/**
* 更新
*/
public int update(ShopDeliveryPlanItemDO record) {
record.setUpdateTime(new Date());
return shopDeliveryPlanItemMapper.update(record);
}
/**
* 删除
*/
public int deleteById(Long id) {
if (id == null) {
return 0;
}
return shopDeliveryPlanItemMapper.deleteById(id);
}
/**
* 根据主表ID删除明细
*/
public int deleteByPlanId(Long planId) {
if (planId == null) {
return 0;
}
return shopDeliveryPlanItemMapper.deleteByPlanId(planId);
}
}

View File

@@ -489,6 +489,15 @@ public class ShopStageInfoDAO {
example.createCriteria().andIn("shopId",shopIds).andEqualTo("shopStage",shopStage);
return shopStageInfoMapper.selectByExample(example);
}
public List<ShopStageInfoDO> getStageByShopSubStage(List<Long> shopIds, Integer shopSubStage){
if (CollectionUtils.isEmpty(shopIds) || shopSubStage == null){
return null;
}
Example example = new Example(ShopStageInfoDO.class);
example.createCriteria().andIn("shopId",shopIds).andEqualTo("shopSubStage",shopSubStage);
return shopStageInfoMapper.selectByExample(example);
}
//查询处于xx状态的数据
public List<ShopStageInfoDO> getShopStageInfoByShopSubStageStatus(Integer shopSubStageStatus) {
Example example = new Example(ShopStageInfoDO.class);

View File

@@ -0,0 +1,51 @@
package com.cool.store.mapper;
import com.cool.store.entity.plan.ShopDeliveryPlanItemDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ShopDeliveryPlanItemMapper {
/**
* 根据ID查询
*/
ShopDeliveryPlanItemDO getById(@Param("id") Long id);
/**
* 根据主表ID查询明细列表
*/
List<ShopDeliveryPlanItemDO> listByPlanId(@Param("planId") Long planId);
/**
* 根据主表ID和类型查询明细
*/
ShopDeliveryPlanItemDO getByPlanIdAndItemType(@Param("planId") Long planId, @Param("itemType") Integer itemType);
/**
* 插入
*/
int insert(ShopDeliveryPlanItemDO record);
/**
* 批 liqu量插入
*/
int batchInsert(@Param("list") List<ShopDeliveryPlanItemDO> list);
/**
* 更新
*/
int update(ShopDeliveryPlanItemDO record);
/**
* 删除
*/
int deleteById(@Param("id") Long id);
/**
* 根据主表ID删除明细
*/
int deleteByPlanId(@Param("planId") Long planId);
}

View File

@@ -0,0 +1,50 @@
package com.cool.store.mapper;
import com.cool.store.entity.plan.ShopDeliveryPlanDO;
import com.cool.store.vo.desk.DeliveryPendingVO;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ShopDeliveryPlanMapper {
/**
* 根据ID查询
*/
ShopDeliveryPlanDO getById(@Param("id") Long id);
/**
* 根据门店ID查询
*/
ShopDeliveryPlanDO getByShopId(@Param("shopId") Long shopId);
/**
* 插入
*/
int insert(ShopDeliveryPlanDO record);
/**
* 更新
*/
int update(ShopDeliveryPlanDO record);
/**
* 删除
*/
int deleteById(@Param("id") Long id);
/**
* 查询所有
*/
List<ShopDeliveryPlanDO> listAll();
/**
* 查询代办
* @param keyword
* @return
*/
List<DeliveryPendingVO> getPendingList(@Param("keyword") String keyword, @Param("type") Integer type);
}

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cool.store.mapper.ShopDeliveryPlanItemMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.plan.ShopDeliveryPlanItemDO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="plan_id" property="planId" jdbcType="BIGINT"/>
<result column="item_type" property="itemType" jdbcType="INTEGER"/>
<result column="delivery_status" property="deliveryStatus" jdbcType="INTEGER"/>
<result column="delivery_remark" property="deliveryRemark" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, plan_id, item_type, delivery_status, delivery_remark, create_time, update_time
</sql>
<select id="getById" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM zxjp_shop_delivery_plan_item
WHERE id = #{id}
</select>
<select id="listByPlanId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM zxjp_shop_delivery_plan_item
WHERE plan_id = #{planId}
ORDER BY id ASC
</select>
<select id="getByPlanIdAndItemType" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM zxjp_shop_delivery_plan_item
WHERE plan_id = #{planId} AND item_type = #{itemType}
LIMIT 1
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.cool.store.entity.plan.ShopDeliveryPlanItemDO">
INSERT INTO zxjp_shop_delivery_plan_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planId != null">plan_id,</if>
<if test="itemType != null">item_type,</if>
<if test="deliveryStatus != null">delivery_status,</if>
<if test="deliveryRemark != null">delivery_remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="planId != null">#{planId,jdbcType=BIGINT},</if>
<if test="itemType != null">#{itemType,jdbcType=INTEGER},</if>
<if test="deliveryStatus != null">#{deliveryStatus,jdbcType=INTEGER},</if>
<if test="deliveryRemark != null">#{deliveryRemark,jdbcType=VARCHAR},</if>
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<insert id="batchInsert">
INSERT INTO zxjp_shop_delivery_plan_item
(plan_id, item_type, delivery_status, delivery_remark, create_time, update_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.planId}, #{item.itemType}, #{item.deliveryStatus}, #{item.deliveryRemark}, now(), now())
</foreach>
</insert>
<update id="update" parameterType="com.cool.store.entity.plan.ShopDeliveryPlanItemDO">
UPDATE zxjp_shop_delivery_plan_item
<set>
<if test="planId != null">plan_id = #{planId,jdbcType=BIGINT},</if>
<if test="itemType != null">item_type = #{itemType,jdbcType=INTEGER},</if>
<if test="deliveryStatus != null">delivery_status = #{deliveryStatus,jdbcType=INTEGER},</if>
<if test="deliveryRemark != null">delivery_remark = #{deliveryRemark,jdbcType=VARCHAR},</if>
<if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
</set>
WHERE id = #{id,jdbcType=BIGINT}
</update>
<delete id="deleteById">
DELETE FROM zxjp_shop_delivery_plan_item
WHERE id = #{id}
</delete>
<delete id="deleteByPlanId">
DELETE FROM zxjp_shop_delivery_plan_item
WHERE plan_id = #{planId}
</delete>
</mapper>

View File

@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cool.store.mapper.ShopDeliveryPlanMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.plan.ShopDeliveryPlanDO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="shop_id" property="shopId" jdbcType="BIGINT"/>
<result column="expected_delivery_time" property="expectedDeliveryTime" jdbcType="TIMESTAMP"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="create_user" property="createUser" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, shop_id, expected_delivery_time, remark, create_user, create_time, update_time
</sql>
<select id="getById" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM zxjp_shop_delivery_plan
WHERE id = #{id}
</select>
<select id="getByShopId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM zxjp_shop_delivery_plan
WHERE shop_id = #{shopId}
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.cool.store.entity.plan.ShopDeliveryPlanDO">
INSERT INTO zxjp_shop_delivery_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="shopId != null">shop_id,</if>
<if test="expectedDeliveryTime != null">expected_delivery_time,</if>
<if test="remark != null">remark,</if>
<if test="createUser != null">create_user,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="shopId != null">#{shopId,jdbcType=BIGINT},</if>
<if test="expectedDeliveryTime != null">#{expectedDeliveryTime,jdbcType=TIMESTAMP},</if>
<if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
<if test="createUser != null">#{createUser,jdbcType=VARCHAR},</if>
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<update id="update" parameterType="com.cool.store.entity.plan.ShopDeliveryPlanDO">
UPDATE zxjp_shop_delivery_plan
<set>
<if test="shopId != null">shop_id = #{shopId,jdbcType=BIGINT},</if>
<if test="expectedDeliveryTime != null">expected_delivery_time = #{expectedDeliveryTime,jdbcType=TIMESTAMP},</if>
<if test="remark != null">remark = #{remark,jdbcType=VARCHAR},</if>
<if test="createUser != null">create_user = #{createUser,jdbcType=VARCHAR},</if>
<if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
</set>
WHERE id = #{id,jdbcType=BIGINT}
</update>
<delete id="deleteById">
DELETE FROM zxjp_shop_delivery_plan
WHERE id = #{id}
</delete>
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM zxjp_shop_delivery_plan
ORDER BY create_time DESC
</select>
<select id="getPendingList" resultType="com.cool.store.vo.desk.DeliveryPendingVO">
select
a.shop_id as shopId,
c.shop_name as shopName,
c.line_id as lineId,
c.region_id as regionId,
c.invest_region_id as investRegionId,
c.detail_address as address,
b.item_type as itemType,
b.delivery_status as deliveryStatus
from zxjp_shop_delivery_plan a
left join zxjp_shop_delivery_plan_item b on a.id = b.plan_id
left join xfsg_shop_info c on a.shop_id = c.id
<where>
and b.delivery_status = 0
<if test="keyword!=null and keyword!=''">
and (c.shop_name like concat('%', #{keyword}, '%') or c.shop_code like concat('%', #{keyword}, '%'))
</if>
<if test="type != null">
and item_type = #{type}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,64 @@
package com.cool.store.converter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.alibaba.fastjson.JSON;
import com.cool.store.vo.order.OrderDeviceConfigItemVO;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @Auther zx_szh
* @Date 2026/4/3 09:30
* @Version 1.0
*/
public class ConfigItemListConverter implements Converter<List<OrderDeviceConfigItemVO>> {
@Override
public Class<?> supportJavaTypeKey() {
return List.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public List<OrderDeviceConfigItemVO> convertToJavaData(CellData cellData,
ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
if (!StringUtils.hasText(cellValue)) {
return new ArrayList<>();
}
// 将 JSON 字符串解析为 List
return JSON.parseArray(cellValue, OrderDeviceConfigItemVO.class);
}
/**
* 导出 Excel 时:将 List 对象转换为字符串写入单元格
* 导出时使用
*/
@Override
public CellData convertToExcelData(List<OrderDeviceConfigItemVO> value,
ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
if (value == null || value.isEmpty()) {
return new CellData<>("");
}
// 将 List 转换为 JSON 字符串
String jsonString = JSON.toJSONString(value);
return new CellData<>(jsonString);
}
}

View File

@@ -0,0 +1,53 @@
package com.cool.store.entity.plan;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
/**
* 门店发货阶段主表
*/
@Data
@Table(name = "zxjp_shop_delivery_plan")
public class ShopDeliveryPlanDO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 门店ID
*/
@Column(name = "shop_id")
private Long shopId;
/**
* 期望发货时间
*/
@Column(name = "expected_delivery_time")
private Date expectedDeliveryTime;
/**
* 备注
*/
private String remark;
/**
* 创建人
*/
@Column(name = "create_user")
private String createUser;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 更新时间
*/
@Column(name = "update_time")
private Date updateTime;
}

View File

@@ -0,0 +1,54 @@
package com.cool.store.entity.plan;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
/**
* 门店发货阶段明细映射表
*/
@Data
@Table(name = "zxjp_shop_delivery_plan_item")
public class ShopDeliveryPlanItemDO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 主表ID(shop_delivery_plan.id)
*/
@Column(name = "plan_id")
private Long planId;
/**
* 明细类型1=采购设备2=火码设备
*/
@Column(name = "item_type")
private Integer itemType;
/**
* 发货/订货状态0-未发货 1-发货
*/
@Column(name = "delivery_status")
private Integer deliveryStatus;
/**
* 发货/订货备注
*/
@Column(name = "delivery_remark")
private String deliveryRemark;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 更新时间
*/
@Column(name = "update_time")
private Date updateTime;
}

View File

@@ -0,0 +1,26 @@
package com.cool.store.request.plan;
import com.cool.store.common.InsertGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* 通知发货请求
*/
@Data
public class NotifyDeliveryRequest {
@ApiModelProperty(value = "门店ID", required = true)
@NotNull(message = "门店ID不能为空")
private Long shopId;
@ApiModelProperty(value = "期望发货日期", required = true)
private Date expectedDeliveryDate;
@ApiModelProperty(value = "备注")
private String remark;
}

View File

@@ -0,0 +1,28 @@
package com.cool.store.request.plan;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 更新发货项请求
*/
@Data
public class UpdateDeliveryItemRequest {
@ApiModelProperty(value = "门店ID", required = true)
@NotNull(message = "门店ID不能为空")
private Long shopId;
@ApiModelProperty(value = "发货项类型1=采购设备2=火码设备", required = true)
@NotNull(message = "发货项类型不能为空")
private Integer itemType;
@ApiModelProperty(value = "发货状态0-未发货 1-发货", required = true)
@NotNull(message = "发货状态不能为空")
private Integer deliveryStatus;
@ApiModelProperty(value = "发货备注")
private String deliveryRemark;
}

View File

@@ -0,0 +1,51 @@
package com.cool.store.vo.desk;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
/**
* @Auther zx_szh
* @Date 2026/4/2 10:41
* @Version 1.0
*/
@Data
public class DeliveryPendingVO {
@ApiModelProperty("门店ID")
private Long shopId;
@ApiModelProperty("类型")
private Integer itemType;
@ApiModelProperty("门店名称")
private String shopName;
@ApiModelProperty("加盟商名称")
private String partnerName;
private Long lineId;
@ApiModelProperty("地址")
private String address;
private Integer deliveryStatus ;
@ApiModelProperty("运营大区")
private Long regionId;
@ApiModelProperty("运营大区名称")
private String regionName;
@ApiModelProperty("招商大区")
private Long investRegionId;
@ApiModelProperty("招商大区名称")
private String investRegionName;
private Integer subStageStatus;
}

View File

@@ -0,0 +1,66 @@
package com.cool.store.vo.order;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cool.store.utils.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* 订单设备配置项明细VO
*/
@Data
public class OrderDeviceConfigItemVO {
@ApiModelProperty("费用类型")
private String expenseTypeCode;
@ApiModelProperty("配置大类")
private String categoryCode;
@ApiModelProperty("配置大类名称")
@ExcelProperty(value = "配置大类", index = 1)
private String categoryName;
@ApiModelProperty("配置项")
private String itemCode;
@ApiModelProperty("配置项名称")
@ExcelProperty(value = "配置项", index = 2)
private String itemName;
@ApiModelProperty("配置选型名称")
@ExcelProperty(value = "配置项选型", index = 3)
private String optionName;
@ApiModelProperty("原单价")
@ExcelProperty(value = "原单价", index = 3)
private BigDecimal originalOptionPrice;
@ApiModelProperty("默认数量")
@ExcelProperty(value = "优惠数量", index = 3)
private BigDecimal defaultQuantity;
@ApiModelProperty("优惠单价")
@ExcelProperty(value = "优惠单价", index = 3)
private BigDecimal optionPrice;
@ApiModelProperty("下单数量")
@ExcelProperty(value = "下单数量", index = 3)
private BigDecimal quantity;
@ApiModelProperty("价格合计")
@ExcelProperty(value = "价格合计", index = 3)
private BigDecimal amount;
@ApiModelProperty("单位")
private String optionUnit;
}

View File

@@ -0,0 +1,73 @@
package com.cool.store.vo.order;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cool.store.utils.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @Auther zx_szh
* @Date 2026/4/3 10:15
* @Version 1.0
*/
@Data
public class OrderDeviceDetailExportVO {
@ApiModelProperty("费用名称")
@ExcelProperty(value = "费用类型", index = 0)
private String expenseTypeName;
@ApiModelProperty("配置大类名称")
@ExcelProperty(value = "配置大类", index = 1)
private String categoryName;
@ApiModelProperty("配置项名称")
@ExcelProperty(value = "配置项", index = 2)
private String itemName;
@ApiModelProperty("配置选型名称")
@ExcelProperty(value = "配置项选型", index = 3)
private String optionName;
@ApiModelProperty("原单价")
@ExcelProperty(value = "原单价", index = 4)
private BigDecimal originalOptionPrice;
@ApiModelProperty("默认数量")
@ExcelProperty(value = "优惠数量", index = 5)
private BigDecimal defaultQuantity;
@ApiModelProperty("优惠单价")
@ExcelProperty(value = "优惠单价", index = 6)
private BigDecimal optionPrice;
@ApiModelProperty("下单数量")
@ExcelProperty(value = "下单数量", index = 7)
private BigDecimal quantity;
@ApiModelProperty("价格合计")
@ExcelProperty(value = "价格合计", index = 8)
private BigDecimal amount;
public static List<OrderDeviceDetailExportVO> convert(List<OrderDeviceDetailVO> voList){
if (CollectionUtils.isEmpty(voList)){
return new ArrayList<>();
}
List<OrderDeviceDetailExportVO> result = new ArrayList<>();
voList.forEach(x->{
x.getItems().forEach(y->{
OrderDeviceDetailExportVO orderDeviceConfigItemVO = new OrderDeviceDetailExportVO();
BeanUtil.copyProperties(y,orderDeviceConfigItemVO);
orderDeviceConfigItemVO.setExpenseTypeName(x.getExpenseTypeName());
result.add(orderDeviceConfigItemVO);
});
});
return result;
}
}

View File

@@ -0,0 +1,28 @@
package com.cool.store.vo.order;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cool.store.converter.ConfigItemListConverter;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 订单设备明细VO
*/
@Data
public class OrderDeviceDetailVO {
@ApiModelProperty("费用类型")
private String expenseTypeCode;
@ApiModelProperty("费用名称")
@ExcelProperty(value = "费用类型", index = 0)
private String expenseTypeName;
@ApiModelProperty("配置项列表")
@ExcelProperty(value = "配置项", index = 1, converter = ConfigItemListConverter.class)
private List<OrderDeviceConfigItemVO> items;
}

View File

@@ -0,0 +1,48 @@
package com.cool.store.vo.plan;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 发货详细信息VO
*/
@Data
public class DeliveryDetailVO {
@ApiModelProperty("主表ID")
private Long id;
@ApiModelProperty("门店ID")
private Long shopId;
private Long orderId;
@ApiModelProperty("期望发货日期")
private Date expectedDeliveryTime;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("采购设备发货状态0-未发货 1-发货")
private Integer purchaseDeviceDeliveryStatus;
@ApiModelProperty("采购设备发货备注")
private String purchaseDeviceDeliveryRemark;
@ApiModelProperty("火码设备发货状态0-未发货 1-发货")
private Integer fireCodeDeviceDeliveryStatus;
@ApiModelProperty("火码设备发货备注")
private String fireCodeDeviceDeliveryRemark;
@ApiModelProperty("创建人")
private String createUser;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新时间")
private Date updateTime;
}

View File

@@ -0,0 +1,37 @@
package com.cool.store.vo.plan;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 发货信息VO
*/
@Data
public class DeliveryInfoVO {
@ApiModelProperty("主表ID")
private Long id;
@ApiModelProperty("门店ID")
private Long shopId;
@ApiModelProperty("期望发货日期")
private String expectedDeliveryDate;
@ApiModelProperty("期望发货时间")
private Date expectedDeliveryTime;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("创建人")
private String createUser;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新时间")
private Date updateTime;
}

View File

@@ -235,4 +235,7 @@ public interface DeskService {
*/
PageInfo<OperationsConsultantAssignVO> assignPendingList(AssignPendingRequest request,LoginUserInfo user);
PageInfo<DeliveryPendingVO> deliveryPendingList(AssignPendingRequest request,LoginUserInfo user);
}

View File

@@ -7,6 +7,7 @@ import com.cool.store.request.FranchiseReportRequest;
import com.cool.store.request.order.PCStoreOrderQueryRequest;
import com.cool.store.request.visit.VisitRecordQueryRequest;
import com.cool.store.request.PointPageRequest;
import com.cool.store.request.visit.VisitRecordQueryRequest;
import com.cool.store.response.BranchShopResponse;
import com.cool.store.response.FranchiseReportResponse;
import com.cool.store.response.ShopReportResponse;
@@ -43,6 +44,12 @@ public interface ExportRealizeService {
void exportOrderRecord(PCStoreOrderQueryRequest request, ImportTaskDO importTaskDO);
void exportPoint(AllPointPageRequest request, ImportTaskDO importTaskDO);
void myExportPoint(PointPageRequest request, String userId, ImportTaskDO importTaskDO);
/**
* 导出订单设备明细
* @param orderId 订单ID
* @param importTaskDO 导出任务
*/
void exportOrderDeviceDetail(Long orderId, ImportTaskDO importTaskDO);
}

View File

@@ -77,4 +77,12 @@ public interface ExportService {
* @return 记录总数
*/
Long myPointExport(PointPageRequest request, LoginUserInfo user);
/**
* 订单设备明细导出
* @param orderId 订单ID
* @param user 当前用户
* @return 记录总数
*/
Long exportOrderDeviceDetail(Long orderId, LoginUserInfo user);
}

View File

@@ -7,10 +7,7 @@ import com.cool.store.dto.InvestmentCountDTO;
import com.cool.store.dto.PendingCountDTO;
import com.cool.store.dto.openPreparation.PlanLineDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.ShopAccountEnum;
import com.cool.store.enums.UserRoleEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.enums.*;
import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
@@ -104,6 +101,8 @@ public class DeskServiceImpl implements DeskService {
OperationsConsultantAssignDAO operationsConsultantAssignDAO;
@Resource
private RegionDao regionDao;
@Resource
ShopDeliveryPlanDAO shopDeliveryPlanDAO;
@Override
public PageInfo<IntendPendingVO> intendPendingList(Integer pageNum, Integer pageSize, String userId, String keyword) {
@@ -848,6 +847,60 @@ public class DeskServiceImpl implements DeskService {
return page;
}
@Override
public PageInfo<DeliveryPendingVO> deliveryPendingList(AssignPendingRequest request,LoginUserInfo user) {
List<Long> userRoleIds = enterpriseUserRoleMapper.getUserRoleIds(user.getUserId());
List<Integer> subStageStatusList = new ArrayList<>();
Boolean isAdmin = sysRoleService.checkIsAdmin(user.getUserId());
Boolean flag = userRoleIds.contains(UserRoleEnum.DEVICE_SHIPMENT_HM.getCode()) && userRoleIds.contains(UserRoleEnum.DEVICE_SHIPMENT_CG.getCode());
if (isAdmin||flag){
//返回所有数据
List<DeliveryPendingVO> pendingList = shopDeliveryPlanDAO.getPendingList(request.getKeyword(), null);
return convert(pendingList);
}
Integer type = null;
//采购
if (userRoleIds.contains(UserRoleEnum.DEVICE_SHIPMENT_CG.getCode())){
type = DeliveryItemTypeEnum.PURCHASE_DEVICE.getCode();
}
//火码
if (userRoleIds.contains(UserRoleEnum.DEVICE_SHIPMENT_HM.getCode())){
type = DeliveryItemTypeEnum.FIRE_CODE_DEVICE.getCode();
}
if(type!=null){
List<DeliveryPendingVO> pendingList = shopDeliveryPlanDAO.getPendingList(request.getKeyword(), type);
return convert(pendingList);
}
return new PageInfo<>();
}
private PageInfo<DeliveryPendingVO> convert(List<DeliveryPendingVO> pendingList){
if (CollectionUtils.isEmpty(pendingList)){
return new PageInfo<>();
}
PageInfo<DeliveryPendingVO> result = new PageInfo<>(pendingList);
List<Long> lineIdList = pendingList.stream().map(DeliveryPendingVO::getLineId).collect(Collectors.toList());
List<LineInfoDO> lineInfoDOList = lineInfoDAO.getByLineIds(lineIdList);
Map<Long, String> lineMap = lineInfoDOList.stream().collect(Collectors.toMap(LineInfoDO::getId, LineInfoDO::getUsername));
List<Long> regionIds = pendingList.stream().filter(x->x.getRegionId()!=null).map(DeliveryPendingVO::getRegionId).collect(Collectors.toList());
List<Long> investRegionIds = pendingList.stream().filter(x->x.getInvestRegionId()!=null).map(DeliveryPendingVO::getRegionId).collect(Collectors.toList());
regionIds.addAll(investRegionIds);
Map<Long, String> regionNameMap = regionDao.getRegionNameMap(regionIds);
List<Long> shopIdList = pendingList.stream().map(DeliveryPendingVO::getShopId).collect(Collectors.toList());
List<ShopStageInfoDO> stageByShopSubStage = shopStageInfoDAO.getStageByShopSubStage(shopIdList, ShopSubStageEnum.SHOP_STAGE_29.getShopSubStage());
Map<Long, Integer> stageStatusMap = stageByShopSubStage.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, ShopStageInfoDO::getShopSubStageStatus));
result.getList().stream().forEach(x->{
x.setPartnerName(lineMap.get(x.getLineId()));
x.setRegionName(regionNameMap.get(x.getRegionId()));
x.setInvestRegionName(regionNameMap.get(x.getInvestRegionId()));
x.setSubStageStatus(stageStatusMap.get(x.getShopId()));
});
return result;
}
/**
* 通用查询

View File

@@ -33,6 +33,8 @@ import com.cool.store.utils.easyExcel.EasyExcelUtil;
import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.order.OrderDeviceDetailExportVO;
import com.cool.store.vo.order.OrderDeviceDetailVO;
import com.cool.store.vo.order.PCStoreOrderListVO;
import com.cool.store.vo.visit.VisitRecordListVO;
import com.cool.store.vo.point.PointExportVO;
@@ -856,6 +858,29 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
return o.toString();
}
@Override
@Async("generalThreadPool")
public void exportOrderDeviceDetail(Long orderId, ImportTaskDO importTaskDO) {
String url = "";
try {
List<OrderDeviceDetailVO> list = miniStoreOrderService.queryOrderDeviceDetailByOrderId(orderId);
if (CollectionUtils.isEmpty(list)) {
throw new ServiceException("订单设备明细数据为空");
}
List<OrderDeviceDetailExportVO> exportList = OrderDeviceDetailExportVO.convert(list);
url = easyExcelUtil.exportExcel(OrderDeviceDetailExportVO.class, exportList, null,
FileTypeEnum.ORDER_DEVICE_DETAIL_EXPORT.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()),
FileTypeEnum.ORDER_DEVICE_DETAIL_EXPORT.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()));
importTaskDO.setStatus(ImportStatusEnum.success.getCode());
importTaskDO.setFileUrl(url);
} catch (Exception e) {
log.error("订单设备明细导出失败", e);
importTaskDO.setStatus(ImportStatusEnum.fail.getCode());
} finally {
importTaskMapper.update(eid, importTaskDO);
}
}
private List<Date> JsonToDate(String json) {
if (StringUtils.isBlank(json)) {
return new ArrayList<>();

View File

@@ -334,5 +334,20 @@ public class ExportServiceImpl implements ExportService {
return count;
}
@Override
public Long exportOrderDeviceDetail(Long orderId, LoginUserInfo user) {
ImportTaskDO importTaskDO = new ImportTaskDO();
importTaskDO.setStatus(ImportStatusEnum.Ongoing.getCode());
importTaskDO.setFileName(FileTypeEnum.ORDER_DEVICE_DETAIL_EXPORT.getDesc() + DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1, new Date()));
importTaskDO.setIsImport(Boolean.FALSE);
importTaskDO.setFileType(FileTypeEnum.ORDER_DEVICE_DETAIL_EXPORT.getFileType());
importTaskDO.setCreateUserId(user.getUserId());
importTaskDO.setCreateTime(new Date().getTime());
importTaskDO.setCreateName(user.getName());
importTaskMapper.insert(eid, importTaskDO);
exportRealizeService.exportOrderDeviceDetail(orderId, importTaskDO);
return 1L;
}
}

View File

@@ -206,6 +206,7 @@ public class PreparationServiceImpl implements PreparationService {
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_1);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_150);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_290);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, list);
}
}

View File

@@ -1037,6 +1037,8 @@ public class ShopServiceImpl implements ShopService {
return getUsersByRoleAndRegion(ORDER_GROUP, shopInfo.getRegionId());
case SHOP_SUB_STAGE_STATUS_281:
return getUsersByRole(AI_STORE_TYPE_APPROVE);
case SHOP_SUB_STAGE_STATUS_281_2:
return getUsersByRole(DEVICE_SHIPMENT_CG);
default:
return Collections.emptyList();
}

View File

@@ -8,6 +8,7 @@ import com.cool.store.vo.order.MiniStoreOrderDetailVO;
import com.cool.store.vo.order.MiniStoreOrderListVO;
import com.cool.store.vo.order.MiniStoreWishlistDetailVO;
import com.cool.store.vo.order.MiniStoreWishlistListVO;
import com.cool.store.vo.order.OrderDeviceDetailVO;
import com.cool.store.vo.order.PCStoreOrderListVO;
import com.cool.store.vo.order.WalletPayVO;
import com.github.pagehelper.PageInfo;
@@ -29,9 +30,9 @@ public interface MiniStoreOrderService {
Long updateOrder(MiniStoreOrderUpdateRequest request,PartnerUserInfoVO user);
Boolean withdraw(Long orderId);
Boolean cancel(Long orderId);
// Boolean withdraw(Long orderId);
//
// Boolean cancel(Long orderId);
PageInfo<MiniStoreOrderListVO> queryPageByLineId(MiniStoreOrderLineQueryRequest request);
@@ -68,4 +69,13 @@ public interface MiniStoreOrderService {
Boolean changeWishlist(ChangeWishlistRequest request);
List<OrderDeviceDetailVO> queryOrderDeviceDetailByShopId(Long shopId);
/**
* 查询订单设备明细
* @param orderId 订单ID
* @return 订单设备明细列表
*/
List<OrderDeviceDetailVO> queryOrderDeviceDetailByOrderId(Long orderId);
}

View File

@@ -63,12 +63,7 @@ import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.config.ConfigItemCategoryVO;
import com.cool.store.vo.config.ConfigItemVO;
import com.cool.store.vo.dict.DictColumnVO;
import com.cool.store.vo.order.MiniStoreOrderDetailVO;
import com.cool.store.vo.order.MiniStoreOrderListVO;
import com.cool.store.vo.order.MiniStoreWishlistDetailVO;
import com.cool.store.vo.order.MiniStoreWishlistListVO;
import com.cool.store.vo.order.PCStoreOrderListVO;
import com.cool.store.vo.order.WalletPayVO;
import com.cool.store.vo.order.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -590,6 +585,26 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
throw new ServiceException(ErrorCodeEnum.CURRENT_ORDER_NOT_SUPPORT);
}
if (WAIT_CONFIRM.getCode().equals(currentStatus)){
//修改订单状态
order.setStatus(DEVICE_CONFIRM.getCode());
storeOrderDAO.updateSelective(order);
//修改阶段数据
shopStageInfoDAO.updateShopStageInfo(order.getShopId(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281_2);
//处理审批记录 通过
handleAudit(order.getShopId(),user,0,request.getRemark(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281);
//下一级审批记录
SysRoleRequest sysRoleRequest = new SysRoleRequest();
sysRoleRequest.setRoleName(AI_STORE_TYPE_APPROVE.getDesc());
List<EnterpriseUserDO> userListByRole = userAuthMappingService.findUserListByRole(sysRoleRequest, false);
operationLogService.addOperationLog(order.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281_2,
user.getUserId(), userListByRole,
OperationTypeEnum.OPERATION_TYPE_1, "待采购设备确认", OperationStatusEnum.NOT_PROCESSED, 1);
}
if (DEVICE_CONFIRM.getCode().equals(currentStatus)){
//修改订单状态
order.setStatus(INVEST_MANAGER_CONFIRM.getCode());
storeOrderDAO.updateSelective(order);
@@ -598,7 +613,7 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
shopStageInfoDAO.updateShopStageInfo(order.getShopId(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281_5);
//处理审批记录 通过
handleAudit(order.getShopId(),user,0,request.getRemark(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281);
handleAudit(order.getShopId(),user,0,request.getRemark(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281_2);
}
if (INVEST_MANAGER_CONFIRM.getCode().equals(currentStatus)){
@@ -878,65 +893,65 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
return order.getId();
}
@Override
@Transactional
public Boolean withdraw(Long orderId) {
if (orderId == null) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
// 1. 查询订单
StoreOrderDO order = storeOrderDAO.getById(orderId);
if (order == null) {
throw new ServiceException(ErrorCodeEnum.STORE_ORDER_NOT_FOUND);
}
// 2. 校验状态:仅待确认(5)和待支付(15)状态允许撤回
Integer status = order.getStatus();
if (!StoreOrderStatusEnum.canWithdraw(status)) {
throw new ServiceException(ErrorCodeEnum.STORE_ORDER_WITHDRAW_FORBIDDEN);
}
// 3. 更新订单状态为草稿(0)
StoreOrderDO updateOrder = StoreOrderDO.builder()
.id(orderId)
.status(StoreOrderStatusEnum.DRAFT.getCode())
.updateTime(new Date())
.build();
shopStageInfoDAO.updateShopStageInfo(order.getShopId(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_280);
return storeOrderDAO.updateSelective(updateOrder);
}
@Override
@Transactional
public Boolean cancel(Long orderId) {
if (orderId == null) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
// 1. 查询订单
StoreOrderDO order = storeOrderDAO.getById(orderId);
if (order == null) {
throw new ServiceException(ErrorCodeEnum.STORE_ORDER_NOT_FOUND);
}
// 2. 校验状态:仅草稿(0)状态允许作废
if (!StoreOrderStatusEnum.DRAFT.getCode().equals(order.getStatus())) {
throw new ServiceException(ErrorCodeEnum.STORE_ORDER_CANCEL_FORBIDDEN);
}
// 3. 更新订单状态为已结束(25)
StoreOrderDO updateOrder = StoreOrderDO.builder()
.id(orderId)
.status(StoreOrderStatusEnum.CLOSED.getCode()) // 已结束状态
.updateTime(new Date())
.build();
return storeOrderDAO.updateSelective(updateOrder);
}
// @Override
// @Transactional
// public Boolean withdraw(Long orderId) {
// if (orderId == null) {
// throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
// }
//
// // 1. 查询订单
// StoreOrderDO order = storeOrderDAO.getById(orderId);
// if (order == null) {
// throw new ServiceException(ErrorCodeEnum.STORE_ORDER_NOT_FOUND);
// }
//
// // 2. 校验状态:仅待确认(5)和待支付(15)状态允许撤回
// Integer status = order.getStatus();
// if (!StoreOrderStatusEnum.canWithdraw(status)) {
// throw new ServiceException(ErrorCodeEnum.STORE_ORDER_WITHDRAW_FORBIDDEN);
// }
//
// // 3. 更新订单状态为草稿(0)
// StoreOrderDO updateOrder = StoreOrderDO.builder()
// .id(orderId)
// .status(StoreOrderStatusEnum.DRAFT.getCode())
// .updateTime(new Date())
// .build();
//
// shopStageInfoDAO.updateShopStageInfo(order.getShopId(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_280);
//
// return storeOrderDAO.updateSelective(updateOrder);
// }
//
// @Override
// @Transactional
// public Boolean cancel(Long orderId) {
// if (orderId == null) {
// throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
// }
//
// // 1. 查询订单
// StoreOrderDO order = storeOrderDAO.getById(orderId);
// if (order == null) {
// throw new ServiceException(ErrorCodeEnum.STORE_ORDER_NOT_FOUND);
// }
//
// // 2. 校验状态:仅草稿(0)状态允许作废
// if (!StoreOrderStatusEnum.DRAFT.getCode().equals(order.getStatus())) {
// throw new ServiceException(ErrorCodeEnum.STORE_ORDER_CANCEL_FORBIDDEN);
// }
//
// // 3. 更新订单状态为已结束(25)
// StoreOrderDO updateOrder = StoreOrderDO.builder()
// .id(orderId)
// .status(StoreOrderStatusEnum.CLOSED.getCode()) // 已结束状态
// .updateTime(new Date())
// .build();
//
//
// return storeOrderDAO.updateSelective(updateOrder);
// }
@Override
@Transactional
@@ -2001,4 +2016,99 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
.filter(v -> StringUtils.isNotBlank(v.getColumnCode()))
.collect(Collectors.toMap(DictColumnVO::getColumnCode, DictColumnVO::getColumnName, (a, b) -> a));
}
@Override
public List<OrderDeviceDetailVO> queryOrderDeviceDetailByShopId(Long shopId) {
StoreOrderDO order = storeOrderDAO.getLatestOrderByShopId(shopId);
return queryOrderDeviceDetailByOrderId(order.getId());
}
@Override
public List<OrderDeviceDetailVO> queryOrderDeviceDetailByOrderId(Long orderId) {
if (orderId == null) {
return Collections.emptyList();
}
// 查询订单快照列表
List<StoreOrderOptionSnapshotDO> snapshotList = snapshotDAO.listByOrderId(orderId);
if (CollectionUtils.isEmpty(snapshotList)) {
return Collections.emptyList();
}
// 查询订单信息获取店型ID
StoreOrderDO orderDO = storeOrderDAO.getById(orderId);
if (orderDO == null) {
return Collections.emptyList();
}
// 获取费用类型字典映射(费用名称)
Map<String, String> expenseTypeNameMap = buildDictNameMap(32L);
// 获取配置大类名称映射
Set<String> categoryCodeSet = snapshotList.stream()
.map(StoreOrderOptionSnapshotDO::getCategoryCode)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toSet());
Map<String, String> categoryNameMap = configItemCategoryDAO.nameMap(new ArrayList<>(categoryCodeSet));
// 获取配置项名称映射
Set<String> itemCodeSet = snapshotList.stream()
.map(StoreOrderOptionSnapshotDO::getItemCode)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toSet());
Map<String, String> itemNameMap = configItemDAO.nameMap(new ArrayList<>(itemCodeSet));
// 查询店型选项绑定(获取默认数量)
Set<Long> optionIdSet = snapshotList.stream()
.map(StoreOrderOptionSnapshotDO::getOptionId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
List<StoreTypeOptionDO> storeTypeOptionList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(optionIdSet)) {
storeTypeOptionList = storeTypeOptionDAO.selectByIds(new ArrayList<>(optionIdSet), orderDO.getStoreTypeId());
}
Map<Long, BigDecimal> defaultQuantityMap = storeTypeOptionList.stream()
.collect(Collectors.toMap(StoreTypeOptionDO::getOptionId, StoreTypeOptionDO::getDefaultQuantity, (a, b) -> a));
// 按费用类型分组
Map<String, List<StoreOrderOptionSnapshotDO>> expenseTypeGroupMap = snapshotList.stream()
.filter(v -> StringUtils.isNotBlank(v.getExpenseTypeCode()))
.collect(Collectors.groupingBy(StoreOrderOptionSnapshotDO::getExpenseTypeCode));
List<OrderDeviceDetailVO> resultList = new ArrayList<>();
for (Map.Entry<String, List<StoreOrderOptionSnapshotDO>> expenseEntry : expenseTypeGroupMap.entrySet()) {
String expenseTypeCode = expenseEntry.getKey();
OrderDeviceDetailVO expenseVO = new OrderDeviceDetailVO();
expenseVO.setExpenseTypeCode(expenseTypeCode);
expenseVO.setExpenseTypeName(expenseTypeNameMap.getOrDefault(expenseTypeCode, expenseTypeCode));
// 转换为配置项明细
List<OrderDeviceConfigItemVO> configItemList = expenseEntry.getValue().stream()
.map(snapshot -> {
OrderDeviceConfigItemVO configItem = new OrderDeviceConfigItemVO();
configItem.setExpenseTypeCode(snapshot.getExpenseTypeCode());
configItem.setCategoryCode(snapshot.getCategoryCode());
configItem.setCategoryName(categoryNameMap.getOrDefault(snapshot.getCategoryCode(), snapshot.getCategoryCode()));
configItem.setItemCode(snapshot.getItemCode());
configItem.setItemName(itemNameMap.getOrDefault(snapshot.getItemCode(), snapshot.getItemCode()));
configItem.setOptionName(snapshot.getOptionName());
configItem.setOriginalOptionPrice(snapshot.getOriginalOptionPrice());
configItem.setOptionPrice(snapshot.getOptionPrice());
configItem.setQuantity(snapshot.getQuantity());
configItem.setAmount(snapshot.getAmount());
configItem.setOptionUnit(snapshot.getOptionUnit());
// 从店型选项绑定获取默认数量
configItem.setDefaultQuantity(defaultQuantityMap.get(snapshot.getOptionId()));
return configItem;
})
.collect(Collectors.toList());
expenseVO.setItems(configItemList);
resultList.add(expenseVO);
}
return resultList;
}
}

View File

@@ -0,0 +1,42 @@
package com.cool.store.service.plan;
import com.cool.store.enums.DeliveryPlanStageEnum;
import com.cool.store.enums.DeliveryStatusEnum;
import com.cool.store.request.plan.NotifyDeliveryRequest;
import com.cool.store.request.plan.UpdateDeliveryItemRequest;
import com.cool.store.vo.plan.DeliveryDetailVO;
import com.cool.store.vo.plan.DeliveryInfoVO;
/**
* 门店发货阶段服务接口
*/
public interface ShopDeliveryPlanService {
/**
* 通知发货
* @param request 通知发货请求
* @return 发货阶段枚举:待发货(1)
*/
Boolean notifyDelivery(NotifyDeliveryRequest request);
/**
* 查询发货信息
* @param shopId 门店ID
* @return 发货信息VO
*/
DeliveryInfoVO queryDeliveryInfo(Long shopId);
/**
* 更新发货项信息
* @param request 更新发货项请求
* @return 发货阶段枚举:待发货(1)、部分发货(2)、已完成(3)
*/
Boolean updateDeliveryItem(UpdateDeliveryItemRequest request);
/**
* 根据门店查询发货详细信息
* @param shopId 门店ID
* @return 发货详细信息VO
*/
DeliveryDetailVO queryDeliveryDetail(Long shopId);
}

View File

@@ -0,0 +1,227 @@
package com.cool.store.service.plan.impl;
import cn.hutool.core.date.DateUtil;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dao.*;
import com.cool.store.dao.order.StoreOrderDAO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.entity.SysRoleDO;
import com.cool.store.entity.order.StoreOrderDO;
import com.cool.store.entity.plan.ShopDeliveryPlanDO;
import com.cool.store.entity.plan.ShopDeliveryPlanItemDO;
import com.cool.store.enums.*;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.EnterpriseUserRoleMapper;
import com.cool.store.request.plan.NotifyDeliveryRequest;
import com.cool.store.request.plan.UpdateDeliveryItemRequest;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.service.impl.CommonService;
import com.cool.store.service.plan.ShopDeliveryPlanService;
import com.cool.store.utils.BeanUtil;
import com.cool.store.utils.CoolDateUtils;
import com.cool.store.vo.plan.DeliveryDetailVO;
import com.cool.store.vo.plan.DeliveryInfoVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 门店发货阶段服务实现类
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class ShopDeliveryPlanServiceImpl implements ShopDeliveryPlanService {
private final ShopDeliveryPlanDAO shopDeliveryPlanDAO;
private final ShopDeliveryPlanItemDAO shopDeliveryPlanItemDAO;
private final ShopStageInfoDAO shopStageInfoDAO;
private final StoreOrderDAO storeOrderDAO;
private final CommonService commonService;
private final EnterpriseUserDAO enterpriseUserDAO;
private final EnterpriseUserRoleMapper enterpriseUserRoleMapper;
private final ShopInfoDAO shopInfoDAO;
private final LineInfoDAO lineInfoDAO;
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean notifyDelivery(NotifyDeliveryRequest request) {
// 校验门店是否已存在发货计划
ShopDeliveryPlanDO existingPlan = shopDeliveryPlanDAO.getByShopId(request.getShopId());
if (existingPlan != null) {
throw new ServiceException("该门店已存在发货计划,不能重复通知发货");
}
// 创建发货计划主表
ShopDeliveryPlanDO planDO = new ShopDeliveryPlanDO();
planDO.setShopId(request.getShopId());
planDO.setExpectedDeliveryTime(request.getExpectedDeliveryDate());
planDO.setRemark(request.getRemark());
planDO.setCreateUser(CurrentUserHolder.getUser().getName());
int result = shopDeliveryPlanDAO.insert(planDO);
if (result <= 0) {
throw new ServiceException("创建发货计划失败");
}
// 创建默认的发货项明细(采购设备和火码设备,初始状态为未发货)
List<ShopDeliveryPlanItemDO> list = new ArrayList<>();
ShopDeliveryPlanItemDO purchaseItem = new ShopDeliveryPlanItemDO();
purchaseItem.setPlanId(planDO.getId());
purchaseItem.setItemType(DeliveryItemTypeEnum.PURCHASE_DEVICE.getCode());
purchaseItem.setDeliveryStatus(DeliveryStatusEnum.NOT_DELIVERED.getCode());
list.add(purchaseItem);
ShopDeliveryPlanItemDO fireCodeItem = new ShopDeliveryPlanItemDO();
fireCodeItem.setPlanId(planDO.getId());
fireCodeItem.setItemType(DeliveryItemTypeEnum.FIRE_CODE_DEVICE.getCode());
fireCodeItem.setDeliveryStatus(DeliveryStatusEnum.NOT_DELIVERED.getCode());
list.add(fireCodeItem);
shopDeliveryPlanItemDAO.batchInsert(list);
log.info("通知发货成功门店ID{}发货计划ID{}", request.getShopId(), planDO.getId());
//阶段变为待发货
shopStageInfoDAO.updateShopStageInfo(planDO.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_291);
//发送短信通知
List<String> userIds = enterpriseUserRoleMapper.getUserIdsByRoleIdList(Arrays.asList(UserRoleEnum.DEVICE_SHIPMENT_HM.getCode(), UserRoleEnum.DEVICE_SHIPMENT_CG.getCode()));
List<EnterpriseUserDO> userInfoByUserIds = enterpriseUserDAO.getUserInfoByUserIds(userIds);
userInfoByUserIds = userInfoByUserIds.stream().filter(x->StringUtils.isNotBlank(x.getMobile())).collect(Collectors.toList());
Map<String, String> templateParam = new HashMap<>();
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
templateParam.put("partnerName",lineInfo.getUsername());
templateParam.put("shopName",shopInfo.getShopName());
templateParam.put("shippingDate", DateUtil.format(request.getExpectedDeliveryDate(), CoolDateUtils.DATE_FORMAT_DAY));
userInfoByUserIds.stream().forEach(x->{
commonService.sendSms(x.getMobile(), SMSMsgEnum.DEVICE_NOTICE, templateParam);
});
return Boolean.TRUE;
}
@Override
public DeliveryInfoVO queryDeliveryInfo(Long shopId) {
if (shopId == null) {
return null;
}
ShopDeliveryPlanDO planDO = shopDeliveryPlanDAO.getByShopId(shopId);
if (planDO == null) {
return null;
}
return BeanUtil.toBean(planDO, DeliveryInfoVO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateDeliveryItem(UpdateDeliveryItemRequest request) {
// 查询发货计划
ShopDeliveryPlanDO planDO = shopDeliveryPlanDAO.getByShopId(request.getShopId());
if (planDO == null) {
throw new ServiceException("该门店不存在发货计划");
}
// 查询对应的发货项
ShopDeliveryPlanItemDO itemDO = shopDeliveryPlanItemDAO.getByPlanIdAndItemType(planDO.getId(), request.getItemType());
if (itemDO == null) {
throw new ServiceException("发货项不存在");
}
// 更新发货项信息
itemDO.setDeliveryStatus(request.getDeliveryStatus());
if (StringUtils.isNotBlank(request.getDeliveryRemark())) {
itemDO.setDeliveryRemark(request.getDeliveryRemark());
}
int result = shopDeliveryPlanItemDAO.update(itemDO);
if (result <= 0) {
throw new ServiceException("更新发货项失败");
}
ShopSubStageStatusEnum shopSubStageStatusEnum = calculateDeliveryStage(planDO.getId());
shopStageInfoDAO.updateShopStageInfo(planDO.getShopId(),shopSubStageStatusEnum );
// 重新计算发货阶段
return Boolean.TRUE;
}
@Override
public DeliveryDetailVO queryDeliveryDetail(Long shopId) {
if (shopId == null) {
return null;
}
DeliveryDetailVO vo = new DeliveryDetailVO();
StoreOrderDO latestOrderByShopId = storeOrderDAO.getLatestOrderByShopId(shopId);
if (latestOrderByShopId!=null){
vo.setOrderId(latestOrderByShopId.getId());
}
ShopDeliveryPlanDO planDO = shopDeliveryPlanDAO.getByShopId(shopId);
if (planDO == null) {
return vo;
}
BeanUtils.copyProperties(planDO,vo,"orderId");
// 查询发货项明细
List<ShopDeliveryPlanItemDO> items = shopDeliveryPlanItemDAO.listByPlanId(planDO.getId());
if (CollectionUtils.isNotEmpty(items)) {
for (ShopDeliveryPlanItemDO item : items) {
if (DeliveryItemTypeEnum.PURCHASE_DEVICE.getCode().equals(item.getItemType())) {
vo.setPurchaseDeviceDeliveryStatus(item.getDeliveryStatus());
vo.setPurchaseDeviceDeliveryRemark(item.getDeliveryRemark());
} else if (DeliveryItemTypeEnum.FIRE_CODE_DEVICE.getCode().equals(item.getItemType())) {
vo.setFireCodeDeviceDeliveryStatus(item.getDeliveryStatus());
vo.setFireCodeDeviceDeliveryRemark(item.getDeliveryRemark());
}
}
}
// 计算发货阶段
return vo;
}
/**
* 计算发货阶段
* @param planId 发货计划ID
* @return 发货阶段枚举
*/
private ShopSubStageStatusEnum calculateDeliveryStage(Long planId) {
List<ShopDeliveryPlanItemDO> items = shopDeliveryPlanItemDAO.listByPlanId(planId);
if (CollectionUtils.isEmpty(items)) {
return ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_291;
}
int deliveredCount = 0;
int totalCount = items.size();
for (ShopDeliveryPlanItemDO item : items) {
if (DeliveryStatusEnum.DELIVERED.getCode().equals(item.getDeliveryStatus())) {
deliveredCount++;
}
}
if (deliveredCount == 0) {
return ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_291;
} else if (deliveredCount == totalCount) {
return ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_294;
} else {
return ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_292;
}
}
}

View File

@@ -141,7 +141,7 @@ public class PreAllocationRecordServiceImpl implements PreAllocationRecordServic
continue;
}
if (BigDecimal.ZERO.compareTo(item.getPayAmount())>=0){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE);
throw new ServiceException(ErrorCodeEnum.AMOUNT_GEN_ZERO);
}
Long id = item.getId();
if (id == null) {
@@ -276,6 +276,7 @@ public class PreAllocationRecordServiceImpl implements PreAllocationRecordServic
throw new ServiceException(ErrorCodeEnum.NOT_ENOUGH_BALANCE);
}
//首次缴款 校验总金额
log.info("batchTrans total:{},orderAmount",total,storeOrder.getTotalAmount());
if (req.getSubStage()==ShopSubStageEnum.SHOP_STAGE_28.getShopSubStage()){
if (total.compareTo(storeOrder.getTotalAmount())<0) {
throw new ServiceException(ErrorCodeEnum.NOT_ENOUGH_BALANCE);

View File

@@ -268,4 +268,11 @@ public class DeskController {
LoginUserInfo userInfo = CurrentUserHolder.getUser();
return ResponseResult.success(deskService.assignPendingList(request, userInfo));
}
@ApiOperation("待处理-设备通知")
@PostMapping("/deliveryPendingList")
public ResponseResult<PageInfo<DeliveryPendingVO>> deliveryPendingList(@RequestBody AssignPendingRequest request) {
LoginUserInfo userInfo = CurrentUserHolder.getUser();
return ResponseResult.success(deskService.deliveryPendingList(request, userInfo));
}
}

View File

@@ -0,0 +1,52 @@
package com.cool.store.controller.webb;
import com.cool.store.enums.DeliveryPlanStageEnum;
import com.cool.store.enums.DeliveryStatusEnum;
import com.cool.store.request.plan.NotifyDeliveryRequest;
import com.cool.store.request.plan.UpdateDeliveryItemRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.plan.ShopDeliveryPlanService;
import com.cool.store.vo.plan.DeliveryDetailVO;
import com.cool.store.vo.plan.DeliveryInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 门店发货阶段控制器
*/
@RequestMapping("/pc/shopDeliveryPlan")
@RestController
@Api("门店发货阶段")
public class ShopDeliveryPlanController {
@Resource
private ShopDeliveryPlanService shopDeliveryPlanService;
@PostMapping("/notifyDelivery")
@ApiOperation("通知发货")
public ResponseResult<Boolean> notifyDelivery(@RequestBody @Validated NotifyDeliveryRequest request) {
return ResponseResult.success(shopDeliveryPlanService.notifyDelivery(request));
}
@GetMapping("/queryDeliveryInfo")
@ApiOperation("查询发货信息")
public ResponseResult<DeliveryInfoVO> queryDeliveryInfo(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(shopDeliveryPlanService.queryDeliveryInfo(shopId));
}
@PostMapping("/updateDeliveryItem")
@ApiOperation("更新发货项信息")
public ResponseResult<Boolean> updateDeliveryItem(@RequestBody @Validated UpdateDeliveryItemRequest request) {
return ResponseResult.success(shopDeliveryPlanService.updateDeliveryItem(request));
}
@GetMapping("/queryDeliveryDetail")
@ApiOperation("根据门店查询发货详细信息")
public ResponseResult<DeliveryDetailVO> queryDeliveryDetail(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(shopDeliveryPlanService.queryDeliveryDetail(shopId));
}
}

View File

@@ -4,6 +4,7 @@ import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.request.order.*;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ExportService;
import com.cool.store.service.order.MiniStoreOrderService;
import com.cool.store.vo.order.*;
@@ -30,6 +31,7 @@ import java.util.List;
public class StoreOrderController {
private final MiniStoreOrderService miniStoreOrderService;
private final ExportService exportService;
@ApiOperation("订单 立规确认 加盟商确认")
@PostMapping("/passOrder")
@@ -117,4 +119,16 @@ public class StoreOrderController {
return ResponseResult.success(miniStoreOrderService.getCurrentShopBindWishlist(shopId));
}
@ApiOperation("查询订单设备明细")
@GetMapping("/queryOrderDeviceDetail")
public ResponseResult<List<OrderDeviceDetailVO>> queryOrderDeviceDetail(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(miniStoreOrderService.queryOrderDeviceDetailByShopId(shopId));
}
@ApiOperation("导出订单设备明细")
@PostMapping("/exportOrderDeviceDetail")
public ResponseResult<Long> exportOrderDeviceDetail(@RequestParam("orderId") Long orderId) {
return ResponseResult.success(exportService.exportOrderDeviceDetail(orderId, CurrentUserHolder.getUser()));
}
}

View File

@@ -0,0 +1,41 @@
package com.cool.store.controller.webc;
import com.cool.store.request.plan.NotifyDeliveryRequest;
import com.cool.store.request.plan.UpdateDeliveryItemRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.plan.ShopDeliveryPlanService;
import com.cool.store.vo.plan.DeliveryDetailVO;
import com.cool.store.vo.plan.DeliveryInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @Auther zx_szh
* @Date 2026/4/2 10:38
* @Version 1.0
*/
@RequestMapping("/mini/shopDeliveryPlan")
@RestController
@Api("门店发货阶段-小程序")
public class MiniShopDeliveryPlanController {
@Resource
private ShopDeliveryPlanService shopDeliveryPlanService;
@GetMapping("/queryDeliveryInfo")
@ApiOperation("查询发货信息")
public ResponseResult<DeliveryInfoVO> queryDeliveryInfo(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(shopDeliveryPlanService.queryDeliveryInfo(shopId));
}
@GetMapping("/queryDeliveryDetail")
@ApiOperation("根据门店查询发货详细信息")
public ResponseResult<DeliveryDetailVO> queryDeliveryDetail(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(shopDeliveryPlanService.queryDeliveryDetail(shopId));
}
}

View File

@@ -4,12 +4,15 @@ import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.request.order.*;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ExportService;
import com.cool.store.service.order.MiniStoreOrderService;
import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.order.MiniStoreOrderDetailVO;
import com.cool.store.vo.order.MiniStoreOrderListVO;
import com.cool.store.vo.order.MiniStoreWishlistDetailVO;
import com.cool.store.vo.order.MiniStoreWishlistListVO;
import com.cool.store.vo.order.OrderDeviceDetailVO;
import com.cool.store.vo.order.OrderDeviceConfigItemVO;
import com.github.pagehelper.PageInfo;
@@ -28,6 +31,7 @@ import javax.validation.Valid;
public class MiniStoreOrderController {
private final MiniStoreOrderService miniStoreOrderService;
private final ExportService exportService;
@ApiOperation("创建订单")
@PostMapping("/create")
@@ -59,17 +63,17 @@ public class MiniStoreOrderController {
return ResponseResult.success(miniStoreOrderService.updateOrder(request,PartnerUserHolder.getUser()));
}
@ApiOperation("撤回订单到草稿")
@PostMapping("/withdraw")
public ResponseResult<Boolean> withdraw(@RequestBody MiniStoreOrderRequest request) {
return ResponseResult.success(miniStoreOrderService.withdraw(request.getOrderId()));
}
@ApiOperation("作废订单")
@PostMapping("/cancel")
public ResponseResult<Boolean> cancel(@RequestBody MiniStoreOrderRequest request) {
return ResponseResult.success(miniStoreOrderService.cancel(request.getOrderId()));
}
// @ApiOperation("撤回订单到草稿")
// @PostMapping("/withdraw")
// public ResponseResult<Boolean> withdraw(@RequestBody MiniStoreOrderRequest request) {
// return ResponseResult.success(miniStoreOrderService.withdraw(request.getOrderId()));
// }
//
// @ApiOperation("作废订单")
// @PostMapping("/cancel")
// public ResponseResult<Boolean> cancel(@RequestBody MiniStoreOrderRequest request) {
// return ResponseResult.success(miniStoreOrderService.cancel(request.getOrderId()));
// }
@ApiOperation("门店预定列表")
@PostMapping("/queryPageByLineId")
@@ -131,4 +135,10 @@ public class MiniStoreOrderController {
return ResponseResult.success(miniStoreOrderService.passOrder(request, null));
}
@ApiOperation("查询订单设备明细")
@GetMapping("/queryOrderDeviceDetail")
public ResponseResult<List<OrderDeviceDetailVO>> queryOrderDeviceDetail(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(miniStoreOrderService.queryOrderDeviceDetailByShopId(shopId));
}
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.controller.webc;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
@@ -37,6 +38,7 @@ import com.cool.store.service.impl.CommonService;
import com.cool.store.service.wallet.WalletService;
import com.cool.store.service.close.CloseStoreAccountService;
import com.cool.store.service.close.CloseStoreRefundService;
import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.poi.ExcelUtil;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.RegionPathNameVO;
@@ -108,11 +110,10 @@ public class TestController {
private WalletPayInfoDAO walletPayInfoDAO;
@Resource
private ShopAllocationInfoDAO shopAllocationInfoDAO;
@Resource
UserAuthMappingService userAuthMappingService;
@Resource
CommonService commonService;
@Resource
UserAuthMappingService userAuthMappingService;
@Autowired
private ShopInfoDAO shopInfoDAO;
@Resource
@@ -478,13 +479,26 @@ public class TestController {
return ResponseResult.success(storeService.handleStoreLogLai(flag,storeCode));
}
@Resource
LineInfoDAO lineInfoDAO;
@GetMapping("/testSendMsg")
public ResponseResult<Boolean> testSendMsg(@RequestParam(value = "poneNumber", required = false) String poneNumber ,
@RequestParam(value = "shopId", required = false) Long shopId ,
@RequestParam(value = "templateCode", required = false) SMSMsgEnum templateCode) {
commonService.sendSms(poneNumber, templateCode);
Map<String, String> templateParam = new HashMap<>();
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
Date date = new Date();
templateParam.put("partnerName",lineInfo.getUsername());
templateParam.put("shopName",shopInfo.getShopName());
templateParam.put("shippingDate", DateUtil.format(date, CoolDateUtils.DATE_FORMAT_DAY));
commonService.sendSms(poneNumber, templateCode,templateParam);
return ResponseResult.success();
}
@GetMapping("/pushReceiptToXGJ")
public ResponseResult<Boolean> pushReceiptToXGJ(@RequestParam(value = "shopId", required = false) Long shopId,
@RequestParam(value = "payId", required = false) Long payId) {

View File

@@ -55,7 +55,7 @@ oss.host=https://oss-cool.coolstore.cn/
#cdn地址
cdn.url=https://oss-cool.coolstore.cn
cdn.url=https://oss-cool.coolstore.cn/
#TRTC
trtc.sdkAppId=1600026212