代码提交

dev
徐杰盟 2024-08-22 17:30:14 +08:00
parent f509113769
commit e550301940
9 changed files with 108 additions and 52 deletions

View File

@ -15,6 +15,7 @@ import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import org.apache.commons.collections4.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -252,10 +253,20 @@ public class OrderEndService extends BaseService {
updateOrderEnd(updates);
}
// if (CollectionUtils.isNotEmpty(deletes)){
// // 更新
if (CollectionUtils.isNotEmpty(deletes)){
List<OrderEnd> updateData = deletes.stream().map(id -> {
OrderEnd orderEnd = new OrderEnd();
orderEnd.setId(id);
orderEnd.setCount(0);
orderEnd.setWeight(BigDecimal.ZERO);
orderEnd.setTotalPrice(BigDecimal.ZERO);
return orderEnd;
}).collect(toList());
updateOrderEnd(updateData);
// 更新
// deleteOrderEnd(deletes);
// }
}
}
@ -275,13 +286,13 @@ public class OrderEndService extends BaseService {
log.info("更新数据结果: %s %s", add, orderEnds.size());
}
private void deleteOrderEnd(List<String> orderEnds){
boolean add = Db.tx(() -> OrderEnd.dao.deleteByIds(orderEnds));
log.info("删除数据结果: %s %s", add, orderEnds.size());
}
// private void deleteOrderEnd(List<String> orderEnds){
//
//
// boolean add = Db.tx(() -> OrderEnd.dao.deleteByIds(orderEnds));
//
// log.info("删除数据结果: %s %s", add, orderEnds.size());
// }
}

View File

