Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop
This commit is contained in:
commit
347877cdad
@ -75,7 +75,7 @@ public class UploadController {
|
||||
}
|
||||
|
||||
|
||||
if (!CharSequenceUtil.containsAny(file.getContentType().toLowerCase(), "image")) {
|
||||
if (!CharSequenceUtil.containsAny(Objects.requireNonNull(file.getContentType()).toLowerCase(), "image", "video")) {
|
||||
throw new ServiceException(ResultCode.FILE_TYPE_NOT_SUPPORT);
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,12 @@ import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.modules.file.entity.enums.OssEnum;
|
||||
import cn.lili.modules.file.plugin.FilePlugin;
|
||||
import cn.lili.modules.system.entity.dto.OssSetting;
|
||||
|
||||
import com.obs.services.ObsClient;
|
||||
import com.obs.services.exception.ObsException;
|
||||
import com.obs.services.model.*;
|
||||
import com.obs.services.model.DeleteObjectsRequest;
|
||||
import com.obs.services.model.DeleteObjectsResult;
|
||||
import com.obs.services.model.ListVersionsResult;
|
||||
import com.obs.services.model.PutObjectRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.File;
|
||||
@ -20,8 +22,6 @@ import java.util.List;
|
||||
* 华为obs 文件操作
|
||||
*
|
||||
* @author Bulbasaur
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@ -72,7 +72,7 @@ public class HuaweiFilePlugin implements FilePlugin {
|
||||
public String inputStreamUpload(InputStream inputStream, String key) {
|
||||
ObsClient obsClient = getObsClient();
|
||||
try {
|
||||
PutObjectRequest putObjectRequest=new PutObjectRequest(ossSetting.getHuaweicloudOBSBucketName(), key, inputStream);
|
||||
PutObjectRequest putObjectRequest = new PutObjectRequest(ossSetting.getHuaweicloudOBSBucketName(), key, inputStream);
|
||||
obsClient.putObject(putObjectRequest);
|
||||
} catch (ObsException obsException) {
|
||||
obsException.printStackTrace();
|
||||
|
@ -14,7 +14,6 @@ import com.qcloud.cos.exception.CosServiceException;
|
||||
import com.qcloud.cos.http.HttpProtocol;
|
||||
import com.qcloud.cos.model.DeleteObjectsRequest;
|
||||
import com.qcloud.cos.model.ObjectMetadata;
|
||||
import com.qcloud.cos.model.PutObjectRequest;
|
||||
import com.qcloud.cos.region.Region;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -66,7 +65,6 @@ public class TencentFilePlugin implements FilePlugin {
|
||||
* @return
|
||||
*/
|
||||
private String getUrlPrefix() {
|
||||
// return "https://" + ossSetting.getTencentCOSBucket() + "." + ossSetting.getTencentCOSEndPoint() + "/";
|
||||
return "https://" + ossSetting.getTencentCOSBucket() + ".cos" + ossSetting.getTencentCOSEndPoint() + ".myqcloud.com/";
|
||||
}
|
||||
|
||||
@ -108,7 +106,7 @@ public class TencentFilePlugin implements FilePlugin {
|
||||
|
||||
try {
|
||||
List<DeleteObjectsRequest.KeyVersion> delObjects = new ArrayList<>();
|
||||
for (String key:keys) {
|
||||
for (String key : keys) {
|
||||
delObjects.add(new DeleteObjectsRequest.KeyVersion(key));
|
||||
}
|
||||
cosClient.deleteObjects(new DeleteObjectsRequest(ossSetting.getTencentCOSBucket()).withKeys(delObjects));
|
||||
|
@ -1,24 +0,0 @@
|
||||
package cn.lili.modules.file.util;
|
||||
|
||||
/**
|
||||
* FileUtil
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* 2021-11-22 11:19
|
||||
*/
|
||||
public class FileUtil {
|
||||
|
||||
/**
|
||||
* 根据原图生成规定尺寸的图片
|
||||
*
|
||||
* @param url 连接
|
||||
* @param width 宽
|
||||
* @param height 高
|
||||
* @return
|
||||
*/
|
||||
public static String getUrl(String url, Integer width, Integer height) {
|
||||
//缩略图全路径
|
||||
return url + "?x-oss-process=style/" + width + "X" + height;
|
||||
}
|
||||
}
|
@ -189,7 +189,7 @@ public class GoodsSku extends BaseEntity {
|
||||
this.goodsId = goods.getId();
|
||||
this.goodsName = goods.getGoodsName();
|
||||
this.goodsType = goods.getGoodsType();
|
||||
|
||||
this.goodsVideo = goods.getGoodsVideo();
|
||||
this.selfOperated = goods.getSelfOperated();
|
||||
this.sellingPoint = goods.getSellingPoint();
|
||||
this.categoryPath = goods.getCategoryPath();
|
||||
|
@ -1,12 +1,13 @@
|
||||
package cn.lili.modules.goods.serviceimpl;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.modules.file.util.FileUtil;
|
||||
import cn.lili.modules.file.entity.enums.OssEnum;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsGallery;
|
||||
import cn.lili.modules.goods.mapper.GoodsGalleryMapper;
|
||||
import cn.lili.modules.goods.service.GoodsGalleryService;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.entity.dto.GoodsSetting;
|
||||
import cn.lili.modules.system.entity.dto.OssSetting;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -59,9 +60,9 @@ public class GoodsGalleryServiceImpl extends ServiceImpl<GoodsGalleryMapper, Goo
|
||||
Setting setting = settingService.get(SettingEnum.GOODS_SETTING.name());
|
||||
GoodsSetting goodsSetting = JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class);
|
||||
//缩略图
|
||||
String thumbnail = FileUtil.getUrl(origin, goodsSetting.getAbbreviationPictureWidth(), goodsSetting.getAbbreviationPictureHeight());
|
||||
String thumbnail = this.getUrl(origin, goodsSetting.getAbbreviationPictureWidth(), goodsSetting.getAbbreviationPictureHeight());
|
||||
//小图
|
||||
String small = FileUtil.getUrl(origin, goodsSetting.getSmallPictureWidth(), goodsSetting.getSmallPictureHeight());
|
||||
String small = this.getUrl(origin, goodsSetting.getSmallPictureWidth(), goodsSetting.getSmallPictureHeight());
|
||||
//赋值
|
||||
goodsGallery.setSmall(small);
|
||||
goodsGallery.setThumbnail(thumbnail);
|
||||
@ -84,4 +85,34 @@ public class GoodsGalleryServiceImpl extends ServiceImpl<GoodsGalleryMapper, Goo
|
||||
public void removeByGoodsId(String goodsId) {
|
||||
this.baseMapper.delete(new QueryWrapper<GoodsGallery>().eq("goods_id", goodsId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据原图生成规定尺寸的图片
|
||||
*
|
||||
* @param url 连接
|
||||
* @param width 宽
|
||||
* @param height 高
|
||||
* @return
|
||||
*/
|
||||
private String getUrl(String url, Integer width, Integer height) {
|
||||
Setting setting = settingService.get(SettingEnum.OSS_SETTING.name());
|
||||
OssSetting ossSetting = JSONUtil.toBean(setting.getSettingValue(), OssSetting.class);
|
||||
switch (OssEnum.valueOf(ossSetting.getType())) {
|
||||
case MINIO:
|
||||
//缩略图全路径
|
||||
return url + "?x-oss-process=style/" + width + "X" + height;
|
||||
case ALI_OSS:
|
||||
//缩略图全路径
|
||||
return url + "?x-oss-process=style/" + width + "X" + height;
|
||||
case HUAWEI_OBS:
|
||||
//缩略图全路径
|
||||
return url + "?image/resize,m_fixed,h_" + height + ",w_" + width;
|
||||
case TENCENT_COS:
|
||||
//缩略图全路径
|
||||
return url + "?imageMogr2/thumbnail/" + width + "x" + height;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
@ -63,7 +63,7 @@ public class KdniaoPlugin implements LogisticsPlugin {
|
||||
Map<String, String> params = new HashMap<>(8);
|
||||
params.put("RequestData", urlEncoder(requestData, "UTF-8"));
|
||||
params.put("EBusinessID", logisticsSetting.getKdniaoEbusinessID());
|
||||
params.put("RequestType", "1002");
|
||||
params.put("RequestType", logisticsSetting.getRequestType());
|
||||
String dataSign = encrypt(requestData, logisticsSetting.getKdniaoAppKey(), "UTF-8");
|
||||
params.put("DataSign", urlEncoder(dataSign, "UTF-8"));
|
||||
params.put("DataType", "2");
|
||||
@ -112,9 +112,9 @@ public class KdniaoPlugin implements LogisticsPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> labelOrder(LabelOrderDTO labelOrderDTO) {
|
||||
public Map<String, Object> labelOrder(LabelOrderDTO labelOrderDTO) {
|
||||
try {
|
||||
Map<String,Object> resultMap = new HashMap();
|
||||
Map<String, Object> resultMap = new HashMap();
|
||||
//订单
|
||||
Order order = labelOrderDTO.getOrder();
|
||||
//订单货物
|
||||
@ -206,7 +206,7 @@ public class KdniaoPlugin implements LogisticsPlugin {
|
||||
}
|
||||
|
||||
JSONObject orderJson = JSONObject.parseObject(obj.getString("Order"));
|
||||
resultMap.put("printTemplate",obj.getString("PrintTemplate"));
|
||||
resultMap.put("printTemplate", obj.getString("PrintTemplate"));
|
||||
return resultMap;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -122,7 +122,7 @@ public class Kuaidi100Plugin implements LogisticsPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> labelOrder(LabelOrderDTO labelOrderDTO) {
|
||||
public Map<String, Object> labelOrder(LabelOrderDTO labelOrderDTO) {
|
||||
try {
|
||||
//订单
|
||||
Order order = labelOrderDTO.getOrder();
|
||||
|
@ -769,7 +769,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
this.systemCancel(entry.getKey(), reason);
|
||||
} else {
|
||||
for (Order order : entry.getValue()) {
|
||||
this.systemCancel(order.getSn(), reason);
|
||||
if (!CharSequenceUtil.equalsAny(order.getOrderStatus(), OrderStatusEnum.COMPLETED.name(), OrderStatusEnum.DELIVERED.name(), OrderStatusEnum.TAKE.name(), OrderStatusEnum.STAY_PICKED_UP.name())) {
|
||||
this.systemCancel(order.getSn(), reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(fictitious)) {
|
||||
@ -785,7 +787,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
* @param entry 订单列表
|
||||
* @param requiredNum 必须参团人数
|
||||
*/
|
||||
private void fictitiousPintuan(Map.Entry<String, List<Order>> entry, Integer requiredNum) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void fictitiousPintuan(Map.Entry<String, List<Order>> entry, Integer requiredNum) {
|
||||
Map<String, List<Order>> listMap = entry.getValue().stream().collect(Collectors.groupingBy(Order::getPayStatus));
|
||||
//未付款订单
|
||||
List<Order> unpaidOrders = listMap.get(PayStatusEnum.UNPAID.name());
|
||||
@ -813,9 +816,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
paidOrders.add(order);
|
||||
}
|
||||
for (Order paidOrder : paidOrders) {
|
||||
paidOrder.setOrderStatus(OrderStatusEnum.UNDELIVERED.name());
|
||||
this.updateById(paidOrder);
|
||||
orderStatusMessage(paidOrder);
|
||||
if (!CharSequenceUtil.equalsAny(paidOrder.getOrderStatus(), OrderStatusEnum.COMPLETED.name(), OrderStatusEnum.DELIVERED.name(), OrderStatusEnum.TAKE.name(), OrderStatusEnum.STAY_PICKED_UP.name())) {
|
||||
if (OrderTypeEnum.NORMAL.name().equals(paidOrder.getOrderType())) {
|
||||
paidOrder.setOrderStatus(OrderStatusEnum.UNDELIVERED.name());
|
||||
} else if (OrderTypeEnum.VIRTUAL.name().equals(paidOrder.getOrderType())) {
|
||||
paidOrder.setOrderStatus(OrderStatusEnum.TAKE.name());
|
||||
}
|
||||
this.updateById(paidOrder);
|
||||
orderStatusMessage(paidOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -871,7 +880,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
* @param pintuanId 拼团活动ID
|
||||
* @param parentOrderSn 拼团父订单编号
|
||||
*/
|
||||
private void checkPintuanOrder(String pintuanId, String parentOrderSn) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void checkPintuanOrder(String pintuanId, String parentOrderSn) {
|
||||
//获取拼团配置
|
||||
Pintuan pintuan = pintuanService.getById(pintuanId);
|
||||
List<Order> list = this.getPintuanOrder(pintuanId, parentOrderSn);
|
||||
@ -881,6 +891,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
PintuanOrderMessage pintuanOrderMessage = new PintuanOrderMessage();
|
||||
//开团结束时间
|
||||
long startTime = DateUtil.offsetHour(new Date(), 24).getTime();
|
||||
if (DateUtil.compare(DateUtil.offsetHour(pintuan.getStartTime(), 24), pintuan.getEndTime()) > 0) {
|
||||
startTime = pintuan.getEndTime().getTime();
|
||||
}
|
||||
pintuanOrderMessage.setOrderSn(parentOrderSn);
|
||||
pintuanOrderMessage.setPintuanId(pintuanId);
|
||||
TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.PROMOTION_EXECUTOR,
|
||||
@ -923,7 +936,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
*
|
||||
* @param orderList 需要更新拼团状态为成功的拼团订单列表
|
||||
*/
|
||||
private void pintuanOrderSuccess(List<Order> orderList) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void pintuanOrderSuccess(List<Order> orderList) {
|
||||
for (Order order : orderList) {
|
||||
if (order.getOrderType().equals(OrderTypeEnum.VIRTUAL.name())) {
|
||||
this.virtualOrderConfirm(order.getSn());
|
||||
|
@ -48,7 +48,7 @@ public class HuaweiSmsPlugin implements SmsPlugin {
|
||||
@Override
|
||||
public void sendSmsCode(String signName, String mobile, Map<String, String> param, String templateCode) {
|
||||
try {
|
||||
this.sendSms(signName, mobile, "[" + param.values() + "]", templateCode);
|
||||
this.sendSms(signName, mobile, param.values() + "", templateCode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -115,7 +115,7 @@ public class HuaweiSmsPlugin implements SmsPlugin {
|
||||
|
||||
//条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称
|
||||
//国际/港澳台短信不用关注该参数
|
||||
String signature = signName; //签名名称
|
||||
String signature = smsSetting.getHuaweiSignature(); //签名名称
|
||||
|
||||
//必填,全局号码格式(包含国家码),示例:+8615123456789,多个号码之间用英文逗号分隔
|
||||
String receiver = mobile; //短信接收人号码
|
||||
|
@ -31,6 +31,11 @@ public class LogisticsSetting implements Serializable {
|
||||
*/
|
||||
private String kdniaoAppKey;
|
||||
|
||||
/**
|
||||
* 调用端口
|
||||
*/
|
||||
private String requestType;
|
||||
|
||||
/**
|
||||
* 快递100 授权码,请申请企业版获取
|
||||
*/
|
||||
|
@ -31,10 +31,10 @@ public class OssSetting implements Serializable {
|
||||
* 阿里云-储存空间
|
||||
*/
|
||||
private String aliyunOSSBucketName = "";
|
||||
/**
|
||||
* 阿里云-存放路径路径
|
||||
*/
|
||||
private String aliyunOSSPicLocation = "";
|
||||
// /**
|
||||
// * 阿里云-存放路径路径
|
||||
// */
|
||||
// private String aliyunOSSPicLocation = "";
|
||||
/**
|
||||
* 阿里云-密钥id
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user