|
|
|
@@ -551,14 +551,23 @@ public class WxEnergyServiceImpl implements WxEnergyService { |
|
|
|
return retList; |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
|
@Override |
|
|
|
public void createFeesShop(WxEnergyFeesShop record) { |
|
|
|
//新增关联 |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
Date date = new Date(); |
|
|
|
WxEnergyFees fees = this.getFeesById(record.getFeesId(),record.getTenantId()); |
|
|
|
WxShop sq = new WxShop(); |
|
|
|
sq.updateTenantInfo(record); |
|
|
|
sq.setIds(record.getShopIds()); |
|
|
|
Map<Long, WxShop> shopMap = wxShopService.findShopMap(sq); |
|
|
|
for (int i = 0 ; i < record.getShopIds().size(); i ++) { |
|
|
|
Long shopId = record.getShopIds().get(i); |
|
|
|
WxShop shop = shopMap.get(shopId); |
|
|
|
if (StringUtils.isBlank(shop.getPulicRate())) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺未设置公摊系数"); |
|
|
|
} |
|
|
|
WxEnergyFeesShop msf = new WxEnergyFeesShop(); |
|
|
|
msf.updateTenantInfo(record); |
|
|
|
msf.setId(idWorker.nextId()); |
|
|
|
@@ -580,7 +589,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { |
|
|
|
msf.setFormulaListStr(JSON.toJSONString(record.getFormulaList())); |
|
|
|
} |
|
|
|
msf.setFormula(record.getFormula()); |
|
|
|
wxEnergyHelper.testCalcute(record.getFormula()); |
|
|
|
wxEnergyHelper.testCalcute(record.getFormula(),shop.getPulicRate()); |
|
|
|
wxEnergyFeesShopMapper.insert(msf); |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -617,7 +626,11 @@ public class WxEnergyServiceImpl implements WxEnergyService { |
|
|
|
if (null != record.getFormulaList() && record.getFormulaList().size() > 0 ) { |
|
|
|
record.setFormulaListStr(JSON.toJSONString(record.getFormulaList())); |
|
|
|
} |
|
|
|
wxEnergyHelper.testCalcute(record.getFormula()); |
|
|
|
WxShop shop = wxShopService.getById(record.getShopId()); |
|
|
|
if (StringUtils.isBlank(shop.getPulicRate())) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺未设置公摊系数"); |
|
|
|
} |
|
|
|
wxEnergyHelper.testCalcute(record.getFormula(),shop.getPulicRate()); |
|
|
|
wxEnergyFeesShopMapper.updateById(record); |
|
|
|
} |
|
|
|
|
|
|
|
|