sysuser中去掉零散客户相关的改动
parent
f6fd4158ea
commit
2dde478f84
|
|
@ -21,9 +21,7 @@ public class OrderService {
|
||||||
|
|
||||||
int sntype = Integer.parseInt(sn.substring(10, 12));
|
int sntype = Integer.parseInt(sn.substring(10, 12));
|
||||||
|
|
||||||
if (sntype == OrderTypeEnum.SALE.getTypeid()) {
|
if (sntype == OrderTypeEnum.TRANSFER.getTypeid()) {
|
||||||
return OrderSale.dao.findById(sn);
|
|
||||||
} else if (sntype == OrderTypeEnum.TRANSFER.getTypeid()) {
|
|
||||||
return OrderTransfer.dao.findById(sn);
|
return OrderTransfer.dao.findById(sn);
|
||||||
} else if (sntype == OrderTypeEnum.TEMP.getTypeid()) {
|
} else if (sntype == OrderTypeEnum.TEMP.getTypeid()) {
|
||||||
return OrderTemp.dao.findById(sn);
|
return OrderTemp.dao.findById(sn);
|
||||||
|
|
|
||||||
|
|
@ -323,10 +323,6 @@ public class SysuserSyncService extends BaseService {
|
||||||
sqlbuf.append(" from sysuser u \n");
|
sqlbuf.append(" from sysuser u \n");
|
||||||
sqlbuf.append(" left join customer c on u.entity_id = c.id\n");
|
sqlbuf.append(" left join customer c on u.entity_id = c.id\n");
|
||||||
sqlbuf.append(" left join customer_type t on c.customer_type_id = t.id\n");
|
sqlbuf.append(" left join customer_type t on c.customer_type_id = t.id\n");
|
||||||
sqlbuf.append(" union all\n");
|
|
||||||
sqlbuf.append(" select o.sn id, o.customer_phone phone, '零散客户' name, 3 type, 0 del, null entity_id, o.customer_name, o.customer_texpayer_name texpayer_name, o.invoice_type, 99 customer_type, '零散' customer_type_name \n");
|
|
||||||
sqlbuf.append(" from order_temp o \n");
|
|
||||||
|
|
||||||
sqlbuf.append(") a\n");
|
sqlbuf.append(") a\n");
|
||||||
sqlbuf.append("where 1 = 1");
|
sqlbuf.append("where 1 = 1");
|
||||||
if (StrKit.notBlank(customer_name)) {
|
if (StrKit.notBlank(customer_name)) {
|
||||||
|
|
|
||||||
|
|
@ -93,81 +93,10 @@ public class CheckUndonOrderclusterJob implements Job {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 转结未完成的 ordercluster
|
|
||||||
*/
|
|
||||||
public void forwardOrder() {
|
|
||||||
try {
|
|
||||||
Calendar c = Calendar.getInstance();
|
|
||||||
c.set(Calendar.HOUR_OF_DAY, 0);
|
|
||||||
c.set(Calendar.MINUTE, 0);
|
|
||||||
c.set(Calendar.SECOND, 0);
|
|
||||||
c.set(Calendar.MILLISECOND, 0);
|
|
||||||
|
|
||||||
List<Ordercluster> undonlist = Ordercluster.dao.find(
|
|
||||||
"select * from ordercluster t \n" +
|
|
||||||
" where t.state < ? \n" +
|
|
||||||
" and t.cutoff_time < ? ",
|
|
||||||
OrderStateEnum.RECEIVED.getStateid(), c.getTime());
|
|
||||||
|
|
||||||
if (undonlist != null && !undonlist.isEmpty()) {
|
|
||||||
log.debug("完成未执行完的订单 %d", undonlist.size());
|
|
||||||
|
|
||||||
for (Ordercluster ordercluster : undonlist) {
|
|
||||||
try {
|
|
||||||
int ordercluster_id = ordercluster.getId();
|
|
||||||
BigDecimal over_weight = OrderclusterService.me.getOverWeight(ordercluster_id); // 按客户找集团订单已完成量
|
|
||||||
BigDecimal surplus_weight = ordercluster.getTotalWeight().subtract(over_weight); // 剩余未完成量
|
|
||||||
Sysuser user = new Sysuser();
|
|
||||||
user.setId(0);
|
|
||||||
user.setName("system");
|
|
||||||
|
|
||||||
Calendar cold = Calendar.getInstance();
|
|
||||||
cold.setTime(ordercluster.getCutoffTime());
|
|
||||||
cold.add(Calendar.DATE, 1);
|
|
||||||
Date cutoff_time = cold.getTime();
|
|
||||||
|
|
||||||
Result ret;
|
|
||||||
|
|
||||||
if (ordercluster.getCustomerId() != null) {
|
|
||||||
ret = OrderclusterSyncService.me.forwardCluster(ordercluster_id, surplus_weight, ordercluster.getCutoffTime(), cutoff_time, user, true);
|
|
||||||
} else {
|
|
||||||
String trucks = Db.queryStr("select group_concat(t.truck_license) trucks from ordercluster_truck t\n" +
|
|
||||||
" where t.ordercluster_id = ?\n" +
|
|
||||||
" group by t.ordercluster_id", ordercluster_id);
|
|
||||||
|
|
||||||
if(trucks == null){
|
|
||||||
log.debug("没有找到 trucks , ordercluster_id: %s", ordercluster_id);
|
|
||||||
trucks = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = OrderclusterSyncService.me.forwardTemp(ordercluster_id, surplus_weight, ordercluster.getCutoffTime(), cutoff_time, trucks, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret.getCode() != Result.SUCCESS) {
|
|
||||||
log.error("自动转结失败。ordercluster_id:%s, err msg: %s", ordercluster_id, ret.getMsg());
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug("自动转结完成");
|
|
||||||
} else {
|
|
||||||
log.debug("无未完成的订单");
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext jobExecutionContext) {
|
public void execute(JobExecutionContext jobExecutionContext) {
|
||||||
try {
|
try {
|
||||||
// closeOrder();
|
closeOrder();
|
||||||
forwardOrder();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -846,10 +846,6 @@ public class SysuserSyncService extends BaseSyncService {
|
||||||
sqlbuf.append(" from sysuser u \n");
|
sqlbuf.append(" from sysuser u \n");
|
||||||
sqlbuf.append(" left join customer c on u.entity_id = c.id\n");
|
sqlbuf.append(" left join customer c on u.entity_id = c.id\n");
|
||||||
sqlbuf.append(" left join customer_type t on c.customer_type_id = t.id\n");
|
sqlbuf.append(" left join customer_type t on c.customer_type_id = t.id\n");
|
||||||
sqlbuf.append(" union all\n");
|
|
||||||
sqlbuf.append(" select o.sn id, o.customer_phone phone, '零散客户' name, 3 type, 0 del, null entity_id, o.customer_name, o.customer_texpayer_name texpayer_name, o.invoice_type, 99 customer_type, '零散' customer_type_name \n");
|
|
||||||
sqlbuf.append(" from order_temp o \n");
|
|
||||||
|
|
||||||
sqlbuf.append(") a\n");
|
sqlbuf.append(") a\n");
|
||||||
sqlbuf.append("where 1 = 1");
|
sqlbuf.append("where 1 = 1");
|
||||||
if (StrKit.notBlank(customer_name)) {
|
if (StrKit.notBlank(customer_name)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue