单价修改审批优化

dev
wuwenxiong 2021-12-27 15:26:28 +08:00
parent 6ee2bb1cdc
commit 9fd378d544
7 changed files with 167 additions and 395 deletions

View File

@ -15,11 +15,6 @@ import com.cowr.model.ProductPriceModify;
public class ProductPriceModifyValidator extends CrudParamValidator {
@Override
protected void validate(Controller c) {
// 默认新增时,前端不需要传主键。若需要前端传主键,需要去掉这个判断
if (!"save".equals(getActionMethodName())) {
validateRequired("id", "id", "id 必填");
validateString("id", 1, 32, "id", "id 长度 1~32");
}
if (StrKit.notBlank(c.get("customer_id"))) { // 可为空字段,当传入值时,才做验证
validateLong("customer_id", 1, 2147483647, "customer_id", "customer_id 范围 1~2147483647");
}
@ -36,6 +31,9 @@ public class ProductPriceModifyValidator extends CrudParamValidator {
validateRequired("type", "type", "type 必填");
validateLong("type", 1, 2, "type", "type 范围1或2");
validateRequired("operation_type", "operation_type", "operation_type 必填");
validateLong("operation_type", 1, 3, "operation_type", "operation_type 范围1或2");
// 使用 model 更新时model 不能只有主键有值
// 这里用 getActionMethodName 写死,判断是 update 时,才做验证
// 如果确实是需要将主键外的字段置为 null可以在代码生成后删掉这段

View File

@ -42,7 +42,6 @@ import com.cowr.local.ssjygl.prepay.prepaytruck.PrepayTruckController;
import com.cowr.local.ssjygl.prepay.refunddetail.RefundDetailController;
import com.cowr.local.ssjygl.presellorder.PresellOrderController;
import com.cowr.local.ssjygl.product.ProductController;
import com.cowr.local.ssjygl.productpricemodify.ProductPriceModifyController;
import com.cowr.local.ssjygl.purchase.PurchaseController;
import com.cowr.local.ssjygl.sandfarm.SandfarmController;
import com.cowr.local.ssjygl.sms.log.SmsLogController;
@ -236,7 +235,6 @@ public class Config extends JFinalConfig {
me.add("/orderclustertruck", OrderclusterTruckController.class);
me.add("/order/invalidverify", OrderInvalidVerifyController.class);
me.add("/presellorder", PresellOrderController.class);
me.add("/productPriceModify", ProductPriceModifyController.class);
// -- 统计
me.add("/stat/sale", OrderStatController.class);

View File

@ -1,41 +0,0 @@
package com.cowr.local.ssjygl.productpricemodify;
import com.cowr.common.view.PageParam;
import com.cowr.common.view.Result;
import com.cowr.ssjygl.productpricemodify.ProductPriceModifyService;
import com.jfinal.core.Controller;
/**
* Generated by COWR Tue Dec 07 16:33:49 CST 2021
* TableName: product_price_modify
* Remarks:
* PrimaryKey: id
*/
public class ProductPriceModifyController extends Controller {
/**
* product_price_modify
*/
public void find(){
String name = get("name");
String stm = get("stm");
String etm = get("etm");
Integer supermarket_id = getInt("supermarket_id");
Integer state = getInt("state");
PageParam pp = getBean(PageParam.class, "", true);
renderJson(Result.object(ProductPriceModifyService.me.find(pp, name, stm, etm, supermarket_id, state)));
}
/**
* product_price_modify
*/
public void list(){
String name = get("name");
String stm = get("stm");
String etm = get("etm");
Integer supermarket_id = getInt("supermarket_id");
Integer state = getInt("state");
renderJson(Result.object(ProductPriceModifyService.me.list(name, stm, etm, supermarket_id, state)));
}
}

View File

@ -1,114 +1,45 @@
package com.cowr.service.ssjygl.customer.supermarketproduct;
import com.cowr.common.enums.Enums;
import com.cowr.common.view.Result;
import com.cowr.model.*;
import com.cowr.service.ssjygl.base.BaseSyncService;
import com.cowr.service.ssjygl.main.SvrCacheData;
import com.cowr.service.ssjygl.synctask.SyncTaskService;
import com.cowr.ssjygl.modifylog.ModifyLogService;
import com.jfinal.kit.StrKit;
import com.jfinal.log.Log;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.IAtom;
import java.math.BigDecimal;
import java.util.Date;
public class CustomerSupermarketProductSyncService extends BaseSyncService {
private static Log log = Log.getLog(CustomerSupermarketProductSyncService.class);
public static CustomerSupermarketProductSyncService me = new CustomerSupermarketProductSyncService();
public Result saveOrUpdate(CustomerSupermarketProduct model, Sysuser user) {
Integer customer_id = model.getCustomerId();
Integer supermarket_id = model.getSupermarketId();
Integer product_id = model.getProductId();
BigDecimal unit_price = model.getUnitPrice();
Customer customer = Customer.dao.findById(customer_id);
public Result saveOrUpdate(CustomerSupermarketProduct model, Sysuser sysuser) {
Customer customer = Customer.dao.findById(model.getCustomerId());
if (customer == null) {
return Result.failed("没有找到对应客户信息");
}
Supermarket supermarket = SvrCacheData.SUP_CACHE.get(supermarket_id);
Supermarket supermarket = SvrCacheData.SUP_CACHE.get(model.getSupermarketId());
if (supermarket == null) {
return Result.failed("没找到砂站信息");
}
Product product = Product.dao.findById(product_id);
Product product = Product.dao.findById(model.getProductId());
if (product == null) {
return Result.failed("没有找到品类信息");
}
CustomerSupermarketProduct old = CustomerSupermarketProduct.dao.findByIds(customer_id, supermarket_id, product_id);
CustomerSupermarketProduct old = CustomerSupermarketProduct.dao.findByIds(model.getCustomerId(), model.getSupermarketId(), model.getProductId());
SupermarketProduct sp = SupermarketProduct.dao.findByIds(supermarket_id, product_id);
SupermarketProduct sp = SupermarketProduct.dao.findByIds(model.getSupermarketId(), model.getProductId());
if (sp == null) {
return Result.failed("砂站没有该品类");
}
if (old == null) {
return super.save(model, user);
return super.save(model, sysuser);
} else {
// 提交单价修改申请
ProductPriceModify ppm = new ProductPriceModify();
ppm.setId(StrKit.getRandomUUID());
ppm.setCustomerId(customer_id);
ppm.setSupermarketId(supermarket_id);
ppm.setProductId(product_id);
ppm.setUnitPrice(unit_price);
ppm.setType(2);
ppm.setState(1);
ppm.setCreateTime(new Date());
ppm.setChangeTime(new Date());
ppm.setCreateUserId(user.getId());
SyncTask synctask = new SyncTask();
boolean ret = Db.tx(new IAtom() {
@Override
public boolean run() {
try {
boolean ret = ppm.save();
if (!ret) {
return false;
}
ProductPriceModifyLog his = new ProductPriceModifyLog();
his.setId(StrKit.getRandomUUID());
his.setProductPriceModifyId(ppm.getId());
his.setChangeUserId(user.getId());
his.setChangeUserName(user.getName());
his.setState(ppm.getState());
his.setChangeTime(new Date());
ret = his.save();
if (!ret) {
return false;
}
synctask.addSaveData(ppm);
synctask.addSaveData(his);
return SyncTaskService.me.save(synctask, supermarket_id)
&& ModifyLogService.me.save(ppm, null, Enums.DataOpType.SAVE.getId(), user);
} catch (Exception e) {
log.error(e.getMessage(), e);
return false;
}
}
});
if (ret) {
SyncTaskService.me.send(synctask);
}
return ret ? Result.object(ppm) : Result.failed(false, "修改失败");
return super.update(model, sysuser);
}
}
}

View File

@ -3,9 +3,11 @@ package com.cowr.service.ssjygl.productpricemodify;
import com.cowr.common.validator.StartAndEndTimeValidator;
import com.cowr.common.view.PageParam;
import com.cowr.common.view.Result;
import com.cowr.model.ProductPriceModify;
import com.cowr.model.Sysuser;
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
import com.cowr.ssjygl.productpricemodify.ProductPriceModifyService;
import com.cowr.ssjygl.productpricemodify.ProductPriceModifyValidator;
import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
@ -43,6 +45,19 @@ public class ProductPriceModifyController extends Controller {
renderJson(Result.object(ProductPriceModifyService.me.list(name, stm, etm, supermarket_id, state)));
}
@Before(ProductPriceModifyValidator.class)
public void save() {
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
if (tokenuser == null) {
renderJson(Result.noauth());
return;
}
ProductPriceModify model = getModel(ProductPriceModify.class, "", true); // 忽略不在model中的字段
renderJson(ProductPriceModifySyncService.me.save(model, tokenuser));
}
@Before(ProductPriceModifyVerifyValidator.class)
public void verify() {
@ -55,9 +70,8 @@ public class ProductPriceModifyController extends Controller {
String id = get("id");
Integer state = getInt("state", 0);
Integer type = getInt("type", 1);
String memo = get("memo");
renderJson(ProductPriceModifySyncService.me.verify(id, state, type, memo, tokenuser));
renderJson(ProductPriceModifySyncService.me.verify(id, state, memo, tokenuser));
}
}

View File

@ -1,9 +1,12 @@
package com.cowr.service.ssjygl.productpricemodify;
import com.cowr.common.base.BaseModel;
import com.cowr.common.enums.Enums;
import com.cowr.common.view.Result;
import com.cowr.model.*;
import com.cowr.service.ssjygl.base.BaseSyncService;
import com.cowr.service.ssjygl.customer.supermarketproduct.CustomerSupermarketProductSyncService;
import com.cowr.service.ssjygl.supermarket.SupermarketSyncService;
import com.cowr.service.ssjygl.synctask.SyncTaskService;
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
import com.cowr.ssjygl.modifylog.ModifyLogService;
@ -15,9 +18,6 @@ import com.jfinal.plugin.activerecord.IAtom;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Generated by COWR Tue Dec 07 16:33:49 CST 2021
@ -30,7 +30,59 @@ public class ProductPriceModifySyncService extends BaseSyncService {
public static final ProductPriceModifySyncService me = new ProductPriceModifySyncService();
public Result verify(String id, Integer state, Integer type, String memo, Sysuser user) {
public Result save(ProductPriceModify model, Sysuser user) {
model.setId(StrKit.getRandomUUID());
model.setState(1);
model.setCreateTime(new Date());
model.setChangeTime(new Date());
model.setCreateUserId(user.getId());
SyncTask synctask = new SyncTask();
boolean ret = Db.tx(new IAtom() {
@Override
public boolean run() {
try {
boolean ret = model.save();
if (!ret) {
return false;
}
ProductPriceModifyLog his = new ProductPriceModifyLog();
his.setId(StrKit.getRandomUUID());
his.setProductPriceModifyId(model.getId());
his.setChangeUserId(user.getId());
his.setChangeUserName(user.getName());
his.setState(model.getState());
his.setChangeTime(new Date());
ret = his.save();
if (!ret) {
return false;
}
synctask.addSaveData(model);
synctask.addSaveData(his);
return SyncTaskService.me.save(synctask, model.getSupermarketId())
&& ModifyLogService.me.save(model, null, Enums.DataOpType.SAVE.getId(), user);
} catch (Exception e) {
log.error(e.getMessage(), e);
return false;
}
}
});
if (ret) {
SyncTaskService.me.send(synctask);
}
return ret ? Result.object(model) : Result.failed(false, "");
}
public Result verify(String id, Integer state, String memo, Sysuser user) {
if (!SysuserSyncService.me.isCompanyManager(user.getRole())) {
return Result.permissionDenied();
}
@ -39,10 +91,6 @@ public class ProductPriceModifySyncService extends BaseSyncService {
return Result.failed("state 值错误");
}
if (type != 1 && type != 2) {
return Result.failed("type 值错误");
}
ProductPriceModify model = ProductPriceModify.dao.findById(id);
if (model == null) {
@ -53,199 +101,30 @@ public class ProductPriceModifySyncService extends BaseSyncService {
return Result.failed("价格变更申请状态未变化");
}
if (type == 1) {
return verifyProductUnitPrice(model, state, memo, user);
}
return verifyCustomerUnitPrice(model, state, memo, user);
}
/**
*
* @param model
* @param state
* @param memo
* @param user
* @return
*/
public Result verifyProductUnitPrice(ProductPriceModify model, Integer state, String memo, Sysuser user) {
Integer supermarket_id = model.getSupermarketId();
Integer product_id = model.getProductId();
BigDecimal unit_price = model.getUnitPrice();
SupermarketProduct supermarketProduct = SupermarketProduct.dao.findByIds(supermarket_id, product_id);
if (supermarketProduct == null) {
return Result.failed("未找到商品单价信息");
}
String sql = "select t.* from ordercluster t \n" +
" where t.state < 5 \n" +
" and t.supermarket_id = ?\n" +
" and t.product_id = ?\n" +
" and t.customer_id not in (\n" +
" select a.customer_id from customer_supermarket_product a\n" +
" where a.customer_id = t.customer_id \n" +
" and a.supermarket_id = t.supermarket_id \n" +
" and a.product_id = t.product_id\n" +
" )";
List<Ordercluster> orderclusterList = Ordercluster.dao.find(sql, supermarket_id, product_id);
Map<Integer, SyncTask> map = new HashMap<>();
if (orderclusterList != null && !orderclusterList.isEmpty()) {
for (Ordercluster ordercluster : orderclusterList) {
ordercluster.setUnitPrice(unit_price);
if (!map.containsKey(ordercluster.getId())) {
map.put(ordercluster.getSupermarketId(), new SyncTask());
}
map.get(ordercluster.getSupermarketId()).addUpdateData(ordercluster);
}
}
try {
SyncTask synctask = new SyncTask();
ProductPriceModify oldmodel = model.clone();
boolean ret = Db.tx(new IAtom() {
@Override
public boolean run() throws SQLException {
Date now = new Date();
model.setState(state);
model.setVerifyTime(now);
boolean ret = model.update();
if (!ret) {
return false;
}
synctask.addUpdateData(model);
SupermarketProduct oldPriceModal = null;
SupermarketProduct priceModal = null;
if (state == 2) { // 审核通过
Stock stock = Stock.dao.findByIds(supermarket_id, product_id);
if (stock != null) {
stock.setStockWeight(new BigDecimal(0));
synctask.addUpdateData(stock);
ret = stock.update();
}
if (!ret) {
return false;
}
if (orderclusterList != null && !orderclusterList.isEmpty()) {
int[] editret = Db.batchUpdate(orderclusterList, orderclusterList.size());
for (int i : editret) {
// 必须是每条 sql 修改一条记录
if (i != 1) {
return false;
}
}
// 将单价同步到不同的砂站
for (Map.Entry<Integer, SyncTask> entry : map.entrySet()) {
if (!SyncTaskService.me.save(entry.getValue(), entry.getKey())) {
return false;
}
}
}
SupermarketProduct supermarketProduct = SupermarketProduct.dao.findByIds(supermarket_id, product_id);
oldPriceModal = supermarketProduct.clone();
supermarketProduct.setUnitPrice(unit_price);
ret = supermarketProduct.update();
synctask.addUpdateData(supermarketProduct);
priceModal = supermarketProduct.clone();
if (!ret) {
return false;
}
}
ProductPriceModifyLog his = new ProductPriceModifyLog();
his.setId(StrKit.getRandomUUID());
his.setProductPriceModifyId(model.getId());
his.setChangeUserId(user.getId());
his.setChangeUserName(user.getName());
his.setState(model.getState());
his.setChangeTime(now);
his.setMemo(memo);
ret = his.save();
if (!ret) {
return false;
}
synctask.addSaveData(his);
if (state == 2) {
return SyncTaskService.me.save(synctask, supermarket_id)
&& ModifyLogService.me.save(model, oldmodel, Enums.DataOpType.UPDATE.getId(), user)
&& ModifyLogService.me.save(priceModal, oldPriceModal, Enums.DataOpType.UPDATE.getId(), user);
}
return SyncTaskService.me.save(synctask, supermarket_id)
&& ModifyLogService.me.save(model, oldmodel, Enums.DataOpType.UPDATE.getId(), user);
}
});
if (ret) {
SyncTaskService.me.send(synctask);
}
return ret ? Result.success(true) : Result.failed(false, "审核失败");
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.failed(false, e.getMessage());
}
}
/**
*
* @param model
* @param state
* @param memo
* @param user
* @return
*/
public Result verifyCustomerUnitPrice(ProductPriceModify model, Integer state, String memo, Sysuser user) {
Integer customer_id = model.getCustomerId();
Integer supermarket_id = model.getSupermarketId();
Integer product_id = model.getProductId();
Integer type = model.getType();
BigDecimal unit_price = model.getUnitPrice();
Customer customer = Customer.dao.findById(customer_id);
if (customer == null) {
return Result.failed("未找到有效的客户信息");
}
CustomerSupermarketProduct customerSupermarketProduct = CustomerSupermarketProduct.dao.findByIds(customer_id, supermarket_id, product_id);
if (customerSupermarketProduct == null) {
return Result.failed("未找到客户自定义单价信息");
}
ProductPriceModifyLog his = new ProductPriceModifyLog();
his.setId(StrKit.getRandomUUID());
his.setProductPriceModifyId(id);
his.setChangeUserId(user.getId());
his.setChangeUserName(user.getName());
his.setState(state);
his.setChangeTime(new Date());
his.setMemo(memo);
try {
SyncTask synctask = new SyncTask();
ProductPriceModify oldmodel = model.clone();
boolean ret = Db.tx(new IAtom() {
@Override
public boolean run() throws SQLException {
Date now = new Date();
public boolean run() {
model.setState(state);
model.setVerifyTime(now);
model.setVerifyTime(new Date());
boolean ret = model.update();
@ -255,36 +134,6 @@ public class ProductPriceModifySyncService extends BaseSyncService {
synctask.addUpdateData(model);
CustomerSupermarketProduct oldPriceModal = null;
CustomerSupermarketProduct priceModal = null;
if (state == 2) { // 审核通过
CustomerSupermarketProduct customerSupermarketProduct = CustomerSupermarketProduct.dao.findByIds(customer_id, supermarket_id, product_id);
oldPriceModal = customerSupermarketProduct.clone();
customerSupermarketProduct.setUnitPrice(unit_price);
ret = customerSupermarketProduct.update();
synctask.addUpdateData(customerSupermarketProduct);
priceModal = customerSupermarketProduct.clone();
if (!ret) {
return false;
}
}
ProductPriceModifyLog his = new ProductPriceModifyLog();
his.setId(StrKit.getRandomUUID());
his.setProductPriceModifyId(model.getId());
his.setChangeUserId(user.getId());
his.setChangeUserName(user.getName());
his.setState(model.getState());
his.setChangeTime(now);
his.setMemo(memo);
ret = his.save();
if (!ret) {
@ -293,12 +142,6 @@ public class ProductPriceModifySyncService extends BaseSyncService {
synctask.addSaveData(his);
if (state == 2) {
return SyncTaskService.me.save(synctask, supermarket_id)
&& ModifyLogService.me.save(model, oldmodel, Enums.DataOpType.UPDATE.getId(), user)
&& ModifyLogService.me.save(priceModal, oldPriceModal, Enums.DataOpType.UPDATE.getId(), user);
}
return SyncTaskService.me.save(synctask, supermarket_id)
&& ModifyLogService.me.save(model, oldmodel, Enums.DataOpType.UPDATE.getId(), user);
}
@ -308,11 +151,27 @@ public class ProductPriceModifySyncService extends BaseSyncService {
SyncTaskService.me.send(synctask);
}
return ret ? Result.success(true) : Result.failed(false, "审核失败");
if (state == 9) {
return ret ? Result.success(true) : Result.failed(false, "操作失败");
}
// 砂站单价修改
if (type == 1) {
SupermarketProduct sp = SupermarketProduct.dao.findByIds(supermarket_id, product_id);
if (sp == null) {
return SupermarketSyncService.me.addProduct(supermarket_id, product_id, unit_price.doubleValue(), user);
}
return SupermarketSyncService.me.editUnitPrice(supermarket_id, product_id, unit_price.doubleValue(), user);
}
// 客户商品单价修改
CustomerSupermarketProduct csp = new CustomerSupermarketProduct();
csp.setCustomerId(customer_id);
csp.setSupermarketId(supermarket_id);
csp.setProductId(product_id);
csp.setUnitPrice(unit_price);
return CustomerSupermarketProductSyncService.me.saveOrUpdate(csp, user);
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.failed(false, e.getMessage());
}
}
}

View File

@ -7,15 +7,14 @@ import com.cowr.service.ssjygl.base.BaseSyncService;
import com.cowr.service.ssjygl.main.SvrCacheData;
import com.cowr.service.ssjygl.synctask.SyncTaskService;
import com.cowr.ssjygl.modifylog.ModifyLogService;
import com.jfinal.kit.StrKit;
import com.jfinal.log.Log;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.IAtom;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SupermarketSyncService extends BaseSyncService {
private static Log log = Log.getLog(SupermarketSyncService.class);
@ -158,10 +157,10 @@ public class SupermarketSyncService extends BaseSyncService {
* @param supermarket_id
* @param product_id
* @param unit_price
* @param user
* @param sysuser
* @return
*/
public Result editUnitPrice(int supermarket_id, int product_id, Double unit_price, Sysuser user) {
public Result editUnitPrice(int supermarket_id, int product_id, Double unit_price, Sysuser sysuser) {
if (unit_price == null || unit_price <= 0) {
return Result.failed("商品单价不能小于0");
}
@ -171,48 +170,66 @@ public class SupermarketSyncService extends BaseSyncService {
return Result.failed("商品配置信息不存在");
}
ProductPriceModify ppm = new ProductPriceModify();
ppm.setId(StrKit.getRandomUUID());
ppm.setSupermarketId(supermarket_id);
ppm.setProductId(product_id);
ppm.setUnitPrice(BigDecimal.valueOf(unit_price));
ppm.setType(1);
ppm.setState(1);
ppm.setCreateTime(new Date());
ppm.setChangeTime(new Date());
ppm.setCreateUserId(user.getId());
SupermarketProduct saveold = sp.clone();
SyncTask synctask = new SyncTask();
sp.setUnitPrice(BigDecimal.valueOf(unit_price));
String sql = "select t.* from ordercluster t \n" +
" where t.state < 5 \n" +
" and t.supermarket_id = ?\n" +
" and t.product_id = ?\n" +
" and t.customer_id not in (\n" +
" select a.customer_id from customer_supermarket_product a\n" +
" where a.customer_id = t.customer_id \n" +
" and a.supermarket_id = t.supermarket_id \n" +
" and a.product_id = t.product_id\n" +
" )";
List<Ordercluster> orderclusterList = Ordercluster.dao.find(sql, supermarket_id, product_id);
Map<Integer, SyncTask> map = new HashMap<>();
if (orderclusterList != null && !orderclusterList.isEmpty()) {
for (Ordercluster ordercluster : orderclusterList) {
ordercluster.setUnitPrice(BigDecimal.valueOf(unit_price));
if (!map.containsKey(ordercluster.getId())) {
map.put(ordercluster.getSupermarketId(), new SyncTask());
}
map.get(ordercluster.getSupermarketId()).addUpdateData(ordercluster);
}
}
boolean ret = Db.tx(new IAtom() {
@Override
public boolean run() {
try {
boolean ret = ppm.save();
boolean ret = true;
SyncTask synctask = new SyncTask();
synctask.addUpdateData(sp);
if (!ret) {
return false;
Stock stock = Stock.dao.findByIds(supermarket_id, product_id);
if (stock != null) {
stock.setStockWeight(new BigDecimal(0));
synctask.addUpdateData(stock);
ret = stock.update();
}
ProductPriceModifyLog his = new ProductPriceModifyLog();
his.setId(StrKit.getRandomUUID());
his.setProductPriceModifyId(ppm.getId());
his.setChangeUserId(user.getId());
his.setChangeUserName(user.getName());
his.setState(ppm.getState());
his.setChangeTime(new Date());
ret = his.save();
if (!ret) {
return false;
if (orderclusterList != null && !orderclusterList.isEmpty()) {
int[] editret = Db.batchUpdate(orderclusterList, orderclusterList.size());
for (int i : editret) {
// 必须是每条 sql 修改一条记录
if (i != 1) {
return false;
}
}
// 将单价同步到不同的砂站
for (Map.Entry<Integer, SyncTask> entry : map.entrySet()) {
if (!SyncTaskService.me.save(entry.getValue(), entry.getKey())) {
return false;
}
}
}
synctask.addSaveData(ppm);
synctask.addSaveData(his);
return SyncTaskService.me.save(synctask, supermarket_id)
&& ModifyLogService.me.save(ppm, null, Enums.DataOpType.SAVE.getId(), user);
return ret && sp.update()
&& SyncTaskService.me.save(synctask)
&& ModifyLogService.me.save(sp, saveold, Enums.DataOpType.UPDATE.getId(), sysuser);
} catch (Exception e) {
log.error(e.getMessage(), e);
return false;
@ -220,10 +237,6 @@ public class SupermarketSyncService extends BaseSyncService {
}
});
if (ret) {
SyncTaskService.me.send(synctask);
}
return ret ? Result.object(ppm) : Result.failed(false, "修改失败");
return Result.object(ret);
}
}