DESKTOP-71BH0QO\L、ming
2021-04-19 3d93cf89ab294fcc17aaf519816db5ea63e875ea
Merge remote-tracking branch 'origin/master'

# Conflicts:
# springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
# springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ShopApi.java
# springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopOrderDAO.java
# springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComShopOrderService.java
# springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOrderServiceImpl.java
10个文件已修改
28个文件已添加
2614 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ComShopFundsExportDTO.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ComShopOrderDeliverDTO.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ComShopOrderExportDTO.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ComShopOrderShipDTO.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ExcelShopFundsDTO.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ExcelShopOrderDTO.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/PageComShopFundsSearchDTO.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/PageComShopOrderSearchDTO.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/helper/SerializerBigDecimal.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/ComShopFundsOrderVO.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/ComShopFundsVO.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/IPUtil.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/pom.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ShopApi.java 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopOrderDAO.java 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComShopOrderService.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComShopStoreService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOrderServiceImpl.java 324 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/.gitignore 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/mvnw 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/mvnw.cmd 182 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/pom.xml 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/ShopBackstageApplication.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/aop/OperLogAspect.java 326 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/FundsApi.java 149 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/GoodsApi.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/LogApi.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/LoginApi.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/OrderApi.java 179 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/config/SFTPConfig.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/config/SwaggerConfig.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/excel/CustomSheetWriteHandler.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/model/vos/LoginBody.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/utils/ClazzUtils.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/resources/bootstrap.yml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/resources/logback-spring.xml 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ComShopFundsExportDTO.java
New file
@@ -0,0 +1,34 @@
package com.panzhihua.common.model.dtos.shop;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * @ClasssName OrderShipDTO
 * @Description TODO
 * @Author cedoo
 * @Date 2021/4/16
 * @Version 1.0
 **/
@Data
@ApiModel("订单导出信息")
public class ComShopFundsExportDTO {
    @ApiModelProperty(value = "订单编号",example = "316356541616")
    private String orderNo;
    @ApiModelProperty(value = "支付时间-开始",example = "2021-03-18 19:59:06")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payTimeStart;
    @ApiModelProperty(value = "支付时间-结束",example = "2021-04-18 19:59:14")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payTimeEnd;
    @ApiModelProperty(value = "订单ID", notes = "如果指定了订单ID,其它搜索条件将被忽略,只导出指定订单")
    private Long[] orderIds;
    @JsonIgnore
    private Long userId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ComShopOrderDeliverDTO.java
New file
@@ -0,0 +1,24 @@
package com.panzhihua.common.model.dtos.shop;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NonNull;
import javax.validation.constraints.Min;
/**
 * @ClasssName OrderShipDTO
 * @Description TODO
 * @Author cedoo
 * @Date 2021/4/16
 * @Version 1.0
 **/
@Data
@ApiModel("订单发货信息")
public class ComShopOrderDeliverDTO {
    @ApiModelProperty(value = "订单号")
    private String orderNo;
    @ApiModelProperty(value = "订单ID")
    private Long orderId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ComShopOrderExportDTO.java
New file
@@ -0,0 +1,44 @@
package com.panzhihua.common.model.dtos.shop;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * @ClasssName OrderShipDTO
 * @Description TODO
 * @Author cedoo
 * @Date 2021/4/16
 * @Version 1.0
 **/
@Data
@ApiModel("订单导出信息")
public class ComShopOrderExportDTO {
    @ApiModelProperty(value = "订单编号",example = "316356541616")
    private String orderNo;
    @ApiModelProperty(value = "用户账号")
    private String userAccount;
    @ApiModelProperty(value = "收货人",example = "张三")
    private String receiverAccount;
    @ApiModelProperty(value = "收货人电话",example = "13123456789")
    private String receiverPhone;
    @ApiModelProperty(value = "商品",example = "鞋")
    private String goodsName;
    @ApiModelProperty(value = "订单状态(1.待付款 2.代发货 3.待收货 4.待评价 5.已完成 6.已取消)",example = "1")
    private Integer status;
    @ApiModelProperty(value = "下单时间-开始",example = "2021-04-01 19:58:41")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private String createAtStart;
    @ApiModelProperty(value = "下单时间-结束",example = "2021-04-18 19:58:54")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createAtEnd;
    @ApiModelProperty(value = "订单ID", notes = "如果指定了订单ID,其它搜索条件将被忽略,只导出指定订单")
    private Long[] orderIds;
    @JsonIgnore
    private Long userId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ComShopOrderShipDTO.java
New file
@@ -0,0 +1,25 @@
package com.panzhihua.common.model.dtos.shop;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @ClasssName OrderShipDTO
 * @Description TODO
 * @Author cedoo
 * @Date 2021/4/16
 * @Version 1.0
 **/
@Data
@ApiModel("订单发货信息")
public class ComShopOrderShipDTO {
    @ApiModelProperty(value = "订单号")
    private String orderNo;
    @ApiModelProperty(value = "ID")
    private Long orderId;
    @ApiModelProperty(value = "物流公司")
    private String logisticsCompany;
    @ApiModelProperty(value = "物流单号")
    private String logisticsNo;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ExcelShopFundsDTO.java
New file
@@ -0,0 +1,37 @@
package com.panzhihua.common.model.dtos.shop;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Date;
/**
 * @description: 商城订单导出
 * @author: Null
 * @date: 2021-4-18 16:13:21
 */
@Data
public class ExcelShopFundsDTO {
    @ExcelProperty("金额")
    @NumberFormat("0.00")
    private BigDecimal totalAmount;
    @ExcelProperty("支付时间")
    private String payTime;
    @ExcelProperty("订单编号")
    private String orderNo;
    @ExcelProperty("支付方式")
    private String payType;
    @ExcelProperty("收支类型")
    private String type;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/ExcelShopOrderDTO.java
New file
@@ -0,0 +1,57 @@
package com.panzhihua.common.model.dtos.shop;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
 * @description: 商城订单导出
 * @author: cedoo
 * @date: 2021-4-18 16:13:21
 */
@Data
public class ExcelShopOrderDTO {
    @ExcelProperty("商品总额")
    @NumberFormat("0.00")
    private BigDecimal goodsTotal;
    @ExcelProperty("全部商品")
    private String goodsName;
    @ExcelProperty("数量总计")
    private Integer goodsCount;
    @ExcelProperty("用户账号")
    private String account;
    @ExcelProperty("收货人")
    private String receiver;
    @ExcelProperty("收货人电话")
    private String receiverPhone;
    @ExcelProperty("收货地址")
    private String receiverAddress;
    @ExcelProperty("店铺名称")
    private String storeName;
    @ExcelProperty("备注")
    private String remark;
    @ExcelProperty("订单状态")
    private String status;
    @ExcelProperty("下单时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createAt;
    @ExcelProperty("付款时间")
    private String payTime;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/PageComShopFundsSearchDTO.java
New file
@@ -0,0 +1,35 @@
package com.panzhihua.common.model.dtos.shop;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * @ClasssName OrderSearchDTO
 * @Description 资金管理DTO
 * @Author cedoo
 * @Date 2021/4/16
 * @Version 1.0
 **/
@Data
@ApiModel("资金管理查询参数")
public class PageComShopFundsSearchDTO {
    @ApiModelProperty(value = "订单编号",example = "316356541616")
    private String orderNo;
    @ApiModelProperty(value = "支付时间-开始",example = "2021-03-18 19:59:06")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payTimeStart;
    @ApiModelProperty(value = "支付时间-结束",example = "2021-04-18 19:59:14")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payTimeEnd;
    @ApiModelProperty(value = "分页-当前页数",example = "1", required = true)
    private Long pageNum;
    @ApiModelProperty(value = "分页-每页记录数",example = "10", required = true)
    private Long pageSize;
    @JsonIgnore
    private Long userId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/PageComShopOrderSearchDTO.java
@@ -1,5 +1,6 @@
package com.panzhihua.common.model.dtos.shop;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -26,11 +27,15 @@
    private String receiverPhone;
    @ApiModelProperty(value = "商品",example = "鞋")
    private String goodsName;
    @ApiModelProperty(value = "店铺名称",example = "小二的店")
    private String storeName;
    @ApiModelProperty(value = "订单状态(1.待付款 2.代发货 3.待收货 4.待评价 5.已完成 6.已取消)",example = "1")
    private Date status;
    private Integer status;
    @ApiModelProperty(value = "下单时间-开始",example = "1")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private String createAtStart;
    @ApiModelProperty(value = "下单时间-结束",example = "1")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createAtEnd;
    @ApiModelProperty(value = "分页-当前页数",example = "1", required = true)
    private Long pageNum;
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/helper/SerializerBigDecimal.java
New file
@@ -0,0 +1,73 @@
package com.panzhihua.common.model.helper;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.ContextualSerializer;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Objects;
/**
 * BigDecimal序列化(默认保留二位小数和四舍五入)
 * @author   cedoo
 * @date 2021-4-19 01:24:28
 */
public class SerializerBigDecimal extends JsonSerializer<BigDecimal> implements ContextualSerializer {
    protected DecimalFormat decimalFormat;
    public SerializerBigDecimal() {
    }
    public SerializerBigDecimal(DecimalFormat decimalFormat) {
        this.decimalFormat = decimalFormat;
    }
    @Override
    public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        if(Objects.isNull(value)) {
            gen.writeNull();
        } else {
            if(null != decimalFormat) {
                gen.writeNumber(decimalFormat.format(value));
            }else {
                gen.writeNumber(value.setScale(2, BigDecimal.ROUND_HALF_UP));
            }
        }
    }
    @Override
    public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property)
            throws JsonMappingException {
        JsonFormat.Value format = findFormatOverrides(prov, property, handledType());
        if (format == null) {
            return this;
        }
        if (format.hasPattern()) {
            DecimalFormat decimalFormat = new DecimalFormat(format.getPattern());
            decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
            return new SerializerBigDecimal(decimalFormat);
        }
        return this;
    }
    protected JsonFormat.Value findFormatOverrides(SerializerProvider provider,
                                                   BeanProperty prop, Class<?> typeForDefaults)
    {
        if (prop != null) {
            return prop.findPropertyFormat(provider.getConfig(), typeForDefaults);
        }
        return provider.getDefaultPropertyFormat(typeForDefaults);
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/ComShopFundsOrderVO.java
New file
@@ -0,0 +1,39 @@
package com.panzhihua.common.model.vos.shop;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.panzhihua.common.model.helper.SerializerBigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel("商户资金订单信息")
public class ComShopFundsOrderVO {
    @ApiModelProperty("金额")
    //@JsonFormat(pattern = "0.00", shape = JsonFormat.Shape.STRING)
    //@JsonSerialize(using = SerializerBigDecimal.class)
    private BigDecimal totalAmount;
    @ApiModelProperty("支付时间")
    private String payTime;
    @ApiModelProperty("订单编号")
    private String orderNo;
    @ApiModelProperty("支付方式")
    private String payType;
    @ApiModelProperty("收支类型")
    private String type;
    @ApiModelProperty("订单ID")
    private long id;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/ComShopFundsVO.java
New file
@@ -0,0 +1,29 @@
package com.panzhihua.common.model.vos.shop;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.panzhihua.common.model.helper.SerializerBigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel("商户资金统计信息")
public class ComShopFundsVO {
    @ApiModelProperty(value = "当日收入")
    private BigDecimal todayTotal;
    @ApiModelProperty(value = "本周收入")
    private BigDecimal weekTotal;
    @ApiModelProperty(value = "本月收入")
    private BigDecimal monthTotal;
    @JsonIgnore
    private Long userId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -1837,7 +1837,7 @@
     * @param id
     * @return
     */
    @GetMapping("/shop/changeShopGoodsStatus")
    @PostMapping("/shop/changeShopGoodsStatus")
    R changeStatus(@RequestParam("id") Long id,@RequestParam("status")Integer status);
    /**
     * 结果
@@ -2028,4 +2028,68 @@
     */
    @GetMapping("/shop/capitalDetailByStore")
    R capitalDetailByStore(@RequestParam("id") Long id);
    /**
     * 订单发货
     * @param orderShipDTO 商城订单发货信息
     * @return  发货结果
     */
    @PostMapping("/shop/shipOrder")
    R shipOrder(@RequestBody ComShopOrderShipDTO orderShipDTO);
    /**
     * 订单配送
     * @param deliverDTO 订单信息
     * @return  配送结果
     */
    @PostMapping("/shop/deliverOrder")
    R deliverOrder(@RequestBody ComShopOrderDeliverDTO deliverDTO);
    /**
     * 订单完成配送
     * @param deliverDTO 订单信息
     * @return  配送完成结果
     */
    @PostMapping("/shop/finishDeliverOrder")
    R finishDeliverOrder(@RequestBody ComShopOrderDeliverDTO deliverDTO);
    /**
     * 获取用户商户详情
     * @param userId 用户ID
     */
    @GetMapping("/shop/getUserStoreInfo")
    R getUserStoreInfo(@RequestParam("userId") Long userId);
    /**
     * 订单导出信息
     * @param comShopOrderExportDTO 订单导出信息
     * @return  订单导出信息
     */
    @PostMapping("/shop/shopOrderExportData")
    R shopOrderExportData(@RequestBody ComShopOrderExportDTO comShopOrderExportDTO);
    /**
     * 资金管理导出信息
     * @param comShopFundsExportDTO 资金管理导出信息
     * @return  资金管理导出信息
     */
    @PostMapping("/shop/shopOrderFundsExportData")
    R shopOrderFundsExportData(@RequestBody ComShopFundsExportDTO comShopFundsExportDTO );
    /**
     * 店铺资金统计信息
     * @param userId 用户ID
     * @return  店铺资金统计信息
     */
    @GetMapping("/shop/getFundsStat")
    R getFundsStat(@RequestParam("userId") Long userId);
    /**
     * 店铺资金统计信息
     * @param pageComShopFundsSearchDTO 店铺资金
     * @return  店铺资金统计信息
     */
    @PostMapping("/shop/pageShopFunds")
    R pageShopFunds(@RequestBody PageComShopFundsSearchDTO pageComShopFundsSearchDTO);
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/IPUtil.java
@@ -94,9 +94,8 @@
                ipAddress =  "["+jsonObject.get("country")+"/" +jsonObject.get("city")+"]";
            }
        }catch(Exception e){
            log.error("获取IP所属地址出错",e);
            e.printStackTrace();
            log.error("获取IP所属地址出错");
            //e.printStackTrace();
        }
        return ipAddress;
    }
springcloud_k8s_panzhihuazhihuishequ/pom.xml
@@ -206,6 +206,7 @@
        <module>community_backstage</module>
        <module>service_community</module>
        <module>service_user</module>
        <module>shop_backstage</module>
    </modules>
    <packaging>pom</packaging>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ShopApi.java
@@ -97,6 +97,18 @@
        return comShopStoreService.getOneInfo(id);
    }
    /**
     * 获取用户商铺详细
     *
     * @param userId 用户ID
     * @return
     */
    @GetMapping("/getUserStoreInfo")
    public R getUserStoreInfo(@RequestParam("userId") Long userId) {
        return comShopStoreService.getUserStoreInfo(userId);
    }
    /**
     * 添加商城后台日志
     *
@@ -323,7 +335,7 @@
    /**
     * 商品列表-分页查询-运营后台
     * 商品列表-分页查询
     * @param pageComShopGoodsDTO 查询参数
     * @return PageShopStoreVO
     */
@@ -363,7 +375,6 @@
        return comShopGoodsService.deleteShopGoods(id);
    }
    /**
     * 修改商品状态
     * @param id
@@ -384,4 +395,77 @@
        return comShopOrderService.capitalDetailByStore(id);
    }
    /**
     * 订单发货
     * @param orderShipDTO 发货信息
     * @return 发货结果
     */
    @PostMapping("/shipOrder")
    R shipOrder(@RequestBody ComShopOrderShipDTO orderShipDTO){
        return comShopOrderService.shipOrder(orderShipDTO);
    }
    /**
     * 订单配送
     * @param deliverDTO 订单ID
     * @return 配送结果
     */
    @PostMapping("/deliverOrder")
    R deliverOrder(@RequestBody  ComShopOrderDeliverDTO deliverDTO){
        Long orderId = deliverDTO.getOrderId();
        return comShopOrderService.deliverOrder(orderId);
    }
    /**
     * 订单配送
     * @param deliverDTO 订单ID
     * @return 配送完成
     */
    @PostMapping("/finishDeliverOrder")
    R finishDeliverOrder(@RequestBody ComShopOrderDeliverDTO deliverDTO){
        Long orderId = deliverDTO.getOrderId();
        return comShopOrderService.finishDeliverOrder(orderId);
    }
    /**
     * 订单导出信息
     * @param comShopOrderExportDTO 订单导出信息
     * @return  订单导出信息
     */
    @PostMapping("/shopOrderExportData")
    R shopOrderExportData(@RequestBody ComShopOrderExportDTO comShopOrderExportDTO){
        return comShopOrderService.shopOrderExportData(comShopOrderExportDTO);
    }
    /**
     * 资金管理导出信息
     * @param comShopFundsExportDTO 资金管理导出信息
     * @return  资金管理导出信息
     */
    @PostMapping("/shopOrderFundsExportData")
    R shopOrderFundsExportData(@RequestBody ComShopFundsExportDTO comShopFundsExportDTO){
        return comShopOrderService.shopOrderFundsExportData(comShopFundsExportDTO);
    }
    /**
     * 用户资金统计信息
     * @param userId 用户ID
     * @return 统计信息
     */
    @GetMapping("/getFundsStat")
    R getFundsStat(@RequestParam("userId") Long userId){
        return comShopOrderService.getFundsStat(userId);
    }
    /**
     * 店铺资金统计信息
     * @param pageComShopFundsSearchDTO 店铺资金
     * @return  店铺资金统计信息
     */
    @PostMapping("/pageShopFunds")
    R pageShopFunds(@RequestBody PageComShopFundsSearchDTO pageComShopFundsSearchDTO){
        return comShopOrderService.pageShopFunds(pageComShopFundsSearchDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopOrderDAO.java
@@ -5,8 +5,10 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.shop.PageComOrderListDTO;
import com.panzhihua.common.model.vos.shop.*;
import com.panzhihua.common.model.dtos.shop.*;
import com.panzhihua.common.model.vos.shop.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.panzhihua.common.model.dtos.PageDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopOrderSearchDTO;
import com.panzhihua.common.model.vos.shop.ComShopOrderVO;
import com.panzhihua.service_community.model.dos.ComShopOrderDO;
import org.apache.ibatis.annotations.Mapper;
@@ -32,15 +34,188 @@
    IPage<ComShopOrderPageVO> pageOrderList(Page page,@Param("comOrderListDTO") PageComOrderListDTO comOrderListDTO);
    @Select("<script> " +
            "SELECT   ordr.id, ordr.store_id, ordr. user_id, ordr.order_no, ordr.pay_no, \n" +
            "    ordr.wx_tarde_no, ordr.status, ordr.pay_status, ordr.receiver_id, \n" +
            "    ordr.total_amount, ordr.discount_amount, ordr.pay_amount, ordr.pay_type,  \n" +
            "    ordr.pay_time, ordr.delivery_type, ordr.delivery_status, ordr.logistics_company, \n" +
            "    ordr.logistics_no, ordr.create_at  \n" +
            " FROM  com_shop_order ordr LEFT JOIN com_shop_order_goods goods ON ordr.id = goods.order_id \n" +
            " order by create_at desc"+
            "SELECT   sr.id, sr.store_id, sr.user_id, sr.order_no, sr.pay_no, \n" +
                "    sr.wx_tarde_no, sr.status, sr.pay_status, sr.receiver_id, \n" +
                "    sr.total_amount, sr.discount_amount, sr.pay_amount, sr.pay_type,  \n" +
                "    sr.pay_time, sr.delivery_type, sr.delivery_status, sr.logistics_company, \n" +
                "    sr.logistics_no, sr.create_at  \n" +
            " FROM com_shop_order sr LEFT JOIN com_shop_order_goods og ON sr.id = og.order_id \n" +
                " LEFT JOIN com_shop_goods_attr ga ON og.goods_attr_id = ga.id \n" +
                " LEFT JOIN sys_user su ON sr.user_id = su.user_id \n" +
                " LEFT JOIN com_shop_user_address uad ON sr.receiver_id = uad.id \n" +
                " LEFT JOIN com_shop_store ss ON sr.store_id = ss.id \n" +
            " WHERE sr.delete_status = 1" +
                "<if test='pageComShopOrderSearchDTO.userId != null'>" +
                " AND sr.user_id = #{pageComShopOrderSearchDTO.userId} " +
                " </if> " +
                "<if test='pageComShopOrderSearchDTO.createAtStart != null'>" +
                " AND #{pageComShopOrderSearchDTO.createAtStart}  <![CDATA[<=]]>  sr.create_at   " +
                " </if> " +
                "<if test='pageComShopOrderSearchDTO.createAtEnd != null'>" +
                " AND sr.create_at <![CDATA[<=]]> #{pageComShopOrderSearchDTO.createAtEnd} " +
                " </if> " +
                "<if test='pageComShopOrderSearchDTO.orderNo != null  '>" +
                " AND sr.order_no = #{pageComShopOrderSearchDTO.orderNo} " +
                " </if> " +
                "<if test='pageComShopOrderSearchDTO.userAccount != null  '>" +
                " AND su.phone = #{pageComShopOrderSearchDTO.userAccount} " +
                " </if> " +
                "<if test='pageComShopOrderSearchDTO.receiverAccount != null  '>" +
                " AND uad.name = #{pageComShopOrderSearchDTO.receiverAccount} " +
                " </if> " +
                "<if test='pageComShopOrderSearchDTO.receiverPhone != null '>" +
                " AND uad.phone = #{pageComShopOrderSearchDTO.receiverPhone} " +
                " </if> " +
                "<if test='pageComShopOrderSearchDTO.goodsName != null'>" +
                " AND og.goods_name like concat('%',  #{pageComShopOrderSearchDTO.goodsName}, '%') " +
                " </if> " +
                "<if test='pageComShopOrderSearchDTO.status != null '>" +
                " AND sr.status = #{pageComShopOrderSearchDTO.status} " +
                " </if> " +
                "<if test='pageComShopOrderSearchDTO.storeName != null '>" +
                " AND ss.name like concat('%', #{pageComShopOrderSearchDTO.storeName}, '%') " +
                " </if> " +
            " ORDER BY sr.create_at "+
            "</script>")
    IPage<ComShopOrderVO> pageOrderBy(PageDTO page,@Param("pageComShopOrderSearchDTO")  PageComShopOrderSearchDTO pageComShopOrderSearchDTO);
    IPage<ComShopOrderSearchVO> pageOrderBy(Page page, @Param("pageComShopOrderSearchDTO")  PageComShopOrderSearchDTO pageComShopOrderSearchDTO);
    @Select("<script> " +
            "SELECT sr.total_amount AS goods_total, GROUP_CONCAT(og.goods_name) AS goods_name , count(og.id) AS goods_count, " +
                " su.phone AS account, uad.name AS receiver, uad.phone AS receiverPhone, \n" +
                " concat(uad.province_name, uad.city_name, uad.district_name, uad.detail_address) AS receiver_address, ss.name AS storeName, sr.remark," +
                    "  CASE\n" +
                    "    WHEN sr.`status` = 1 THEN '待付款' \n" +
                    "    WHEN sr.`status` = 2 THEN '待发货' \n" +
                    "    WHEN sr.`status` = 3 THEN '待收货' \n" +
                    "    WHEN sr.`status` = 4 THEN '待评价' \n" +
                    "    WHEN sr.`status` = 5 THEN '已完成' \n" +
                    "    WHEN sr.`status` = 5 THEN '已取消' \n" +
                    "    ELSE  '---' \n" +
                    " END AS 'status' , " +
                " sr.create_at, " +
                    " CASE WHEN sr.pay_time IS NOT NULL THEN sr.pay_time ELSE '---' END  AS pay_time  " +
            " FROM com_shop_order sr LEFT JOIN com_shop_order_goods og ON sr.id = og.order_id \n" +
                " LEFT JOIN com_shop_goods_attr ga ON og.goods_attr_id = ga.id \n" +
                " LEFT JOIN sys_user su ON sr.user_id = su.user_id \n" +
                " LEFT JOIN com_shop_user_address uad ON sr.receiver_id = uad.id \n" +
                " LEFT JOIN com_shop_store ss ON sr.store_id = ss.id \n" +
            " WHERE sr.delete_status = 1" +
            "<if test='comShopOrderExportDTO.userId != null'>" +
            " AND ss.user_id = #{comShopOrderExportDTO.userId} " +
            " </if> " +
            "<if test='comShopOrderExportDTO.orderIds != null and comShopOrderExportDTO.orderIds.length>0 '>" +
                " AND sr.id in " +
                "<foreach collection='comShopOrderExportDTO.orderIds' item='id' index='index' open='(' close=')' separator=',' >\n" +
                    "  #{id}" +
                "</foreach>" +
            " </if> " +
            "<if test='comShopOrderExportDTO.orderIds == null or comShopOrderExportDTO.orderIds.length==0 '>" +
                "<if test='comShopOrderExportDTO.createAtStart != null '>" +
                " AND #{comShopOrderExportDTO.createAtStart}  <![CDATA[<=]]>  sr.create_at   " +
                " </if> " +
                "<if test='comShopOrderExportDTO.createAtEnd != null'>" +
                " AND sr.create_at <![CDATA[<=]]> #{comShopOrderExportDTO.createAtEnd} " +
                " </if> " +
                "<if test='comShopOrderExportDTO.orderNo != null '>" +
                " AND sr.order_no = #{comShopOrderExportDTO.orderNo} " +
                " </if> " +
                "<if test='comShopOrderExportDTO.userAccount != null  '>" +
                " AND su.phone = #{comShopOrderExportDTO.userAccount} " +
                " </if> " +
                "<if test='comShopOrderExportDTO.receiverAccount != null'>" +
                " AND uad.name = #{comShopOrderExportDTO.receiverAccount} " +
                " </if> " +
                "<if test='comShopOrderExportDTO.receiverPhone != null '>" +
                " AND uad.phone = #{comShopOrderExportDTO.receiverPhone} " +
                " </if> " +
                "<if test='comShopOrderExportDTO.goodsName != null '>" +
                " AND og.name like concat('%',  #{comShopOrderExportDTO.goodsName}, '%') " +
                " </if> " +
                "<if test='comShopOrderExportDTO.status != null  '>" +
                " AND sr.status = #{comShopOrderExportDTO.status} " +
                " </if> " +
            " </if> " +
            " GROUP BY sr.id ORDER BY sr.create_at "+
            "</script>")
    IPage<ExcelShopOrderDTO> selectOrderExport(Page page, @Param("comShopOrderExportDTO")  ComShopOrderExportDTO comShopOrderExportDTO);
    @Select("<script> " +
            "SELECT sr.total_amount, sr.pay_time, sr.order_no, \n" +
            " CASE  WHEN sr.pay_type = 1 THEN '微信支付'  ELSE '' END AS payType, \n" +
            " '收入' AS 'type' " +
            "FROM com_shop_order  sr LEFT JOIN com_shop_store st ON sr.store_id = st.id \n" +
            " WHERE sr.pay_status = 2 AND sr.delete_status=1 " +
            "<if test='comShopFundsExportDTO.userId != null'>" +
            " AND st.sys_user_id = #{comShopFundsExportDTO.userId} " +
            " </if> " +
            "<if test='comShopFundsExportDTO.orderIds != null and comShopFundsExportDTO.orderIds.length>0 '>" +
            " AND sr.id in " +
            "<foreach collection='comShopFundsExportDTO.orderIds' item='id' index='index' open='(' close=')' separator=',' >\n" +
            "  #{id}" +
            "</foreach>" +
            " </if> " +
            "<if test='comShopFundsExportDTO.orderIds == null or comShopFundsExportDTO.orderIds.length==0 '>" +
                "<if test='comShopFundsExportDTO.payTimeStart != null'>" +
                " AND #{comShopFundsExportDTO.payTimeStart}  <![CDATA[<=]]>  sr.pay_time   " +
                " </if> " +
                "<if test='comShopFundsExportDTO.payTimeEnd != null'>" +
                " AND sr.pay_time <![CDATA[<=]]> #{comShopFundsExportDTO.payTimeEnd} " +
                " </if> " +
                "<if test='comShopFundsExportDTO.orderNo != null '>" +
                " AND sr.order_no = #{comShopFundsExportDTO.orderNo} " +
                " </if> " +
            " </if> " +
            " GROUP BY sr.id ORDER BY sr.create_at "+
            "</script>")
    IPage<ExcelShopFundsDTO> selectFundsExport(Page page, @Param("comShopFundsExportDTO") ComShopFundsExportDTO comShopFundsExportDTO);
    @Select("<script> " +
            " SELECT sys_user_id,\n" +
            " sum(case when abt.days = DATE_FORMAT(NOW(),'%Y%m%d') then abt.t END) AS todayTotal,\n" +
            " sum(case when abt.days = DATE_FORMAT(NOW(),'%Y%u') then abt.t END) AS weekTotal,\n" +
            " sum(case when abt.days = DATE_FORMAT(NOW(),'%Y%m') then abt.t END) AS monthTotal\n" +
            "FROM (\n" +
            "SELECT ss.sys_user_id, (sr.pay_amount) AS t ,  DATE_FORMAT(sr.pay_time,'%Y%m%d') days\n" +
            "FROM com_shop_order sr LEFT JOIN  com_shop_store ss ON sr.store_id = ss.id\n" +
            "WHERE sr.pay_status = 2  AND DATE_FORMAT(sr.pay_time,'%Y%m%d') = DATE_FORMAT(NOW(),'%Y%m%d')\n" +
            "GROUP BY days\n" +
            "UNION \n" +
            "SELECT ss.sys_user_id, sum(sr.pay_amount) AS t,  DATE_FORMAT(sr.pay_time,'%Y%u') weeks\n" +
            "FROM com_shop_order sr LEFT JOIN  com_shop_store ss ON sr.store_id = ss.id\n" +
            "WHERE sr.pay_status = 2 AND DATE_FORMAT(sr.pay_time,'%Y%u') = DATE_FORMAT(NOW(),'%Y%u')\n" +
            "GROUP BY weeks\n" +
            "UNION \n" +
            "SELECT ss.sys_user_id, sum(sr.pay_amount) AS t,  DATE_FORMAT(sr.pay_time,'%Y%m') months\n" +
            "FROM com_shop_order sr LEFT JOIN  com_shop_store ss ON sr.store_id = ss.id\n" +
            "WHERE sr.pay_status = 2 AND DATE_FORMAT(sr.pay_time,'%Y%m') = DATE_FORMAT(NOW(),'%Y%m')\n" +
            "GROUP BY months\n" +
            ") abt\n" +
            "GROUP BY abt.sys_user_id "+
            "</script>")
    ComShopFundsVO queryStatis(Long userId);
    @Select("<script> " +
            "SELECT sr.id, sr.total_amount, sr.pay_time, sr.order_no, \n" +
            " CASE  WHEN sr.pay_type = 1 THEN '微信支付'  ELSE '' END AS payType, \n" +
            " '收入' AS 'type' " +
            "FROM com_shop_order  sr LEFT JOIN com_shop_store st ON sr.store_id = st.id \n" +
            " WHERE sr.pay_status = 2 AND sr.delete_status=1 " +
            "<if test='pageComShopFundsSearchDTO.userId != null'>" +
            " AND st.sys_user_id = #{pageComShopFundsSearchDTO.userId} " +
            " </if> " +
            "<if test='pageComShopFundsSearchDTO.payTimeStart != null'>" +
            " AND #{pageComShopFundsSearchDTO.payTimeStart}  <![CDATA[<=]]>  sr.pay_time   " +
            " </if> " +
            "<if test='pageComShopFundsSearchDTO.payTimeEnd != null'>" +
            " AND sr.pay_time <![CDATA[<=]]> #{pageComShopFundsSearchDTO.payTimeEnd} " +
            " </if> " +
            "<if test='pageComShopFundsSearchDTO.orderNo != null '>" +
            " AND sr.order_no = #{pageComShopFundsSearchDTO.orderNo} " +
            " </if> " +
            " GROUP BY sr.id ORDER BY sr.create_at "+
            "</script>")
    IPage<ComShopFundsOrderVO> pageShopFunds(Page page, @Param("pageComShopFundsSearchDTO") PageComShopFundsSearchDTO pageComShopFundsSearchDTO);
    @Select("<script> " +
            "SELECT\n" +
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComShopOrderService.java
@@ -2,6 +2,8 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.common.model.dtos.shop.*;
import com.panzhihua.common.model.dtos.shop.*;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.model.dos.ComShopOrderDO;
@@ -83,4 +85,52 @@
     */
    R capitalDetailByStore(Long id);
    /**
     * 订单发货
     * @param orderShipDTO 订单发货信息
     * @return 发货结果
     */
    R shipOrder(ComShopOrderShipDTO orderShipDTO);
    /**
     * 订单配送
     * @param orderId 订单id
     * @return 配送结果
     */
    R deliverOrder(Long orderId);
    /**
     * 订单完成配送
     * @param orderId 订单id
     * @return 完成配送结果
     */
    R finishDeliverOrder(Long orderId);
    /**
     * 获取订单导出数据
     * @param comShopOrderExportDTO 订单导出参数
     * @return 订单数据
     */
    R shopOrderExportData(ComShopOrderExportDTO comShopOrderExportDTO);
    /**
     * 获取资金导出数据
     * @param comShopFundsExportDTO 资金导出参数
     * @return 资金数据
     */
    R shopOrderFundsExportData(ComShopFundsExportDTO comShopFundsExportDTO);
    /**
     * 获取用户资金信息
     * @param userId 用户ID
     * @return 统计结果
     */
    R getFundsStat(Long userId);
    /**
     * 获取分页 资金订单数据
     * @param pageComShopFundsSearchDTO 资金导出参数
     * @return 资金订单数据
     */
    R pageShopFunds(PageComShopFundsSearchDTO pageComShopFundsSearchDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComShopStoreService.java
@@ -57,4 +57,11 @@
     * @return
     */
    R getOneInfo(Long id);
    /**
     * 获取用户商铺信息
     * @param userId
     * @return
     */
    R getUserStoreInfo(Long userId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOrderServiceImpl.java
@@ -1,5 +1,6 @@
package com.panzhihua.service_community.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -9,6 +10,7 @@
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.dao.ComShopOrderDAO;
import com.panzhihua.service_community.model.dos.ComShopOrderDO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.shop.*;
import com.panzhihua.common.utlis.OrderNoUtils;
import com.panzhihua.common.utlis.StringUtils;
@@ -49,6 +51,8 @@
    private ComShopOrderOperateDAO comShopOrderOperateDAO;
    @Resource
    private ComShopOrderGoodsDAO comShopOrderGoodsDAO;
    @Resource
    private ComShopOrderDAO comShopOrderDAO;
    /**
     * 订单预览
@@ -57,7 +61,7 @@
     * @return 订单预览数据
     */
    @Override
    public R orderPreview(ComShopOrderPreviewDTO orderPreviewDTO) {
    public R orderPreview(ComShopOrderPreviewDTO orderPreviewDTO){
        //返回参数
        ComShopOrderPreviewVO orderPreviewVO = new ComShopOrderPreviewVO();
@@ -67,11 +71,11 @@
        BigDecimal orderTotal = BigDecimal.ZERO;
        Integer orderGoodsTotal = 0;
        //判断提交方式
        if (orderPreviewDTO.getSubmitType().equals(ComShopOrderPreviewDTO.submitType.details)) {//详情页提交
        if(orderPreviewDTO.getSubmitType().equals(ComShopOrderPreviewDTO.submitType.details)){//详情页提交
            //查询商品信息
            ComShopGoodsDO goodsDO = comShopGoodsDAO.selectOne(new QueryWrapper<ComShopGoodsDO>().eq("id", orderPreviewDTO.getGoodsId())
                    .eq("status", ComShopGoodsDO.status.sell).eq("delete_status", ComShopGoodsDO.deleteStatus.no));
            if (goodsDO == null) {
            ComShopGoodsDO goodsDO = comShopGoodsDAO.selectOne(new QueryWrapper<ComShopGoodsDO>().eq("id",orderPreviewDTO.getGoodsId())
                    .eq("status",ComShopGoodsDO.status.sell).eq("delete_status",ComShopGoodsDO.deleteStatus.no));
            if(goodsDO == null){
                return R.fail("商品已下架或已删除");
            }
            //设置店铺id
@@ -79,7 +83,7 @@
            //查询商品规格信息
            ComShopGoodsAttrDO goodsAttrDO = comShopGoodsAttrDAO.selectById(orderPreviewDTO.getGoodsAttrId());
            if (goodsAttrDO == null) {
            if(goodsAttrDO == null){
                return R.fail("商品规格不存在");
            }
@@ -94,15 +98,15 @@
            orderGoodsVO.setPrice(goodsAttrDO.getPrice());
            orderGoodsVO.setNum(orderPreviewDTO.getBuyNum());
            orderGoodsList.add(orderGoodsVO);
        } else if (orderPreviewDTO.getSubmitType().equals(ComShopOrderPreviewDTO.submitType.cart)) {//购物车提交
        }else if(orderPreviewDTO.getSubmitType().equals(ComShopOrderPreviewDTO.submitType.cart)){//购物车提交
            List<ComShopCartDO> cartList = comShopCartDAO.selectBatchIds(orderPreviewDTO.getCartIds());
            if (cartList.isEmpty()) {
            if(cartList.isEmpty()){
                return R.fail("未找到购物车商品信息");
            }
            //设置店铺id
            storeId = cartList.get(0).getStoreId();
            //循环遍历购物车商品信息
            for (ComShopCartDO cartDO : cartList) {
            for (ComShopCartDO cartDO:cartList) {
                //商品信息赋值
                ComShopOrderGoodsVO orderGoodsVO = new ComShopOrderGoodsVO();
                orderGoodsVO.setGoodsId(cartDO.getGoodsId());
@@ -112,9 +116,9 @@
                orderGoodsVO.setGoodsName(cartDO.getGoodsName());
                //查询商品规格
                ComShopGoodsAttrDO goodsAttrDO = comShopGoodsAttrDAO.selectById(cartDO.getGoodsAttrId());
                if (goodsAttrDO != null) {
                if(goodsAttrDO != null){
                    orderGoodsVO.setPrice(goodsAttrDO.getPrice());
                } else {
                }else{
                    orderGoodsVO.setPrice(BigDecimal.ZERO);
                }
                orderTotal = orderTotal.add(orderGoodsVO.getPrice().multiply(BigDecimal.valueOf(cartDO.getAmount())));
@@ -128,37 +132,37 @@
        //查询店铺信息
        ComShopStoreDO storeDO = comShopStoreDAO.selectById(storeId);
        if (storeDO != null) {
        if(storeDO != null){
            PageShopStoreVO shopStoreVO = new PageShopStoreVO();
            BeanUtils.copyProperties(storeDO, shopStoreVO);
            BeanUtils.copyProperties(storeDO,shopStoreVO);
            orderPreviewVO.setShopStoreVO(shopStoreVO);
        }
        //查询默认收货地址
        //查询上次购买记录的收货地址
        List<ComShopOrderDO> shopOrders = this.baseMapper.selectList(new QueryWrapper<ComShopOrderDO>()
                .eq("user_id", orderPreviewDTO.getUserId()).orderByDesc("create_at"));
        if (shopOrders.isEmpty()) {//未查询到用户上一笔订单
                .eq("user_id",orderPreviewDTO.getUserId()).orderByDesc("create_at"));
        if(shopOrders.isEmpty()){//未查询到用户上一笔订单
            //查询用户收货地址中的默认地址
            ComShopUserAddressDO userAddressDO = comShopUserAddressDAO.selectOne(new QueryWrapper<ComShopUserAddressDO>()
                    .eq("user_id", orderPreviewDTO.getUserId()).eq("is_default", ComShopUserAddressDO.isDefault.yes));
            if (userAddressDO != null) {
                    .eq("user_id",orderPreviewDTO.getUserId()).eq("is_default",ComShopUserAddressDO.isDefault.yes));
            if(userAddressDO != null){
                ComShopUserAddressVO userAddressVO = new ComShopUserAddressVO();
                BeanUtils.copyProperties(userAddressDO, userAddressVO);
                BeanUtils.copyProperties(userAddressDO,userAddressVO);
                orderPreviewVO.setUserAddressVO(userAddressVO);
            } else {
            }else{
                List<ComShopUserAddressDO> userAddressDOList = comShopUserAddressDAO.selectList(new QueryWrapper<ComShopUserAddressDO>()
                        .eq("user_id", orderPreviewDTO.getUserId()).orderByDesc("create_at"));
                if (!userAddressDOList.isEmpty()) {
                        .eq("user_id",orderPreviewDTO.getUserId()).orderByDesc("create_at"));
                if(!userAddressDOList.isEmpty()){
                    ComShopUserAddressVO userAddressVO = new ComShopUserAddressVO();
                    BeanUtils.copyProperties(userAddressDOList.get(0), userAddressVO);
                    BeanUtils.copyProperties(userAddressDOList.get(0),userAddressVO);
                    orderPreviewVO.setUserAddressVO(userAddressVO);
                }
            }
        } else {//查询到用户上一笔订单
        }else{//查询到用户上一笔订单
            ComShopUserAddressDO userAddressDO = comShopUserAddressDAO.selectById(shopOrders.get(0).getReceiverId());
            ComShopUserAddressVO userAddressVO = new ComShopUserAddressVO();
            BeanUtils.copyProperties(userAddressDO, userAddressVO);
            BeanUtils.copyProperties(userAddressDO,userAddressVO);
            orderPreviewVO.setUserAddressVO(userAddressVO);
        }
@@ -167,19 +171,18 @@
    /**
     * 创建订单
     *
     * @param orderCreateDTO 创建订单请求参数
     * @return 创建结果
     * @param orderCreateDTO    创建订单请求参数
     * @return  创建结果
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public R orderCreate(ComShopOrderCreateDTO orderCreateDTO) {
    public R orderCreate(ComShopOrderCreateDTO orderCreateDTO){
        //创建返回参数
        ComShopOrderVO shopOrderVO = new ComShopOrderVO();
        //查询用户收货地址
        ComShopUserAddressDO userAddressDO = comShopUserAddressDAO.selectById(orderCreateDTO.getReceiverId());
        if (userAddressDO == null) {
        if(userAddressDO == null){
            return R.fail("收货地址不存在");
        }
        //用户id
@@ -196,13 +199,13 @@
        //创建订单商品信息
        List<ComShopOrderGoodsDO> orderGoodsDOList = new ArrayList<>();
        if (!orderCreateDTO.getOrderGoodsList().isEmpty()) {
            for (ComShopOrderCreateGoodsDTO createGoodsDTO : orderCreateDTO.getOrderGoodsList()) {
        if(!orderCreateDTO.getOrderGoodsList().isEmpty()){
            for (ComShopOrderCreateGoodsDTO createGoodsDTO:orderCreateDTO.getOrderGoodsList()) {
                //查询当前商品信息
                ComShopGoodsDO goodsDO = comShopGoodsDAO.selectOne(new QueryWrapper<ComShopGoodsDO>()
                        .eq("id", createGoodsDTO.getGoodsId()).eq("delete_status", ComShopGoodsDO.deleteStatus.no)
                        .eq("status", ComShopGoodsDO.status.sell));
                if (goodsDO == null) {
                        .eq("id",createGoodsDTO.getGoodsId()).eq("delete_status",ComShopGoodsDO.deleteStatus.no)
                        .eq("status",ComShopGoodsDO.status.sell));
                if(goodsDO == null){
                    log.error("未查询到商品信息,商品已下架活已删除,商品id" + createGoodsDTO.getGoodsId());
                    continue;
                }
@@ -217,7 +220,7 @@
                orderGoodsDO.setOrderNo(orderNo);
                //查询当前商品规格
                ComShopGoodsAttrDO goodsAttrDO = comShopGoodsAttrDAO.selectById(createGoodsDTO.getGoodsAttrId());
                if (goodsAttrDO == null) {
                if(goodsAttrDO == null){
                    log.error("未查询到商品规格信息,商品id" + createGoodsDTO.getGoodsId() + "商品规格id:" + createGoodsDTO.getGoodsAttrId());
                    continue;
                }
@@ -231,7 +234,7 @@
        }
        //如果是购物车提交,需要将购物车内商品移除
        if (orderCreateDTO.getSubmitType().equals(ComShopOrderCreateDTO.submitType.cart)) {
        if(orderCreateDTO.getSubmitType().equals(ComShopOrderCreateDTO.submitType.cart)){
            comShopCartDAO.deleteBatchIds(orderCreateDTO.getCartIds());
        }
@@ -247,13 +250,13 @@
        shopOrderDO.setTotalAmount(orderTotal);
        shopOrderDO.setDiscountAmount(BigDecimal.ZERO);
        shopOrderDO.setDeliveryType(deliveryType);
        if (StringUtils.isNotEmpty(orderCreateDTO.getRemark())) {
        if(StringUtils.isNotEmpty(orderCreateDTO.getRemark())){
            shopOrderDO.setRemark(orderCreateDTO.getRemark());
        }
        this.baseMapper.insert(shopOrderDO);
        if (!orderGoodsDOList.isEmpty()) {
            orderGoodsDOList.forEach(orderGoods -> {
        if(!orderGoodsDOList.isEmpty()){
            orderGoodsDOList.forEach(orderGoods ->{
                orderGoods.setOrderId(shopOrderDO.getId());
                comShopOrderGoodsDAO.insert(orderGoods);
            });
@@ -265,10 +268,10 @@
        orderOperateDO.setOperationType(ComShopOrderOperateDO.operationType.create);
        orderOperateDO.setOperationTime(new Date());
        if (StringUtils.isNotEmpty(orderCreateDTO.getPhone())) {
        if(StringUtils.isNotEmpty(orderCreateDTO.getPhone())){
            orderOperateDO.setOperationContent("用户" + orderCreateDTO.getPhone() + "下单");
            orderOperateDO.setOperationBy("用户" + orderCreateDTO.getPhone());
        } else {
        }else {
            orderOperateDO.setOperationContent("用户下单");
            orderOperateDO.setOperationBy("用户");
        }
@@ -281,24 +284,23 @@
    /**
     * 分页查询用户订单列表
     *
     * @param comOrderListDTO 请求参数
     * @return 查询结果
     * @param comOrderListDTO   请求参数
     * @return  查询结果
     */
    @Override
    public R pageOrderList(PageComOrderListDTO comOrderListDTO) {
        Page page = new Page<>(comOrderListDTO.getPageNum(), comOrderListDTO.getPageSize());
        IPage<ComShopOrderPageVO> orderPageVOIPage = this.baseMapper.pageOrderList(page, comOrderListDTO);
        if (!orderPageVOIPage.getRecords().isEmpty()) {
    public R pageOrderList(PageComOrderListDTO comOrderListDTO){
        Page page = new Page<>(comOrderListDTO.getPageNum(),comOrderListDTO.getPageSize());
        IPage<ComShopOrderPageVO> orderPageVOIPage = this.baseMapper.pageOrderList(page,comOrderListDTO);
        if(!orderPageVOIPage.getRecords().isEmpty()){
            orderPageVOIPage.getRecords().forEach(orderVo -> {
                List<ComShopOrderGoodsVO> orderGoodsVOS = new ArrayList<>();
                //查询订单下商品信息
                List<ComShopOrderGoodsDO> orderGoodsDOList = comShopOrderGoodsDAO.selectList(new QueryWrapper<ComShopOrderGoodsDO>()
                        .eq("order_no", orderVo.getOrderNo()));
                if (!orderGoodsDOList.isEmpty()) {
                        .eq("order_no",orderVo.getOrderNo()));
                if(!orderGoodsDOList.isEmpty()){
                    orderGoodsDOList.forEach(orderGoods -> {
                        ComShopOrderGoodsVO orderGoodsVO = new ComShopOrderGoodsVO();
                        BeanUtils.copyProperties(orderGoods, orderGoodsVO);
                        BeanUtils.copyProperties(orderGoods,orderGoodsVO);
                        orderGoodsVO.setNum(orderGoods.getAmount());
                        orderGoodsVO.setGoodsPic(orderGoods.getGoodsAttrPic());
                        orderGoodsVO.setPrice(orderGoods.getGoodsAttrPrice());
@@ -310,8 +312,8 @@
                PageShopStoreVO shopStoreVO = new PageShopStoreVO();
                //查询店铺信息
                ComShopStoreDO shopStoreDO = comShopStoreDAO.selectById(orderVo.getStoreId());
                if (shopStoreDO != null) {
                    BeanUtils.copyProperties(shopStoreDO, shopStoreVO);
                if(shopStoreDO != null){
                    BeanUtils.copyProperties(shopStoreDO,shopStoreVO);
                }
                orderVo.setShopStoreVO(shopStoreVO);
            });
@@ -321,9 +323,8 @@
    /**
     * 根据订单id查询订单详情
     *
     * @param orderId 订单id
     * @return 订单详情
     * @param orderId   订单id
     * @return  订单详情
     */
    @Override
    public R orderDetail(Long orderId) {
@@ -331,28 +332,28 @@
        ComShopOrderPageVO orderVO = new ComShopOrderPageVO();
        //查询订单信息
        ComShopOrderDO shopOrderDO = this.baseMapper.selectById(orderId);
        if (shopOrderDO == null) {
        if(shopOrderDO == null){
            return R.fail("未查询到订单");
        }
        BeanUtils.copyProperties(shopOrderDO, orderVO);
        BeanUtils.copyProperties(shopOrderDO,orderVO);
        orderVO.setOrderTotal(shopOrderDO.getTotalAmount());
        PageShopStoreVO shopStoreVO = new PageShopStoreVO();
        //查询店铺信息
        ComShopStoreDO shopStoreDO = comShopStoreDAO.selectById(shopOrderDO.getStoreId());
        if (shopStoreDO != null) {
            BeanUtils.copyProperties(shopStoreDO, shopStoreVO);
        if(shopStoreDO != null){
            BeanUtils.copyProperties(shopStoreDO,shopStoreVO);
        }
        orderVO.setShopStoreVO(shopStoreVO);
        List<ComShopOrderGoodsVO> orderGoodsVOS = new ArrayList<>();
        //查询订单下商品信息
        List<ComShopOrderGoodsDO> orderGoodsDOList = comShopOrderGoodsDAO.selectList(new QueryWrapper<ComShopOrderGoodsDO>()
                .eq("order_no", shopOrderDO.getOrderNo()));
        if (!orderGoodsDOList.isEmpty()) {
                .eq("order_no",shopOrderDO.getOrderNo()));
        if(!orderGoodsDOList.isEmpty()){
            orderGoodsDOList.forEach(orderGoods -> {
                ComShopOrderGoodsVO orderGoodsVO = new ComShopOrderGoodsVO();
                BeanUtils.copyProperties(orderGoods, orderGoodsVO);
                BeanUtils.copyProperties(orderGoods,orderGoodsVO);
                orderGoodsVO.setNum(orderGoods.getAmount());
                orderGoodsVO.setGoodsPic(orderGoods.getGoodsAttrPic());
                orderGoodsVO.setPrice(orderGoods.getGoodsAttrPrice());
@@ -364,8 +365,8 @@
        ComShopUserAddressVO userAddressVO = new ComShopUserAddressVO();
        //查询用户收货地址
        ComShopUserAddressDO userAddressDO = comShopUserAddressDAO.selectById(shopOrderDO.getReceiverId());
        if (userAddressDO != null) {
            BeanUtils.copyProperties(userAddressDO, userAddressVO);
        if(userAddressDO != null){
            BeanUtils.copyProperties(userAddressDO,userAddressVO);
            orderVO.setUserAddressVO(userAddressVO);
        }
@@ -374,40 +375,39 @@
    /**
     * 根据订单id取消订单
     *
     * @param orderId 订单id
     * @param phone   操作用户手机号
     * @return 取消结果
     * @param orderId   订单id
     * @param phone 操作用户手机号
     * @return  取消结果
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public R orderCancel(Long orderId, String phone) {
    public R orderCancel(Long orderId,String phone){
        //查询订单
        ComShopOrderDO shopOrderDO = this.baseMapper.selectById(orderId);
        if (shopOrderDO == null) {
        if(shopOrderDO == null){
            return R.fail("未查询到订单");
        }
        if (!shopOrderDO.getStatus().equals(ComShopOrderDO.status.dfk)) {
        if(!shopOrderDO.getStatus().equals(ComShopOrderDO.status.dfk)){
            return R.fail("已支付订单不可取消");
        }
        //取消订单
        shopOrderDO.setStatus(ComShopOrderDO.status.yqx);
        if (this.baseMapper.updateById(shopOrderDO) > 0) {
        if(this.baseMapper.updateById(shopOrderDO) > 0){
            //添加订单操作记录
            ComShopOrderOperateDO orderOperateDO = new ComShopOrderOperateDO();
            orderOperateDO.setOrderNo(shopOrderDO.getOrderNo());
            orderOperateDO.setOperationType(ComShopOrderOperateDO.operationType.cancel);
            orderOperateDO.setOperationTime(new Date());
            if (StringUtils.isNotEmpty(phone)) {
            if(StringUtils.isNotEmpty(phone)){
                orderOperateDO.setOperationContent("用户" + phone + "取消订单");
                orderOperateDO.setOperationBy("用户" + phone);
            } else {
            }else {
                orderOperateDO.setOperationContent("用户取消订单");
                orderOperateDO.setOperationBy("用户");
            }
            comShopOrderOperateDAO.insert(orderOperateDO);
            return R.ok();
        } else {
        }else{
            return R.fail("取消订单失败");
        }
@@ -415,77 +415,74 @@
    /**
     * 根据订单id删除订单
     *
     * @param orderId 订单id
     * @return 删除结果
     * @param orderId   订单id
     * @return  删除结果
     */
    @Override
    public R orderDelete(Long orderId) {
    public R orderDelete(Long orderId){
        //查询订单
        ComShopOrderDO shopOrderDO = this.baseMapper.selectById(orderId);
        if (shopOrderDO == null) {
        if(shopOrderDO == null){
            return R.fail("未查询到订单");
        }
        if (!shopOrderDO.getStatus().equals(ComShopOrderDO.status.ywc) && !shopOrderDO.getStatus().equals(ComShopOrderDO.status.yqx)) {
        if(!shopOrderDO.getStatus().equals(ComShopOrderDO.status.ywc) && !shopOrderDO.getStatus().equals(ComShopOrderDO.status.yqx)){
            return R.fail("该订单状态不可删除");
        }
        shopOrderDO.setDeleteStatus(ComShopOrderDO.deleteStatus.yes);
        if (this.baseMapper.updateById(shopOrderDO) > 0) {
        if(this.baseMapper.updateById(shopOrderDO) > 0){
            return R.ok();
        } else {
        }else{
            return R.fail("取消订单失败");
        }
    }
    /**
     * 根据订单id确认收货
     *
     * @param orderId 订单id
     * @param phone   手机号
     * @return 确认结果
     * @param orderId   订单id
     * @param phone 手机号
     * @return  确认结果
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public R orderConfirm(Long orderId, String phone) {
    public R orderConfirm(Long orderId, String phone){
        //查询订单
        ComShopOrderDO shopOrderDO = this.baseMapper.selectById(orderId);
        if (shopOrderDO == null) {
        if(shopOrderDO == null){
            return R.fail("未查询到订单");
        }
        if (!shopOrderDO.getStatus().equals(ComShopOrderDO.status.dsh)) {
        if(!shopOrderDO.getStatus().equals(ComShopOrderDO.status.dsh)){
            return R.fail("该订单状态不可确认收货");
        }
        //订单确认收货
        shopOrderDO.setStatus(ComShopOrderDO.status.ywc);
        if (this.baseMapper.updateById(shopOrderDO) > 0) {
        if(this.baseMapper.updateById(shopOrderDO) > 0){
            //添加订单操作记录
            ComShopOrderOperateDO orderOperateDO = new ComShopOrderOperateDO();
            orderOperateDO.setOrderNo(shopOrderDO.getOrderNo());
            orderOperateDO.setOperationType(ComShopOrderOperateDO.operationType.complete);
            orderOperateDO.setOperationTime(new Date());
            if (StringUtils.isNotEmpty(phone)) {
            if(StringUtils.isNotEmpty(phone)){
                orderOperateDO.setOperationContent("用户" + phone + "确认收货");
                orderOperateDO.setOperationBy("用户" + phone);
            } else {
            }else {
                orderOperateDO.setOperationContent("用户确认收货");
                orderOperateDO.setOperationBy("用户");
            }
            comShopOrderOperateDAO.insert(orderOperateDO);
            return R.ok();
        } else {
        }else{
            return R.fail("确认收货失败");
        }
    }
    /**
     * 统计用户订单数量
     *
     * @param userId 用户id
     * @return 统计结果
     * @param userId    用户id
     * @return  统计结果
     */
    @Override
    public R orderStatistics(Long userId) {
    public R orderStatistics(Long userId){
        OrderStatisticsVO orderStatisticsVO = new OrderStatisticsVO();
        //待付款订单数
        Integer paymentNum = 0;
@@ -494,14 +491,14 @@
        //待收货订单数
        Integer receivingNum = 0;
        List<ComShopOrderDO> shopOrderList = this.baseMapper.selectList(new QueryWrapper<ComShopOrderDO>()
                .eq("user_id", userId).eq("delete_status", ComShopOrderDO.deleteStatus.no));
        if (!shopOrderList.isEmpty()) {
            for (ComShopOrderDO orderDO : shopOrderList) {
                if (orderDO.getStatus().equals(ComShopOrderDO.status.dfk)) {
                .eq("user_id",userId).eq("delete_status",ComShopOrderDO.deleteStatus.no));
        if(!shopOrderList.isEmpty()){
            for (ComShopOrderDO orderDO:shopOrderList) {
                if(orderDO.getStatus().equals(ComShopOrderDO.status.dfk)){
                    paymentNum++;
                } else if (orderDO.getStatus().equals(ComShopOrderDO.status.dfh)) {
                }else if(orderDO.getStatus().equals(ComShopOrderDO.status.dfh)){
                    deliverNum++;
                } else if (orderDO.getStatus().equals(ComShopOrderDO.status.dsh)) {
                }else if(orderDO.getStatus().equals(ComShopOrderDO.status.dsh)){
                    receivingNum++;
                }
            }
@@ -513,23 +510,120 @@
    }
    @Override
    public R pageShopOrder(PageComShopOrderSearchDTO pageComShopOrderSearchDTO) {
    public R shipOrder(ComShopOrderShipDTO orderShipDTO) {
        ComShopOrderDO comShopOrderDO = comShopOrderDAO.selectById(orderShipDTO.getOrderId());
        if(comShopOrderDO==null){
            return R.fail("订单不存在");
        }
        if(!(comShopOrderDO.getStatus()==2)
                || !(comShopOrderDO.getDeleteStatus()==1)){
            return R.fail("订单发货失败,订单状态不允许发货");
        }
        comShopOrderDO.setDeliveryStatus(2);
        comShopOrderDO.setDeliveryType(2);
        comShopOrderDO.setStatus(3);
        comShopOrderDO.setLogisticsCompany(orderShipDTO.getLogisticsCompany());
        comShopOrderDO.setLogisticsNo(orderShipDTO.getLogisticsNo());
        int updated = comShopOrderDAO.updateById(comShopOrderDO);
        if(updated==1){
            return R.ok("发货成功");
        }
        return R.fail("发货失败!");
    }
    @Override
    public R deliverOrder(Long orderId) {
        ComShopOrderDO comShopOrderDO = comShopOrderDAO.selectById(orderId);
        if(comShopOrderDO==null){
            return R.fail("订单不存在");
        }
        if(!(comShopOrderDO.getStatus()==2)){
            return R.fail("当前订单不能配送");
        }
        comShopOrderDO.setDeliveryStatus(4);
        comShopOrderDO.setDeliveryType(1);
        int updated = comShopOrderDAO.updateById(comShopOrderDO);
        if(updated==1){
            return R.ok("开始配送");
        }
        return R.fail("操作失败!");
    }
    @Override
    public R finishDeliverOrder(Long orderId) {
        ComShopOrderDO comShopOrderDO = comShopOrderDAO.selectById(orderId);
        if(comShopOrderDO==null){
            return R.fail("订单不存在");
        }
        if(!(comShopOrderDO.getDeliveryStatus() == 4)){
            return R.fail("订单还未开始配送");
        }
        comShopOrderDO.setDeliveryStatus(5);
        int updated = comShopOrderDAO.updateById(comShopOrderDO);
        if(updated==1){
            return R.ok("配送完成");
        }
        return R.fail("操作失败!");
    }
    @Override
    public R shopOrderExportData(ComShopOrderExportDTO comShopOrderExportDTO) {
        Page page = new Page();
        page.setSize(1000);
        page.setCurrent(1);
        IPage<ExcelShopOrderDTO>  excelShopOrderDTO = comShopOrderDAO.selectOrderExport(page, comShopOrderExportDTO);
        return R.ok(excelShopOrderDTO.getRecords());
    }
    @Override
    public R shopOrderFundsExportData(ComShopFundsExportDTO comShopFundsExportDTO) {
        Page page = new Page();
        page.setSize(1000);
        page.setCurrent(1);
        IPage<ExcelShopFundsDTO>  excelShopFundsDTO = comShopOrderDAO.selectFundsExport(page, comShopFundsExportDTO);
        return R.ok(excelShopFundsDTO.getRecords());
    }
    @Override
    public R getFundsStat(Long userId) {
        ComShopFundsVO comShopFundsVO = comShopOrderDAO.queryStatis(userId);
        return R.ok(comShopFundsVO);
    }
    @Override
    public R pageShopFunds(PageComShopFundsSearchDTO pageComShopFundsSearchDTO) {
        Long pageNum = pageComShopFundsSearchDTO.getPageNum();
        Long pageSize = pageComShopFundsSearchDTO.getPageSize();
        Page page = new Page();
        if(pageNum==null||0==pageNum.longValue()){
            pageNum = 1l;
        }
        if(pageSize==null||0==pageSize.longValue()){
            pageSize = 10l;
        }
        page.setCurrent(pageNum);
        page.setSize(pageSize);
        IPage<ComShopFundsOrderVO>  comShopFundsOrderVOIPage = comShopOrderDAO.pageShopFunds(page, pageComShopFundsSearchDTO);
        return R.ok(comShopFundsOrderVOIPage);
    }
    @Override
    public R pageShopOrder(PageComShopOrderSearchDTO pageComShopOrderSearchDTO) {
        Long pageNum = pageComShopOrderSearchDTO.getPageNum();
        Long pageSize = pageComShopOrderSearchDTO.getPageSize();
        PageDTO page = new PageDTO();
        Page page = new Page();
        page.setPageNum(pageNum);
        page.setPageSize(pageSize);
        if (pageNum == null || new Long(0).equals(pageNum.longValue())) {
            page.setPageNum(1l);
        page.setCurrent(pageNum);
        page.setSize(pageSize);
        if(pageNum==null||0==pageNum.longValue()){
            page.setCurrent(1l);
        }
        if (pageSize == null || new Long(0).equals(pageSize.longValue())) {
            page.setPageSize(10l);
        if(pageSize==null||0==pageSize.longValue()){
            page.setSize(10l);
        }
        this.baseMapper.pageOrderBy(page, pageComShopOrderSearchDTO);
        return null;
        IPage<ComShopOrderSearchVO> ipage = this.baseMapper.pageOrderBy(page, pageComShopOrderSearchDTO);
        return R.ok(ipage);
    }
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
@@ -114,4 +114,15 @@
        BeanUtils.copyProperties(comShopStoreDO,shopStoreVO);
        return R.ok(shopStoreVO);
    }
    @Override
    public R getUserStoreInfo(Long userId) {
        ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>().eq(ComShopStoreDO::getDeleteStatus, 1).eq(ComShopStoreDO::getSysUserId, userId));
        if (comShopStoreDO == null) {
            R.fail(500,"商铺不存在");
        }
        ShopStoreVO shopStoreVO = new ShopStoreVO();
        BeanUtils.copyProperties(comShopStoreDO,shopStoreVO);
        return R.ok(shopStoreVO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/.gitignore
New file
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/mvnw
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/mvnw.cmd
New file
@@ -0,0 +1,182 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements.  See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership.  The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License.  You may obtain a copy of the License at
@REM
@REM    https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied.  See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
    if "%MVNW_VERBOSE%" == "true" (
        echo Found %WRAPPER_JAR%
    )
) else (
    if not "%MVNW_REPOURL%" == "" (
        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
    )
    if "%MVNW_VERBOSE%" == "true" (
        echo Couldn't find %WRAPPER_JAR%, downloading it ...
        echo Downloading from: %DOWNLOAD_URL%
    )
    powershell -Command "&{"^
        "$webclient = new-object System.Net.WebClient;"^
        "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
        "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
        "}"^
        "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
        "}"
    if "%MVNW_VERBOSE%" == "true" (
        echo Finished downloading %WRAPPER_JAR%
    )
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/pom.xml
New file
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.panzhihua</groupId>
        <artifactId>zhihuishequ</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <groupId>com.panzhihua</groupId>
    <artifactId>shop_backstage</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>shop_backstage</name>
    <description>商家后台</description>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.panzhihua</groupId>
            <artifactId>common</artifactId>
        </dependency>
        <dependency>
            <groupId>com.netflix.hystrix</groupId>
            <artifactId>hystrix-javanica</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>swagger-bootstrap-ui</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>com.panzhihua.community_backstage.CommunityBackstageApplication</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>1.2.0</version>
                <configuration>
                    <imageName>registry.cn-chengdu.aliyuncs.com/panzhihua/community_backstage:v1</imageName>
                    <serverId></serverId>
                    <baseImage>java</baseImage>
                    <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
        </repository>
    </repositories>
</project>
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/ShopBackstageApplication.java
New file
@@ -0,0 +1,23 @@
package com.panzhihua.shop_backstage;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@SpringCloudApplication
@EnableCircuitBreaker
@EnableEurekaClient
@EnableFeignClients(basePackages = {"com.panzhihua.common.service"})
@ComponentScan({"com.panzhihua.shop_backstage","com.panzhihua.common"})
public class ShopBackstageApplication {
    public static void main(String[] args) {
        SpringApplication.run(ShopBackstageApplication.class, args);
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/aop/OperLogAspect.java
New file
@@ -0,0 +1,326 @@
package com.panzhihua.shop_backstage.aop;
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.constants.TokenConstant;
import com.panzhihua.common.interfaces.ShopOperLog;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.shop.ShopOperLogVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.AES;
import com.panzhihua.common.utlis.IPUtil;
import com.panzhihua.shop_backstage.model.vos.LoginBody;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * @ClasssName 商家后台日志
 * @Description
 * @Author cedoo
 * @Date 2021/4/16
 * @Version 1.0
 **/
@Slf4j
@Aspect
@Component
public class OperLogAspect {
    @Resource
    private CommunityService communityService;
    @Resource
    private UserService userService;
    /**
     * 设置操作日志切入点 记录操作日志 在注解的位置切入代码
     */
    @Pointcut("@annotation(com.panzhihua.common.interfaces.ShopOperLog)")
    public void operLogPoinCut() {
    }
//    /**
//     * 设置操作异常切入点记录异常日志 扫描所有controller包下操作
//     */
//    @Pointcut("execution(* com.hyd.zcar.cms.controller..*.*(..))")
//    public void operExceptionLogPoinCut() {
//    }
    /**
     * 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行
     *
     * @param joinPoint 切入点
     * @param keys      返回结果
     */
    @AfterReturning(value = "operLogPoinCut()", returning = "keys")
    public void saveOperLog(JoinPoint joinPoint, Object keys) {
        log.info("进入切面");
        // 获取RequestAttributes
        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        // 从获取RequestAttributes中获取HttpServletRequest的信息
        HttpServletRequest request = (HttpServletRequest) requestAttributes
                .resolveReference(RequestAttributes.REFERENCE_REQUEST);
//        登录对象信息
        String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO);
        boolean empty = ObjectUtils.isEmpty(userInfo);
        if (empty) {
            log.error("操作日志获取登录用户信息失败【{}】",joinPoint);
            return;
        }
        byte[] bytes = AES.parseHexStr2Byte(userInfo);
        byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY);
        userInfo=new String(decrypt);
        LoginUserInfoVO loginUserInfoVO= JSONObject.parseObject(userInfo,LoginUserInfoVO.class);
        ShopOperLogVO shopOperlog = new ShopOperLogVO();
        try {
            // 从切面织入点处通过反射机制获取织入点处的方法
            MethodSignature signature = (MethodSignature) joinPoint.getSignature();
            // 获取切入点所在的方法
            Method method = signature.getMethod();
            // 获取操作
            ShopOperLog opLog = method.getAnnotation(ShopOperLog.class);
            if (opLog != null) {
                String operModul = opLog.operModul();
                int operType = opLog.operType();
                shopOperlog.setTitle(operModul); // 操作模块
                shopOperlog.setBusinessType(operType); // 操作类型
            }
            // 获取请求的类名
            String className = joinPoint.getTarget().getClass().getName();
            // 获取请求的方法名
            String methodName = method.getName();
            methodName = className + "." + methodName;
            shopOperlog.setMethod(methodName); // 请求方法
            if (joinPoint.getArgs().length > 0) {
                for (Object o : joinPoint.getArgs()) {
                    if (o instanceof HttpServletRequest || o instanceof HttpServletResponse) {
                        continue;
                    }
                    shopOperlog.setOperParam(JSONObject.toJSONString(o)); // 请求参数
                }
            }
            shopOperlog.setJsonResult(JSONObject.toJSONString(keys)); // 返回结果
            shopOperlog.setAccount(loginUserInfoVO.getAccount());
            shopOperlog.setOperName(loginUserInfoVO.getName()); // 请求用户名称
            shopOperlog.setOperIp(IPUtil.getIpAddress(request)); // 请求IP
            shopOperlog.setOperUrl(request.getRequestURI()); // 请求URI
            shopOperlog.setRequestMethod(request.getMethod());
            shopOperlog.setOperLocation(IPUtil.getIpBelongAddress(request));
            shopOperlog.setOperTime(new Date()); // 创建时间
            shopOperlog.setAccount(loginUserInfoVO.getAccount());
            Long communityId = loginUserInfoVO.getCommunityId();
            shopOperlog.setCommunityId(null==communityId?0:communityId);
            shopOperlog.setUserId(loginUserInfoVO.getUserId());
            communityService.addShopOperLog(shopOperlog);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
//    /**
//     * 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行
//     *
//     * @param joinPoint 切入点
//     * @param e         异常信息
//     */
//    @AfterThrowing(pointcut = "operExceptionLogPoinCut()", throwing = "e")
//    public void saveExceptionLog(JoinPoint joinPoint, Throwable e) {
//        // 获取RequestAttributes
//        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
//        // 从获取RequestAttributes中获取HttpServletRequest的信息
//        HttpServletRequest request = (HttpServletRequest) requestAttributes
//                .resolveReference(RequestAttributes.REFERENCE_REQUEST);
//
//        ExceptionLog excepLog = new ExceptionLog();
//        try {
//            // 从切面织入点处通过反射机制获取织入点处的方法
//            MethodSignature signature = (MethodSignature) joinPoint.getSignature();
//            // 获取切入点所在的方法
//            Method method = signature.getMethod();
//            excepLog.setExcId(UuidUtil.get32UUID());
//            // 获取请求的类名
//            String className = joinPoint.getTarget().getClass().getName();
//            // 获取请求的方法名
//            String methodName = method.getName();
//            methodName = className + "." + methodName;
//            // 请求的参数
//            Map<String, String> rtnMap = converMap(request.getParameterMap());
//            // 将参数所在的数组转换成json
//            String params = JSON.toJSONString(rtnMap);
//            excepLog.setExcRequParam(params); // 请求参数
//            excepLog.setOperMethod(methodName); // 请求方法名
//            excepLog.setExcName(e.getClass().getName()); // 异常名称
//            excepLog.setExcMessage(stackTraceToString(e.getClass().getName(), e.getMessage(), e.getStackTrace())); // 异常信息
//            excepLog.setOperUserId(UserShiroUtil.getCurrentUserLoginName()); // 操作员ID
//            excepLog.setOperUserName(UserShiroUtil.getCurrentUserName()); // 操作员名称
//            excepLog.setOperUri(request.getRequestURI()); // 操作URI
//            excepLog.setOperIp(IPUtil.getRemortIP(request)); // 操作员IP
//            excepLog.setOperVer(operVer); // 操作版本号
//            excepLog.setOperCreateTime(new Date()); // 发生异常时间
//
//            exceptionLogService.insert(excepLog);
//
//        } catch (Exception e2) {
//            e2.printStackTrace();
//        }
//
//    }
    /**
     * 转换request 请求参数
     *
     * @param paramMap request获取的参数数组
     */
    public Map<String, String> converMap(Map<String, String[]> paramMap) {
        Map<String, String> rtnMap = new HashMap<String, String>();
        for (String key : paramMap.keySet()) {
            rtnMap.put(key, paramMap.get(key)[0]);
        }
        return rtnMap;
    }
    private  String getPostData(HttpServletRequest request) {
        StringBuffer data = new StringBuffer();
        String line = null;
        BufferedReader reader = null;
        try {
            reader = request.getReader();
            while (null != (line = reader.readLine()))
                data.append(line);
        } catch (IOException e) {
        } finally {
        }
        return data.toString();
    }
    /**
     * 转换异常信息为字符串
     *
     * @param exceptionName    异常名称
     * @param exceptionMessage 异常信息
     * @param elements         堆栈信息
     */
    public String stackTraceToString(String exceptionName, String exceptionMessage, StackTraceElement[] elements) {
        StringBuffer strbuff = new StringBuffer();
        for (StackTraceElement stet : elements) {
            strbuff.append(stet + "\n");
        }
        String message = exceptionName + ":" + exceptionMessage + "\n\t" + strbuff.toString();
        return message;
    }
    /**
     * 登录日志切入点
     */
    @Pointcut("execution(public * com.panzhihua.shop_backstage.api.LoginApi.login(..) )")
    public void operLogLoginPoinCut() {
    }
    /**
     * 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行
     *
     * @param joinPoint 切入点
     * @param keys      返回结果
     */
    @AfterReturning(value = "operLogLoginPoinCut()", returning = "keys")
    public void saveLoginOperLog(JoinPoint joinPoint, Object keys) {
        log.info("进入商家后台登录日志切面");
        // 获取RequestAttributes
        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        // 从获取RequestAttributes中获取HttpServletRequest的信息
        HttpServletRequest request = (HttpServletRequest) requestAttributes
                .resolveReference(RequestAttributes.REFERENCE_REQUEST);
        if(keys instanceof R ){
            R r = (R)keys;
            if(r.getCode()==200 && "success".equals(r.getMsg())) {
                Object obj = joinPoint.getArgs();
                Object[] obja = (Object[])obj;
                LoginBody loginBody = (LoginBody)obja[0];
                String userName = loginBody.getAccount();
                R<LoginUserInfoVO> userR = userService.getUserInfo(userName+"_5");
                LoginUserInfoVO loginUserInfoVO = userR.getData();
                ShopOperLogVO shopOperlog = new ShopOperLogVO();
                try {
                    // 从切面织入点处通过反射机制获取织入点处的方法
                    MethodSignature signature = (MethodSignature) joinPoint.getSignature();
                    // 获取切入点所在的方法
                    Method method = signature.getMethod();
                    // 获取操作
                    ShopOperLog opLog = method.getAnnotation(ShopOperLog.class);
                    if (opLog != null) {
                        String operModul = opLog.operModul();
                        int operType = opLog.operType();
                        shopOperlog.setTitle(operModul); // 操作模块
                        shopOperlog.setBusinessType(operType); // 操作类型
                    }
                    // 获取请求的类名
                    String className = joinPoint.getTarget().getClass().getName();
                    // 获取请求的方法名
                    String methodName = method.getName();
                    methodName = className + "." + methodName;
                    shopOperlog.setMethod(methodName); // 请求方法
                    if (joinPoint.getArgs().length > 0) {
                        for (Object o : joinPoint.getArgs()) {
                            if (o instanceof HttpServletRequest || o instanceof HttpServletResponse) {
                                continue;
                            }
                            shopOperlog.setOperParam(JSONObject.toJSONString(o)); // 请求参数
                        }
                    }
                    shopOperlog.setJsonResult(JSONObject.toJSONString(keys)); // 返回结果
                    shopOperlog.setAccount(loginUserInfoVO.getAccount());
                    shopOperlog.setOperName(loginUserInfoVO.getName()); // 请求用户名称
                    shopOperlog.setOperIp(IPUtil.getIpAddress(request)); // 请求IP
                    shopOperlog.setOperUrl(request.getRequestURI()); // 请求URI
                    shopOperlog.setRequestMethod(request.getMethod());
                    shopOperlog.setOperLocation(IPUtil.getIpBelongAddress(request));
                    shopOperlog.setOperTime(new Date()); // 创建时间
                    shopOperlog.setAccount(loginUserInfoVO.getAccount());
                    Long communityId = loginUserInfoVO.getCommunityId();
                    shopOperlog.setCommunityId(null==communityId?0:communityId);
                    shopOperlog.setUserId(loginUserInfoVO.getUserId());
                    communityService.addShopOperLog(shopOperlog);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/FundsApi.java
New file
@@ -0,0 +1,149 @@
package com.panzhihua.shop_backstage.api;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.interfaces.ShopOperLog;
import com.panzhihua.common.model.dtos.shop.*;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.shop.ShopStoreVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.shop_backstage.excel.CustomSheetWriteHandler;
import com.panzhihua.shop_backstage.utils.ClazzUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * @ClasssName GoodsApi 商品API
 * @Description
 * @Author cedoo
 * @Date 2021/4/16
 * @Version 1.0
 **/
@Slf4j
@RestController
@RequestMapping("/funs")
@Api(tags = {"商家后台", "资金管理"})
public class FundsApi extends BaseController {
    @Resource
    private CommunityService communityService;
    @Value("${excel.userurl}")
    private String excelUrl;
    // FTP 登录用户名
    @Value("${ftp.username}")
    private String userName;
    // FTP 登录密码
    @Value("${ftp.password}")
    private String password;
    // FTP 服务器地址IP地址
    @Value("${ftp.host}")
    private String host;
    // FTP 端口
    @Value("${ftp.port}")
    private int port;
    @ApiOperation(value = "订单分页")
    @PostMapping("/page")
    public R page(@RequestBody PageComShopFundsSearchDTO pageComShopFundsSearchDTO){
        pageComShopFundsSearchDTO.setUserId(getUserId());
        ClazzUtils.setIfStringIsEmpty(pageComShopFundsSearchDTO);
        return communityService.pageShopFunds(pageComShopFundsSearchDTO);
    }
    @ApiOperation(value = "资金统计信息")
    @GetMapping("/stat")
    public R stat(){
        return communityService.getFundsStat(getUserId());
    }
    @ApiOperation(value = "导出表格")
    @PostMapping("/export")
    @ShopOperLog(operType = 12)
    public R export(@RequestBody ComShopFundsExportDTO comShopFundsExportDTO){
        ClazzUtils.setIfStringIsEmpty(comShopFundsExportDTO);
        String url=excelUrl;
        String uuid= UUID.randomUUID().toString().replace("-","");
        //String name=uuid+".xlsx";
        String ftpUrl="/mnt/data/web/excel/";
        R<ShopStoreVO> storeR = communityService.getUserStoreInfo(getUserId());
        if(!R.isOk(storeR)){
            return R.fail("用户不是商家");
        }
        ShopStoreVO shopStoreVO = JSONObject.parseObject(JSONObject.toJSONString(storeR.getData()),ShopStoreVO.class);
        Long userId = this.getUserId();
        comShopFundsExportDTO.setUserId(userId);
        R r=communityService.shopOrderFundsExportData(comShopFundsExportDTO);
        if (R.isOk(r)) {
            List<ExcelShopFundsDTO> excelShopFundsDTO = JSONArray.parseArray(JSONArray.toJSONString(r.getData()),ExcelShopFundsDTO.class);
            if(excelShopFundsDTO==null||excelShopFundsDTO.size()==0){
                return R.ok("未找到数据");
            }
            try {
                SFTPUtil sftp = new SFTPUtil(userName,password,host,port);
                sftp.login();
                String name = shopStoreVO.getName() +"-商家资金流水-" + new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()) + ".xlsx";
                boolean existDir = sftp.isExistDir(ftpUrl+name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator+name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream=null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ExcelShopFundsDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet(shopStoreVO.getName()+"订单").build();
                        excelWriter.write(excelShopFundsDTO, writeSheet);
                        excelWriter.finish();
                        File file=new File(fileName);
                        inputStream=new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】",absolutePath,delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
                            inputStream.close();
                        }
                        if (excelWriter != null) {
                            excelWriter.finish();
                        }
                    }
                }
                return R.ok(url+ URLEncoder.encode(name,"UTF-8"));
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
                return R.fail();
            }
        }
        return R.fail("导出数据失败");
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/GoodsApi.java
New file
@@ -0,0 +1,74 @@
package com.panzhihua.shop_backstage.api;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.shop.ComShopGoodsDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.shop.AddShopGoodsVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.validated.PageGroup;
import com.panzhihua.common.interfaces.ShopOperLog;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
 * @ClasssName GoodsApi 商品API
 * @Description
 * @Author cedoo
 * @Date 2021/4/16
 * @Version 1.0
 **/
@Slf4j
@RestController
@RequestMapping("/goods")
public class GoodsApi extends BaseController {
    @Resource
    private CommunityService communityService;
    @ApiOperation(value = "商品分页搜索")
    @PostMapping("/page")
    public R search(@RequestBody @Validated(PageGroup.class) ComShopGoodsDTO comShopGoodsDTO){
        return communityService.pageShopGoods(comShopGoodsDTO);
    }
    @ApiOperation(value = "添加商品")
    @ShopOperLog(operType = 3)
    @PostMapping("/add")
    public R search(@RequestBody AddShopGoodsVO addShopGoodsVO){
        return communityService.saveShopGoods(addShopGoodsVO);
    }
    @ApiOperation(value = "编辑商品")
    @ShopOperLog(operType = 4)
    @PutMapping("/edit/{id}")
    R editShopGoods(@PathVariable("id") Long id,@RequestBody AddShopGoodsVO addShopGoodsVO) {
        return communityService.editShopGoods(id,addShopGoodsVO);
    }
    @ApiOperation(value = "下架商品")
    @ShopOperLog(operType = 5)
    @PutMapping("/toggleDown/{id}")
    public R toggleDown(@PathVariable("id") Long id){
        return communityService.changeStatus(id,2);
    }
    @ApiOperation(value = "上架商品")
    @ShopOperLog(operType = 6)
    @PutMapping("/toggleUp/{id}")
    public R toggleUp(@PathVariable("id") Long id){
        return communityService.changeStatus(id,1);
    }
    @ApiOperation(value = "删除商品")
    @ShopOperLog(operType = 7)
    @DeleteMapping("/delete")
    R deleteShopGoods(@RequestBody Long[] id) {
        return communityService.deleteShopGoods(id);
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/LogApi.java
New file
@@ -0,0 +1,56 @@
package com.panzhihua.shop_backstage.api;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.PageDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.service.community.CommunityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
 * @ClasssName GoodsApi 商品API
 * @Description
 * @Author cedoo
 * @Date 2021/4/16
 * @Version 1.0
 **/
@Slf4j
@RestController
@RequestMapping("/log")
@Api(tags = {"商家后台", "操作日志"})
public class LogApi extends BaseController {
    @Resource
    private CommunityService communityService;
    @ApiOperation(value = "登陆用户操作日志")
    @GetMapping("/page")
    public R page(@RequestParam("pageNum") Long pageNum, @RequestParam("pageSize") Long pageSize){
        PageDTO pageDTO = new PageDTO();
        pageDTO.setPageNum(pageNum);
        pageDTO.setPageSize(pageSize);
        if(pageNum==null||new Long(0).equals(pageNum.longValue())){
            pageDTO.setPageNum(1l);
        }
        if(pageSize==null||new Long(0).equals(pageSize.longValue())){
            pageDTO.setPageSize(10l);
        }
        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
        if(loginUserInfoVO==null){
            return R.fail("未登陆");
        }
        pageDTO.setUserId(loginUserInfoVO.getUserId());
        return communityService.pageShopOperLog(pageDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/LoginApi.java
New file
@@ -0,0 +1,67 @@
package com.panzhihua.shop_backstage.api;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.user.ChangePasswordVO;
import com.panzhihua.common.service.auth.TokenService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.interfaces.ShopOperLog;
import com.panzhihua.shop_backstage.model.vos.LoginBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@Slf4j
@RestController
@RequestMapping("/")
@Api(tags = {"商家后台", "登录"})
public class LoginApi extends BaseController {
    @Resource
    private TokenService tokenService;
    @Resource
    private UserService userService;
    @ApiOperation(value = "商家后台登录")
    @ShopOperLog(operType = 1)
    @PostMapping("login")
    public R login(@RequestBody LoginBody loginBody){
        String account = loginBody.getAccount();
        String password = loginBody.getPassword();
        boolean empty = ObjectUtils.isEmpty(account);
        boolean empty1 = ObjectUtils.isEmpty(password);
        if (empty||empty1) {
            return R.fail("账户密码不能为空");
        }
        log.info("登录用户信息【{}】",loginBody);
        R r =  tokenService.loginShopBackStage(account,password);
        return r;
    }
    @ApiOperation(value = "修改密码")
    @PutMapping("changepassword")
    @ShopOperLog(operType = 2)
    public R changePassword(@Validated @RequestBody ChangePasswordVO changePasswordVO){
        Long userId = this.getUserId();
        String newPassword = changePasswordVO.getNewPassword();
        String oldPassword=changePasswordVO.getOldPassword();
        if (newPassword.equals(oldPassword)) {
            return R.fail("修改失败,新密码和原密码一致");
        }
        changePasswordVO.setUserId(userId);
        return userService.changePassword(changePasswordVO);
    }
    @ApiOperation(value = "当前登录用户信息",response = LoginUserInfoVO.class)
    @GetMapping("user")
    public R detailUser(){
        Long userId = this.getUserId();
        return userService.detailUser(userId);
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/OrderApi.java
New file
@@ -0,0 +1,179 @@
package com.panzhihua.shop_backstage.api;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.shop.*;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.interfaces.ShopOperLog;
import com.panzhihua.common.model.vos.shop.ShopStoreVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.shop_backstage.excel.CustomSheetWriteHandler;
import com.panzhihua.shop_backstage.utils.ClazzUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * @ClasssName GoodsApi 商品API
 * @Description
 * @Author cedoo
 * @Date 2021/4/16
 * @Version 1.0
 **/
@Slf4j
@RestController
@RequestMapping("/order")
@Api(tags = {"商家后台", "订单管理"})
public class OrderApi extends BaseController {
    @Resource
    private CommunityService communityService;
    @Value("${excel.userurl}")
    private String excelUrl;
    // FTP 登录用户名
    @Value("${ftp.username}")
    private String userName;
    // FTP 登录密码
    @Value("${ftp.password}")
    private String password;
    // FTP 服务器地址IP地址
    @Value("${ftp.host}")
    private String host;
    // FTP 端口
    @Value("${ftp.port}")
    private int port;
    @ApiOperation(value = "订单分页")
    @PostMapping("")
    public R page(@RequestBody @Validated PageComShopOrderSearchDTO pageComShopOrderSearchDTO){
        pageComShopOrderSearchDTO.setUserId(this.getUserId());
        ClazzUtils.setIfStringIsEmpty(pageComShopOrderSearchDTO);
        return communityService.pageShopOrder(pageComShopOrderSearchDTO);
    }
    @ApiOperation(value = "取消订单")
    @PutMapping("/cancel")
    @ShopOperLog(operType = 8)
    public R cancel(@RequestBody ComShopOrderQueryDTO comShopOrderQueryDTO){
        return communityService.orderCancel(comShopOrderQueryDTO);
    }
    @ApiOperation(value = "发货")
    @PutMapping("/ship")
    @ShopOperLog(operType = 9)
    public R ship(@RequestBody ComShopOrderShipDTO orderShipDTO){
        return communityService.shipOrder(orderShipDTO);
    }
    @ApiOperation(value = "配送")
    @PutMapping("/startDeliver")
    @ShopOperLog(operType = 10)
    public R deliver(@RequestBody ComShopOrderDeliverDTO deliverDTO){
        return communityService.deliverOrder(deliverDTO);
    }
    @ApiOperation(value = "配送完成")
    @PutMapping("/finishDeliver")
    public R finishDeliver(@RequestBody ComShopOrderDeliverDTO deliverDTO){
        return communityService.finishDeliverOrder(deliverDTO);
    }
    @ApiOperation(value = "订单详细")
    @GetMapping("/detail")
    @ShopOperLog(operType = 11)
    public R detail(@RequestParam("orderId") Long orderId){
        return communityService.orderDetail(orderId);
    }
    @ApiOperation(value = "导出表格")
    @PostMapping("/export")
    @ShopOperLog(operType = 12)
    public R export(@RequestBody ComShopOrderExportDTO comShopOrderExportDTO){
        ClazzUtils.setIfStringIsEmpty(comShopOrderExportDTO);
        String url=excelUrl;
        String uuid= UUID.randomUUID().toString().replace("-","");
        //String name=uuid+".xlsx";
        String ftpUrl="/mnt/data/web/excel/";
        R<ShopStoreVO> storeR = communityService.getUserStoreInfo(getUserId());
        if(!R.isOk(storeR)){
            return R.fail("用户不是商家");
        }
        ShopStoreVO shopStoreVO = JSONObject.parseObject(JSONObject.toJSONString(storeR.getData()),ShopStoreVO.class);
        Long userId = this.getUserId();
        comShopOrderExportDTO.setUserId(userId);
        R r=communityService.shopOrderExportData(comShopOrderExportDTO);
        if (R.isOk(r)) {
            List<ExcelShopOrderDTO> excelShopOrderDTO = JSONArray.parseArray(JSONArray.toJSONString(r.getData()),ExcelShopOrderDTO.class);
            if(excelShopOrderDTO==null||excelShopOrderDTO.size()==0){
                return R.ok("未找到数据");
            }
            try {
                SFTPUtil sftp = new SFTPUtil(userName,password,host,port);
                sftp.login();
                String name = shopStoreVO.getName() +"商城订单-" + new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()) + ".xlsx";
                boolean existDir = sftp.isExistDir(ftpUrl+name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator+name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream=null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ExcelShopOrderDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet(shopStoreVO.getName()+"订单").build();
                        excelWriter.write(excelShopOrderDTO, writeSheet);
                        excelWriter.finish();
                        File file=new File(fileName);
                        inputStream=new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】",absolutePath,delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
                            inputStream.close();
                        }
                        if (excelWriter != null) {
                            excelWriter.finish();
                        }
                    }
                }
                return R.ok(url+ URLEncoder.encode(name,"UTF-8"));
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
                return R.fail();
            }
        }
        return R.fail("导出数据失败");
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/config/SFTPConfig.java
New file
@@ -0,0 +1,30 @@
package com.panzhihua.shop_backstage.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
 * @Author: llming
 * @Description:
 */
@Configuration
@Data
public class SFTPConfig {
    // FTP 登录用户名
    @Value("${ftp.username}")
    private String userName;
    // FTP 登录密码
    @Value("${ftp.password}")
    private String password;
    // FTP 服务器地址IP地址
    @Value("${ftp.host}")
    private String host;
    // FTP 端口
    @Value("${ftp.port}")
    private int port;
    @Value("${ftp.url}")
    private String url;
    @Value("${excel.userurl}")
    private String excelUrl;
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/config/SwaggerConfig.java
New file
@@ -0,0 +1,40 @@
package com.panzhihua.shop_backstage.config;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: swagger3
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-11-19 16:08
 **/
@Configuration
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("商家后台管理接口")
                .description("。")
                .contact(new Contact("Ray。", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com"))
                .version("1.0")
                .build();
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/excel/CustomSheetWriteHandler.java
New file
@@ -0,0 +1,47 @@
package com.panzhihua.shop_backstage.excel;
import com.alibaba.excel.write.handler.SheetWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
import org.apache.poi.ss.usermodel.DataValidation;
import org.apache.poi.ss.usermodel.DataValidationConstraint;
import org.apache.poi.ss.usermodel.DataValidationHelper;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * 自定义拦截器.对第一列第一行和第二行的数据新增下拉框,显示 测试1 测试2
 *
 * @author Jiaju Zhuang
 */
public class CustomSheetWriteHandler implements SheetWriteHandler {
    private static final Logger LOGGER = LoggerFactory.getLogger(CustomSheetWriteHandler.class);
    @Override
    public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
    }
    @Override
    public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
        LOGGER.info("第{}个Sheet写入成功。", writeSheetHolder.getSheetNo());
        // 区间设置 第一列第一行和第二行的数据。由于第一行是头,所以第一、二行的数据实际上是第二三行
        CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(1, 2000, 1, 1);
        CellRangeAddressList cellRangeAddressList1 = new CellRangeAddressList(1, 2000, 3 ,3);
        CellRangeAddressList cellRangeAddressList2 = new CellRangeAddressList(1, 2000, 10 ,10);
        DataValidationHelper helper = writeSheetHolder.getSheet().getDataValidationHelper();
        DataValidationConstraint constraint = helper.createExplicitListConstraint(new String[] {"是", "否"});
        DataValidationConstraint constraint1 = helper.createExplicitListConstraint(new String[] {"中共党员","中共预备党员","共青团员","民革党员","民盟盟员","民建会员","农工党党员","致公党党员","九三学社社员","台盟盟员","无党派人士","群众"});
        DataValidationConstraint constraint2 = helper.createExplicitListConstraint(new String[] {"男", "女","未知"});
        DataValidation dataValidation = helper.createValidation(constraint2, cellRangeAddressList);
        DataValidation dataValidation1 = helper.createValidation(constraint, cellRangeAddressList1);
        DataValidation dataValidation2= helper.createValidation(constraint1, cellRangeAddressList2);
        writeSheetHolder.getSheet().addValidationData(dataValidation);
        writeSheetHolder.getSheet().addValidationData(dataValidation1);
        writeSheetHolder.getSheet().addValidationData(dataValidation2);
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/model/vos/LoginBody.java
New file
@@ -0,0 +1,26 @@
package com.panzhihua.shop_backstage.model.vos;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 登录
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-11-24 10:54
 **/
@Data
@ApiModel(value = "小程序后台登录")
@AllArgsConstructor
@NoArgsConstructor
public class LoginBody {
    @ApiModelProperty(value = "登录账户")
    private String account;
    @ApiModelProperty(value = "登录密码")
    private String password;
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/utils/ClazzUtils.java
New file
@@ -0,0 +1,52 @@
package com.panzhihua.shop_backstage.utils;
import com.panzhihua.common.model.dtos.shop.PageComShopOrderSearchDTO;
import java.lang.reflect.Field;
import java.text.DecimalFormat;
import java.util.Arrays;
/**
 * 工具类
 */
public class ClazzUtils {
    /**
     * 如果string属性为“”, 则将其设置为NULL
     * @param o
     */
    public static void setIfStringIsEmpty(Object o){
        if(o==null){
            return;
        }
        Class clazz = o.getClass();
        Field[] fields = clazz.getDeclaredFields();
        Arrays.stream(fields).forEach(field -> {
            if(String.class == field.getType()){
                try {
                    field.setAccessible(true);
                    if(field.get(o)!=null) {
                        String oVal = (String) field.get(o);
                        if ("".equals(oVal)) {
                            field.set(o, null);
                        }
                    }
                } catch (IllegalAccessException e) {
                }
            }
        });
    }
    public static void main(String[] args){
        PageComShopOrderSearchDTO dto = new PageComShopOrderSearchDTO();
        dto.setGoodsName("");
        dto.setOrderNo("123");
        setIfStringIsEmpty(dto);
        System.out.println(dto);
        double d = 1234.200;
        DecimalFormat df = new DecimalFormat("0.00");
        System.out.println(df.format(d));
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/resources/bootstrap.yml
New file
@@ -0,0 +1,22 @@
spring:
  application:
    name: shopbackstage
  cloud:
    config:
      discovery:
        enabled: true
        service-id: config  # 注册中心的服务名
      profile: ${ENV:dev}  # 指定配置文件的环境
      uri: http://${CONFIG_URL:localhost}:8193/
  profiles:
    active: ${ENV:dev}
  servlet:
    multipart:
      max-file-size: 10MB
      max-request-size: 10MB
eureka:
  client:
    service-url:
      defaultZone: http://${EUREKA_URL:localhost}:8192/eureka
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/resources/logback-spring.xml
New file
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
    <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
    <springProfile name="dev">
        <property name="LOG_HOME" value="F:/log" />
    </springProfile>
       <springProfile name="test">
        <property name="LOG_HOME" value="/mnt/data/gocd/log" />
    </springProfile>
<property name="LOG_HOME" value="/mnt/data/gocd/log" />
    <!-- 控制台输出 -->
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
    </appender>
    <!-- 按照每天生成日志文件 -->
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!--日志文件输出的文件名-->
            <FileNamePattern>${LOG_HOME}/community_backstage.log.%d{yyyy-MM-dd}.log</FileNamePattern>
            <!--日志文件保留天数-->
            <MaxHistory>30</MaxHistory>
        </rollingPolicy>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
        <!--日志文件最大的大小-->
        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <MaxFileSize>10MB</MaxFileSize>
        </triggeringPolicy>
    </appender>
    <!--myibatis log configure-->
    <logger name="com.apache.ibatis" level="TRACE"/>
    <logger name="java.sql.Connection" level="DEBUG"/>
    <logger name="java.sql.Statement" level="DEBUG"/>
    <logger name="java.sql.PreparedStatement" level="DEBUG"/>
    <logger name="com.panzhihua.community_backstage" level="DEBUG"/>
    <!-- 日志输出级别 -->
    <root level="DEBUG">
        <appender-ref ref="STDOUT" />
    </root>
    <root level="INFO">
        <appender-ref ref="STDOUT" />
        <appender-ref ref="FILE" />
    </root>
</configuration>