日销售统计短信修改
parent
f4c8898a12
commit
fea970bd69
|
|
@ -226,10 +226,10 @@ public class OrderEndService extends BaseService {
|
||||||
updateOrderEnd(updates);
|
updateOrderEnd(updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(deletes)){
|
// if (CollectionUtils.isNotEmpty(deletes)){
|
||||||
// 更新
|
// // 更新
|
||||||
deleteOrderEnd(deletes);
|
// deleteOrderEnd(deletes);
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -471,5 +471,8 @@ public class Config extends JFinalConfig {
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// ENV = "prod";
|
||||||
|
|
||||||
|
// return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ socketserver.port=21002
|
||||||
socketio.port=12002
|
socketio.port=12002
|
||||||
|
|
||||||
#当前部署本地程序的砂站id
|
#当前部署本地程序的砂站id
|
||||||
current.supermarket_id=1
|
current.supermarket_id=2
|
||||||
#落杆后,等待上磅的时间
|
#落杆后,等待上磅的时间
|
||||||
default_scale_wait_time=8000
|
default_scale_wait_time=8000
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cowr.common.Const;
|
import com.cowr.common.Const;
|
||||||
import com.cowr.common.utils.DateTimeUtil;
|
import com.cowr.common.utils.DateTimeUtil;
|
||||||
import com.cowr.model.PrepayCustomer;
|
import com.cowr.model.PrepayCustomer;
|
||||||
|
import com.cowr.service.ssjygl.main.AuthInterceptor;
|
||||||
import com.cowr.service.ssjygl.main.Config;
|
import com.cowr.service.ssjygl.main.Config;
|
||||||
import com.cowr.service.ssjygl.main.SvrCacheData;
|
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||||
import com.cowr.service.ssjygl.sms.log.SmsService;
|
import com.cowr.service.ssjygl.sms.log.SmsService;
|
||||||
import com.cowr.ssjygl.addsubtractitemrecord.AddSubtractItemRecordService;
|
import com.cowr.ssjygl.addsubtractitemrecord.AddSubtractItemRecordService;
|
||||||
|
import com.jfinal.aop.Clear;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
import com.jfinal.log.Log;
|
import com.jfinal.log.Log;
|
||||||
import com.jfinal.plugin.activerecord.Db;
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
|
@ -21,7 +24,7 @@ import java.util.*;
|
||||||
/**
|
/**
|
||||||
* 统计数据并发送短信
|
* 统计数据并发送短信
|
||||||
*/
|
*/
|
||||||
public class StatSmsJob implements Job {
|
public class StatSmsJob extends Controller implements Job {
|
||||||
private static Log log = Log.getLog(StatSmsJob.class);
|
private static Log log = Log.getLog(StatSmsJob.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -204,6 +207,7 @@ public class StatSmsJob implements Job {
|
||||||
* 27.34和2011.27这两个数是固定值
|
* 27.34和2011.27这两个数是固定值
|
||||||
* 274.62和21830.32这两个数是系统里统计的总数
|
* 274.62和21830.32这两个数是系统里统计的总数
|
||||||
*/
|
*/
|
||||||
|
@Clear(AuthInterceptor.class)
|
||||||
public void statAggr() {
|
public void statAggr() {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
Calendar c = Calendar.getInstance();
|
Calendar c = Calendar.getInstance();
|
||||||
|
|
@ -223,7 +227,8 @@ public class StatSmsJob implements Job {
|
||||||
" from order_temp t \n" +
|
" from order_temp t \n" +
|
||||||
" where t.create_time >= ? \n" +
|
" where t.create_time >= ? \n" +
|
||||||
" and t.create_time < ? \n" +
|
" and t.create_time < ? \n" +
|
||||||
" and t.state = 5";
|
" and t.state = 5" +
|
||||||
|
" and t.sale_type = 0 ";
|
||||||
String cusmersql = "select ifnull(sum(t.surplus), 0) customer_total_surplus from prepay_customer t";
|
String cusmersql = "select ifnull(sum(t.surplus), 0) customer_total_surplus from prepay_customer t";
|
||||||
String daysql = "select count(t.sn) total_cnt, ifnull(sum(t.weight), 0) total_weight, ifnull(sum(t.total_price), 0) total_price from order_temp t\n" +
|
String daysql = "select count(t.sn) total_cnt, ifnull(sum(t.weight), 0) total_weight, ifnull(sum(t.total_price), 0) total_price from order_temp t\n" +
|
||||||
" where t.state = 5\n" +
|
" where t.state = 5\n" +
|
||||||
|
|
@ -289,6 +294,11 @@ public class StatSmsJob implements Job {
|
||||||
BigDecimal aggr_weight = orderobj.getBigDecimal("aggr_weight");
|
BigDecimal aggr_weight = orderobj.getBigDecimal("aggr_weight");
|
||||||
BigDecimal aggr_price = orderobj.getBigDecimal("aggr_price");
|
BigDecimal aggr_price = orderobj.getBigDecimal("aggr_price");
|
||||||
|
|
||||||
|
if ("2024".equals(year)) {
|
||||||
|
aggr_price = aggr_price
|
||||||
|
.add(new BigDecimal(1000 * 10000)); // 久联认款1000万中出站销售金额加到2024年
|
||||||
|
|
||||||
|
}
|
||||||
if ("2021".equals(year)) {
|
if ("2021".equals(year)) {
|
||||||
aggr_weight = aggr_weight
|
aggr_weight = aggr_weight
|
||||||
.subtract(new BigDecimal("27.34")) // 2020提前充值客户运输量,要从2021年内扣除
|
.subtract(new BigDecimal("27.34")) // 2020提前充值客户运输量,要从2021年内扣除
|
||||||
|
|
@ -386,6 +396,13 @@ public class StatSmsJob implements Job {
|
||||||
BigDecimal aggr_weight = orderobj.getBigDecimal("aggr_weight");
|
BigDecimal aggr_weight = orderobj.getBigDecimal("aggr_weight");
|
||||||
BigDecimal aggr_price = orderobj.getBigDecimal("aggr_price");
|
BigDecimal aggr_price = orderobj.getBigDecimal("aggr_price");
|
||||||
|
|
||||||
|
String year = DateTimeUtil.year.get().format(now); // 当前年
|
||||||
|
|
||||||
|
if ("2024".equals(year)) {
|
||||||
|
aggr_price = aggr_price
|
||||||
|
.add(new BigDecimal(1000 * 10000)); // 久联认款1000万中出站销售金额加到2024年
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
obj.put("aggr_cnt", orderobj.get("aggr_cnt"));
|
obj.put("aggr_cnt", orderobj.get("aggr_cnt"));
|
||||||
obj.put("aggr_weight", String.format("%.2f万",
|
obj.put("aggr_weight", String.format("%.2f万",
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,9 @@ public class Config extends JFinalConfig {
|
||||||
me.add("/log/sms", SmsLogController.class);
|
me.add("/log/sms", SmsLogController.class);
|
||||||
me.add("/log/actioncmd", ActionCmdLogController.class);
|
me.add("/log/actioncmd", ActionCmdLogController.class);
|
||||||
me.add("/log/modify", ModifyLogController.class);
|
me.add("/log/modify", ModifyLogController.class);
|
||||||
|
|
||||||
|
|
||||||
|
// me.add("/job/sms", StatSmsJob.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,9 @@ public class PrepayCustomerController extends Controller {
|
||||||
PrepayCustomerSyncService.me.updatePrepayCustomerSurplus();
|
PrepayCustomerSyncService.me.updatePrepayCustomerSurplus();
|
||||||
renderJson(Result.success());
|
renderJson(Result.success());
|
||||||
}
|
}
|
||||||
|
@Clear(AuthInterceptor.class)
|
||||||
|
public void updateAllCustomerSurplus() {
|
||||||
|
PrepayCustomerSyncService.me.updateAllCustomerSurplus();
|
||||||
|
renderJson(Result.success());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class PrepayCustomerSyncService extends BaseSyncService {
|
||||||
"\tIFNULL(pd.amount,0) - IFNULL(rd.amount,0) - IFNULL(o.amount,0)) amount1\n" +
|
"\tIFNULL(pd.amount,0) - IFNULL(rd.amount,0) - IFNULL(o.amount,0)) amount1\n" +
|
||||||
"FROM\n" +
|
"FROM\n" +
|
||||||
"\tprepay_customer pc\n" +
|
"\tprepay_customer pc\n" +
|
||||||
"\tLEFT JOIN customer c ON pc.customer_id = c.id\n" +
|
"\tLEFT JOIN customer c ON pc.customer_id = c.id AND c.del = 0\n" +
|
||||||
"\tLEFT JOIN ( SELECT customer_id, sum( amount ) amount FROM prepay_detail WHERE state = 2 GROUP BY customer_id ) pd ON pd.customer_id = c.id\n" +
|
"\tLEFT JOIN ( SELECT customer_id, sum( amount ) amount FROM prepay_detail WHERE state = 2 GROUP BY customer_id ) pd ON pd.customer_id = c.id\n" +
|
||||||
"\tLEFT JOIN ( SELECT customer_id, sum( amount ) amount FROM refund_detail WHERE state = 3 GROUP BY customer_id ) rd ON rd.customer_id = c.id\n" +
|
"\tLEFT JOIN ( SELECT customer_id, sum( amount ) amount FROM refund_detail WHERE state = 3 GROUP BY customer_id ) rd ON rd.customer_id = c.id\n" +
|
||||||
"\tLEFT JOIN ( SELECT customer_id, sum( presell_amount ) amount FROM presell_order WHERE del = 0 GROUP BY customer_id ) po ON po.customer_id = c.id\n" +
|
"\tLEFT JOIN ( SELECT customer_id, sum( presell_amount ) amount FROM presell_order WHERE del = 0 GROUP BY customer_id ) po ON po.customer_id = c.id\n" +
|
||||||
|
|
@ -67,6 +67,9 @@ public class PrepayCustomerSyncService extends BaseSyncService {
|
||||||
if (CollectionUtils.isNotEmpty(list)){
|
if (CollectionUtils.isNotEmpty(list)){
|
||||||
for (Record record : list) {
|
for (Record record : list) {
|
||||||
PrepayCustomer prepayCustomer = PrepayCustomer.dao.findFirst("select * from prepay_customer where customer_id = ? ", record.getInt("id"));
|
PrepayCustomer prepayCustomer = PrepayCustomer.dao.findFirst("select * from prepay_customer where customer_id = ? ", record.getInt("id"));
|
||||||
|
if (prepayCustomer == null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
prepayCustomer.setSurplus(record.getBigDecimal("amount1"));
|
prepayCustomer.setSurplus(record.getBigDecimal("amount1"));
|
||||||
prepayCustomer.update();
|
prepayCustomer.update();
|
||||||
|
|
||||||
|
|
@ -80,4 +83,23 @@ public class PrepayCustomerSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 更新所有用户余额
|
||||||
|
public void updateAllCustomerSurplus() {
|
||||||
|
List<Record> list = Db.find("SELECT id FROM customer WHERE del = 0");
|
||||||
|
if (CollectionUtils.isNotEmpty(list)){
|
||||||
|
for (Record record : list) {
|
||||||
|
PrepayCustomer prepayCustomer = PrepayCustomer.dao.findFirst("select * from prepay_customer where customer_id = ? ", record.getInt("id"));
|
||||||
|
if (prepayCustomer == null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
synctask.addUpdateData(prepayCustomer);
|
||||||
|
|
||||||
|
SyncTaskService.me.save(synctask);
|
||||||
|
|
||||||
|
log.info("修改用户的余额: " + prepayCustomer.getCustomerId() + "_" + prepayCustomer.getSurplus());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -255,24 +255,25 @@ public class SyncTaskService {
|
||||||
|
|
||||||
long st = System.currentTimeMillis();
|
long st = System.currentTimeMillis();
|
||||||
|
|
||||||
String redisKey = Config.dbprop.get("redis.basekey") + Const.REDIS_SEPARATE + SyncTask.tablename + Const.REDIS_SEPARATE + recvdata.getString("id");
|
// String redisKey = Config.dbprop.get("redis.basekey") + Const.REDIS_SEPARATE + SyncTask.tablename + Const.REDIS_SEPARATE + recvdata.getString("id");
|
||||||
|
|
||||||
// 0,待同步,1已同步 2执行中
|
// 0,待同步,1已同步 2执行中
|
||||||
String status = Redis.use().get(redisKey);
|
// String status = Redis.use().get(redisKey);
|
||||||
|
//
|
||||||
|
// if (status == null){
|
||||||
|
// Redis.use().set(redisKey,"2");
|
||||||
|
// status = "0";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if ( status.equals("2")){
|
||||||
|
// log.info("任务执行中: %s" ,recvdata.getString("id"));
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// if (status.equals("1")){
|
||||||
|
// log.info("任务执行过: %s" ,recvdata.getString("id"));
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
if (status == null){
|
|
||||||
Redis.use().set(redisKey,"2");
|
|
||||||
status = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( status.equals("2")){
|
|
||||||
log.info("任务执行中: %s" ,recvdata.getString("id"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (status.equals("1")){
|
|
||||||
log.info("任务执行过: %s" ,recvdata.getString("id"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
JSONObject save_data = JSONObject.parseObject(recvdata.getString("save_data"));
|
JSONObject save_data = JSONObject.parseObject(recvdata.getString("save_data"));
|
||||||
JSONObject update_data = JSONObject.parseObject(recvdata.getString("update_data"));
|
JSONObject update_data = JSONObject.parseObject(recvdata.getString("update_data"));
|
||||||
|
|
@ -569,8 +570,8 @@ public class SyncTaskService {
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
// 当前sn 已添加过
|
// 当前sn 已添加过
|
||||||
Record str = Redis.use().get(statkey);
|
JSONObject str = Redis.use().get(statkey);
|
||||||
log.info("当前sn 数据 : " + recvdata.toJSONString());
|
log.info("当前sn 数据 : " + data.toJSONString());
|
||||||
log.info("当前redis 数据" + str);
|
log.info("当前redis 数据" + str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -656,7 +657,7 @@ public class SyncTaskService {
|
||||||
});
|
});
|
||||||
|
|
||||||
// 执行完成添加状态
|
// 执行完成添加状态
|
||||||
Redis.use().set(redisKey,"1");
|
// Redis.use().set(redisKey,"1");
|
||||||
|
|
||||||
log.debug("recv 2 time: %s", System.currentTimeMillis() - st);
|
log.debug("recv 2 time: %s", System.currentTimeMillis() - st);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -664,7 +665,7 @@ public class SyncTaskService {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
||||||
log.debug("recv 3 time: %s", System.currentTimeMillis() - st);
|
log.debug("recv 3 time: %s", System.currentTimeMillis() - st);
|
||||||
Redis.use().set(redisKey,"0");
|
// Redis.use().set(redisKey,"0");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ password=Ssjy_xs_890_prod
|
||||||
#user=root
|
#user=root
|
||||||
#password=19999999
|
#password=19999999
|
||||||
|
|
||||||
|
#jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||||
|
#user=dev_ssjy_xsx
|
||||||
|
#password=Ssjy_xs_890
|
||||||
|
|
||||||
# redis
|
# redis
|
||||||
redis.basekey=ssjcgl_xsx_dev
|
redis.basekey=ssjcgl_xsx_dev
|
||||||
redis.ip=r-wz9168ab2f2f7ec4pd.redis.rds.aliyuncs.com
|
redis.ip=r-wz9168ab2f2f7ec4pd.redis.rds.aliyuncs.com
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue