|
|
|
@@ -7,8 +7,11 @@ import com.iformall.common.IdWorker; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxMerchant; |
|
|
|
import com.iformall.domain.po.WxMerchantPowerBillConfig; |
|
|
|
import com.iformall.domain.po.WxPowerBillAutoConfig; |
|
|
|
import com.iformall.enums.EnumPowerBillBuildWay; |
|
|
|
import com.iformall.mapper.WxMerchantMapper; |
|
|
|
import com.iformall.mapper.WxMerchantPowerBillConfigMapper; |
|
|
|
import com.iformall.mapper.WxPowerBillAutoConfigMapper; |
|
|
|
import com.iformall.service.WxMerchantPowerBillConfigService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.slf4j.Logger; |
|
|
|
@@ -34,6 +37,10 @@ public class WxMerchantPowerBillConfigServiceImpl implements WxMerchantPowerBill |
|
|
|
@Autowired |
|
|
|
WxMerchantMapper wxMerchantMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxPowerBillAutoConfigMapper wxPowerBillAutoConfigMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageInfo<WxMerchantPowerBillConfig> listAsPage(WxMerchantPowerBillConfig record, Integer pageIndex, Integer pageSize) { |
|
|
|
@@ -48,8 +55,19 @@ public class WxMerchantPowerBillConfigServiceImpl implements WxMerchantPowerBill |
|
|
|
@Override |
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) |
|
|
|
public ResultData saveOrUpdate(WxMerchantPowerBillConfig config) { |
|
|
|
|
|
|
|
Date date = new Date(); |
|
|
|
if (config.getId() == null) { |
|
|
|
//按电表计费 从配置中拉取单价 |
|
|
|
if (config.getBuildWay().equals(EnumPowerBillBuildWay.PRICE.getCode())) { |
|
|
|
WxPowerBillAutoConfig wxPowerBillAutoConfig = new WxPowerBillAutoConfig(); |
|
|
|
wxPowerBillAutoConfig.setTenantId(config.getTenantId()); |
|
|
|
WxPowerBillAutoConfig powerBillAutoConfig = wxPowerBillAutoConfigMapper.selectOne(wxPowerBillAutoConfig); |
|
|
|
if (powerBillAutoConfig == null) { |
|
|
|
return new ResultData(ErrorCode.POWER_BILL_CONFIGU_NOT_FOUND); |
|
|
|
} |
|
|
|
config.setPrice(powerBillAutoConfig.getUnitPrice()); |
|
|
|
} |
|
|
|
WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(config.getMerchantId()); |
|
|
|
if (wxMerchant == null) { |
|
|
|
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); |
|
|
|
|