Commit 2b5e79f8 authored by unset's avatar unset

影像图库新增批量上下架以及删除接口

parent 5010618c
......@@ -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,12 @@ public class ImageImgStorageBiz extends BaseBiz<ImageImgStorageMapper,ImageImgSt
@Autowired
ImageInfoRelationBiz imageInfoRelationBiz;
private final ShoppingCartInfoBiz shoppingCartInfoBiz;
public ImageImgStorageBiz(ShoppingCartInfoBiz shoppingCartInfoBiz) {
this.shoppingCartInfoBiz = shoppingCartInfoBiz;
}
/**
* 新增或者编辑图像库信息
* @param imageImgStorage
......@@ -61,6 +64,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 +92,7 @@ public class ImageImgStorageBiz extends BaseBiz<ImageImgStorageMapper,ImageImgSt
} else {
BeanUtil.copyProperties(imageImgStorage, old, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdRe(old);
shoppingCartInfoBiz.updateObj(old.getId(), old.getStatus(), null);
}
return ObjectRestResponse.succ();
}
......@@ -234,9 +241,11 @@ public class ImageImgStorageBiz extends BaseBiz<ImageImgStorageMapper,ImageImgSt
imageImgStorageList.parallelStream().forEach(imageImgStorage -> {
if (imageStorageImgDto.getStatus() != null) {
imageImgStorage.setStatus(imageStorageImgDto.getStatus());
shoppingCartInfoBiz.updateObj(imageImgStorage.getId(), imageImgStorage.getStatus(), null);
}
if (imageStorageImgDto.getIsDel() != null) {
imageImgStorage.setIsDel(imageStorageImgDto.getIsDel());
shoppingCartInfoBiz.updateObj(imageImgStorage.getId(), null, imageImgStorage.getIsDel());
}
});
mapper.batchSave(imageImgStorageList);
......
......@@ -37,7 +37,11 @@ public class IndustryApplicationInfoBiz extends BaseBiz<IndustryApplicationInfoM
@Autowired
IndustryApplicationTypeBiz industryApplicationTypeBiz;
private final ShoppingCartInfoBiz shoppingCartInfoBiz;
public IndustryApplicationInfoBiz(ShoppingCartInfoBiz shoppingCartInfoBiz) {
this.shoppingCartInfoBiz = shoppingCartInfoBiz;
}
/**
* 行业应用信息
* @param industryApplicationInfo
......@@ -54,6 +58,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);
}
......
......@@ -85,6 +85,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 +102,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 +238,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 +261,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 +310,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 +339,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 +352,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);
}
......
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