Commit e85fee64 authored by 周健威's avatar 周健威

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

parents fd1e5130 7fc0aaab
......@@ -148,6 +148,11 @@ public class ShoppingCartInfo implements Serializable {
private BigDecimal totalAmount;
/**
* 1、上架,2、下架
*/
private Integer status;
public static OrderItem convertToOrderItem(ShoppingCartInfo shoppingCartInfo) {
OrderItem orderItem = new OrderItem();
orderItem.setDetailId(shoppingCartInfo.getDetailId());
......
......@@ -18,10 +18,7 @@ import com.upyuns.platform.rs.website.mapper.ImageImgStorageMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
* 影像图库
......@@ -36,6 +33,9 @@ public class ImageImgStorageBiz extends BaseBiz<ImageImgStorageMapper,ImageImgSt
@Autowired
ImageInfoRelationBiz imageInfoRelationBiz;
@Autowired
ShoppingCartInfoBiz shoppingCartInfoBiz;
/**
* 新增或者编辑图像库信息
* @param imageImgStorage
......@@ -61,6 +61,9 @@ public class ImageImgStorageBiz extends BaseBiz<ImageImgStorageMapper,ImageImgSt
} else {
BeanUtil.copyProperties(imageImgStorage, old, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdRe(old);
if (imageImgStorage.getIsDel() != null) {
shoppingCartInfoBiz.updateObj(old.getId(), null, imageImgStorage.getIsDel());
}
}
imageInfoRelationBiz.deleteAll(old.getId());
if (old.getImageInfoRelationList() != null && old.getImageInfoRelationList().size() > 0) {
......@@ -86,6 +89,12 @@ public class ImageImgStorageBiz extends BaseBiz<ImageImgStorageMapper,ImageImgSt
} else {
BeanUtil.copyProperties(imageImgStorage, old, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdRe(old);
List<ImageInfoRelation> imageInfoRelationList = imageInfoRelationBiz.getAllById(imageImgStorage.getId(), 1);
if (imageInfoRelationList != null && imageInfoRelationList.size() > 0) {
imageInfoRelationList.parallelStream().forEach(imageInfoRelation -> {
shoppingCartInfoBiz.updateObj(imageInfoRelation.getId(), old.getStatus(), null);
});
}
}
return ObjectRestResponse.succ();
}
......@@ -136,7 +145,7 @@ public class ImageImgStorageBiz extends BaseBiz<ImageImgStorageMapper,ImageImgSt
for (String id : arr) {
if (StringUtils.isNotBlank(id)) {
ImageImgStorage imageImgStorage = selectById(Integer.valueOf(id));
if (imageImgStorage != null) {
if (imageImgStorage != null && imageImgStorage.getIsDel() == 0 && imageImgStorage.getStatus() == 1) {
List<ImageInfoRelation> imageInfoRelationList = imageInfoRelationBiz.getAllById(imageImgStorage.getId(), 1);
if (imageInfoRelationList != null) {
imageImgStorage.setImageInfoRelationList(imageInfoRelationList);
......@@ -234,9 +243,21 @@ public class ImageImgStorageBiz extends BaseBiz<ImageImgStorageMapper,ImageImgSt
imageImgStorageList.parallelStream().forEach(imageImgStorage -> {
if (imageStorageImgDto.getStatus() != null) {
imageImgStorage.setStatus(imageStorageImgDto.getStatus());
List<ImageInfoRelation> imageInfoRelationList = imageInfoRelationBiz.getAllById(imageImgStorage.getId(), 1);
if (imageInfoRelationList != null && imageInfoRelationList.size() > 0) {
imageInfoRelationList.parallelStream().forEach(imageInfoRelation -> {
shoppingCartInfoBiz.updateObj(imageInfoRelation.getId(), imageImgStorage.getStatus(), null);
});
}
}
if (imageStorageImgDto.getIsDel() != null) {
imageImgStorage.setIsDel(imageStorageImgDto.getIsDel());
List<ImageInfoRelation> imageInfoRelationList = imageInfoRelationBiz.getAllById(imageImgStorage.getId(), 1);
if (imageInfoRelationList != null && imageInfoRelationList.size() > 0) {
imageInfoRelationList.parallelStream().forEach(imageInfoRelation -> {
shoppingCartInfoBiz.updateObj(imageInfoRelation.getId(), null, imageImgStorage.getIsDel());
});
}
}
});
mapper.batchSave(imageImgStorageList);
......
......@@ -38,6 +38,9 @@ public class IndustryApplicationInfoBiz extends BaseBiz<IndustryApplicationInfoM
@Autowired
IndustryApplicationTypeBiz industryApplicationTypeBiz;
@Autowired
ShoppingCartInfoBiz shoppingCartInfoBiz;
/**
* 行业应用信息
* @param industryApplicationInfo
......@@ -54,6 +57,12 @@ public class IndustryApplicationInfoBiz extends BaseBiz<IndustryApplicationInfoM
}
BeanUtil.copyProperties(industryApplicationInfo, old, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdRe(old);
if (industryApplicationInfo.getIsDel() != null) {
shoppingCartInfoBiz.updateObj(old.getId(), null, industryApplicationInfo.getIsDel());
}
if (industryApplicationInfo.getStatus() != null) {
shoppingCartInfoBiz.updateObj(old.getId(), industryApplicationInfo.getStatus(), null);
}
} else {
insertSelectiveRe(industryApplicationInfo);
}
......
......@@ -41,18 +41,15 @@ import java.util.Set;
*/
@Service
public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, ShoppingCartInfo> {
@Autowired
OrderInfoBiz orderInfoBiz;
@Autowired
OrderItemBiz orderItemBiz;
@Autowired
IndustryApplicationInfoBiz industryApplicationInfoBiz;
@Autowired
ImageImgStorageBiz imageImgStorageBiz;
ImageImgStorageBiz imageImgStorageBiz;
@Autowired
UserFeign userFeign;
......@@ -85,6 +82,7 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
ShoppingCartInfo old = selectById(shoppingCartInfo.getCartId());
BeanUtil.copyProperties(shoppingCartInfo, old, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdRe(old);
}
return ObjectRestResponse.succ();
}
......@@ -101,7 +99,7 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
Example example = new Example(ShoppingCartInfo.class);
example.createCriteria().andEqualTo("userId", appUserDTO.getUserid()).andEqualTo("isDel", 0);
example.createCriteria().andEqualTo("userId", appUserDTO.getUserid()).andEqualTo("isDel", 0).andEqualTo("status", 1);
example.orderBy("updTime").desc();
Query query = new Query(orderInfoDto);
PageDataVO<ShoppingCartInfo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectByExample(example));
......@@ -237,7 +235,7 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
public ShoppingCartInfo selectByUser(Integer userId, Long detailId) {
Example example = new Example(ShoppingCartInfo.class);
example.createCriteria().andEqualTo("detailId", detailId)
.andEqualTo("userId", userId).andEqualTo("isDel", 0);
.andEqualTo("userId", userId).andEqualTo("isDel", 0).andEqualTo("status", 1);
return mapper.selectOneByExample(example);
}
......@@ -260,7 +258,7 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, ResultCode.getMsg(ResultCode.NOTEXIST_CODE));
}
Example example = new Example(ShoppingCartInfo.class);
example.createCriteria().andIn("cartId", Arrays.asList(cartIds)).andEqualTo("isDel", 0);
example.createCriteria().andIn("cartId", Arrays.asList(cartIds)).andEqualTo("isDel", 0).andEqualTo("status", 1);
List<ShoppingCartInfo> cartInfoList = mapper.selectByExample(example);
if (cartInfoList != null && cartInfoList.size() > 0) {
convertToOrderInfo(cartInfoList, cartOrderDto, appUserDTO);
......@@ -309,7 +307,7 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
* @param id
* @return
*/
public ObjectRestResponse deleteOne(Integer id) {
public ObjectRestResponse deleteOne(Long id) {
if (id == null) {
return ObjectRestResponse.paramIsEmpty();
}
......@@ -338,7 +336,7 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
}
for (String id : idArr) {
if (StringUtils.isNotBlank(id)) {
deleteOne(Integer.parseInt(id));
deleteOne(Long.valueOf(id));
}
}
return ObjectRestResponse.succ();
......@@ -351,8 +349,28 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
*/
public List<ShoppingCartInfo> getAllByIds(Set<Integer> idList) {
Example example = new Example(ShoppingCartInfo.class);
example.createCriteria().andIn("id", idList);
example.createCriteria().andIn("id", idList).andEqualTo("status", 1).andEqualTo("isDel", 0);
return mapper.selectByExample(example);
}
/**
* 购物车下架
* @param detailId
*/
public void updateObj(Integer detailId, Integer status, Integer isDel) {
Example example = new Example(ShoppingCartInfo.class);
example.createCriteria().andEqualTo("detailId", detailId)
.andEqualTo("status", 1).andEqualTo("isDel", 0);
ShoppingCartInfo shoppingCartInfo = mapper.selectOneByExample(example);
if (shoppingCartInfo != null) {
if (status != null) {
shoppingCartInfo.setStatus(status);
}
if (isDel != null) {
shoppingCartInfo.setIsDel(1);
}
updateSelectiveByIdRe(shoppingCartInfo);
}
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ public class ShoppingCartInfoWebController extends BaseController<ShoppingCartIn
}
@DeleteMapping(value = "deleteOne")
public ObjectRestResponse deleteOne(Integer id) {
public ObjectRestResponse deleteOne(Long id) {
return baseBiz.deleteOne(id);
}
......
......@@ -13,7 +13,7 @@
</foreach>
ON DUPLICATE KEY UPDATE
is_del = values(is_del),
status = values(amount)
status = values(status)
</insert>
</mapper>
\ No newline at end of file
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