修改计算余额方式
parent
6c013d24fe
commit
7791a585b5
|
|
@ -141,7 +141,7 @@ public class PrepayService {
|
||||||
//获取账户可用余额
|
//获取账户可用余额
|
||||||
BigDecimal availableBalance = RefundDetailService.me.getAvailableBalance(prepayCustomer.getCustomerId(), prepayCustomer.getSurplus());
|
BigDecimal availableBalance = RefundDetailService.me.getAvailableBalance(prepayCustomer.getCustomerId(), prepayCustomer.getSurplus());
|
||||||
if (ordercluster.getSaleType() == 1) {
|
if (ordercluster.getSaleType() == 1) {
|
||||||
availableBalance = PresellOrderService.me.getPresellCustomerSurplusById(ordercluster.getPresellOrderId());
|
availableBalance = PresellOrderService.me.getPresellCustomerSurplusById(ordercluster.getCustomerId());
|
||||||
}
|
}
|
||||||
out.set("prepay_truck", true);
|
out.set("prepay_truck", true);
|
||||||
out.set("prepay_threshold", prepayCustomer.getThreshold());
|
out.set("prepay_threshold", prepayCustomer.getThreshold());
|
||||||
|
|
|
||||||
|
|
@ -163,21 +163,32 @@ public class PresellOrderService extends BaseService {
|
||||||
return PresellOrder.dao.find(sql, paraList.toArray());
|
return PresellOrder.dao.find(sql, paraList.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getPresellCustomerSurplusById(String id) {
|
public BigDecimal getPresellCustomerSurplusById(Integer id) {
|
||||||
String sql = "select t.presell_amount - ifnull(g.total_price, 0) surplus from presell_order t\n" +
|
List<Object> params = new ArrayList<>();
|
||||||
" left join ( \n" +
|
params.add(id);
|
||||||
|
params.add(id);
|
||||||
|
String sql = "SELECT\n" +
|
||||||
|
" (\n" +
|
||||||
" SELECT\n" +
|
" SELECT\n" +
|
||||||
" o.presell_order_id,\n" +
|
" sum(t.presell_amount)\n" +
|
||||||
" SUM(d.total_price) total_price\n" +
|
|
||||||
" FROM\n" +
|
" FROM\n" +
|
||||||
" `order_temp` d\n" +
|
" presell_order t\n" +
|
||||||
"LEFT JOIN ordercluster o ON d.ordercluster_id = o.id\n" +
|
|
||||||
" WHERE\n" +
|
" WHERE\n" +
|
||||||
" d.sale_type = 1\n" +
|
" t.del = 0\n" +
|
||||||
"AND d.state = 5\n" +
|
" AND t.customer_id = ?\n" +
|
||||||
"GROUP BY\n" +
|
" ) - (\n" +
|
||||||
" o.presell_order_id" + ") g on g.presell_order_id = t.id\n" +
|
" SELECT\n" +
|
||||||
"WHERE t.id = ?";
|
" sum(\n" +
|
||||||
return Db.queryBigDecimal(sql, id);
|
" t.total_weight * t.unit_price\n" +
|
||||||
|
" )\n" +
|
||||||
|
" FROM\n" +
|
||||||
|
" ordercluster t\n" +
|
||||||
|
" WHERE\n" +
|
||||||
|
" t.sale_type = 1\n" +
|
||||||
|
" AND t.state < 5\n" +
|
||||||
|
" AND t.customer_id = ?\n" +
|
||||||
|
" ) as surplus";
|
||||||
|
BigDecimal out = Db.queryBigDecimal(sql, params.toArray());
|
||||||
|
return out == null ? new BigDecimal(0) : out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ public class CustomerStatService {
|
||||||
" where t.customer_id is not null\n" +
|
" where t.customer_id is not null\n" +
|
||||||
" and t.create_time <= ? \n" +
|
" and t.create_time <= ? \n" +
|
||||||
" and t.state = 5\n" +
|
" and t.state = 5\n" +
|
||||||
|
" and t.sale_type = 0\n" +
|
||||||
customerSql +
|
customerSql +
|
||||||
" group by t.customer_id\n";
|
" group by t.customer_id\n";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3026,7 +3026,7 @@ public class OrderStatService {
|
||||||
" left join (\n" +
|
" left join (\n" +
|
||||||
" select t.id, t.product_id, count(*) as orderCount, sum(t.total_price) as totalPrice, sum(t.weight) as weight\n" +
|
" select t.id, t.product_id, count(*) as orderCount, sum(t.total_price) as totalPrice, sum(t.weight) as weight\n" +
|
||||||
" from (\n" +
|
" from (\n" +
|
||||||
" select t.supermarket_id as id, t.paid, t.total_price, t.weight, t.product_id\n" +
|
" select t.supermarket_id as id, t.total_price, t.weight, t.product_id\n" +
|
||||||
" from order_temp t \n" +
|
" from order_temp t \n" +
|
||||||
" where t.sale_type = 0 \n" +
|
" where t.sale_type = 0 \n" +
|
||||||
" and t.state = 5 \n" +
|
" and t.state = 5 \n" +
|
||||||
|
|
@ -3040,9 +3040,9 @@ public class OrderStatService {
|
||||||
List<Record> yhList = Db.find(
|
List<Record> yhList = Db.find(
|
||||||
"SELECT\n" +
|
"SELECT\n" +
|
||||||
" t.supermarket_id id,\n" +
|
" t.supermarket_id id,\n" +
|
||||||
" count(*) as order_num,\n" +
|
" ifnull(count(*), 0) as order_num,\n" +
|
||||||
" sum(t.weight) as weight,\n" +
|
" ifnull(sum(t.weight), 0) as weight,\n" +
|
||||||
" sum(t.total_price) total_price\n" +
|
" ifnull(sum(t.total_price), 0) as total_price\n" +
|
||||||
"FROM\n" +
|
"FROM\n" +
|
||||||
" order_temp t\n" +
|
" order_temp t\n" +
|
||||||
"LEFT JOIN ordercluster c ON c.id = t.ordercluster_id\n" +
|
"LEFT JOIN ordercluster c ON c.id = t.ordercluster_id\n" +
|
||||||
|
|
@ -3050,6 +3050,7 @@ public class OrderStatService {
|
||||||
"WHERE\n" +
|
"WHERE\n" +
|
||||||
" t.sale_type = 1\n" +
|
" t.sale_type = 1\n" +
|
||||||
" AND t.state = 5\n" +
|
" AND t.state = 5\n" +
|
||||||
|
" AND p.del = 0\n" +
|
||||||
yhParams +
|
yhParams +
|
||||||
"GROUP BY\n" +
|
"GROUP BY\n" +
|
||||||
" t.supermarket_id", yhParamsList.toArray());
|
" t.supermarket_id", yhParamsList.toArray());
|
||||||
|
|
@ -3076,7 +3077,7 @@ public class OrderStatService {
|
||||||
double hj_yh_total_price = 0.0;
|
double hj_yh_total_price = 0.0;
|
||||||
|
|
||||||
// 实售合并
|
// 实售合并
|
||||||
if (shList.size() > 0) {
|
if (shList != null && !shList.isEmpty()) {
|
||||||
List<Record> shList2 = new ArrayList<>();
|
List<Record> shList2 = new ArrayList<>();
|
||||||
for (Record s : shList) {
|
for (Record s : shList) {
|
||||||
int id = s.getInt("id");
|
int id = s.getInt("id");
|
||||||
|
|
@ -3095,6 +3096,16 @@ public class OrderStatService {
|
||||||
if ((s1_id == 1 && s2_id == 7) || (s1_id == 5 && s2_id == 9) ||s1_id == 6 && s2_id == 8) {
|
if ((s1_id == 1 && s2_id == 7) || (s1_id == 5 && s2_id == 9) ||s1_id == 6 && s2_id == 8) {
|
||||||
Record s3 = new Record();
|
Record s3 = new Record();
|
||||||
|
|
||||||
|
int order_num;
|
||||||
|
int s1_order_num = s1.getInt("order_num") == null ? 0 : s1.getInt("order_num");
|
||||||
|
int s2_order_num = s2.getInt("order_num") == null ? 0 : s2.getInt("order_num");
|
||||||
|
order_num = s1_order_num + s2_order_num;
|
||||||
|
|
||||||
|
BigDecimal total_price;
|
||||||
|
BigDecimal s1_total_price = s1.getBigDecimal("total_price") == null ? new BigDecimal(0) : s1.getBigDecimal("total_price");
|
||||||
|
BigDecimal s2_total_price = s2.getBigDecimal("total_price") == null ? new BigDecimal(0) : s2.getBigDecimal("total_price");
|
||||||
|
total_price = s1_total_price.add(s2_total_price);
|
||||||
|
|
||||||
BigDecimal weight = s1.getBigDecimal("weight").add(s2.getBigDecimal("weight"));
|
BigDecimal weight = s1.getBigDecimal("weight").add(s2.getBigDecimal("weight"));
|
||||||
if (weight.compareTo(new BigDecimal(0)) == 0) {
|
if (weight.compareTo(new BigDecimal(0)) == 0) {
|
||||||
weight = new BigDecimal(0);
|
weight = new BigDecimal(0);
|
||||||
|
|
@ -3104,8 +3115,8 @@ public class OrderStatService {
|
||||||
s3.set("name", s1.getStr("name"));
|
s3.set("name", s1.getStr("name"));
|
||||||
s3.set("product_id", s1.getInt("product_id"));
|
s3.set("product_id", s1.getInt("product_id"));
|
||||||
s3.set("product_name", s1.getStr("product_name"));
|
s3.set("product_name", s1.getStr("product_name"));
|
||||||
s3.set("order_num", Math.addExact(s1.getInt("order_num"), s2.getInt("order_num")));
|
s3.set("order_num", order_num);
|
||||||
s3.set("total_price", s1.getBigDecimal("total_price").add(s2.getBigDecimal("total_price")));
|
s3.set("total_price", total_price);
|
||||||
s3.set("weight", weight);
|
s3.set("weight", weight);
|
||||||
shList1.add(s3);
|
shList1.add(s3);
|
||||||
break;
|
break;
|
||||||
|
|
@ -3115,9 +3126,21 @@ public class OrderStatService {
|
||||||
} else if (shList2.size() == 1) {
|
} else if (shList2.size() == 1) {
|
||||||
shList1.addAll(shList2);
|
shList1.addAll(shList2);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (Record s : sups) {
|
||||||
|
Record p = new Record();
|
||||||
|
p.set("id", s.getInt("id"));
|
||||||
|
p.set("name", s.getStr("name"));
|
||||||
|
p.set("product_id", 1);
|
||||||
|
p.set("product_name", "黄砂");
|
||||||
|
p.set("order_num", 0);
|
||||||
|
p.set("weight", new BigDecimal(0));
|
||||||
|
p.set("total_price", new BigDecimal(0));
|
||||||
|
shList1.add(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 预售合并
|
// 预售合并
|
||||||
if (yhList.size() > 0) {
|
if (yhList != null && !yhList.isEmpty()) {
|
||||||
List<Record> yhList2 = new ArrayList<>();
|
List<Record> yhList2 = new ArrayList<>();
|
||||||
for (Record s : yhList) {
|
for (Record s : yhList) {
|
||||||
int id = s.getInt("id");
|
int id = s.getInt("id");
|
||||||
|
|
@ -3137,14 +3160,24 @@ public class OrderStatService {
|
||||||
flag = true;
|
flag = true;
|
||||||
Record s3 = new Record();
|
Record s3 = new Record();
|
||||||
|
|
||||||
|
int order_num;
|
||||||
|
int s1_order_num = s1.getInt("order_num") == null ? 0 : s1.getInt("order_num");
|
||||||
|
int s2_order_num = s2.getInt("order_num") == null ? 0 : s2.getInt("order_num");
|
||||||
|
order_num = s1_order_num + s2_order_num;
|
||||||
|
|
||||||
|
BigDecimal total_price;
|
||||||
|
BigDecimal s1_total_price = s1.getBigDecimal("total_price") == null ? new BigDecimal(0) : s1.getBigDecimal("total_price");
|
||||||
|
BigDecimal s2_total_price = s2.getBigDecimal("total_price") == null ? new BigDecimal(0) : s2.getBigDecimal("total_price");
|
||||||
|
total_price = s1_total_price.add(s2_total_price);
|
||||||
|
|
||||||
BigDecimal weight = s1.getBigDecimal("weight").add(s2.getBigDecimal("weight"));
|
BigDecimal weight = s1.getBigDecimal("weight").add(s2.getBigDecimal("weight"));
|
||||||
if (weight.compareTo(new BigDecimal(0)) == 0) {
|
if (weight.compareTo(new BigDecimal(0)) == 0) {
|
||||||
weight = new BigDecimal(0);
|
weight = new BigDecimal(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
s3.set("id", s1_id);
|
s3.set("id", s1_id);
|
||||||
s3.set("order_num", Math.addExact(s1.getInt("order_num"), s2.getInt("order_num")));
|
s3.set("order_num", order_num);
|
||||||
s3.set("total_price", s1.getBigDecimal("total_price").add(s2.getBigDecimal("total_price")));
|
s3.set("total_price", total_price);
|
||||||
s3.set("weight", weight);
|
s3.set("weight", weight);
|
||||||
yhList1.add(s3);
|
yhList1.add(s3);
|
||||||
break;
|
break;
|
||||||
|
|
@ -3159,7 +3192,11 @@ public class OrderStatService {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Record s : sups) {
|
for (Record s : sups) {
|
||||||
Record p = new Record().set("id", s.getInt("id")).set("total_price", new BigDecimal(0));
|
Record p = new Record();
|
||||||
|
p.set("id", s.getInt("id"));
|
||||||
|
p.set("order_num", 0);
|
||||||
|
p.set("weight", new BigDecimal(0));
|
||||||
|
p.set("total_price", new BigDecimal(0));
|
||||||
yhList1.add(p);
|
yhList1.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3182,9 +3219,9 @@ public class OrderStatService {
|
||||||
if (s_id == sl_id) {
|
if (s_id == sl_id) {
|
||||||
flag = false;
|
flag = false;
|
||||||
Record r = new Record();
|
Record r = new Record();
|
||||||
int order_num = sl.getInt("order_num");
|
int order_num = sl.getInt("order_num") == null ? 0 : sl.getInt("order_num");
|
||||||
BigDecimal weight = sl.getBigDecimal("weight");
|
BigDecimal weight = sl.getBigDecimal("weight") == null ? new BigDecimal(0) : sl.getBigDecimal("weight");
|
||||||
BigDecimal total_price = sl.getBigDecimal("total_price");
|
BigDecimal total_price = sl.getBigDecimal("total_price") == null ? new BigDecimal(0) : sl.getBigDecimal("total_price");
|
||||||
|
|
||||||
if (product_id == 1) {
|
if (product_id == 1) {
|
||||||
hj_hs_sh_order_num += order_num;
|
hj_hs_sh_order_num += order_num;
|
||||||
|
|
@ -3249,9 +3286,9 @@ public class OrderStatService {
|
||||||
flag = false;
|
flag = false;
|
||||||
Record r = new Record();
|
Record r = new Record();
|
||||||
|
|
||||||
int order_num = yl.getInt("order_num");
|
int order_num = yl.getInt("order_num") == null ? 0 : yl.getInt("order_num");
|
||||||
BigDecimal weight = yl.getBigDecimal("weight");
|
BigDecimal weight = yl.getBigDecimal("weight") == null ? new BigDecimal(0) : yl.getBigDecimal("weight");
|
||||||
BigDecimal total_price = yl.getBigDecimal("total_price");
|
BigDecimal total_price = yl.getBigDecimal("total_price") == null ? new BigDecimal(0) : yl.getBigDecimal("total_price");
|
||||||
hj_yh_order_num += order_num;
|
hj_yh_order_num += order_num;
|
||||||
hj_yh_weight += weight.doubleValue();
|
hj_yh_weight += weight.doubleValue();
|
||||||
hj_yh_total_price += total_price.doubleValue();
|
hj_yh_total_price += total_price.doubleValue();
|
||||||
|
|
@ -3375,7 +3412,7 @@ public class OrderStatService {
|
||||||
Record total = new Record();
|
Record total = new Record();
|
||||||
total.set("key", "total").set("name", "总合计").set("item_name", "-").set("product_name", "-")
|
total.set("key", "total").set("name", "总合计").set("item_name", "-").set("product_name", "-")
|
||||||
.set("order_num", hj_hs_sh_order_num + hj_els_sh_order_num + hj_jzs_sh_order_num + hj_yh_order_num)
|
.set("order_num", hj_hs_sh_order_num + hj_els_sh_order_num + hj_jzs_sh_order_num + hj_yh_order_num)
|
||||||
.set("weight", hj_hs_sh_weight + hj_els_sh_weight + hj_els_sh_weight + hj_yh_weight)
|
.set("weight", hj_hs_sh_weight + hj_els_sh_weight + hj_jzs_sh_weight + hj_yh_weight)
|
||||||
.set("total_price", hj_hs_sh_total_price + hj_els_sh_total_price + hj_jzs_sh_total_price + hj_yh_total_price);
|
.set("total_price", hj_hs_sh_total_price + hj_els_sh_total_price + hj_jzs_sh_total_price + hj_yh_total_price);
|
||||||
|
|
||||||
retList.add(total);
|
retList.add(total);
|
||||||
|
|
|
||||||
|
|
@ -1126,7 +1126,7 @@ public class OrderTempSyncService {
|
||||||
return Result.failed("没有找到客户预付费信息");
|
return Result.failed("没有找到客户预付费信息");
|
||||||
}
|
}
|
||||||
//账户可用余额
|
//账户可用余额
|
||||||
BigDecimal availableBalance = PresellOrderService.me.getPresellCustomerSurplusById(ordercluster.getPresellOrderId());
|
BigDecimal availableBalance = PresellOrderService.me.getPresellCustomerSurplusById(ordercluster.getCustomerId());
|
||||||
if (availableBalance == null || availableBalance.compareTo(min) <= 0) {
|
if (availableBalance == null || availableBalance.compareTo(min) <= 0) {
|
||||||
return Result.failed("客户余额不足");
|
return Result.failed("客户余额不足");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -322,11 +322,10 @@ public class OrderStatController extends BaseController {
|
||||||
String tm = get("tm");
|
String tm = get("tm");
|
||||||
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||||
Boolean stat_product = getBoolean("stat_product", false);
|
Boolean stat_product = getBoolean("stat_product", false);
|
||||||
Integer sale_type = getInt("sale_type");
|
|
||||||
if (export == 0) {
|
if (export == 0) {
|
||||||
renderJson(Result.object(OrderStatService.me.salestat(tm, sale_type)));
|
renderJson(Result.object(OrderStatService.me.statYearBySup(tm, 2)));
|
||||||
} else {
|
} else {
|
||||||
Workbook wb = OrderStatService.me.yearsalestatExport(tm, sale_type);
|
Workbook wb = OrderStatService.me.yearsalestatExportBySup(tm);
|
||||||
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,14 +114,12 @@ public class InvoiceReceiveSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
receive.setSurplus(0);
|
receive.setSurplus(0);
|
||||||
|
|
||||||
SyncTask syncTask = new SyncTask();
|
|
||||||
|
|
||||||
boolean ret = Db.tx(new IAtom() {
|
boolean ret = Db.tx(new IAtom() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
try {
|
try {
|
||||||
return receive.update()
|
return receive.update()
|
||||||
&& SyncTaskService.me.save(syncTask.addUpdateData(receive), receive.getSupermarketId()) // 下发到指定的砂站
|
&& SyncTaskService.me.save(new SyncTask().addUpdateData(receive), receive.getSupermarketId()) // 下发到指定的砂站
|
||||||
&& ModifyLogService.me.save(receive, oldobj, Enums.DataOpType.UPDATE.getId(), user);
|
&& ModifyLogService.me.save(receive, oldobj, Enums.DataOpType.UPDATE.getId(), user);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
@ -130,10 +128,6 @@ public class InvoiceReceiveSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ret) {
|
|
||||||
SyncTaskService.me.send(syncTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret ? Result.object(receive) : Result.failed(false, "回收失败");
|
return ret ? Result.object(receive) : Result.failed(false, "回收失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 余额
|
// 余额
|
||||||
BigDecimal pug_amount = PresellOrderService.me.getPresellCustomerSurplusById(model.getPresellOrderId());
|
BigDecimal pug_amount = PresellOrderService.me.getPresellCustomerSurplusById(model.getCustomerId());
|
||||||
BigDecimal surplus = presellOrder.getPresellAmount().subtract(pug_amount);
|
BigDecimal surplus = presellOrder.getPresellAmount().subtract(pug_amount);
|
||||||
|
|
||||||
if (unitprice.multiply(model.getTotalWeight()).compareTo(surplus) > 0) {
|
if (unitprice.multiply(model.getTotalWeight()).compareTo(surplus) > 0) {
|
||||||
|
|
@ -901,7 +901,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
return Result.failed(false, "未获取到订单信息");
|
return Result.failed(false, "未获取到订单信息");
|
||||||
}
|
}
|
||||||
// 余额
|
// 余额
|
||||||
BigDecimal pug_amount = PresellOrderService.me.getPresellCustomerSurplusById(oldobj.getPresellOrderId());
|
BigDecimal pug_amount = PresellOrderService.me.getPresellCustomerSurplusById(oldobj.getCustomerId());
|
||||||
BigDecimal surplus = order.getPresellAmount().subtract(pug_amount);
|
BigDecimal surplus = order.getPresellAmount().subtract(pug_amount);
|
||||||
if (plan_total_price.compareTo(surplus) > 0) {
|
if (plan_total_price.compareTo(surplus) > 0) {
|
||||||
return Result.failedstr("共计总配额达 %.2f元,客户余额(%.2f元)不足", plan_total_price, surplus);
|
return Result.failedstr("共计总配额达 %.2f元,客户余额(%.2f元)不足", plan_total_price, surplus);
|
||||||
|
|
@ -1128,7 +1128,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
} else {
|
} else {
|
||||||
PresellOrder order = PresellOrder.dao.findById(presell_order_id);
|
PresellOrder order = PresellOrder.dao.findById(presell_order_id);
|
||||||
if (order != null) {
|
if (order != null) {
|
||||||
BigDecimal pug_amount = PresellOrderService.me.getPresellCustomerSurplusById(presell_order_id);
|
BigDecimal pug_amount = PresellOrderService.me.getPresellCustomerSurplusById(order.getCustomerId());
|
||||||
availableBalance = order.getPresellAmount().subtract(pug_amount);
|
availableBalance = order.getPresellAmount().subtract(pug_amount);
|
||||||
maximumConfiguration = availableBalance.divide(new BigDecimal(unit_price), 2, BigDecimal.ROUND_DOWN);
|
maximumConfiguration = availableBalance.divide(new BigDecimal(unit_price), 2, BigDecimal.ROUND_DOWN);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,14 +111,12 @@ public class TicketReceiveSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
receive.setSurplus(0);
|
receive.setSurplus(0);
|
||||||
|
|
||||||
SyncTask syncTask = new SyncTask();
|
|
||||||
|
|
||||||
boolean ret = Db.tx(new IAtom() {
|
boolean ret = Db.tx(new IAtom() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
try {
|
try {
|
||||||
return receive.update()
|
return receive.update()
|
||||||
&& SyncTaskService.me.save(syncTask.addUpdateData(receive), receive.getSupermarketId()) // 下发到指定的砂站
|
&& SyncTaskService.me.save(new SyncTask().addUpdateData(receive), receive.getSupermarketId()) // 下发到指定的砂站
|
||||||
&& ModifyLogService.me.save(receive, oldobj, Enums.DataOpType.UPDATE.getId(), user);
|
&& ModifyLogService.me.save(receive, oldobj, Enums.DataOpType.UPDATE.getId(), user);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
@ -127,10 +125,6 @@ public class TicketReceiveSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ret) {
|
|
||||||
SyncTaskService.me.send(syncTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret ? Result.object(receive) : Result.failed(false, "回收失败");
|
return ret ? Result.object(receive) : Result.failed(false, "回收失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue