Merge remote-tracking branch 'origin/master'

This commit is contained in:
chc
2024-01-24 11:32:43 +08:00
16 changed files with 269 additions and 126 deletions

View File

@@ -23,7 +23,7 @@ public enum PromotionTypeEnum {
/**
* 有促销库存的活动类型
*/
static final PromotionTypeEnum[] haveStockPromotion = new PromotionTypeEnum[]{PINTUAN, SECKILL, KANJIA, POINTS_GOODS};
public static final PromotionTypeEnum[] haveStockPromotion = new PromotionTypeEnum[]{PINTUAN, SECKILL, KANJIA, POINTS_GOODS};
private final String description;

View File

@@ -65,7 +65,7 @@ public class TencentFilePlugin implements FilePlugin {
* @return
*/
private String getUrlPrefix() {
return "https://" + ossSetting.getTencentCOSBucket() + ".cos" + ossSetting.getTencentCOSRegion() + ".myqcloud.com/";
return "https://" + ossSetting.getTencentCOSBucket() + ".cos." + ossSetting.getTencentCOSRegion() + ".myqcloud.com/";
}
@Override

View File

@@ -7,7 +7,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Map;
/**
* 商品导入DTO
@@ -36,7 +35,7 @@ public class GoodsImportDTO {
private Boolean release;
@ApiModelProperty(value = "商品图片")
private List<Map<String, String>> images;
private List<String> images;
private List<String> goodsGalleryList;
@ApiModelProperty(value = "成本价")

View File

@@ -32,18 +32,5 @@ public class SpecValueVO implements Serializable {
* 规格图片
*/
@ApiModelProperty(value = "规格的图片")
private List<SpecImages> specImage;
@Data
public static class SpecImages implements Serializable {
private static final long serialVersionUID = 1816357809660916086L;
private String url;
private String name;
private String status;
}
private List<String> specImage;
}

View File

@@ -33,7 +33,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Slf4j
@Service
@@ -203,15 +205,11 @@ public class GoodsImportServiceImpl implements GoodsImportService {
goodsImportDTO.setCategory(category);
goodsImportDTO.setTemplate(templateId);
goodsImportDTO.setGoodsUnit(objects.get(4).toString().substring(objects.get(4).toString().indexOf("-") + 1));
goodsImportDTO.setRelease(objects.get(5).toString().equals("上架") ? true : false);
goodsImportDTO.setRelease(objects.get(5).toString().equals("上架"));
List<Map<String, String>> images = new ArrayList<>();
List<String> goodsGalleryList = new ArrayList<>();
Map<String, String> map = new HashMap<>();
map.put("url", objects.get(6).toString());
images.add(map);
goodsGalleryList.add(objects.get(6).toString());
goodsImportDTO.setImages(images);
goodsImportDTO.setImages(goodsGalleryList);
goodsImportDTO.setGoodsGalleryList(goodsGalleryList);
goodsImportDTO.setCost(Convert.toDouble(objects.get(7)));
@@ -241,7 +239,7 @@ public class GoodsImportServiceImpl implements GoodsImportService {
//获取父
Category parentCategory = categoryService.getCategoryById(goodsImportDTO.getCategory().getParentId());
goodsOperationDTO.setCategoryPath(parentCategory.getParentId() + "," + parentCategory.getId() + "," + goodsImportDTO.getCategory().getParentId());
goodsOperationDTO.setCategoryPath(parentCategory.getParentId() + "," + parentCategory.getId() + "," + goodsImportDTO.getCategory().getId());
//添加商品
goodsService.addGoods(goodsOperationDTO);
}

View File

@@ -35,7 +35,6 @@ import cn.lili.modules.goods.service.WholesaleService;
import cn.lili.modules.goods.sku.GoodsSkuBuilder;
import cn.lili.modules.goods.sku.render.SalesModelRender;
import cn.lili.modules.member.entity.dos.FootPrint;
import cn.lili.modules.member.service.MemberEvaluationService;
import cn.lili.modules.promotion.entity.dos.Coupon;
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
import cn.lili.modules.promotion.entity.dto.search.PromotionGoodsSearchParams;
@@ -98,11 +97,6 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
*/
@Autowired
private RocketmqCustomProperties rocketmqCustomProperties;
/**
* 会员评价
*/
@Autowired
private MemberEvaluationService memberEvaluationService;
/**
* 商品
*/
@@ -334,6 +328,11 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
}
}
if (goodsSkuDetail.getGoodsGalleryList() == null || goodsSkuDetail.getGoodsGalleryList().isEmpty()) {
goodsSkuDetail.setGoodsGalleryList(goodsVO.getGoodsGalleryList());
} else {
goodsSkuDetail.getGoodsGalleryList().addAll(goodsVO.getGoodsGalleryList());
}
map.put("data", goodsSkuDetail);
//获取分类
@@ -474,13 +473,10 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
SpecValueVO specValueVO = new SpecValueVO();
if ("images".equals(entry.getKey())) {
specValueVO.setSpecName(entry.getKey());
if (entry.getValue().toString().contains("url")) {
List<SpecValueVO.SpecImages> specImages = JSONUtil.toList(JSONUtil.parseArray(entry.getValue()),
SpecValueVO.SpecImages.class);
specValueVO.setSpecImage(specImages);
goodsGalleryList =
specImages.stream().map(SpecValueVO.SpecImages::getUrl).collect(Collectors.toList());
}
List<String> specImages = JSONUtil.toList(JSONUtil.parseArray(entry.getValue()),
String.class);
specValueVO.setSpecImage(specImages);
goodsGalleryList = new ArrayList<>(specImages);
} else {
specValueVO.setSpecName(entry.getKey());
specValueVO.setSpecValue(entry.getValue().toString());
@@ -677,7 +673,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
salesModelRenders.stream().filter(i -> i.getSalesMode().equals(goodsOperationDTO.getSalesModel())).findFirst().ifPresent(i -> i.renderBatch(goodsSkuList, goodsOperationDTO));
for (GoodsSku goodsSku : goodsSkuList) {
extendOldSkuValue(goodsSku);
this.renderImages(goodsSku);
this.renderImages(goodsSku, goodsOperationDTO.getGoodsGalleryList());
}
}
@@ -709,7 +705,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
extendOldSkuValue(goodsSku);
// 商品销售模式渲染器
salesModelRenders.stream().filter(i -> i.getSalesMode().equals(goodsOperationDTO.getSalesModel())).findFirst().ifPresent(i -> i.renderSingle(goodsSku, goodsOperationDTO));
this.renderImages(goodsSku);
this.renderImages(goodsSku, goodsOperationDTO.getGoodsGalleryList());
}
/**
@@ -734,16 +730,20 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
*
* @param goodsSku sku
*/
void renderImages(GoodsSku goodsSku) {
void renderImages(GoodsSku goodsSku, List<String> goodsImages) {
JSONObject jsonObject = JSONUtil.parseObj(goodsSku.getSpecs());
List<Map<String, String>> images = jsonObject.get("images", List.class);
List<String> images = jsonObject.getBeanList("images", String.class);
GoodsGallery goodsGallery;
if (images != null && !images.isEmpty()) {
GoodsGallery goodsGallery = goodsGalleryService.getGoodsGallery(images.get(0).get("url"));
goodsSku.setBig(goodsGallery.getOriginal());
goodsSku.setOriginal(goodsGallery.getOriginal());
goodsSku.setThumbnail(goodsGallery.getThumbnail());
goodsSku.setSmall(goodsGallery.getSmall());
goodsGallery = goodsGalleryService.getGoodsGallery(images.get(0));
} else {
goodsGallery = goodsGalleryService.getGoodsGallery(goodsImages.get(0));
}
goodsSku.setBig(goodsGallery.getOriginal());
goodsSku.setOriginal(goodsGallery.getOriginal());
goodsSku.setThumbnail(goodsGallery.getThumbnail());
goodsSku.setSmall(goodsGallery.getSmall());
}
/**

View File

@@ -399,6 +399,8 @@ public class SeckillApplyServiceImpl extends ServiceImpl<SeckillApplyMapper, Sec
Object quantity = cache.get(promotionGoodsStockCacheKey);
if (quantity != null) {
goodsVO.setQuantity((Integer) quantity);
} else {
cache.put(promotionGoodsStockCacheKey, seckillApply.getQuantity());
}
seckillGoodsVoS.add(goodsVO);
}

View File

@@ -103,9 +103,16 @@ public class Bill extends BaseIdEntity {
@ApiModelProperty(value = "积分商品结算价格")
private Double pointSettlementPrice;
@ApiModelProperty(value = "退货积分补贴返还")
private Double pointRefundSettlementPrice;
@ApiModelProperty(value = "砍价商品结算价格")
private Double kanjiaSettlementPrice;
@ApiModelProperty(value = "退货砍价补贴返还")
private Double kanjiaRefundSettlementPrice;
/**
* 开始算钱啦

View File

@@ -35,8 +35,10 @@ public interface BillMapper extends BaseMapper<Bill> {
* @param queryWrapper 查询条件
* @return 结算单
*/
@Select("SELECT IFNULL(SUM( final_price ),0) AS orderPrice,IFNULL(SUM( commission_price ),0) AS commissionPrice" +
",IFNULL(SUM( distribution_rebate ),0) AS distributionCommission,IFNULL(SUM( site_coupon_commission ),0) AS siteCouponCommission" +
@Select("SELECT IFNULL(SUM( final_price ),0) AS orderPrice" +
",IFNULL(SUM( commission_price ),0) AS commissionPrice" +
",IFNULL(SUM( distribution_rebate ),0) AS distributionCommission" +
",IFNULL(SUM( site_coupon_commission ),0) AS siteCouponCommission" +
",IFNULL(SUM( point_settlement_price ),0) AS pointSettlementPrice " +
",IFNULL(SUM( kanjia_settlement_price ),0) AS kanjiaSettlementPrice " +
",IFNULL(SUM( bill_price ),0) AS billPrice " +
@@ -49,8 +51,12 @@ public interface BillMapper extends BaseMapper<Bill> {
* @param queryWrapper 查询条件
* @return 结算单
*/
@Select("SELECT IFNULL(SUM( final_price ),0) AS refundPrice,IFNULL(SUM( commission_price ),0) AS refundCommissionPrice" +
",IFNULL(SUM( distribution_rebate ),0) AS distributionRefundCommission,IFNULL(SUM( site_coupon_commission ),0) AS siteCouponRefundCommission" +
@Select("SELECT IFNULL(SUM( final_price ),0) AS refundPrice" +
",IFNULL(SUM( commission_price ),0) AS refundCommissionPrice" +
",IFNULL(SUM( distribution_rebate ),0) AS distributionRefundCommission" +
",IFNULL(SUM( site_coupon_commission ),0) AS siteCouponRefundCommission" +
",IFNULL(SUM( kanjia_settlement_price ),0) AS kanjiaRefundSettlementPrice" +
",IFNULL(SUM( point_settlement_price ),0) AS pointRefundSettlementPrice" +
",IFNULL(SUM( final_price ),0) AS billPrice FROM li_store_flow ${ew.customSqlSegment}")
Bill getRefundBill(@Param(Constants.WRAPPER) QueryWrapper<Bill> queryWrapper);
}

View File

@@ -30,6 +30,10 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@@ -37,9 +41,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* 结算单业务层实现
@@ -95,12 +99,16 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
if (refundBill != null) {
//退单金额
bill.setRefundPrice(refundBill.getRefundPrice() != null ? refundBill.getRefundPrice() : 0D);
//退单产生退还佣金金额
//退单 平台服务费返还
bill.setRefundCommissionPrice(refundBill.getRefundCommissionPrice() != null ? refundBill.getRefundCommissionPrice() : 0D);
//分销订单退还,返现佣金返还
//退单 分销佣金返还
bill.setDistributionRefundCommission(refundBill.getDistributionRefundCommission() != null ? refundBill.getDistributionRefundCommission() : 0D);
//退平台优惠券补贴返还
//退平台优惠券补贴返还
bill.setSiteCouponRefundCommission(refundBill.getSiteCouponRefundCommission() != null ? refundBill.getSiteCouponRefundCommission() : 0D);
//退单 平台优惠券补贴返还
bill.setPointRefundSettlementPrice(refundBill.getPointRefundSettlementPrice() != null ? refundBill.getPointRefundSettlementPrice() : 0D);
//退单 砍价补贴返还
bill.setKanjiaRefundSettlementPrice(refundBill.getKanjiaRefundSettlementPrice() != null ? refundBill.getKanjiaRefundSettlementPrice() : 0D);
//退款金额=店铺最终退款结算金额
refundPrice = refundBill.getBillPrice() != null ? refundBill.getBillPrice() : 0D;
}
@@ -213,8 +221,61 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
@Override
public void download(HttpServletResponse response, String id) {
Bill bill = this.getById(id);
ExcelWriter writer = ExcelUtil.getWriterWithSheet("入账订单");
//创建Excel工作薄对象
ExcelWriter writer = ExcelUtil.getWriterWithSheet("店铺结算单");
writer.setSheet("店铺结算单");
Map<String,Object> map=new LinkedHashMap<>();
map.put("创建时间",DateUtil.format(bill.getCreateTime(), "yyyy-MM-dd"));
writer.setColumnWidth(0, 15);
map.put("账单号",bill.getSn());
writer.setColumnWidth(1, 30);
map.put("结算开始时间",DateUtil.format(bill.getStartTime(), "yyyy-MM-dd"));
writer.setColumnWidth(2, 15);
map.put("结算结束时间",DateUtil.format(bill.getEndTime(), "yyyy-MM-dd"));
writer.setColumnWidth(3, 15);
map.put("账单状态",BillStatusEnum.valueOf(bill.getBillStatus()).description());
map.put("店铺名称",bill.getStoreName());
writer.setColumnWidth(5, 15);
map.put("平台付款时间",DateUtil.format(bill.getPayTime(), "yyyy-MM-dd"));
writer.setColumnWidth(6, 15);
map.put("银行开户名",bill.getBankAccountName());
writer.setColumnWidth(7, 15);
map.put("银行账号",bill.getBankAccountNumber());
writer.setColumnWidth(8, 15);
map.put("开户行",bill.getBankName());
writer.setColumnWidth(9, 15);
map.put("联行号",bill.getBankCode());
map.put("订单金额",bill.getOrderPrice());
map.put("退单金额",bill.getRefundPrice());
map.put("平台收取服务费",bill.getCommissionPrice());
writer.setColumnWidth(13, 15);
map.put("退单退回平台服务费",bill.getRefundCommissionPrice());
writer.setColumnWidth(14, 25);
map.put("分销佣金",bill.getDistributionCommission());
map.put("退单退还分销佣金",bill.getDistributionRefundCommission());
writer.setColumnWidth(16, 20);
map.put("平台优惠券补贴",bill.getSiteCouponCommission());
writer.setColumnWidth(17, 15);
map.put("退单退回平台优惠券补贴",bill.getSiteCouponRefundCommission());
writer.setColumnWidth(18, 25);
map.put("积分商品补贴",bill.getSiteCouponCommission());
writer.setColumnWidth(19, 15);
map.put("积分商品补贴",bill.getPointSettlementPrice());
writer.setColumnWidth(20, 15);
map.put("退单退回积分商品补贴",bill.getPointRefundSettlementPrice());
writer.setColumnWidth(21, 25);
map.put("砍价商品补贴",bill.getKanjiaSettlementPrice());
writer.setColumnWidth(22, 15);
map.put("退单退回砍价补贴",bill.getKanjiaRefundSettlementPrice());
writer.setColumnWidth(23, 25);
map.put("最终结算金额",bill.getBillPrice());
writer.setColumnWidth(24, 15);
writer.writeRow(map,true);
writer.setSheet("入账订单");
writer.addHeaderAlias("createTime", "入账时间");
writer.setColumnWidth(0, 20);
@@ -237,7 +298,6 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
writer.addHeaderAlias("billPrice", "应结金额");
writer.setColumnWidth(11, 20);
List<StoreFlowPayDownloadVO> storeFlowList = storeFlowService.getStoreFlowPayDownloadVO(StoreFlowQueryDTO.builder().type(FlowTypeEnum.PAY.name()).bill(bill).build());
writer.write(storeFlowList, true);
@@ -252,7 +312,7 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
writer.setColumnWidth(3, 20);
writer.addHeaderAlias("goodsName", "商品名称");
writer.setColumnWidth(4, 70);
writer.addHeaderAlias("num", "销售");
writer.addHeaderAlias("num", "退款");
writer.addHeaderAlias("finalPrice", "退款金额");
writer.addHeaderAlias("commissionPrice", "平台分佣");
writer.addHeaderAlias("siteCouponPrice", "平台优惠券");
@@ -265,23 +325,26 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
writer.addHeaderAlias("billPrice", "结算金额");
writer.setColumnWidth(12, 20);
List<StoreFlowRefundDownloadVO> storeFlowRefundDownloadVOList = storeFlowService.getStoreFlowRefundDownloadVO(StoreFlowQueryDTO.builder().type(FlowTypeEnum.REFUND.name()).bill(bill).build());
writer.write(storeFlowRefundDownloadVOList, true);
ServletOutputStream out = null;
try {
writer.setOnlyAlias(true);
//设置公共属性,列表名称
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(bill.getStoreName() + "-" + bill.getSn(), "UTF8") + ".xls");
response.setHeader("Content-Disposition", URLEncoder.encode("店铺结算单详情", "UTF8") + ".xls");
out = response.getOutputStream();
writer.flush(out, true);
} catch (Exception e) {
log.error("下载结算单错误", e);
log.error("下载列表错误", e);
} finally {
writer.close();
IoUtil.close(out);
}
}
}

View File

@@ -28,6 +28,10 @@ public class InsertIgnoreBatchAllColumn extends AbstractMethod {
@Accessors(chain = true)
private Predicate<TableFieldInfo> predicate;
protected InsertIgnoreBatchAllColumn(String methodName) {
super(methodName);
}
@SuppressWarnings("Duplicates")
@Override
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
@@ -36,7 +40,7 @@ public class InsertIgnoreBatchAllColumn extends AbstractMethod {
String sqlTemplate = "<script>\nINSERT IGNORE INTO %s %s VALUES %s\n</script>";
List<TableFieldInfo> fieldList = tableInfo.getFieldList();
String insertSqlColumn = tableInfo.getKeyInsertSqlColumn(true, false) +
String insertSqlColumn = tableInfo.getKeyInsertSqlColumn(true, "", false) +
this.filterTableFieldInfo(fieldList, predicate, TableFieldInfo::getInsertSqlColumn, EMPTY);
String columnScript = LEFT_BRACKET + insertSqlColumn.substring(0, insertSqlColumn.length() - 1) + RIGHT_BRACKET;
String insertSqlProperty = tableInfo.getKeyInsertSqlProperty(true, ENTITY_DOT, false) +

View File

@@ -28,7 +28,7 @@ public class SpiceSqlInjector extends DefaultSqlInjector {
// methodList.add(new InsertBatchSomeColumn(t -> !t.isLogicDelete() && !"update_time".equals(t.getColumn())));
// 要逻辑删除 t.isLogicDelete() 默认不要
methodList.add(new InsertBatchSomeColumn(t -> !t.isLogicDelete()));
methodList.add(new InsertIgnoreBatchAllColumn());
methodList.add(new InsertIgnoreBatchAllColumn("insertIgnoreBatchAllColumn"));
return methodList;
}
}