dev
parent
eff2a8aea4
commit
2193834913
|
|
@ -22,21 +22,25 @@ public class Const {
|
|||
|
||||
public static final String TEMP_CODE_AGGR_STAT = "SMS_205434464"; // 累计销售汇总
|
||||
public static final String TEMP_CODE_DAY_STAT = "SMS_205430436"; // 日销售汇总
|
||||
public static final String TEMP_CODE_CUSTOMER_DAY_STAT = "SMS_205430478"; // 客户日销售汇总
|
||||
public static final String TEMP_CODE_CUSTOMER_DAY_STAT = "SMS_208985081"; // 客户日销售汇总
|
||||
public static final String TEMP_CODE_PEIE = "SMS_203673037"; // 配额分配通知
|
||||
public static final String TEMP_CODE_DEPOSIT_SUCCESS = "SMS_205430440"; // 客户预存成功通知
|
||||
public static final String TEMP_CODE_DEPOSIT_FAIL = "SMS_205440366"; // 客户预存失败通知
|
||||
public static final String TEMP_CODE_DEPOSIT_SUCCESS = "SMS_208980426"; // 客户预存成功通知
|
||||
public static final String TEMP_CODE_DEPOSIT_FAIL = "SMS_208985365"; // 客户预存失败通知
|
||||
public static final String TEMP_CODE_SURPLUS_WARN = "SMS_208975325"; // 客户余额预警
|
||||
public static final String TEMP_CODE_REFUND_SUCCESS = "SMS_208965364"; // 客户退款成功通知
|
||||
public static Map<String, String> SMS_TEMP_MAP;
|
||||
|
||||
static {
|
||||
SMS_TEMP_MAP = new HashMap<>();
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_DAY_STAT, "${time}销售汇总:${supermarket_count}个砂站共销售${weight}吨黄砂,总价${total_price}元。各砂站详情如下:${supermarket_detail}元。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_CUSTOMER_DAY_STAT, "${time}共计运输黄砂${weight}吨、运输车次${truck_num}辆次,合计${total_price}元。其中${supermarket_detail}元。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_CUSTOMER_DAY_STAT, "${time}共计运输黄砂${weight}吨、运输车次${truck_num}辆次,合计${total_price}元。其中${supermarket_detail}元。账户余额${surplus}元。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_PEIE, "已经在${supermarket_name}分配了${weight}吨配额,请在${date}安排车辆前去运输。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_DEPOSIT_SUCCESS, "${time}${customer_name}在浠水县长投环保有限公司的预存${amount}元,合计余额${surplus}元。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_DEPOSIT_FAIL, "${time}${customer_name}在浠水县长投环保有限公司预存的${amount}元审核未通过,若有疑问请及时联系浠水县长投环保结算中心。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_DEPOSIT_SUCCESS, "${time}${customer_name}在${vendor}的预存${amount}元,合计余额${surplus}元。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_DEPOSIT_FAIL, "${time}${customer_name}在${vendor}预存的${amount}元审核未通过,若有疑问请及时联系结算中心。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_AGGR_STAT, "截至${time1}累计销售黄砂${aggr_weight}吨,共计${aggr_price}元,运输${aggr_cnt}辆次。" +
|
||||
"账户累计${aggr_total_price}元,其中预付费客户总余额${customer_total_surplus}元。" +
|
||||
"${time2}当日销售黄砂${total_weight}吨,共计${total_price}元,运输${total_cnt}辆次。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_SURPLUS_WARN, "截至${time}${customer_name}在${vendor}的预存账户余额为${surplus}元。请及时关注。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_REFUND_SUCCESS, "${time}${customer_name}在${vendor}的退款${amount}元,合计余额${surplus}元。");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,11 @@ public class DateTimeUtil {
|
|||
return new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
}
|
||||
};
|
||||
public static final ThreadLocal<SimpleDateFormat> sdfhmch = new ThreadLocal<SimpleDateFormat>() {
|
||||
protected SimpleDateFormat initialValue() {
|
||||
return new SimpleDateFormat("yyyy年MM月dd日HH时mm分");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 验证是否符合格式的时间字符串
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import com.jfinal.plugin.activerecord.IBean;
|
|||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Generated by COWR Sun May 17 21:43:18 CST 2020
|
||||
* Generated by COWR Thu Jan 07 10:50:36 CST 2021
|
||||
* TableName: prepay_customer
|
||||
* Remarks: 客户相关 - 预付费客户余额信息,每个客户在每个砂站有单独的余额
|
||||
* Remarks: 客户相关 - 预付费客户余额信息,每个客户在每个超市有单独的余额
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
|
|
@ -15,8 +15,8 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
|
||||
public static final String tablename = "prepay_customer";
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public String getTablename() {
|
||||
@JSONField(serialize=false)
|
||||
public String getTablename(){
|
||||
return tablename;
|
||||
}
|
||||
|
||||
|
|
@ -26,10 +26,9 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
* isNullable: NO
|
||||
* isPrimaryKey: YES
|
||||
* defaultValue:
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@JSONField(name = "id")
|
||||
@JSONField(name="id")
|
||||
public void setId(Integer id) {
|
||||
set("id", id);
|
||||
}
|
||||
|
|
@ -38,7 +37,7 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
/**
|
||||
* @return id
|
||||
*/
|
||||
@JSONField(name = "id")
|
||||
@JSONField(name="id")
|
||||
public Integer getId() {
|
||||
return getInt("id");
|
||||
}
|
||||
|
|
@ -49,10 +48,9 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param customerId 客户表 customer 的 id
|
||||
*/
|
||||
@JSONField(name = "customer_id")
|
||||
@JSONField(name="customer_id")
|
||||
public void setCustomerId(Integer customerId) {
|
||||
set("customer_id", customerId);
|
||||
}
|
||||
|
|
@ -61,7 +59,7 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
/**
|
||||
* @return customer_id 客户表 customer 的 id
|
||||
*/
|
||||
@JSONField(name = "customer_id")
|
||||
@JSONField(name="customer_id")
|
||||
public Integer getCustomerId() {
|
||||
return getInt("customer_id");
|
||||
}
|
||||
|
|
@ -72,19 +70,18 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param supermarketId 砂站id
|
||||
* @param supermarketId 超市id
|
||||
*/
|
||||
@JSONField(name = "supermarket_id")
|
||||
@JSONField(name="supermarket_id")
|
||||
public void setSupermarketId(Integer supermarketId) {
|
||||
set("supermarket_id", supermarketId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return supermarket_id 砂站id
|
||||
* @return supermarket_id 超市id
|
||||
*/
|
||||
@JSONField(name = "supermarket_id")
|
||||
@JSONField(name="supermarket_id")
|
||||
public Integer getSupermarketId() {
|
||||
return getInt("supermarket_id");
|
||||
}
|
||||
|
|
@ -95,10 +92,9 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 0.00
|
||||
*
|
||||
* @param surplus 账户余额
|
||||
*/
|
||||
@JSONField(name = "surplus")
|
||||
@JSONField(name="surplus")
|
||||
public void setSurplus(java.math.BigDecimal surplus) {
|
||||
set("surplus", surplus);
|
||||
}
|
||||
|
|
@ -107,7 +103,7 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
/**
|
||||
* @return surplus 账户余额
|
||||
*/
|
||||
@JSONField(name = "surplus")
|
||||
@JSONField(name="surplus")
|
||||
public java.math.BigDecimal getSurplus() {
|
||||
return get("surplus");
|
||||
}
|
||||
|
|
@ -118,10 +114,9 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param rechargeTime 最后充值时间
|
||||
*/
|
||||
@JSONField(name = "recharge_time")
|
||||
@JSONField(name="recharge_time")
|
||||
public void setRechargeTime(java.util.Date rechargeTime) {
|
||||
set("recharge_time", rechargeTime);
|
||||
}
|
||||
|
|
@ -130,7 +125,7 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
/**
|
||||
* @return recharge_time 最后充值时间
|
||||
*/
|
||||
@JSONField(name = "recharge_time")
|
||||
@JSONField(name="recharge_time")
|
||||
public java.util.Date getRechargeTime() {
|
||||
return get("recharge_time");
|
||||
}
|
||||
|
|
@ -141,10 +136,9 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param spendTime 最后消费时间
|
||||
*/
|
||||
@JSONField(name = "spend_time")
|
||||
@JSONField(name="spend_time")
|
||||
public void setSpendTime(java.util.Date spendTime) {
|
||||
set("spend_time", spendTime);
|
||||
}
|
||||
|
|
@ -153,7 +147,7 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
/**
|
||||
* @return spend_time 最后消费时间
|
||||
*/
|
||||
@JSONField(name = "spend_time")
|
||||
@JSONField(name="spend_time")
|
||||
public java.util.Date getSpendTime() {
|
||||
return get("spend_time");
|
||||
}
|
||||
|
|
@ -164,10 +158,9 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param firstRechargeTime 第一次充值时间
|
||||
*/
|
||||
@JSONField(name = "first_recharge_time")
|
||||
@JSONField(name="first_recharge_time")
|
||||
public void setFirstRechargeTime(java.util.Date firstRechargeTime) {
|
||||
set("first_recharge_time", firstRechargeTime);
|
||||
}
|
||||
|
|
@ -176,7 +169,7 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
/**
|
||||
* @return first_recharge_time 第一次充值时间
|
||||
*/
|
||||
@JSONField(name = "first_recharge_time")
|
||||
@JSONField(name="first_recharge_time")
|
||||
public java.util.Date getFirstRechargeTime() {
|
||||
return get("first_recharge_time");
|
||||
}
|
||||
|
|
@ -187,10 +180,9 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 3000.00
|
||||
*
|
||||
* @param threshold 余额预警阈值
|
||||
*/
|
||||
@JSONField(name = "threshold")
|
||||
@JSONField(name="threshold")
|
||||
public void setThreshold(java.math.BigDecimal threshold) {
|
||||
set("threshold", threshold);
|
||||
}
|
||||
|
|
@ -199,9 +191,32 @@ public abstract class BasePrepayCustomer<M extends BasePrepayCustomer<M>> extend
|
|||
/**
|
||||
* @return threshold 余额预警阈值
|
||||
*/
|
||||
@JSONField(name = "threshold")
|
||||
@JSONField(name="threshold")
|
||||
public java.math.BigDecimal getThreshold() {
|
||||
return get("threshold");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: notice
|
||||
* type: INT(10)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 0
|
||||
* @param notice 余额低于预警阈值通知,1已发送、0未发送
|
||||
*/
|
||||
@JSONField(name="notice")
|
||||
public void setNotice(Integer notice) {
|
||||
set("notice", notice);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return notice 余额低于预警阈值通知,1已发送、0未发送
|
||||
*/
|
||||
@JSONField(name="notice")
|
||||
public Integer getNotice() {
|
||||
return getInt("notice");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
package com.cowr.service.ssjygl.jobs;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cowr.common.Const;
|
||||
import com.cowr.common.utils.DateTimeUtil;
|
||||
import com.cowr.model.PrepayCustomer;
|
||||
import com.cowr.service.ssjygl.main.Config;
|
||||
import com.cowr.service.ssjygl.sms.log.SmsService;
|
||||
import com.jfinal.log.Log;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class CheckPrepaySurplusJob implements Job {
|
||||
private static Log log = Log.getLog(CheckPrepaySurplusJob.class);
|
||||
|
||||
//截至${time}${customer_name}在${vendor}的预存账户余额为${surplus}元。请及时关注。
|
||||
public void checkSurplus() {
|
||||
List<Record> list = Db.find("select t.*, c.name customer_name from prepay_customer t\n" +
|
||||
" left join customer c on c.id = t.customer_id\n" +
|
||||
" where t.notice = 0\n" +
|
||||
" and t.surplus < t.threshold");
|
||||
|
||||
if (list.isEmpty()) {
|
||||
log.debug("没有低于阈值的客户需要发送通知");
|
||||
return;
|
||||
}
|
||||
|
||||
List<Record> ps = new ArrayList<>();
|
||||
Map<Integer, JSONObject> smsmap = new HashMap<>();
|
||||
Date now = new Date();
|
||||
|
||||
for (Record record : list) {
|
||||
smsmap.put(record.getInt("customer_id"),
|
||||
new JSONObject()
|
||||
.fluentPut("time", DateTimeUtil.sdfhmch.get().format(now))
|
||||
.fluentPut("customer_name", record.getStr("customer_name"))
|
||||
.fluentPut("surplus", String.format("%.2f", record.getBigDecimal("surplus")))
|
||||
.fluentPut("vendor", Config.configprop.get("print.vendor"))
|
||||
);
|
||||
|
||||
Record p = new Record();
|
||||
p.set("id", record.getInt("id"));
|
||||
p.set("notice", 1);
|
||||
|
||||
ps.add(p);
|
||||
}
|
||||
|
||||
if (smsmap.isEmpty()) {
|
||||
log.debug("没有可以发送的短信内容");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
SmsService.me.sendCustomerSms(Const.TEMP_CODE_SURPLUS_WARN, smsmap);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
|
||||
try {
|
||||
if(!ps.isEmpty()){
|
||||
Db.batchUpdate(PrepayCustomer.tablename, ps, ps.size());
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
try {
|
||||
checkSurplus();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
package com.cowr.service.ssjygl.jobs;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cowr.common.Const;
|
||||
import com.cowr.common.utils.DateTimeUtil;
|
||||
import com.cowr.model.PrepayCustomer;
|
||||
import com.cowr.service.ssjygl.main.Config;
|
||||
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||
import com.cowr.service.ssjygl.sms.log.SmsService;
|
||||
|
|
@ -47,11 +49,14 @@ public class StatSmsJob implements Job {
|
|||
return;
|
||||
}
|
||||
|
||||
Map<Integer, List<Record>> map = new HashMap<>();
|
||||
Map<Integer, JSONObject> smsmap = new HashMap<>();
|
||||
Map<Integer, List<Record>> map = new HashMap<>();
|
||||
Map<Integer, JSONObject> smsmap = new HashMap<>();
|
||||
Map<Integer, PrepayCustomer> pmap = new HashMap<>();
|
||||
List<String> ids = new ArrayList<>();
|
||||
|
||||
for (Record record : list) {
|
||||
int customer_id = record.getInt("customer_id");
|
||||
Integer customer_id = record.getInt("customer_id");
|
||||
ids.add(customer_id.toString());
|
||||
|
||||
if (!map.containsKey(customer_id)) {
|
||||
map.put(customer_id, new ArrayList<>());
|
||||
|
|
@ -60,6 +65,12 @@ public class StatSmsJob implements Job {
|
|||
map.get(customer_id).add(record);
|
||||
}
|
||||
|
||||
List<PrepayCustomer> prepayCustomers = PrepayCustomer.dao.find("select * from prepay_customer t where t.id in (" + StrKit.join(ids, ",") + ")");
|
||||
|
||||
for (PrepayCustomer p : prepayCustomers) {
|
||||
pmap.put(p.getCustomerId(), p);
|
||||
}
|
||||
|
||||
// ${time}共计运输黄砂${weight}吨、运输车次${truck_num}辆次,合计${total_price}元。其中${supermarket_detail}元。
|
||||
for (Map.Entry<Integer, List<Record>> entry : map.entrySet()) {
|
||||
BigDecimal weight = new BigDecimal("0");
|
||||
|
|
@ -95,6 +106,10 @@ public class StatSmsJob implements Job {
|
|||
sendobj.put("truck_num", truck_num);
|
||||
sendobj.put("supermarket_detail", supermarket_detail.substring(0, supermarket_detail.length() - 1));
|
||||
|
||||
if (pmap.containsKey(customer_id)) {
|
||||
sendobj.put("surplus", String.format("%.2f", pmap.get(customer_id).getSurplus()));
|
||||
}
|
||||
|
||||
smsmap.put(customer_id, sendobj);
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +118,7 @@ public class StatSmsJob implements Job {
|
|||
return;
|
||||
}
|
||||
|
||||
SmsService.me.sendCustomerDayStat(smsmap);
|
||||
SmsService.me.sendCustomerSms(Const.TEMP_CODE_CUSTOMER_DAY_STAT, smsmap);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -188,9 +203,9 @@ public class StatSmsJob implements Job {
|
|||
String predaytm = DateTimeUtil.sdf.get().format(c.getTime()); // 前一日
|
||||
String sendtmtext = DateTimeUtil.sdfymd.get().format(c.getTime());
|
||||
String year_start = DateTimeUtil.year_start.get().format(now);
|
||||
String year_end = DateTimeUtil.sdf.get().format(now);
|
||||
String year_end = DateTimeUtil.sdf.get().format(now);
|
||||
|
||||
String ordersql = "select count(t.sn) aggr_cnt, ifnull(sum(t.weight), 0) aggr_weight, ifnull(sum(t.total_price), 0) aggr_price \n" +
|
||||
String ordersql = "select count(t.sn) aggr_cnt, ifnull(sum(t.weight), 0) aggr_weight, ifnull(sum(t.total_price), 0) aggr_price \n" +
|
||||
" from order_temp t \n" +
|
||||
" where t.create_time >= ? \n" +
|
||||
" and t.create_time < ? \n" +
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ import com.cowr.service.ssjygl.driver.DriverController;
|
|||
import com.cowr.service.ssjygl.invoice.invalidverify.InvoiceInvalidVerifyController;
|
||||
import com.cowr.service.ssjygl.invoice.log.InvoiceLogController;
|
||||
import com.cowr.service.ssjygl.invoice.receive.InvoiceReceiveController;
|
||||
import com.cowr.service.ssjygl.jobs.CheckExceptionDataJob;
|
||||
import com.cowr.service.ssjygl.jobs.StatSmsJob;
|
||||
import com.cowr.service.ssjygl.netty.NettyServer;
|
||||
import com.cowr.service.ssjygl.order.invalidverify.OrderInvalidVerifyController;
|
||||
import com.cowr.service.ssjygl.order.ordercluster.OrderclusterController;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.cowr.service.ssjygl.prepay.prepaydetail;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cowr.common.Const;
|
||||
import com.cowr.common.enums.Enums;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.*;
|
||||
|
|
@ -155,6 +156,7 @@ public class PrepayDetailSyncService extends BaseSyncService {
|
|||
prepayCustomer[0].setSurplus(model.getAmount()); // 更新余额
|
||||
prepayCustomer[0].setRechargeTime(now); // 更新最后一次充值时间
|
||||
prepayCustomer[0].setFirstRechargeTime(now);
|
||||
prepayCustomer[0].setNotice(0);
|
||||
|
||||
ret = prepayCustomer[0].save();
|
||||
|
||||
|
|
@ -162,6 +164,7 @@ public class PrepayDetailSyncService extends BaseSyncService {
|
|||
} else {
|
||||
prepayCustomer[0].setSurplus(prepayCustomer[0].getSurplus().add(model.getAmount())); // 更新余额
|
||||
prepayCustomer[0].setRechargeTime(now); // 更新最后一次充值时间
|
||||
prepayCustomer[0].setNotice(0);
|
||||
|
||||
ret = prepayCustomer[0].update();
|
||||
|
||||
|
|
@ -204,7 +207,7 @@ public class PrepayDetailSyncService extends BaseSyncService {
|
|||
if (ret && model.getAmount() != null) {
|
||||
if (state == 2 && prepayCustomer[0] != null && prepayCustomer[0].getSurplus() != null) {
|
||||
// 审核通过
|
||||
SmsService.me.sendDepositSuccess(customer, model.getAmount(), prepayCustomer[0].getSurplus());
|
||||
SmsService.me.sendCustomerNoticeSuccess(Const.TEMP_CODE_DEPOSIT_SUCCESS, customer, model.getAmount(), prepayCustomer[0].getSurplus());
|
||||
} else if (state == 9) {
|
||||
// 审核未通过
|
||||
SmsService.me.sendDepositFail(customer, model.getAmount());
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.cowr.service.ssjygl.prepay.refunddetail;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cowr.common.Const;
|
||||
import com.cowr.common.enums.Enums;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.*;
|
||||
import com.cowr.service.ssjygl.base.BaseSyncService;
|
||||
import com.cowr.service.ssjygl.sms.log.SmsService;
|
||||
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
||||
|
|
@ -231,6 +233,10 @@ public class RefundDetailSyncService extends BaseSyncService {
|
|||
model.setSerialnum(serialnum);
|
||||
model.setState(3);
|
||||
|
||||
if (model.checkDuplicate("serialnum")) {
|
||||
return Result.failedstr("流水号【%s】已存在", model.getSerialnum());
|
||||
}
|
||||
|
||||
SyncTask synctask = new SyncTask();
|
||||
|
||||
RefundDetail oldmodel = model.clone();
|
||||
|
|
@ -290,6 +296,10 @@ public class RefundDetailSyncService extends BaseSyncService {
|
|||
}
|
||||
});
|
||||
|
||||
if (ret && model.getState() == 3) {
|
||||
SmsService.me.sendCustomerNoticeSuccess(Const.TEMP_CODE_REFUND_SUCCESS, customer, model.getAmount(), prepayCustomer.getSurplus());
|
||||
}
|
||||
|
||||
return ret ? Result.object(model) : Result.failed(false, "更新失败");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
|
|
|||
|
|
@ -221,11 +221,11 @@ public class SmsService {
|
|||
|
||||
/**
|
||||
* 客户预付款存入成功通知
|
||||
* ${time}${customer_name}在浠水县长投环保有限公司的预存${amount}元,合计余额${surplus}元。
|
||||
* ${time}${customer_name}在${vendor}的预存${amount}元,合计余额${surplus}元。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean sendDepositSuccess(Customer customer, BigDecimal amount, BigDecimal surplus) {
|
||||
public boolean sendCustomerNoticeSuccess(String temp_code, Customer customer, BigDecimal amount, BigDecimal surplus) {
|
||||
if (customer == null) {
|
||||
log.debug("无效的客户信息");
|
||||
return false;
|
||||
|
|
@ -252,22 +252,22 @@ public class SmsService {
|
|||
obj.put("customer_name", customer.getName());
|
||||
obj.put("amount", String.format("%.2f", amount));
|
||||
obj.put("surplus", String.format("%.2f", surplus));
|
||||
obj.put("vendor", Config.configprop.get("print.vendor"));
|
||||
|
||||
String content = null;
|
||||
try {
|
||||
content = this.aliyunsms.generator(Const.SMS_TEMP_MAP.get(Const.TEMP_CODE_DEPOSIT_SUCCESS), obj);
|
||||
content = this.aliyunsms.generator(Const.SMS_TEMP_MAP.get(temp_code), obj);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return sendBySysusers(users, Const.TEMP_CODE_DEPOSIT_SUCCESS, obj, content, customer.getTablename(), customer.getId().toString());
|
||||
return sendBySysusers(users, temp_code, obj, content, customer.getTablename(), customer.getId().toString());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 客户预付款存入失败通知
|
||||
* ${time}${customer_name}在浠水县长投环保有限公司预存的${amount}元审核未通过,若有疑问请及时联系浠水县长投环保结算中心。
|
||||
* ${time}${customer_name}在${vendor}预存的${amount}元审核未通过,若有疑问请及时联系结算中心。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -297,6 +297,7 @@ public class SmsService {
|
|||
obj.put("time", date);
|
||||
obj.put("customer_name", customer.getName());
|
||||
obj.put("amount", String.format("%.2f", amount));
|
||||
obj.put("vendor", Config.configprop.get("print.vendor"));
|
||||
|
||||
String content = null;
|
||||
try {
|
||||
|
|
@ -310,12 +311,12 @@ public class SmsService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 客户每日汇总
|
||||
* ${time}共计运输黄砂${weight}吨、运输车次${truck_num}辆次,合计${total_price}元。其中${supermarket_detail}元。。
|
||||
*
|
||||
* 发送客户map关联短信
|
||||
* 客户每日统计 ${time}共计运输黄砂${weight}吨、运输车次${truck_num}辆次,合计${total_price}元。其中${supermarket_detail}元。。
|
||||
* 客户余额不足 截至${time}${customer_name}在${vendor}的预存账户余额为${surplus}元。请及时关注。
|
||||
* @return
|
||||
*/
|
||||
public boolean sendCustomerDayStat(Map<Integer, JSONObject> smsmap) {
|
||||
public boolean sendCustomerSms(String temp_code, Map<Integer, JSONObject> smsmap) {
|
||||
if (smsmap.isEmpty()) {
|
||||
log.debug("发送对象没有内容");
|
||||
return false;
|
||||
|
|
@ -363,13 +364,13 @@ public class SmsService {
|
|||
JSONObject obj = smsmap.get(customer_id);
|
||||
String content = null;
|
||||
try {
|
||||
content = this.aliyunsms.generator(Const.SMS_TEMP_MAP.get(Const.TEMP_CODE_CUSTOMER_DAY_STAT), obj);
|
||||
content = this.aliyunsms.generator(Const.SMS_TEMP_MAP.get(temp_code), obj);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
|
||||
String response = this.aliyunsms.send(phone, Const.TEMP_CODE_CUSTOMER_DAY_STAT, obj);
|
||||
String response = this.aliyunsms.send(phone, temp_code, obj);
|
||||
log.debug(response);
|
||||
|
||||
JSONObject ret = JSONObject.parseObject(response);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@ synctask.job=com.cowr.service.ssjygl.jobs.SyncJob
|
|||
synctask.cron= 0 * * * * ?
|
||||
synctask.enable=true
|
||||
|
||||
# 检查低于阈值的客户,发送一次短信通知
|
||||
checkprepaysurplus.job=com.cowr.service.ssjygl.jobs.CheckPrepaySurplusJob
|
||||
checkprepaysurplus.cron= 30 * * * * ?
|
||||
checkprepaysurplus.enable=true
|
||||
|
||||
# 在零点检查前一天未完成的集团订单,将开始执行的置为已完成,将未开始的置为取消
|
||||
checkundonordercluster.job=com.cowr.service.ssjygl.jobs.CheckUndonOrderclusterJob
|
||||
checkundonordercluster.cron= 1 0 0 * * ?
|
||||
|
|
|
|||
Loading…
Reference in New Issue