| @@ -204,6 +204,15 @@ public class WxAllBillController extends BillBaseController { | |||||
| if (null == wxMerchant.getId()) { | if (null == wxMerchant.getId()) { | ||||
| return new ResultData(Result.ERROR,"请选择商户"); | return new ResultData(Result.ERROR,"请选择商户"); | ||||
| } | } | ||||
| WxMerchantBillVo vo = getMerchantBillVo(wxMerchant); | |||||
| if (null == vo) { | |||||
| return new ResultData(); | |||||
| } | |||||
| return new ResultData(vo); | |||||
| } | |||||
| private WxMerchantBillVo getMerchantBillVo( WxMerchant wxMerchant) { | |||||
| wxMerchant.updateTenantInfo(getTenantInfo()); | wxMerchant.updateTenantInfo(getTenantInfo()); | ||||
| Date starttime = wxMerchant.getStarttime(); | Date starttime = wxMerchant.getStarttime(); | ||||
| Date enttime = wxMerchant.getEndtime(); | Date enttime = wxMerchant.getEndtime(); | ||||
| @@ -211,7 +220,7 @@ public class WxAllBillController extends BillBaseController { | |||||
| wxMerchant.setEndtime(null); | wxMerchant.setEndtime(null); | ||||
| WxMerchant m = wxMerchantService.selectById(wxMerchant.getId()); | WxMerchant m = wxMerchantService.selectById(wxMerchant.getId()); | ||||
| if (null == m) { | if (null == m) { | ||||
| return new ResultData(Result.ERROR,"商户未查询到"); | |||||
| return null; | |||||
| } | } | ||||
| WxMerchantBillVo vo = new WxMerchantBillVo(); | WxMerchantBillVo vo = new WxMerchantBillVo(); | ||||
| vo.setMerchantId(m.getId()); | vo.setMerchantId(m.getId()); | ||||
| @@ -224,7 +233,7 @@ public class WxAllBillController extends BillBaseController { | |||||
| //根据科目来 | //根据科目来 | ||||
| List<WxBillSum> sumList = billAllHelper.getFeesBillSum(wxMerchant,starttime, enttime); | List<WxBillSum> sumList = billAllHelper.getFeesBillSum(wxMerchant,starttime, enttime); | ||||
| if (null == sumList ) { | if (null == sumList ) { | ||||
| return new ResultData(); | |||||
| return null; | |||||
| } | } | ||||
| WxEnergyFees fq = new WxEnergyFees(); | WxEnergyFees fq = new WxEnergyFees(); | ||||
| @@ -249,8 +258,18 @@ public class WxAllBillController extends BillBaseController { | |||||
| vo.setPaid(paid.toPlainString()); | vo.setPaid(paid.toPlainString()); | ||||
| vo.setOwe(owe.toPlainString()); | vo.setOwe(owe.toPlainString()); | ||||
| vo.setBillSumList(sumList); | vo.setBillSumList(sumList); | ||||
| return new ResultData(vo); | |||||
| return vo; | |||||
| } | |||||
| @ApiOperation("预览结算单") | |||||
| @PostMapping("viewSettleTemplate") | |||||
| @TenantIgnore | |||||
| public ResultData viewSettleTemplate(@RequestBody WxMerchant merchant,Long templateId) { | |||||
| if (null == merchant.getId() || null == merchant.getFeesIdList() || merchant.getFeesIdList().size() <= 0 ) { | |||||
| return new ResultData(Result.ERROR,"清选择商户和科目"); | |||||
| } | |||||
| WxMerchantBillVo vo = getMerchantBillVo(merchant); | |||||
| return new ResultData(wxFinancePrintService.parseTemplateData(merchant.getTenantId(),templateId,merchant.getFeesIdList(),vo)); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -752,16 +771,5 @@ public class WxAllBillController extends BillBaseController { | |||||
| record.setIsPreview(EnumYesOrNo.NO.getCode()); | record.setIsPreview(EnumYesOrNo.NO.getCode()); | ||||
| return new ResultData(wxAllBillService.getBillMonthSum(record)); | return new ResultData(wxAllBillService.getBillMonthSum(record)); | ||||
| } | } | ||||
| @ApiOperation("预览结算单") | |||||
| @PostMapping("viewSettleTemplate") | |||||
| @TenantIgnore | |||||
| public ResultData viewSettleTemplate(@RequestBody WxMerchant merchant,Long templateId) { | |||||
| if (null == merchant.getId()) { | |||||
| return new ResultData(Result.ERROR,"清选择商户"); | |||||
| } | |||||
| merchant.updateTenantInfo(getTenantInfo()); | |||||
| return new ResultData(wxFinancePrintService.parseTemplateData(merchant.getTenantId(),templateId,null,merchant)); | |||||
| } | |||||
| } | } | ||||
| @@ -143,7 +143,7 @@ public class WxAllBill extends TenantEntity { | |||||
| returnPay = "0"; | returnPay = "0"; | ||||
| } | } | ||||
| if (StringUtils.isNotBlank(receivePay) && StringUtils.isNotBlank(pay)) { | if (StringUtils.isNotBlank(receivePay) && StringUtils.isNotBlank(pay)) { | ||||
| String o = new BigDecimal(receivePay).subtract(new BigDecimal(pay)).subtract(new BigDecimal(returnPay)).subtract(new BigDecimal(setOff)).toPlainString(); | |||||
| String o = new BigDecimal(receivePay).subtract(new BigDecimal(pay)).add(new BigDecimal(returnPay)).subtract(new BigDecimal(setOff)).toPlainString(); | |||||
| return o; | return o; | ||||
| } | } | ||||
| return "0"; | return "0"; | ||||
| @@ -484,5 +484,7 @@ public class WxMerchant extends TenantEntity { | |||||
| public Integer toPayMerchant; | public Integer toPayMerchant; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| public Integer isPreview; | public Integer isPreview; | ||||
| @TableField(exist = false) | |||||
| public List<Long> feesIdList; | |||||
| } | } | ||||
| @@ -1,18 +0,0 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| @Data | |||||
| public class PrintMerchantSettleVo implements Serializable{ | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Date startDate; | |||||
| private Date endDate; | |||||
| private Date ReceiveDate; | |||||
| } | |||||
| @@ -54,6 +54,11 @@ public enum EnumBillAllType { | |||||
| return isFixedPrice; | return isFixedPrice; | ||||
| } | } | ||||
| public static EnumBillAllType[] getDepositTypes() { | |||||
| EnumBillAllType[] ret = new EnumBillAllType[] {RENT_DEPOSIT,PROPERTY_DEPOSIT,OTHER_DEPOSIT}; | |||||
| return ret; | |||||
| } | |||||
| public static EnumBillAllType[] getSystemTypes() { | public static EnumBillAllType[] getSystemTypes() { | ||||
| EnumBillAllType[] ret = new EnumBillAllType[] {RENT,RENT_BUSSINESS_MANAGE,RENT_OPERATION_MANAGE, | EnumBillAllType[] ret = new EnumBillAllType[] {RENT,RENT_BUSSINESS_MANAGE,RENT_OPERATION_MANAGE, | ||||
| PROPERTY,PROPERTY_DEPOSIT}; | PROPERTY,PROPERTY_DEPOSIT}; | ||||
| @@ -36,7 +36,7 @@ public class PrintCustomedTableDataHandler{ | |||||
| } | } | ||||
| sb.append(">"); | sb.append(">"); | ||||
| for (int j = 0 ; j < titleTds.size() ; j ++) { | for (int j = 0 ; j < titleTds.size() ; j ++) { | ||||
| Node td = titleTds.get(i); | |||||
| Node td = titleTds.get(j); | |||||
| String tdclass = titleTr.attr("class"); | String tdclass = titleTr.attr("class"); | ||||
| String tdstyle = titleTr.attr("style"); | String tdstyle = titleTr.attr("style"); | ||||
| String tdcolspan = titleTr.attr("colspan"); | String tdcolspan = titleTr.attr("colspan"); | ||||
| @@ -59,7 +59,7 @@ public class PrintCustomedTableDataHandler{ | |||||
| String[] fs = fieldName.split(","); | String[] fs = fieldName.split(","); | ||||
| if (null != fs) { | if (null != fs) { | ||||
| for (int k = 0 ; k<fs.length; k++) { | for (int k = 0 ; k<fs.length; k++) { | ||||
| sb.append(o.get(fieldName)).append(sep); | |||||
| sb.append(o.get(fs[k])).append(sep); | |||||
| } | } | ||||
| } | } | ||||
| @@ -8,7 +8,6 @@ import com.iformall.domain.po.WxAllBill; | |||||
| import com.iformall.domain.po.WxEnergyFees; | import com.iformall.domain.po.WxEnergyFees; | ||||
| import com.iformall.domain.po.WxFinanceReceive; | import com.iformall.domain.po.WxFinanceReceive; | ||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.vo.PrintMerchantSettleVo; | |||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| @Service | @Service | ||||
| @@ -16,7 +15,6 @@ public class PrintMerchantSettleDataHandler{ | |||||
| public Object getObjectValue(String name, Object o,Map<Long,WxMerchant> merchantMap,Map<Long,WxEnergyFees> feesMap) { | public Object getObjectValue(String name, Object o,Map<Long,WxMerchant> merchantMap,Map<Long,WxEnergyFees> feesMap) { | ||||
| PrintMerchantSettleVo receive = (PrintMerchantSettleVo) o; | |||||
| //根据科目来查询对应的信息 | //根据科目来查询对应的信息 | ||||
| // if (name.equals("id")) { | // if (name.equals("id")) { | ||||
| // return receive.getId(); | // return receive.getId(); | ||||
| @@ -16,5 +16,5 @@ public interface WxFinancePrintService { | |||||
| void update(WxFinancePrintTemplate record); | void update(WxFinancePrintTemplate record); | ||||
| void copy(WxFinancePrintTemplate record); | void copy(WxFinancePrintTemplate record); | ||||
| void setTemplatesDel(WxFinancePrintTemplate record); | void setTemplatesDel(WxFinancePrintTemplate record); | ||||
| List<PrintVo> parseTemplateData(String tenantId,Long templateId,List<Long> dataIds,BaseEntity entity); | |||||
| List<PrintVo> parseTemplateData(String tenantId,Long templateId,List<Long> dataIds,Object entity); | |||||
| } | } | ||||
| @@ -24,6 +24,7 @@ import com.iformall.domain.vo.WxBillHotNotify; | |||||
| import com.iformall.domain.vo.WxBillNotify; | import com.iformall.domain.vo.WxBillNotify; | ||||
| import com.iformall.domain.vo.WxBillSum; | import com.iformall.domain.vo.WxBillSum; | ||||
| import com.iformall.enums.EnumBillAction; | import com.iformall.enums.EnumBillAction; | ||||
| import com.iformall.enums.EnumBillAllType; | |||||
| import com.iformall.enums.EnumBillStatus; | import com.iformall.enums.EnumBillStatus; | ||||
| import com.iformall.enums.EnumRentShopType; | import com.iformall.enums.EnumRentShopType; | ||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| @@ -386,6 +387,19 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill | |||||
| wxBillRent.updateTenantInfo(dto); | wxBillRent.updateTenantInfo(dto); | ||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setReturnPay(oldpay.add(new BigDecimal(dto.getPayToMerchant())).toPlainString()); | wxBillRent.setReturnPay(oldpay.add(new BigDecimal(dto.getPayToMerchant())).toPlainString()); | ||||
| //如果屎押金 | |||||
| boolean isDeposit = false; | |||||
| for (EnumBillAllType dep : EnumBillAllType.getDepositTypes()) { | |||||
| if (dbBill.getBillType().intValue() == dep.getCode().intValue()) { | |||||
| isDeposit = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| String owe = wxBillRent.getOwe(); | |||||
| // if (isDeposit && ) { | |||||
| // | |||||
| // } | |||||
| wxAllBillMapper.updateById(wxBillRent); | wxAllBillMapper.updateById(wxBillRent); | ||||
| this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(), | ||||
| dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); | dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); | ||||
| @@ -20,8 +20,9 @@ import com.iformall.domain.po.WxFinanceReceive; | |||||
| import com.iformall.domain.po.WxFinanceReceiveBill; | import com.iformall.domain.po.WxFinanceReceiveBill; | ||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.vo.PrintMerchantSettleVo; | |||||
| import com.iformall.domain.vo.PrintVo; | import com.iformall.domain.vo.PrintVo; | ||||
| import com.iformall.domain.vo.WxBillSum; | |||||
| import com.iformall.domain.vo.WxMerchantBillVo; | |||||
| import com.iformall.enums.EnumFinancePrintDataType; | import com.iformall.enums.EnumFinancePrintDataType; | ||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| @@ -39,6 +40,7 @@ import com.iformall.service.WxFinanceService; | |||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.service.WxShopService; | import com.iformall.service.WxShopService; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| @@ -182,7 +184,7 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||||
| @Override | @Override | ||||
| public List<PrintVo> parseTemplateData(String tenantId, Long templateId, List<Long> dataIds,BaseEntity entity) { | |||||
| public List<PrintVo> parseTemplateData(String tenantId, Long templateId, List<Long> dataIds,Object entity) { | |||||
| WxFinancePrintTemplate template = this.getTemplateById(templateId); | WxFinancePrintTemplate template = this.getTemplateById(templateId); | ||||
| if (null == template) { | if (null == template) { | ||||
| return null; | return null; | ||||
| @@ -284,15 +286,10 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||||
| } | } | ||||
| return voList; | return voList; | ||||
| }else if (printDatatype.getCode().intValue() == EnumFinancePrintDataType.RENT_OWE.getCode()) { | }else if (printDatatype.getCode().intValue() == EnumFinancePrintDataType.RENT_OWE.getCode()) { | ||||
| WxMerchant bq = (WxMerchant) entity; | |||||
| List<WxMerchant> merchantList = wxMerchantService.findList(bq); | |||||
| if (null == merchantList || merchantList.size() <= 0 ) { | |||||
| return null; | |||||
| } | |||||
| WxMerchant m = merchantList.get(0); | |||||
| WxMerchantBillVo bq = (WxMerchantBillVo) entity; | |||||
| //打哪些科目 | |||||
| List<Long> feesId = dataIds; | |||||
| List<PrintVo> voList = new ArrayList<PrintVo>(); | List<PrintVo> voList = new ArrayList<PrintVo>(); | ||||
| //TODO 获取结算单信息 | |||||
| PrintMerchantSettleVo sv = null; | |||||
| PrintVo vo = new PrintVo(); | PrintVo vo = new PrintVo(); | ||||
| vo.setDataId(templateId); | vo.setDataId(templateId); | ||||
| @@ -303,12 +300,26 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||||
| Integer isCustomedTable = ov.getInteger("isFmCustomizedTable"); | Integer isCustomedTable = ov.getInteger("isFmCustomizedTable"); | ||||
| if (null != isCustomedTable && EnumYesOrNo.YES.getCode().intValue() == isCustomedTable.intValue()) { | if (null != isCustomedTable && EnumYesOrNo.YES.getCode().intValue() == isCustomedTable.intValue()) { | ||||
| //表格解析 | //表格解析 | ||||
| List<WxBillSum> sumlist = new ArrayList<WxBillSum>(); | |||||
| BigDecimal receiveTotal = new BigDecimal(0); | |||||
| BigDecimal payTotal = new BigDecimal(0); | |||||
| BigDecimal setoffTotal = new BigDecimal(0); | |||||
| BigDecimal returnTotal = new BigDecimal(0); | |||||
| for (int k = 0 ; k< bq.getBillSumList().size() ; k++) { | |||||
| WxBillSum billSum = bq.getBillSumList().get(k); | |||||
| if (feesId.contains(billSum.getEnergyFeesId())) { | |||||
| sumlist.add(billSum); | |||||
| } | |||||
| } | |||||
| String componentContent = ov.getString("value"); | String componentContent = ov.getString("value"); | ||||
| //if (null != billList) { | |||||
| // printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(billList))); | |||||
| //} | |||||
| // if (null != billList) { | |||||
| // printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(billList))); | |||||
| // } | |||||
| }else { | }else { | ||||
| ov.put("value", printMerchantSettleDataHandler.getObjectValue(ov.getString("name"),sv,merchantMap,feesMap)); | |||||
| //ov.put("value", printMerchantSettleDataHandler.getObjectValue(ov.getString("name"),sv,merchantMap,feesMap)); | |||||
| } | } | ||||
| } | } | ||||