Administrator
2025-07-14 17cea8fe652d1566e856e168d528a1af628e2140
feat(mall): 添加订单角标数量接口并优化相关功能

- 新增 findMarkCnt 接口,用于获取订单角标数量
- 优化订单列表查询逻辑,调整状态筛选条件
- 修复订单列表模板,移除冗余字段和操作按钮
- 优化订单发货和修改物流信息功能
- 添加 Redis 工具类用于本地唤醒状态保持
13 files modified
136 ■■■■■ changed files
src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesOrderController.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java 6 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesOrderItemInfoDto.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesOrderPayDto.java 2 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiMyDraftSaveDto.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiSocialInfoDto.java 2 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/mapper/ClothesOrderMapper.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java 16 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/ApiClothesOrderService.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java 28 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java 4 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/ClothesOrderMapper.xml 15 ●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/clothesType/orderList.html 31 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesOrderController.java
@@ -102,6 +102,14 @@
        return apiClothesOrderService.findOrderList(dto);
    }
    @ApiOperation(value = "获取订单角标数量")
    @GetMapping(value = "/findMarkCnt")
    public FebsResponse findMarkCnt() {
        return apiClothesOrderService.findMarkCnt();
    }
    @ApiOperation(value = "订单详情", notes = "订单详情")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = ApiClothesOrderListInfoVo.class)
src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java
@@ -244,9 +244,13 @@
     */
    @GetMapping("deliverGoods/{id}")
    @RequiresPermissions("deliverGoods:update")
    public String deliverGoods(@PathVariable long id, Model model) {
    public String deliverGoods(@PathVariable Long id, Model model) {
        AdminClothesDeliverGoodsVo data = new AdminClothesDeliverGoodsVo();
        ClothesOrder clothesOrder = clothesOrderMapper.selectById(id);
        data.setId(clothesOrder.getId());
        data.setName(clothesOrder.getName());
        data.setPhone(clothesOrder.getPhone());
        data.setAddress(clothesOrder.getAddress());
        data.setExpressCom("极兔快递");
        MallExpressInfo mallExpressInfo = mallExpressInfoMapper.selectOne(
                Wrappers.lambdaQuery(MallExpressInfo.class)
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesOrderItemInfoDto.java
@@ -15,10 +15,6 @@
    private Long skuId;
    @NotNull(message = "参数不能为空")
    @ApiModelProperty(value = "数量", example = "2")
    private Integer cnt;
    @NotNull(message = "参数不能为空")
    @ApiModelProperty(value = "类型 1正面图案 2反面图案 3工艺 4布料 5尺码 6尺码自定义", example = "2")
    private Integer type;
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesOrderPayDto.java
@@ -15,7 +15,7 @@
    @ApiModelProperty(value = "订单ID")
    private Long id;
    @NotBlank(message = "参数不能为空")
    @NotNull(message = "参数不能为空")
    @ApiModelProperty(value = "支付类型", example = "1微信2支付宝3余额")
    private Integer type;
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiMyDraftSaveDto.java
@@ -32,19 +32,6 @@
    private List<ApiLocationAddDto> locationList;
    @NotNull(message = "图案不能为空")
    @ApiModelProperty(value = "图案ID")
    private Long patternId;
    @ApiModelProperty(value = "自定义内容")
    private String patternRemark;
    @NotNull(message = "图案位置不能为空")
    @ApiModelProperty(value = "图案位置ID")
    private Long locationId;
    @NotNull(message = "布料不能为空")
    @ApiModelProperty(value = "布料ID")
    private Long clothId;
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiSocialInfoDto.java
@@ -7,7 +7,7 @@
import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "ApiMyDraftSaveDto", description = "参数")
@ApiModel(value = "ApiSocialInfoDto", description = "参数")
public class ApiSocialInfoDto {
    @NotNull(message = "社区不能为空")
src/main/java/cc/mrbird/febs/mall/mapper/ClothesOrderMapper.java
@@ -10,9 +10,14 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface ClothesOrderMapper extends BaseMapper<ClothesOrder> {
    Page<ApiClothesOrderListVo> selectPageInOrder(Page<ApiClothesOrderListVo> page,  @Param("record")ApiClothesOrderListVoDto dto);
    IPage<AdminClothesOrderListVo> selectOrderListInPage(Page<AdminClothesOrderListVo> page, @Param("record")AdminClothesOrderListDto dto);
    List<Map<String, Integer>> selectOrderStatusCnt(@Param("memberId")Long memberId);
}
src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java
@@ -2,6 +2,7 @@
import cc.mrbird.febs.common.enumerates.OrderStatusEnum;
import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.mall.entity.*;
import cc.mrbird.febs.mall.mapper.*;
import cn.hutool.core.collection.CollUtil;
@@ -90,10 +91,13 @@
    }
//    @Scheduled(cron = "0/5 * * * * ? ")
//    public void wakeup() {
//        log.info("本地保持唤醒状态");
//        Long id = 5L;
//        mallMemberMapper.selectById(id);
//    }
    @Autowired
    private RedisUtils redisUtils;
    @Scheduled(cron = "0/5 * * * * ? ")
    public void wakeup() {
        redisUtils.set("wakeup", "wakeup");
    }
}
src/main/java/cc/mrbird/febs/mall/service/ApiClothesOrderService.java
@@ -25,6 +25,8 @@
    FebsResponse findOrderList(ApiClothesOrderListVoDto dto);
    FebsResponse findMarkCnt();
    FebsResponse orderDetails(Long id);
    FebsResponse confirmOrder(Long id);
src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java
@@ -431,7 +431,7 @@
                orderItem.setItemId(cloth.getId());
                orderItem.setName(cloth.getName());
                orderItem.setPrice(cloth.getPrice());
                orderItem.setItemCnt(item.getCnt());
                orderItem.setItemCnt(orderItem.getItemCnt());
                orderItem.setAmount(cloth.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
                clothesOrderItemMapper.insert(orderItem);
@@ -445,7 +445,7 @@
                orderItem.setItemId(size.getId());
                orderItem.setName(size.getName());
                orderItem.setPrice(size.getPrice());
                orderItem.setItemCnt(item.getCnt());
                orderItem.setItemCnt(orderItem.getItemCnt());
                orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
                clothesOrderItemMapper.insert(orderItem);
@@ -459,7 +459,7 @@
                orderItem.setItemId(location.getId());
                orderItem.setName(location.getName());
                orderItem.setPrice(location.getPrice());
                orderItem.setItemCnt(item.getCnt());
                orderItem.setItemCnt(orderItem.getItemCnt());
                orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
                orderItem.setRemark(item.getPatternRemark());
                clothesOrderItemMapper.insert(orderItem);
@@ -475,7 +475,7 @@
                orderItem.setRemark(item.getPatternRemark());
                orderItem.setName(pattern.getName());
                orderItem.setPrice(pattern.getPrice());
                orderItem.setItemCnt(item.getCnt());
                orderItem.setItemCnt(orderItem.getItemCnt());
                orderItem.setRemark(item.getPatternRemark());
                orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
                clothesOrderItemMapper.insert(orderItem);
@@ -490,7 +490,7 @@
                orderItem.setItemId(art.getId());
                orderItem.setName(art.getName());
                orderItem.setPrice(art.getPrice());
                orderItem.setItemCnt(item.getCnt());
                orderItem.setItemCnt(orderItem.getItemCnt());
                orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
                clothesOrderItemMapper.insert(orderItem);
@@ -501,7 +501,7 @@
                orderItem.setItemId(clothesMemberStature.getId());
                orderItem.setName(clothesMemberStature.getName());
                orderItem.setPrice(BigDecimal.ZERO);
                orderItem.setItemCnt(item.getCnt());
                orderItem.setItemCnt(orderItem.getItemCnt());
                orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
                clothesOrderItemMapper.insert(orderItem);
@@ -747,6 +747,22 @@
        return new FebsResponse().success().data(voPage);
    }
    @Override
    public FebsResponse findMarkCnt() {
        Long memberId = LoginUserUtil.getLoginUser().getId();
        List<Map<String, Integer>> maps = clothesOrderMapper.selectOrderStatusCnt(memberId);
        Map<Integer, Integer> orderCnt = new HashMap<>();
        if (CollUtil.isNotEmpty(maps)) {
            for (Map<String, Integer> map : maps) {
                orderCnt.put(map.get("status"), map.get("cnt"));
            }
        }
        Map<String, Object> result = new HashMap<>();
        result.put("order", orderCnt);
        return new FebsResponse().success().data(result);
    }
    private List<ApiClothesOrderItemInfoVo> buildOrderItemInfo(Long id) {
src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java
@@ -547,8 +547,8 @@
        clothesOrderMapper.update(
                null,
                Wrappers.lambdaUpdate(ClothesOrder.class)
                        .set(ClothesOrder::getStatus, ClothesOrderStatusEnum.CANCEL.getValue())
                        .set(ClothesOrder::getUpdatedTime, new Date())
                        .set(ClothesOrder::getStatus, value)
                        .set(ClothesOrder::getUpdatedTime, date)
                        .eq(ClothesOrder::getId, id)
        );
    }
src/main/resources/mapper/modules/ClothesOrderMapper.xml
@@ -21,7 +21,7 @@
                        b.name like CONCAT('%', CONCAT(#{record.query}, '%')) or
                    )
                </if>
                <if test="record.status != null">
                <if test="record.status != 0">
                    and (
                        a.status  = #{record.status}
                    )
@@ -64,7 +64,7 @@
        <where>
            <if test="record != null">
                <if test="record.payResult != null">
                <if test="record.payResult != null and record.payResult != ''">
                    and a.pay_result = #{record.payResult}
                </if>
                <if test="record.status != null">
@@ -87,4 +87,15 @@
        order by a.created_time desc
    </select>
    <select id="selectOrderStatusCnt" resultType="java.util.Map">
        select
            a.status,
            count(1) cnt
        from clothes_order a
        where a.del_flag=0 and a.member_id=#{memberId}
        group by a.status
    </select>
</mapper>
src/main/resources/templates/febs/views/modules/clothesType/orderList.html
@@ -159,16 +159,19 @@
                }
                let ids = "";
                for(let i = 0;i < data.length;i++){
                    if(data[i].status != 1){
                    if(data[i].status != 2){
                        febs.alert.warn('请选择待发货的订单');
                        return;
                    }else{
                        ids = data[i].id;
                    }
                }
                console.log(ids);
                if(ids == null || ids == ""){
                    febs.alert.warn('请选择订单');
                    return;
                }
                febs.modal.open('发货', 'modules/clothesType/deliverGoods/' + data.id, {
                febs.modal.open('发货', 'modules/clothesType/deliverGoods/' + ids, {
                    btn: ['确认','取消'],
                    yes: function (index, layero) {
                        $('#deliver-update-clothes').find('#submit').trigger('click');
@@ -190,13 +193,15 @@
                    if(data[i].status != 2){
                        febs.alert.warn('请选择待收货的订单');
                        return;
                    }else{
                        ids = data[i].id;
                    }
                }
                if(ids == null || ids == ""){
                    febs.alert.warn('请选择订单');
                    return;
                }
                febs.modal.open('修改物流信息', 'modules/clothesType/deliverGoods/' + data.id, {
                febs.modal.open('修改物流信息', 'modules/clothesType/deliverGoods/' + ids, {
                    btn: ['确认','取消'],
                    yes: function (index, layero) {
                        $('#deliver-update-clothes').find('#deliverInfoSubmit').trigger('click');
@@ -215,7 +220,7 @@
                }
                let ids = "";
                for(let i = 0;i < data.length;i++){
                    if(data[i].status == 2 ){
                    if(data[i].status != 2 ){
                        febs.alert.warn('请选择待发货的订单');
                        return;
                    }else{
@@ -247,7 +252,7 @@
                    febs.alert.warn('请选择订单');
                    return;
                }
                febs.get(ctx + 'admin/clothesType/confirmOrder?ids='+ids, null, function () {
                febs.get(ctx + 'admin/clothesType/confirmOrder/'+ids, null, function () {
                    febs.alert.success('操作成功');
                    $query.click();
                });
@@ -278,7 +283,7 @@
        });
        function refundOrder(id) {
            febs.get(ctx + 'admin/clothesType/refundOrder' + id, null, function () {
            febs.get(ctx + 'admin/clothesType/refundOrder/' + id, null, function () {
                febs.alert.success('操作成功');
                $query.click();
            });
@@ -334,14 +339,15 @@
                cols: [[
                        {type: 'checkbox', fixed: 'left'},
                        {type: 'numbers', title: '', width: 80},
                        {title: '操作',
                            templet: function (d) {
                                    return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder">详情</button>'
                            },minWidth: 200,align:'center'},
                        // {title: '操作',
                        //     templet: function (d) {
                        //             return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder">详情</button>'
                        //     },minWidth: 200,align:'center'},
                        {field: 'orderNo', title: '订单编号', minWidth: 200,align:'left' ,totalRowText:"合计"},
                        {field: 'memberName', title: '购买人', minWidth: 100,align:'left'},
                        {field: 'typeName', title: '类型', minWidth: 100,align:'left'},
                        {field: 'typeImage', title: '图片', minWidth: 100,align:'left'},
                        // {field: 'goodsName', title: '商品', minWidth: 160,align:'left'},
                        // {field: 'typeImage', title: '图片', minWidth: 100,align:'left'},
                        {field: 'goodsCnt', title: '数量', minWidth: 120,align:'left'},
                        {field: 'status', title: '状态',
                            templet: function (d) {
@@ -359,7 +365,6 @@
                                    return ''
                                }
                            }, minWidth: 80,align:'center'},
                        {field: 'goodsName', title: '商品', minWidth: 160,align:'left'},
                        {field: 'amount', title: '总价', minWidth: 80,align:'left', totalRow:true},
                        {field: 'discountAmount', title: '优惠', minWidth: 80,align:'left', totalRow:true},
                        {field: 'carriage', title: '邮费', minWidth: 80,align:'left', totalRow:true},
@@ -388,8 +393,6 @@
                orderNo: $searchForm.find('input[name="orderNo"]').val().trim(),
                payResult: $searchForm.find("select[name='payResult']").val(),
                status: $searchForm.find("select[name='status']").val(),
                isHome: $searchForm.find("select[name='isHome']").val(),
                uniqueCode: $searchForm.find("select[name='uniqueCode']").val(),
            };
        }