记得上下班打卡 | git大法好,push需谨慎

Commit 3ca07d14 authored by 胡佳晨's avatar 胡佳晨

Merge remote-tracking branch 'origin/dev_goblin' into dev_goblin

parents 6372d186 9def8731
......@@ -55,7 +55,7 @@ public class GoblinStoreMgtCouponAddParam implements Serializable {
@NotNull(message = "卡券库存不能为空")
@Min(value = 0, message = "卡券库存不能小于0")
private Integer stock;
@ApiModelProperty(position = 12, required = true, value = "触发金额[8,2]", example = "1")
@ApiModelProperty(position = 12, required = false, value = "触发金额[8,2]", example = "1")
@DecimalMin(value = "0.01", message = "触发金额不能小于0.01")
private BigDecimal triggers;
@ApiModelProperty(position = 12, required = false, value = "面值[8,2]", example = "5")
......
......@@ -24,6 +24,7 @@ import com.liquidnet.service.adam.mapper.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
......@@ -217,7 +218,7 @@ public class AdamMemberOrderAdminServiceImpl extends ServiceImpl<AdamMemberOrder
linkedMultiValueMap.add("priceTotal", String.valueOf(memberOrder.getPricePaid()));
linkedMultiValueMap.add("reason", reason);
LinkedMultiValueMap<String, String> linkedMultiheadersMap = new LinkedMultiValueMap<>();
linkedMultiheadersMap.add("Accept", "application/json;charset=UTF-8");
linkedMultiheadersMap.add("Accept", MediaType.APPLICATION_JSON_UTF8_VALUE);
log.info("会员管理:会员订单:退款:支付中心请求参数:{}", linkedMultiValueMap);
String postResult = HttpUtil.post(applyUrl, linkedMultiValueMap, linkedMultiheadersMap);
......
......@@ -41,6 +41,7 @@ import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.Iterator;
import java.util.List;
......@@ -207,6 +208,10 @@ public class GoblinStoreMgtCouponController {
storeCouponBasicVo.setDeduction(mgtCouponAddParam.getValMinus());
break;
}
LocalDateTime startTime = storeCouponBasicVo.getStartTime(), endTime = storeCouponBasicVo.getEndTime();
if (startTime.isEqual(endTime) || startTime.isAfter(endTime) || endTime.isBefore(LocalDateTime.now())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "活动开始、结束时间无效");
}
List<String> spuIdList = storeCouponBasicVo.getSpuIdList();
if (storeCouponBasicVo.getUseScope().equals("1") && !CollectionUtils.isEmpty(spuIdList)) {
......@@ -265,9 +270,17 @@ public class GoblinStoreMgtCouponController {
log.debug("商铺活动:优惠券编辑:[mgtCouponEditParam={}]", JsonUtils.toJson(mgtCouponEditParam));
}
GoblinStoreCouponBasicVo storeCouponBasicVo = mgtCouponEditParam.initStoreCouponBasicInfo();
LocalDateTime startTime = storeCouponBasicVo.getStartTime(), endTime = storeCouponBasicVo.getEndTime();
if (startTime.isEqual(endTime) || startTime.isAfter(endTime) || endTime.isBefore(LocalDateTime.now())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "活动开始、结束时间无效");
}
LocalDateTime befStartTime = storeCouponVo.getStartTime();
if (befStartTime.minusMinutes(10).isAfter(storeCouponBasicVo.getStartTime())) {
storeCouponBasicVo.setStartTime(startTime);
}
storeCouponBasicVo.setType(storeCouponVo.getType());
storeCouponBasicVo.setState(storeCouponVo.getState());
storeCouponBasicVo.setStartTime(storeCouponVo.getStartTime());
storeCouponBasicVo.setStock(storeCouponVo.getStock());// 这里库存不允许编辑修改,只可在列表页编辑'增减库存'
switch (storeCouponBasicVo.getType()) {
case "1":// 代金
......
......@@ -136,6 +136,9 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
String storeCouponId = IDGenerator.nextMilliId();
LocalDateTime now = LocalDateTime.now();
boolean activityStartFlg = storeCouponBasicVo.getStartTime().isBefore(now);
storeCouponBasicVo.setState(activityStartFlg ? "1" : "0");
storeCouponBasicVo.setStoreCouponId(storeCouponId);
storeCouponBasicVo.setStoreCouponNo(storeCouponId);
storeCouponBasicVo.setDelFlg("0");
......@@ -148,6 +151,14 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
goblinRedisUtils.setStoreCouponStock(storeCouponId, stock);
}
if (activityStartFlg) {// 活动已开始,处理店铺活动数据
GoblinStoreMarketDto storeMarketDto = GoblinStoreMarketDto.getNew();
storeMarketDto.setId(storeCouponId);
storeMarketDto.setType(1);
goblinRedisUtils.addStoreMarketDto(storeCouponBasicVo.getStoreId(), storeMarketDto);
}
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_store_coupon.insert"));
LinkedList<Object[]> initStoreCouponObjs = CollectionUtil.linkedListObjectArr();
......@@ -210,10 +221,21 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
String storeCouponId = storeCouponBasicVo.getStoreCouponId();
LocalDateTime now = LocalDateTime.now();
boolean activityStopFlg = storeCouponBasicVo.getEndTime().isBefore(now);
storeCouponBasicVo.setState(activityStopFlg ? "2" : storeCouponBasicVo.getState());
storeCouponBasicVo.setUpdatedAt(now);
storeCouponBasicVo.setUpdatedBy(uid);
if (goblinMongoUtils.updateMgtStoreCouponBasicVo(storeCouponBasicVo)) {
if (activityStopFlg) {// 活动已结束,处理店铺活动数据
GoblinStoreMarketDto storeMarketDto = GoblinStoreMarketDto.getNew();
storeMarketDto.setId(storeCouponId);
storeMarketDto.setType(1);
goblinRedisUtils.delStoreMarketDto(storeCouponBasicVo.getStoreId(), storeMarketDto);
}
goblinRedisUtils.del(GoblinRedisConst.STORE_COUPON.concat(storeCouponId));// 删除REDIS缓存
goblinRedisUtils.del(GoblinRedisConst.STORE_COUPON_RULE.concat(storeCouponId));// 删除REDIS缓存
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment