2025008071805
This commit is contained in:
parent
466aae0244
commit
238f958a84
|
|
@ -634,6 +634,7 @@ public class OrderUtil {
|
||||||
* @return 新建的订单对象(仅拼团),或处理结果Map
|
* @return 新建的订单对象(仅拼团),或处理结果Map
|
||||||
*/
|
*/
|
||||||
public static Object prepayCallback(UsersPayBefor payBefor, Users user) throws Exception {
|
public static Object prepayCallback(UsersPayBefor payBefor, Users user) throws Exception {
|
||||||
|
payBefor= usersPayBeforService.selectUsersPayBeforById(payBefor.getId());
|
||||||
System.out.println("=== prepayCallback 方法开始 ===");
|
System.out.println("=== prepayCallback 方法开始 ===");
|
||||||
System.out.println("输入参数 - payBefor: " + (payBefor != null ? payBefor.toString() : "null"));
|
System.out.println("输入参数 - payBefor: " + (payBefor != null ? payBefor.toString() : "null"));
|
||||||
System.out.println("输入参数 - user: " + (user != null ? user.toString() : "null"));
|
System.out.println("输入参数 - user: " + (user != null ? user.toString() : "null"));
|
||||||
|
|
@ -2092,7 +2093,7 @@ public class OrderUtil {
|
||||||
*/
|
*/
|
||||||
public static String TheCallWorder() throws Exception {
|
public static String TheCallWorder() throws Exception {
|
||||||
//第一步先去查询已经派单,但是师傅还没接单的订单
|
//第一步先去查询已经派单,但是师傅还没接单的订单
|
||||||
System.out.println("开始执行定时查询任务---------------------------"+new Date());
|
System.out.println("0开始执行定时查询派单任务---------------------------"+new Date());
|
||||||
IOrderService orderService = SpringUtils.getBean(IOrderService.class);
|
IOrderService orderService = SpringUtils.getBean(IOrderService.class);
|
||||||
Order order = new Order();
|
Order order = new Order();
|
||||||
order.setIsAccept(0);
|
order.setIsAccept(0);
|
||||||
|
|
@ -2103,9 +2104,13 @@ public class OrderUtil {
|
||||||
OrderCall orderCall = new OrderCall();
|
OrderCall orderCall = new OrderCall();
|
||||||
orderCall.setOid(order1.getId());
|
orderCall.setOid(order1.getId());
|
||||||
List<OrderCall> orderCallList = orderCallService.selectOrderCallList(orderCall);
|
List<OrderCall> orderCallList = orderCallService.selectOrderCallList(orderCall);
|
||||||
|
System.out.println("1开始执行定时查询派单任务---------------------------"+orderCallList.size());
|
||||||
|
|
||||||
if (orderCallList != null && !orderCallList.isEmpty()){
|
if (orderCallList != null && !orderCallList.isEmpty()){
|
||||||
|
|
||||||
if (orderCallList.size()<3){
|
if (orderCallList.size()<3){
|
||||||
if (orderCallList.getFirst().getCallerstate()!= 0L){
|
if (orderCallList.getFirst().getCallerstate()!= 0L){
|
||||||
|
System.out.println("2开始执行order1.getWorkerId()定时查询派单任务---------------------------"+order1.getWorkerId());
|
||||||
Users user = usersService.selectUsersById(order1.getWorkerId());
|
Users user = usersService.selectUsersById(order1.getWorkerId());
|
||||||
if (user != null){
|
if (user != null){
|
||||||
String phone = user.getPhone();
|
String phone = user.getPhone();
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,34 @@ public class WXsendMsgUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//催单
|
||||||
|
public static String sendMsgForWorkerCuiDanInfo(String openid, Order order, String title,String reamk) throws Exception {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
//拼接推送的模版
|
||||||
|
WxMssVo wxMssVo = new WxMssVo();
|
||||||
|
wxMssVo.setTouser(openid);//用户的openid(要发送给那个用户,通常这里应该动态传进来的)
|
||||||
|
wxMssVo.setTemplate_id(ORDER_STATUS);//订阅消息模板id
|
||||||
|
wxMssVo.setPage("/pages/tab/serve/index");
|
||||||
|
String mark = order.getMark();
|
||||||
|
if (StringUtils.isEmpty( mark)){
|
||||||
|
mark="暂无备注";
|
||||||
|
}
|
||||||
|
Map<String, TemplateData> m = new HashMap<>(3);
|
||||||
|
m.put("thing15", new TemplateData(title));
|
||||||
|
m.put("character_string5", new TemplateData(order.getOrderId()));
|
||||||
|
m.put("date3", new TemplateData(AppletControllerUtil.timeStamp2Date(order)));
|
||||||
|
m.put("thing1", new TemplateData(order.getAddress()));
|
||||||
|
m.put("thing9", new TemplateData(reamk));
|
||||||
|
|
||||||
|
System.out.println("0002订单号:" + m.toString());
|
||||||
|
wxMssVo.setData(m);
|
||||||
|
return PublicPush(wxMssVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//微信推送第er步,给师傅通知派单情况
|
//微信推送第er步,给师傅通知派单情况
|
||||||
public static String sendMsgForWorkerInfo(String openid, Order order, ServiceGoods serviceGoods) throws Exception {
|
public static String sendMsgForWorkerInfo(String openid, Order order, ServiceGoods serviceGoods) throws Exception {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
|
||||||
|
|
@ -655,7 +655,7 @@ public class WorkerCommissionUtil {
|
||||||
// 6. 计算师傅材料初次分佣
|
// 6. 计算师傅材料初次分佣
|
||||||
// 公式:材料费用*材料分佣基数
|
// 公式:材料费用*材料分佣基数
|
||||||
BigDecimal materialCommissionAmount = calculateMaterialCommissionNew(orderId);
|
BigDecimal materialCommissionAmount = calculateMaterialCommissionNew(orderId);
|
||||||
|
logger.info("===材料分佣 分佣基数信息 ====================================================="+materialCommissionAmount);
|
||||||
// 7. 计算师傅质保金
|
// 7. 计算师傅质保金
|
||||||
// 公式:(师傅材料初次分佣+师傅服务初次分佣)*质保金扣除比例
|
// 公式:(师傅材料初次分佣+师傅服务初次分佣)*质保金扣除比例
|
||||||
BigDecimal totalInitialCommission = serviceCommissionAmount.add(materialCommissionAmount);
|
BigDecimal totalInitialCommission = serviceCommissionAmount.add(materialCommissionAmount);
|
||||||
|
|
@ -1026,7 +1026,7 @@ public class WorkerCommissionUtil {
|
||||||
* @return 材料初次分佣金额
|
* @return 材料初次分佣金额
|
||||||
*/
|
*/
|
||||||
private static BigDecimal calculateMaterialCommissionNew(Long orderId) {
|
private static BigDecimal calculateMaterialCommissionNew(Long orderId) {
|
||||||
logger.info("=== 计算师傅材料初次分佣(新逻辑) ===");
|
logger.info("=== 0计算师傅材料初次分佣(新逻辑) =====================================================================");
|
||||||
logger.info("订单ID: {}", orderId);
|
logger.info("订单ID: {}", orderId);
|
||||||
|
|
||||||
BigDecimal totalMaterialCommission = BigDecimal.ZERO;
|
BigDecimal totalMaterialCommission = BigDecimal.ZERO;
|
||||||
|
|
@ -1059,27 +1059,29 @@ public class WorkerCommissionUtil {
|
||||||
// 4. 解析content获取material
|
// 4. 解析content获取material
|
||||||
JSONObject contentJson = JSONObject.parseObject(content);
|
JSONObject contentJson = JSONObject.parseObject(content);
|
||||||
JSONArray materialArray = contentJson.getJSONArray("material");
|
JSONArray materialArray = contentJson.getJSONArray("material");
|
||||||
|
logger.info("1=== 计算师傅材料初次分佣(新逻辑) ====================================================================="+materialArray.toJSONString());
|
||||||
if (materialArray == null || materialArray.isEmpty()) {
|
if (materialArray == null || materialArray.isEmpty()) {
|
||||||
logger.info("订单日志 {} 中没有material数据", orderLog.getId());
|
logger.info("订单日志 {} 中没有material数据", orderLog.getId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 遍历材料明细
|
// 5. 遍历材料明细
|
||||||
for (int i = 0; i < materialArray.size(); i++) {
|
for (int i = 0; i < materialArray.size(); i++) {
|
||||||
JSONObject materialItem = materialArray.getJSONObject(i);
|
JSONObject materialItem = materialArray.getJSONObject(i);
|
||||||
Long materialId = materialItem.getLong("id");
|
Long materialId = materialItem.getLong("id");
|
||||||
BigDecimal quantity = materialItem.getBigDecimal("quantity");
|
BigDecimal quantity = materialItem.getBigDecimal("count");
|
||||||
|
logger.info("2=== 计算师傅材料初次分佣(新逻辑) ====================================================================="+materialId);
|
||||||
|
|
||||||
if (materialId == null || quantity == null || quantity.compareTo(BigDecimal.ZERO) <= 0) {
|
if (materialId == null || quantity == null || quantity.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("处理材料 - ID: {}, 数量: {}", materialId, quantity);
|
logger.info("处理材料 - ID: {}, 数量: {}", materialId, quantity);
|
||||||
|
logger.info("3=== 计算师傅材料初次分佣(新逻辑) ====================================================================="+materialId);
|
||||||
|
|
||||||
// 6. 查询报价材料信息
|
// 6. 查询报价材料信息
|
||||||
BigDecimal materialCommission = calculateSingleMaterialCommission(
|
BigDecimal materialCommission = calculateSingleMaterialCommission(
|
||||||
materialId, quantity, systemMaterialCommissionBase);
|
materialId, quantity, systemMaterialCommissionBase);
|
||||||
|
logger.info("4=== 计算师傅材料初次分佣(新逻辑) ====================================================================="+materialCommission);
|
||||||
|
|
||||||
totalMaterialCommission = totalMaterialCommission.add(materialCommission);
|
totalMaterialCommission = totalMaterialCommission.add(materialCommission);
|
||||||
}
|
}
|
||||||
|
|
@ -1088,6 +1090,7 @@ public class WorkerCommissionUtil {
|
||||||
logger.error("解析订单日志 {} 的material数据失败", orderLog.getId(), e);
|
logger.error("解析订单日志 {} 的material数据失败", orderLog.getId(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logger.info("5=== 计算师傅材料初次分佣(新逻辑) ====================================================================="+totalMaterialCommission);
|
||||||
|
|
||||||
logger.info("材料分佣计算完成: {}元", totalMaterialCommission);
|
logger.info("材料分佣计算完成: {}元", totalMaterialCommission);
|
||||||
return totalMaterialCommission;
|
return totalMaterialCommission;
|
||||||
|
|
@ -1108,6 +1111,7 @@ public class WorkerCommissionUtil {
|
||||||
*/
|
*/
|
||||||
private static BigDecimal calculateSingleMaterialCommission(Long materialId, BigDecimal quantity,
|
private static BigDecimal calculateSingleMaterialCommission(Long materialId, BigDecimal quantity,
|
||||||
BigDecimal systemMaterialCommissionBase) {
|
BigDecimal systemMaterialCommissionBase) {
|
||||||
|
logger.info("4=== 计算师傅材料初次分佣(新逻辑) ====================================================================="+materialId);
|
||||||
try {
|
try {
|
||||||
// 1. 查询报价材料信息
|
// 1. 查询报价材料信息
|
||||||
QuoteMaterial quoteMaterial = quoteMaterialService.selectQuoteMaterialById(materialId);
|
QuoteMaterial quoteMaterial = quoteMaterialService.selectQuoteMaterialById(materialId);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue