| @@ -11,6 +11,7 @@ import com.iformall.domain.po.WxFinanceAdvance; | |||||
| import com.iformall.domain.po.WxFinanceAdvanceType; | import com.iformall.domain.po.WxFinanceAdvanceType; | ||||
| import com.iformall.domain.po.WxFinanceReceive; | import com.iformall.domain.po.WxFinanceReceive; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.base.WxBillBaseEntity; | |||||
| import com.iformall.enums.EnumBillAllType; | import com.iformall.enums.EnumBillAllType; | ||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| import com.iformall.service.WxEnergyService; | import com.iformall.service.WxEnergyService; | ||||
| @@ -20,6 +21,7 @@ import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.util.ArrayList; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -219,8 +221,13 @@ public class WxFinanceController extends BaseController { | |||||
| @PostMapping("setoff") | @PostMapping("setoff") | ||||
| public ResultData setoff(@RequestBody FinanceSetOffDTO dto) { | public ResultData setoff(@RequestBody FinanceSetOffDTO dto) { | ||||
| dto.updateTenantInfo(getTenantInfo()); | dto.updateTenantInfo(getTenantInfo()); | ||||
| wxFinanceService.setOff(dto,this.getUser()); | |||||
| return new ResultData(); | |||||
| WxBillBaseEntity bill = wxFinanceService.setOff(dto,this.getUser()); | |||||
| if (null == bill) { | |||||
| return new ResultData(Result.ERROR,"未冲抵"); | |||||
| } | |||||
| List<WxBillBaseEntity> list = new ArrayList<WxBillBaseEntity>(); | |||||
| list.add(bill); | |||||
| return new ResultData(wxFinanceService.getBills(dto, list)); | |||||
| } | } | ||||
| @ApiOperation("新增收款单") | @ApiOperation("新增收款单") | ||||
| @@ -230,7 +237,8 @@ public class WxFinanceController extends BaseController { | |||||
| if (null == record.getBills() || null == record.getPayWays()) { | if (null == record.getBills() || null == record.getPayWays()) { | ||||
| return new ResultData(Result.ERROR,"请选择账单和支付方式"); | return new ResultData(Result.ERROR,"请选择账单和支付方式"); | ||||
| } | } | ||||
| return new ResultData(wxFinanceService.createReceive(record,this.getUser())); | |||||
| List<WxBillBaseEntity> list = wxFinanceService.createReceive(record,this.getUser()); | |||||
| return new ResultData(wxFinanceService.getBills(record, list)); | |||||
| } | } | ||||
| // @ApiOperation("收款记录列表") | // @ApiOperation("收款记录列表") | ||||
| @@ -38,7 +38,8 @@ public interface WxFinanceService { | |||||
| void updateAdvanceIsDel(WxFinanceAdvance record); | void updateAdvanceIsDel(WxFinanceAdvance record); | ||||
| List<WxFinanceAdvance> getMerchantAdvanceGroupSumList(WxFinanceAdvance record); | List<WxFinanceAdvance> getMerchantAdvanceGroupSumList(WxFinanceAdvance record); | ||||
| List<Map> getSetOffList(FinanceSetOffDTO dto); | List<Map> getSetOffList(FinanceSetOffDTO dto); | ||||
| void setOff(FinanceSetOffDTO dto,MallUserInfo user); | |||||
| WxBillBaseEntity setOff(FinanceSetOffDTO dto,MallUserInfo user); | |||||
| List<WxBillBaseEntity> getBills(TenantEntity tenantEntity,List<WxBillBaseEntity> bills); | |||||
| //收款 | //收款 | ||||
| PageInfo<WxFinanceReceive> receiveListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | PageInfo<WxFinanceReceive> receiveListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | ||||
| @@ -380,14 +380,13 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void setOff(FinanceSetOffDTO dto,MallUserInfo user) { | |||||
| //TODO | |||||
| public WxBillBaseEntity setOff(FinanceSetOffDTO dto,MallUserInfo user) { | |||||
| //根据预充规则计算冲抵费用 | //根据预充规则计算冲抵费用 | ||||
| WxMerchant merchant = new WxMerchant(); | WxMerchant merchant = new WxMerchant(); | ||||
| merchant.updateTenantInfo(dto); | merchant.updateTenantInfo(dto); | ||||
| WxBillBaseEntity bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(dto.getBillType()), merchant, dto.getBillId()); | WxBillBaseEntity bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(dto.getBillType()), merchant, dto.getBillId()); | ||||
| if (new BigDecimal(bill.getOwe()).compareTo(new BigDecimal(0)) <= 0) { | if (new BigDecimal(bill.getOwe()).compareTo(new BigDecimal(0)) <= 0) { | ||||
| return; | |||||
| return null; | |||||
| } | } | ||||
| WxFinanceAdvance advance = this.getAdvanceById(dto, dto.getFinanceAdvanceId()); | WxFinanceAdvance advance = this.getAdvanceById(dto, dto.getFinanceAdvanceId()); | ||||
| WxFinanceAdvanceType advanceType= getAdvanceTypeById(dto,advance.getAdvanceTypeId()); | WxFinanceAdvanceType advanceType= getAdvanceTypeById(dto,advance.getAdvanceTypeId()); | ||||
| @@ -420,6 +419,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| rb.setBillType(bill.getBillType()); | rb.setBillType(bill.getBillType()); | ||||
| rb.setFeesId(bill.getEnergyFeesId()); | rb.setFeesId(bill.getEnergyFeesId()); | ||||
| saveOrUpdateReceiveBill(rb); | saveOrUpdateReceiveBill(rb); | ||||
| return bill; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -572,13 +572,21 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| return updateList; | return updateList; | ||||
| } | } | ||||
| @Override | |||||
| public List<WxBillBaseEntity> getBills(TenantEntity tenantEntity,List<WxBillBaseEntity> bills) { | |||||
| if (null != bills && bills.size() > 0 ) { | |||||
| WxMerchant merchant = new WxMerchant(); | |||||
| merchant.updateTenantInfo(tenantEntity); | |||||
| List<WxBillBaseEntity> retList = new ArrayList<WxBillBaseEntity>(); | |||||
| for (int i = 0 ; i < bills.size() ; i++) { | |||||
| WxBillBaseEntity be = bills.get(i); | |||||
| WxBillBaseEntity bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(be.getBillType()), merchant, be.getId()); | |||||
| retList.add(bill); | |||||
| } | |||||
| return retList; | |||||
| } | |||||
| return null; | |||||
| } | |||||