@ -200,31 +200,34 @@ group by date
" ifnull(sum(case when t.date >= ? then t.weight end ), 0) day_total_weight,\n" +
" ifnull(sum(case when t.date >= ? and t.sale_type = 0 then t.total_price end ), 0) day_total_price,\n" +
" ifnull(sum(case when t.date >= ? then t.count else 0 end ), 0) day_truck_cnt\n" +
// " 0 day_total_weight,\n" +
// " 0 day_total_price,\n" +
// " 0 day_truck_cnt\n" +
" from order_end t\n" +
// " WHERE t.sale_type = 0 \n" +
" UNION\n" +
" SELECT\n" +
" ifnull( sum( t.weight ), 0 ) total_weight,\n" +
// " ifnull( sum( t.total_price ), 0 ) total_price,\n" +
" ifnull( sum( CASE WHEN t.sale_type = 0 THEN t.total_price END ), 0 ) total_price,\n" +
" ifnull( count( t.sn ), 0 ) truck_cnt,\n" +
" ifnull( sum( t.weight ), 0 ) year_total_weight,\n" +
" ifnull( sum(case when t.sale_type = 0 then t.total_price end ), 0 ) year_total_price,\n" +
" ifnull( count( t.sn ), 0 ) year_truck_cnt,\n" +
" ifnull( sum( t.weight ), 0 ) month_total_weight,\n" +
" ifnull( sum( case when t.sale_type = 0 then t.total_price end ), 0 ) month_total_price,\n" +
" ifnull( count( t.sn ), 0 ) month_truck_cnt,\n" +
" ifnull( sum( t.weight ), 0 ) day_total_weight,\n" +
" ifnull( sum( case when t.sale_type = 0 then t.total_price end ), 0 ) day_total_price,\n" +
" ifnull( count( t.sn ), 0 ) day_truck_cnt \n" +
" FROM\n" +
" order_temp t \n" +
" WHERE\n" +
" t.state = 5 \n" +
" AND t.create_time >= ? " +
// " and t.sale_type = 0 \n" +
" union\n" +
// " SELECT\n" +
// " ifnull( sum( t.weight ), 0 ) total_weight,\n" +
//// " ifnull( sum( t.total_price ), 0 ) total_price,\n" +
// " ifnull( sum( CASE WHEN t.sale_type = 0 THEN t.total_price END ), 0 ) total_price,\n" +
// " ifnull( count( t.sn ), 0 ) truck_cnt,\n" +
// " ifnull( sum( t.weight ), 0 ) year_total_weight,\n" +
// " ifnull( sum(case when t.sale_type = 0 then t.total_price end ), 0 ) year_total_price,\n" +
// " ifnull( count( t.sn ), 0 ) year_truck_cnt,\n" +
// " ifnull( sum( t.weight ), 0 ) month_total_weight,\n" +
// " ifnull( sum( case when t.sale_type = 0 then t.total_price end ), 0 ) month_total_price,\n" +
// " ifnull( count( t.sn ), 0 ) month_truck_cnt,\n" +
// " ifnull( sum( t.weight ), 0 ) day_total_weight,\n" +
// " ifnull( sum( case when t.sale_type = 0 then t.total_price end ), 0 ) day_total_price,\n" +
// " ifnull( count( t.sn ), 0 ) day_truck_cnt \n" +
// " FROM\n" +
// " order_temp t \n" +
// " WHERE\n" +
// " t.state = 5 \n" +
// " AND t.create_time >= ? " +
//// " and t.sale_type = 0 \n" +
// " union\n" +
" select \n" +
" 0 total_weight,\n" +
" ifnull(sum(p.presell_amount), 0) total_price,\n" +
@ -245,7 +248,9 @@ group by date
" where p.del = 0\n" +
" ) g";
Record ocout = Db.findFirst(sql_ordercluster, year, year, year, month, month, month, day, day, day, day
Record ocout = Db.findFirst(sql_ordercluster, year, year, year, month, month, month, day
, day, day
// day,
// , year, month, day
);
out.set("ordercluster", ocout);

View File

@ -9,7 +9,8 @@ password=Ssjy_xs_890
#password=Ssjy_xsx_890
# redis
redis.basekey=ssjcgl_xsx_dev
#redis.basekey=ssjcgl_xsx_dev
redis.basekey=ssjcgl_xsx
redis.port=6379
#redis.ip=127.0.0.1

View File

@ -7,7 +7,9 @@ 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.SvrCacheData;
import com.cowr.service.ssjygl.prepay.prepaycustomer.PrepayCustomerSyncService;
import com.cowr.service.ssjygl.sms.log.SmsService;
import com.cowr.service.ssjygl.synctask.SyncTaskService;
import com.cowr.ssjygl.addsubtractitemrecord.AddSubtractItemRecordService;
import com.cowr.ssjygl.order.orderend.OrderEndService;
import com.jfinal.aop.Clear;
@ -16,6 +18,7 @@ import com.jfinal.kit.StrKit;
import com.jfinal.log.Log;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.redis.Redis;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
@ -351,6 +354,23 @@ public class StatSmsJob extends Controller implements Job {
OrderEndService.me.queryList(localDate.minusDays(60).toString(),localDate.toString(),null); // 最近60天的数据
}
@Clear(AuthInterceptor.class)
public void getRedis() {
String statkey = PrepayCustomerSyncService.me.redisbasekey() + get("sn") + ":" + get("surplus");
// 当前sn 已添加过
JSONObject str = Redis.use().get(statkey);
System.out.println(str.toJSONString());
}
@Clear(AuthInterceptor.class)
public void recv() {
String statkey = PrepayCustomerSyncService.me.redisbasekey() + get("sn") + ":" + get("surplus");
// 当前sn 已添加过
JSONObject str = Redis.use().get(statkey);
SyncTaskService.me.recv(str,2);
}
@Clear(AuthInterceptor.class)
public void statAggrAndDay() {
Date now = new Date();

View File

@ -27,6 +27,7 @@ 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.StatSmsJob;
import com.cowr.service.ssjygl.netty.NettyServer;
import com.cowr.service.ssjygl.order.invalidverify.OrderInvalidVerifyController;
import com.cowr.service.ssjygl.order.ordercluster.OrderclusterController;
@ -248,7 +249,7 @@ public class Config extends JFinalConfig {
me.add("/log/modify", ModifyLogController.class);
// me.add("/job/sms", StatSmsJob.class);
me.add("/job/sms", StatSmsJob.class);
}
@Override

View File

@ -9,6 +9,7 @@ import com.cowr.common.validator.StartAndEndIntervalValidator;
import com.cowr.common.view.ExcelRender;
import com.cowr.common.view.Result;
import com.cowr.model.Sysuser;
import com.cowr.service.ssjygl.main.AuthInterceptor;
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
import com.cowr.ssjygl.stat.sale.OrderStatService;
import com.jfinal.aop.Before;
@ -394,6 +395,7 @@ public class OrderStatController extends BaseController {
/**
*
*/
@Clear(AuthInterceptor.class)
public void statYearBySup() {
String tm = get("tm");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出

View File

@ -249,9 +249,9 @@ public class SyncTaskService {
* @return
*/
public boolean recv(JSONObject recvdata, int current_supermarket_id) {
if (!isEnable()) {
return true;
}
// if (!isEnable()) {
// return true;
// }
long st = System.currentTimeMillis();
@ -358,11 +358,12 @@ public class SyncTaskService {
}
}
list = listFilter(tablename, list);
// list = listFilter(tablename, list);
// if (list.isEmpty()) {
// continue;
// }
// 如果是订单修改 就更新order_end表
log.error("save tablename: " + tablename);
int[] ret = Db.batchSave(tablename, list, list.size());
if (ret.length != list.size()) {
@ -442,7 +443,7 @@ public class SyncTaskService {
sts.add(newsynctask);
}
}
log.error("update tablename: " + tablename);
int[] ret = Db.batchUpdate(tablename, pks, list, list.size());
if (ret.length != list.size()) {
@ -476,7 +477,7 @@ public class SyncTaskService {
for (int i = 0; i < arr.size(); i++) {
JSONObject obj = arr.getJSONObject(i);
log.error("del tablename: " + tablename);
boolean ret = Db.delete(tablename, pks, new Record().setColumns(obj.getInnerMap()));
if (!ret) {
@ -549,9 +550,9 @@ public class SyncTaskService {
String sn = orderData.getJSONObject(0).getString("sn");
if (StrKit.notBlank(sn)){
// 判断sn是否添加过
String statkey = PrepayCustomerSyncService.me.redisbasekey() + sn + ":" + increment_data.getString("surplus");
String statkey = PrepayCustomerSyncService.me.redisbasekey() + sn ;
if (! Redis.use().exists(statkey)) {
log.error("update prepay_customer: " + record);
boolean ret = Db.update(tablename, pks, record);
if (!ret) {
return false;
@ -578,6 +579,7 @@ public class SyncTaskService {
}
}
}else{
log.error("update prepay_customer: " + record);
boolean ret = Db.update(tablename, pks, record);
@ -641,6 +643,18 @@ public class SyncTaskService {
// return recvAuthLicense(saveauthlics, deleteauthlics, current_supermarket_id);
// }
try{
SyncTask o = recvdata.toJavaObject(SyncTask.class);
if (!o.save()) {
return false;
}
}catch (Exception e){
log.error("save sync_task error " + e.getMessage(), e);
log.error(e.getMessage(), e);
return false;
}
return true;
} catch (Exception e) {
if (e.getMessage().contains("PRIMARY")) {
@ -653,6 +667,7 @@ public class SyncTaskService {
return false;
}
}
});

View File

@ -8,8 +8,8 @@ print.vendorTaxId=91421125MA49GYYK2B
start.trans.distance=5
#本地服务 和 云端服务 socket 通信
socketserver.enable=true
socketserver.port=21002
#socketserver.enable=true
#socketserver.port=21002
endpoint=oss-cn-shenzhen.aliyuncs.com

View File

@ -1,7 +1,7 @@
# mysql
jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_service?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
user=ssjy_xsx
password=Ssjy_xs_890_prod
#jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_service?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
#user=ssjy_xsx
#password=Ssjy_xs_890_prod
# mysql
@ -9,12 +9,13 @@ password=Ssjy_xs_890_prod
#user=root
#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
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.basekey=ssjcgl_xsx_dev
#redis.basekey=ssjcgl_xsx_dev
redis.basekey=ssjcgl_xsx
redis.ip=r-wz9168ab2f2f7ec4pd.redis.rds.aliyuncs.com
redis.port=6379
redis.pwd=CoWR1111