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