!187 优化代码,修复bug

Merge pull request !187 from OceansDeep/feature/pg
This commit is contained in:
OceansDeep 2022-06-09 01:19:19 +00:00 committed by Gitee
commit 79e1f34890
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 12 additions and 13 deletions

View File

@ -171,11 +171,11 @@ public class GoodsSku extends BaseEntity {
}
@Override
public Date getUpdateTime() {
if (super.getUpdateTime() == null) {
public Date getCreateTime() {
if (super.getCreateTime() == null) {
return new Date(1593571928);
} else {
return super.getUpdateTime();
return super.getCreateTime();
}
}

View File

@ -56,7 +56,7 @@ public class StoreGoodsLabelServiceImpl extends ServiceImpl<StoreGoodsLabelMappe
StoreGoodsLabelVO storeGoodsLabelVO = new StoreGoodsLabelVO(storeGoodsLabel.getId(), storeGoodsLabel.getLabelName(), storeGoodsLabel.getLevel(), storeGoodsLabel.getSortOrder());
List<StoreGoodsLabelVO> storeGoodsLabelVOChildList = new ArrayList<>();
list.stream()
.filter(label -> label.getParentId().equals(storeGoodsLabel.getId()))
.filter(label -> label.getParentId() != null && label.getParentId().equals(storeGoodsLabel.getId()))
.forEach(storeGoodsLabelChild -> storeGoodsLabelVOChildList.add(new StoreGoodsLabelVO(storeGoodsLabelChild.getId(), storeGoodsLabelChild.getLabelName(), storeGoodsLabelChild.getLevel(), storeGoodsLabelChild.getSortOrder())));
storeGoodsLabelVO.setChildren(storeGoodsLabelVOChildList);
storeGoodsLabelVOList.add(storeGoodsLabelVO);

View File

@ -681,7 +681,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
*/
private void checkMember(String userName, String mobilePhone) {
//判断手机号是否存在
if (findMember(userName, mobilePhone) > 0) {
if (findMember(mobilePhone, userName) > 0) {
throw new ServiceException(ResultCode.USER_EXIST);
}
}

View File

@ -107,7 +107,7 @@ public class CheckDataRender implements CartRenderStep {
//缓存中的商品信息
GoodsSku dataSku = goodsSkuService.getGoodsSkuByIdFromCache(cartSkuVO.getGoodsSku().getId());
//商品有效性判定
if (dataSku == null || dataSku.getUpdateTime().before(cartSkuVO.getGoodsSku().getUpdateTime())) {
if (dataSku == null || dataSku.getCreateTime().after(cartSkuVO.getGoodsSku().getCreateTime())) {
//设置购物车未选中
cartSkuVO.setChecked(false);
//设置购物车此sku商品已失效

View File

@ -11,7 +11,6 @@ import cn.lili.modules.store.entity.dto.FreightTemplateChildDTO;
import cn.lili.modules.store.entity.enums.FreightTemplateEnum;
import cn.lili.modules.store.entity.vos.FreightTemplateVO;
import cn.lili.modules.store.service.FreightTemplateService;
import org.apache.xmlbeans.impl.store.Cur;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -51,16 +50,16 @@ public class SkuFreightRender implements CartRenderStep {
Map<String, List<String>> freightGroups = freightTemplateGrouping(cartSkuVOS);
//循环运费模版
for (String freightTemplateId : freightGroups.keySet()) {
for (Map.Entry<String, List<String>> freightTemplateGroup : freightGroups.entrySet()) {
//商品id列表
List<String> skuIds = freightGroups.get(freightTemplateId);
List<String> skuIds = freightTemplateGroup.getValue();
//当前购物车商品列表
List<CartSkuVO> currentCartSkus = cartSkuVOS.stream().filter(item -> skuIds.contains(item.getGoodsSku().getId())).collect(Collectors.toList());
//寻找对应对商品运费计算模版
FreightTemplateVO freightTemplate = freightTemplateService.getFreightTemplate(freightTemplateId);
FreightTemplateVO freightTemplate = freightTemplateService.getFreightTemplate(freightTemplateGroup.getKey());
if (freightTemplate != null
&& freightTemplate.getFreightTemplateChildList() != null
&& !freightTemplate.getFreightTemplateChildList().isEmpty()) {
@ -99,7 +98,7 @@ public class SkuFreightRender implements CartRenderStep {
Double count = currentCartSkus.stream().mapToDouble(item ->
// 根据计费规则 累加计费基数
freightTemplateChildDTO.getPricingMethod().equals(FreightTemplateEnum.NUM.name()) ?
item.getNum() :
item.getNum().doubleValue() :
CurrencyUtil.mul(item.getNum(), item.getGoodsSku().getWeight())
).sum();

View File

@ -150,7 +150,7 @@ public class CartServiceImpl implements CartService {
//购物车中已经存在更新数量
if (cartSkuVO != null && dataSku.getUpdateTime().equals(cartSkuVO.getGoodsSku().getUpdateTime())) {
if (cartSkuVO != null && dataSku.getCreateTime().equals(cartSkuVO.getGoodsSku().getCreateTime())) {
//如果覆盖购物车中商品数量
if (Boolean.TRUE.equals(cover)) {

View File

@ -64,7 +64,7 @@ public abstract class BaseEntity implements Serializable {
@LastModifiedDate
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value = "更新时间", hidden = true)
@Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || yyyy/MM/dd HH:mm:ss|| yyyy/MM/dd ||epoch_millis")
private Date updateTime;