访客短信+报表问题修复

This commit is contained in:
zjf committed 2025-09-27 00:05:40 +08:00
1 parent 67875df86d
commit d4c42f2c18
4 files changed
+44 -13

No files matched your search

@@ -290,7 +290,7 @@ public class VisitorsServiceImpl extends ServiceImpl<VisitorsMapper, VisitorsEnt
int insert = baseMapper.insert(bean);
//todo 生成环境打开短信
// sendVisitorApprovalSms(visitUser, bean);
sendVisitorYYSms(visitUser, bean);
return insert;
}
@@ -371,11 +371,31 @@ public class VisitorsServiceImpl extends ServiceImpl<VisitorsMapper, VisitorsEnt
stringStringHashMap.put("visitorLocal", dataVisitors.getDeptName());
// 构建动态URL
String url = "http://127.0.0.1:9999/integrated/visitors/app/get/visitorDetail?token=" + dataVisitors.getToken();
String url = "https://stgl.pj.gov.cn/pjvisitor/#/detail?token=" + dataVisitors.getToken();
stringStringHashMap.put("url", url);
reminderThirdPartySmsService.sendParamsMsg(visitorUserEntity.getPhone(), "20658", stringStringHashMap, WebUtils.getIP());
}
/**
* 邀约发送短信
* @param visitorUserEntity
* @param dataVisitors
*/
private void sendVisitorYYSms(VisitorUserEntity visitorUserEntity, VisitorsEntity dataVisitors) {
Map<String, String> stringStringHashMap = new HashMap<>();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// stringStringHashMap.put("phone", dataVisitors.getMobile());
stringStringHashMap.put("yyName", dataVisitors.getUserName());
stringStringHashMap.put("visitorTime", dataVisitors.getVStartDate() + "至" + dataVisitors.getVEndDate());
stringStringHashMap.put("deptName", dataVisitors.getDeptName());
// 构建动态URL
String url = "https://stgl.pj.gov.cn/pjvisitor/#/invitation?token=" + dataVisitors.getToken();
stringStringHashMap.put("url", url);
reminderThirdPartySmsService.sendParamsMsg(visitorUserEntity.getPhone(), "27694", stringStringHashMap, WebUtils.getIP());
}
@Override
public Object getPageSQ(Page page, VisitorsEntity visitors) {
Long currentVisitorUserId = getCurrentVisitorUserId();
@@ -230,7 +230,8 @@ public class ProfitMarginReportServiceImpl implements ProfitMarginReportService
// 计算成本额
// 优先使用包装单位的实际进价,如果没有则使用商品主表的成本价
BigDecimal costPrice = getActualCostPrice(product, item, unitMap);
BigDecimal itemCostAmount = costPrice.multiply(new BigDecimal(item.getQuantity() != null ? item.getQuantity() : 0));
// 使用绝对值确保成本金额为正数
BigDecimal itemCostAmount = costPrice.multiply(new BigDecimal(Math.abs(item.getQuantity() != null ? item.getQuantity() : 0)));
totalCostAmount = totalCostAmount.add(itemCostAmount);
@@ -322,7 +323,8 @@ public class ProfitMarginReportServiceImpl implements ProfitMarginReportService
// 使用第一个销售记录的包装单位来获取成本价格
SmErpInventoryRecordsItemEntity firstItem = items.get(0);
BigDecimal costPrice = getActualCostPrice(product, firstItem, unitMap);
BigDecimal costAmount = costPrice.multiply(new BigDecimal(salesQuantity));
// 使用绝对值确保成本金额为正数
BigDecimal costAmount = costPrice.multiply(new BigDecimal(Math.abs(salesQuantity)));
// 计算毛利润
BigDecimal profitAmount = salesAmount.subtract(costAmount);
@@ -1038,7 +1040,8 @@ public class ProfitMarginReportServiceImpl implements ProfitMarginReportService
SmErpSpuEntity product = productMap.get(item.getErpSpuId());
if (product != null && !isPriceAdjustmentProduct(product.getProductName())) {
BigDecimal costPrice = getActualCostPrice(product, item, unitMap);
BigDecimal itemCostAmount = costPrice.multiply(new BigDecimal(item.getQuantity() != null ? item.getQuantity() : 0));
// 使用绝对值确保成本金额为正数
BigDecimal itemCostAmount = costPrice.multiply(new BigDecimal(Math.abs(item.getQuantity() != null ? item.getQuantity() : 0)));
costAmount = costAmount.add(itemCostAmount);
}
}
@@ -1143,7 +1146,8 @@ public class ProfitMarginReportServiceImpl implements ProfitMarginReportService
SmErpSpuEntity product = productMap.get(item.getErpSpuId());
if (product != null && !isPriceAdjustmentProduct(product.getProductName())) {
BigDecimal costPrice = getActualCostPrice(product, item, unitMap);
BigDecimal itemCostAmount = costPrice.multiply(new BigDecimal(item.getQuantity() != null ? item.getQuantity() : 0));
// 使用绝对值确保成本金额为正数
BigDecimal itemCostAmount = costPrice.multiply(new BigDecimal(Math.abs(item.getQuantity() != null ? item.getQuantity() : 0)));
costAmount = costAmount.add(itemCostAmount);
}
}
@@ -564,11 +564,18 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
smErpInventoryRecordsItemEntity.setUnitPrice
(smErpUnitEntity.getPromotionPrice()==null || smErpUnitEntity.getPromotionPrice()==0
?smErpUnitEntity.getRetailPrice():smErpUnitEntity.getPromotionPrice());
// smErpInventoryRecordsItemEntity.setTotalAmount(smErpInventoryRecordsItemEntity.getQuantity() * smErpInventoryRecordsItemEntity.getUnitPrice());
//使用 BigDecimal 避免浮点数精度问题
//setScale(0, RoundingMode.HALF_UP) 确保四舍五入到整数
BigDecimal quantity = BigDecimal.valueOf(smErpInventoryRecordsItemEntity.getQuantity());
BigDecimal unitPrice = BigDecimal.valueOf(smErpInventoryRecordsItemEntity.getUnitPrice());
BigDecimal totalAmount = quantity.multiply(unitPrice);
smErpInventoryRecordsItemEntity.setTotalAmount(totalAmount.setScale(0, RoundingMode.HALF_UP).intValue());
smErpInventoryRecordsItemEntityList.add(smErpInventoryRecordsItemEntity);
}
smErpStockService.updateStock(updateStockDTOS);
int sum = smErpInventoryRecordsItemEntityList.stream().map(smErpInventoryRecordsItemEntity -> smErpInventoryRecordsItemEntity.getUnitPrice()).mapToInt(Integer::intValue).sum();
int sum = smErpInventoryRecordsItemEntityList.stream()
.mapToInt(SmErpInventoryRecordsItemEntity::getTotalAmount)
.sum();
smErpInventoryRecordsEntity.setTotalAmount(sum);
smErpInventoryRecordsEntity.setReceiveAmount(sum);
//生成出入库记录
@@ -119,10 +119,10 @@ sms:
params: [ "code", "date" ]
20658:
content: "您于{createTime}申请的访客预约现已通过审核!
▶ 访客姓名:{visitorName}
▶ 访客手机号:{visitorPhone}
▶ 到访时间:{visitorTime}
▶ 访问地点:{visitorLocal}
访客姓名:{visitorName}
访客手机号:{visitorPhone}
到访时间:{visitorTime}
访问地点:{visitorLocal}
请及时登录系统查看详情:{url}"
params: [ "createTime", "visitorName", "visitorPhone", "visitorTime", "visitorLocal","url" ]