Browse Source

1.预警结果添加remark

2.发送短信添加remark
wq_dev
wangqiang 1 month ago
parent
commit
529fb315c5

+ 1
- 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/WarnEmail.java View File

@@ -14,4 +14,5 @@ public class WarnEmail implements Serializable {
private String warnTime;
private String imagePath;
private String platformName;
private String remark;
}

+ 2
- 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/ZsOperationWarnresultVo.java View File

@@ -111,5 +111,7 @@ public class ZsOperationWarnresultVo {
@ExcelProperty(value = "比对状态")
@ExcelDictFormat(dictType = "zs_operation_compare_status")
private Integer compareStatus;
@ExcelProperty(value = "备注")
private String remark;

}

+ 29
- 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZsOperationWarnresultServiceImpl.java View File

@@ -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);

+ 5
- 0
ruoyi-system/src/main/resources/templates/warnEmail.html View File

@@ -46,6 +46,11 @@
</td>
<td th:text="${warnEmail.getSkuSn()}">B08KGRRSKH</td>
</tr>
<tr>
<td style="background-color: #f2f4f6; font-weight: bold; vertical-align: top;">商品备注
</td>
<td th:text="${warnEmail.getRemark()}"></td>
</tr>
<tr>
<td style="background-color: #f2f4f6; font-weight: bold; vertical-align: top;">商品链接
</td>

Loading…
Cancel
Save