lisai17@sina.com 2020-11-06 11:02:09 +08:00
parent 6c861813e5
commit 7ed2bc5d22
3 changed files with 84 additions and 17 deletions

View File

@ -19,11 +19,11 @@ public class Const {
public static final double DEFAULT_LGTD = 115.265535; // 默认经度 浠水县
public static final double DEFAULT_LTTD = 30.451867; // 默认维度 浠水县
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_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_DAY_STAT = "SMS_205430436"; // 日销售汇总
public static final String TEMP_CODE_CUSTOMER_DAY_STAT = "SMS_205430478"; // 客户日销售汇总
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 Map<String, String> SMS_TEMP_MAP;
static {

View File

@ -271,6 +271,8 @@ group by date
"group by t.supermarket_id", nowdaytm + "%", OrderStateEnum.RECEIVED.getStateid());
for (Record record : by_supermarket_list) {
record.set("day_quota_total_price", 0);
for (Record r : suppeie) {
if (r.getInt("supermarket_id") != null && r.getInt("supermarket_id").equals(record.getInt("supermarket_id"))) {
record.set("day_quota_total_price", r.get("total_weight"));
@ -292,7 +294,7 @@ group by date
*
* @return
*/
public List<Record> lastStat() {
public Collection<Record> lastStat() {
Date now = new Date();
Calendar c = Calendar.getInstance();
@ -302,14 +304,61 @@ group by date
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
String tm = DateTimeUtil.sdfhms.get().format(c.getTime());
return Db.find("\n" +
"select count(t.sn) cnt, sum(t.weight) weight, sum(t.total_price) total_price, date_format(t.create_time, '%Y-%m-%d') date from order_temp t\n" +
"where t.state = ?\n" +
"and t.create_time >= ?\n" +
"group by date",
Map<String, Record> map = new HashMap<>();
for (int i = 0; i < 31; i++) {
c.add(Calendar.DAY_OF_MONTH, 1);
String t = DateTimeUtil.sdf.get().format(c.getTime());
map.put(t,
new Record()
.set("date", t)
.set("cnt", 0)
.set("weight", 0)
.set("total_price", 0)
);
}
List<Record> list = Db.find("\n" +
"select count(t.sn) cnt, sum(t.weight) weight, sum(t.total_price) total_price, date_format(t.create_time, '%Y-%m-%d') date \n" +
" from order_temp t\n" +
" where t.state = ?\n" +
" and t.create_time > ?\n" +
" group by date",
OrderStateEnum.RECEIVED.getStateid(),
DateTimeUtil.sdfhms.get().format(c.getTime()));
tm);
for (Record record : list) {
String t = record.get("date");
map.put(t, record);
}
List<Record> outlist = new ArrayList<>();
outlist.addAll(map.values());
outlist.sort(new Comparator<Record>() {
@Override
public int compare(Record o1, Record o2) {
String t1 = o1.get("date");
String t2 = o2.get("date");
try {
if (DateTimeUtil.sdf.get().parse(t1).after(DateTimeUtil.sdf.get().parse(t2))) {
return 1;
} else {
return -1;
}
} catch (Exception ignored) {
}
return 0;
}
});
return outlist;
}
/**

View File

@ -5,16 +5,14 @@ import com.alibaba.fastjson.JSONObject;
import com.cowr.common.Const;
import com.cowr.common.enums.UserTypeEnum;
import com.cowr.common.utils.DateTimeUtil;
import com.cowr.model.Ordercluster;
import com.cowr.model.SmsLog;
import com.cowr.model.Supermarket;
import com.cowr.model.Sysuser;
import com.cowr.model.*;
import com.cowr.service.ssjygl.main.Config;
import com.cowr.service.ssjygl.main.SvrCacheData;
import com.cowr.sms.AliyunSmsService;
import com.jfinal.kit.StrKit;
import com.jfinal.log.Log;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -202,9 +200,29 @@ public class SmsService {
/**
*
* ${time}${customer_name}${amount}${surplus}
*
* @return
*/
public boolean sendDepositSuccess(){
public boolean sendDepositSuccess(Customer customer, BigDecimal amount, BigDecimal surplus) {
if (customer == null) {
log.debug("无效的客户信息");
return false;
}
// 充值小于等于 0 的肯定就不发了
if (amount.compareTo(new BigDecimal("0")) <= 0) {
log.debug("充值金额错误 %s", amount);
return false;
}
List<Sysuser> users = Sysuser.dao.find("select * from sysuser t where t.type = ? and t.entity_id = ?", UserTypeEnum.CUSTOMER.getTypeid(), customer.getId());
if (users == null || users.isEmpty()) {
log.error("没有找到有效的用户信息");
return false;
}
return false;
}
}