| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.utils.AppContants; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.mall.conversion.MallGoodsConversion; |
| | |
| | | private final RedisUtils redisUtils; |
| | | private final CjItemMapper cjItemMapper; |
| | | private final CjInfoMapper cjInfoMapper; |
| | | private final TzInfoMapper tzInfoMapper; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | |
| | | @Override |
| | | public IPage<AdminMallGoodsVo> getCategoryListInPage(MallGoods mallGoods, QueryRequest request) { |
| | |
| | | QueryWrapper<CjInfo> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("kj_no",kjNo); |
| | | List<CjInfo> cjInfos = cjInfoMapper.selectList(objectQueryWrapper); |
| | | List<Long> collect = cjInfos.stream().map(CjInfo::getId).collect(Collectors.toList()); |
| | | List<CjItem> cjItems = cjItemMapper.selectSumAmountByInfoId(collect); |
| | | for(TzInfo tzInfo1 : records){ |
| | | List<CjItem> collect1 = cjItems.stream().filter(cjItem -> cjItem.getTzCode().equals(tzInfo1.getTzCode())).collect(Collectors.toList()); |
| | | if(CollUtil.isNotEmpty(collect1)){ |
| | | BigDecimal reduce = collect1.stream().map(CjItem::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | tzInfo1.setTzAmount(reduce); |
| | | }else{ |
| | | tzInfo1.setTzAmount(BigDecimal.ZERO); |
| | | if(CollUtil.isNotEmpty(cjInfos)){ |
| | | List<Long> collect = cjInfos.stream().map(CjInfo::getId).collect(Collectors.toList()); |
| | | List<CjItem> cjItems = cjItemMapper.selectSumAmountByInfoId(collect); |
| | | for(TzInfo tzInfo1 : records){ |
| | | List<CjItem> collect1 = cjItems.stream().filter(cjItem -> cjItem.getTzCode().equals(tzInfo1.getTzCode())).collect(Collectors.toList()); |
| | | if(CollUtil.isNotEmpty(collect1)){ |
| | | BigDecimal reduce = collect1.stream().map(CjItem::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | tzInfo1.setTzAmount(reduce); |
| | | }else{ |
| | | tzInfo1.setTzAmount(BigDecimal.ZERO); |
| | | } |
| | | } |
| | | } |
| | | return adminMallGoodsVos; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse tzUpdate(TzInfo tzInfo) { |
| | | Long id = tzInfo.getId(); |
| | | |
| | | TzInfo tzInfo1 = tzInfoMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(tzInfo1)){ |
| | | return new FebsResponse().fail().message("设置失败"); |
| | | } |
| | | tzInfo1.setTzPercent(tzInfo.getTzPercent()); |
| | | tzInfoMapper.updateById(tzInfo1); |
| | | |
| | | if(ObjectUtil.isNotEmpty(tzInfo.getIsRecommend())){ |
| | | dataDictionaryCustomMapper.updateDicValueByTypeAndCode( |
| | | DataDictionaryEnum.OPEN_PRICE.getType(), |
| | | DataDictionaryEnum.OPEN_PRICE.getCode(), |
| | | tzInfo.getIsRecommend() |
| | | ); |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | |
| | | } |