|
|
@@ -33,6 +33,7 @@ import java.math.RoundingMode; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.LocalTime; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 预警结果Service业务层处理 |
|
|
@@ -80,9 +81,36 @@ public class ZsOperationWarnresultServiceImpl implements IZsOperationWarnresultS |
|
|
|
public TableDataInfo<ZsOperationWarnresultVo> queryPageList(ZsOperationWarnresultBo bo, PageQuery pageQuery) { |
|
|
|
LambdaQueryWrapper<ZsOperationWarnresult> lqw = buildQueryWrapper(bo); |
|
|
|
Page<ZsOperationWarnresultVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|
|
|
List<ZsOperationWarnresultVo> warnList = result.getRecords(); |
|
|
|
List<String> urls = new ArrayList<>(); |
|
|
|
if (warnList!=null&&warnList.size()>0) { |
|
|
|
for (ZsOperationWarnresultVo zsOperationWarnresultVo : warnList) { |
|
|
|
String url = zsOperationWarnresultVo.getGoodsSkuUrl(); |
|
|
|
urls.add(url); |
|
|
|
} |
|
|
|
QueryWrapper<ZsOperationGoods> queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.in("goods_sku_url",urls); |
|
|
|
List<ZsOperationGoods> goodsList = zsOperationGoodsMapper.selectList(queryWrapper); |
|
|
|
result.setRecords(getRemark(warnList,goodsList)); |
|
|
|
} |
|
|
|
return TableDataInfo.build(result); |
|
|
|
} |
|
|
|
|
|
|
|
private List<ZsOperationWarnresultVo> getRemark(List<ZsOperationWarnresultVo> warns,List<ZsOperationGoods> goods) { |
|
|
|
// 先将listB转为URL为key的Map |
|
|
|
Map<String, String> goodsMap = goods.stream() |
|
|
|
.collect(Collectors.toMap(ZsOperationGoods::getGoodsSkuUrl, ZsOperationGoods::getRemark)); |
|
|
|
|
|
|
|
// 遍历listA进行匹配和赋值 |
|
|
|
warns.forEach(warn -> { |
|
|
|
String remark = goodsMap.get(warn.getGoodsSkuUrl()); |
|
|
|
if (remark != null) { |
|
|
|
warn.setRemark(remark); |
|
|
|
} |
|
|
|
}); |
|
|
|
return warns; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询预警结果列表 |
|
|
|
*/ |
|
|
@@ -227,6 +255,7 @@ public class ZsOperationWarnresultServiceImpl implements IZsOperationWarnresultS |
|
|
|
warnEmail.setCurPrice(initPrice.toString()); |
|
|
|
warnEmail.setNewPrice(newPrice.toString()); |
|
|
|
warnEmail.setImagePath((String)dataMap.get("screenshotUrl")); |
|
|
|
warnEmail.setRemark(zsOperationGoods.getRemark()); |
|
|
|
//读取邮件模板 |
|
|
|
Context context = new Context(); |
|
|
|
context.setVariable("warnEmail", warnEmail); |