| @@ -223,8 +223,8 @@ public class WxFinanceController extends BaseController { | |||
| if (null == record.getBills() || null == record.getPayWays()) { | |||
| return new ResultData(Result.ERROR,"请选择账单和支付方式"); | |||
| } | |||
| List<WxAllBill> list = wxFinanceService.createReceive(record,this.getUser()); | |||
| return new ResultData(list); | |||
| Map map = wxFinanceService.createReceive(record,this.getUser()); | |||
| return new ResultData(map); | |||
| } | |||
| @ApiOperation("新增付款单") | |||
| @@ -237,8 +237,8 @@ public class WxFinanceController extends BaseController { | |||
| if (null == record.getBills() || null == record.getPayWays()) { | |||
| return new ResultData(Result.ERROR,"请选择账单和支付方式"); | |||
| } | |||
| List<WxAllBill> list = wxFinanceService.createPay(record,this.getUser()); | |||
| return new ResultData(list); | |||
| Map map = wxFinanceService.createPay(record,this.getUser()); | |||
| return new ResultData(map); | |||
| } | |||
| @GetMapping("receiveStatus") | |||
| @@ -133,11 +133,11 @@ public class WxFinancePrintController extends BaseController { | |||
| @ApiOperation("预览") | |||
| @PostMapping("viewTemplate") | |||
| @TenantIgnore | |||
| public ResultData viewTemplate(@RequestBody String tenantId,Long templateId,List<Long> dataIds) { | |||
| if (StringUtils.isBlank(tenantId)||null == dataIds || dataIds.size() <= 0 || null == templateId) { | |||
| public ResultData viewTemplate(@RequestBody WxFinancePrintTemplate record) { | |||
| if (StringUtils.isBlank(record.getTenantId())||null == record.getDataIds() || record.getDataIds().size() <= 0 || null == record.getId()) { | |||
| return new ResultData(Result.ERROR,"参数不对"); | |||
| } | |||
| return new ResultData(wxFinancePrintService.parseTemplateData(tenantId,templateId,dataIds,null)); | |||
| return new ResultData(wxFinancePrintService.parseTemplateData(record.getTenantId(),record.getId(),record.getDataIds(),null)); | |||
| } | |||
| @ApiOperation("") | |||
| @@ -204,6 +204,15 @@ public class WxAllBillController extends BillBaseController { | |||
| if (null == wxMerchant.getId()) { | |||
| 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()); | |||
| Date starttime = wxMerchant.getStarttime(); | |||
| Date enttime = wxMerchant.getEndtime(); | |||
| @@ -211,7 +220,7 @@ public class WxAllBillController extends BillBaseController { | |||
| wxMerchant.setEndtime(null); | |||
| WxMerchant m = wxMerchantService.selectById(wxMerchant.getId()); | |||
| if (null == m) { | |||
| return new ResultData(Result.ERROR,"商户未查询到"); | |||
| return null; | |||
| } | |||
| WxMerchantBillVo vo = new WxMerchantBillVo(); | |||
| vo.setMerchantId(m.getId()); | |||
| @@ -224,7 +233,7 @@ public class WxAllBillController extends BillBaseController { | |||
| //根据科目来 | |||
| List<WxBillSum> sumList = billAllHelper.getFeesBillSum(wxMerchant,starttime, enttime); | |||
| if (null == sumList ) { | |||
| return new ResultData(); | |||
| return null; | |||
| } | |||
| WxEnergyFees fq = new WxEnergyFees(); | |||
| @@ -249,8 +258,18 @@ public class WxAllBillController extends BillBaseController { | |||
| vo.setPaid(paid.toPlainString()); | |||
| vo.setOwe(owe.toPlainString()); | |||
| 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()); | |||
| 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)); | |||
| } | |||
| } | |||
| @@ -142,8 +142,24 @@ public class WxAllBill extends TenantEntity { | |||
| if (StringUtils.isBlank(returnPay)) { | |||
| returnPay = "0"; | |||
| } | |||
| //如果是押金,则不计算已退金额 | |||
| boolean isDeposit = false; | |||
| if (null != billType) { | |||
| for (EnumBillAllType types : EnumBillAllType.getDepositTypes()) { | |||
| if (types.getCode().intValue() == billType.intValue()) { | |||
| isDeposit = true; | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| 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 = "0"; | |||
| if (isDeposit) { | |||
| o = new BigDecimal(receivePay).subtract(new BigDecimal(pay)).subtract(new BigDecimal(setOff)).toPlainString(); | |||
| }else { | |||
| o = new BigDecimal(receivePay).subtract(new BigDecimal(pay)).add(new BigDecimal(returnPay)).subtract(new BigDecimal(setOff)).toPlainString(); | |||
| } | |||
| return o; | |||
| } | |||
| return "0"; | |||
| @@ -38,6 +38,8 @@ public class WxFinancePrintData extends BaseEntity { | |||
| private String printDataJson; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否可编辑",name="isEdit") | |||
| private Integer isEdit; | |||
| @io.swagger.annotations.ApiModelProperty(value="默认值",name="defaultValue") | |||
| private String defaultValue; | |||
| @TableField(exist = false) | |||
| private Object printComponents; | |||
| @@ -57,5 +57,7 @@ public class WxFinancePrintTemplate extends TenantEntity { | |||
| private JSONObject contentJsonUpdate; | |||
| @TableField(exist = false) | |||
| private List tempItems; | |||
| @TableField(exist = false) | |||
| List<Long> dataIds; | |||
| } | |||
| @@ -484,5 +484,7 @@ public class WxMerchant extends TenantEntity { | |||
| public Integer toPayMerchant; | |||
| @TableField(exist = false) | |||
| 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; | |||
| } | |||
| @@ -8,6 +8,7 @@ import java.util.Date; | |||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.iformall.utils.DateUtils; | |||
| @Data | |||
| public class WxBillSum implements Serializable { | |||
| @@ -33,7 +34,23 @@ public class WxBillSum implements Serializable { | |||
| private BigDecimal oweNumber; | |||
| private Date minDate; | |||
| @TableField(exist = false) | |||
| private String minDateStr; | |||
| public String getMinDateStr() { | |||
| if (null != minDate) { | |||
| minDateStr = DateUtils.date2String(minDate,DateUtils.DATE_PATTERN); | |||
| } | |||
| return minDateStr; | |||
| } | |||
| private Date maxDate; | |||
| @TableField(exist = false) | |||
| private String maxDateStr; | |||
| public String getMaxDateStr() { | |||
| if (null != maxDate) { | |||
| maxDateStr = DateUtils.date2String(maxDate,DateUtils.DATE_PATTERN); | |||
| } | |||
| return maxDateStr; | |||
| } | |||
| //手续费 | |||
| private String servicePay = "0"; | |||
| @@ -146,5 +163,7 @@ public class WxBillSum implements Serializable { | |||
| private String billName; | |||
| @TableField(exist = false) | |||
| private Integer billType; | |||
| @TableField(exist = false) | |||
| private String taxRate; | |||
| } | |||
| @@ -54,6 +54,11 @@ public enum EnumBillAllType { | |||
| return isFixedPrice; | |||
| } | |||
| public static EnumBillAllType[] getDepositTypes() { | |||
| EnumBillAllType[] ret = new EnumBillAllType[] {RENT_DEPOSIT,PROPERTY_DEPOSIT,OTHER_DEPOSIT}; | |||
| return ret; | |||
| } | |||
| public static EnumBillAllType[] getSystemTypes() { | |||
| EnumBillAllType[] ret = new EnumBillAllType[] {RENT,RENT_BUSSINESS_MANAGE,RENT_OPERATION_MANAGE, | |||
| PROPERTY,PROPERTY_DEPOSIT}; | |||
| @@ -79,6 +79,7 @@ public class PrintComponentHandler implements Serializable { | |||
| html.setTitle(data.getName()); | |||
| html.setIsEdit(data.getIsEdit()); | |||
| html.setValue(dataJson.getString("html")); | |||
| html.setDefaultValue(data.getDefaultValue()); | |||
| return html; | |||
| }else if ("braid-html-table".equals(data.getPrintDataType())) { | |||
| PrintHtml html = new PrintHtml(); | |||
| @@ -86,6 +87,7 @@ public class PrintComponentHandler implements Serializable { | |||
| html.setIsEdit(data.getIsEdit()); | |||
| html.setValue(dataJson.getString("html")); | |||
| html.setIsFmCustomizedTable(EnumYesOrNo.YES.getCode()); | |||
| html.setDefaultValue(data.getDefaultValue()); | |||
| return html; | |||
| } | |||
| return null; | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.print.data; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| import org.jsoup.Jsoup; | |||
| @@ -14,8 +15,19 @@ import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||
| @Service | |||
| public class PrintCustomedTableDataHandler{ | |||
| public String getTableContent(String componentContent,JSONArray datas){ | |||
| public String getTableContent(String componentContent,JSONArray datas,JSONObject entity){ | |||
| if (null != entity) { | |||
| for (Iterator<String> it = entity.keySet().iterator(); it.hasNext();) { | |||
| String fieldName = it.next(); | |||
| Object o = entity.get(fieldName); | |||
| componentContent = componentContent.replaceAll("\\{"+fieldName+"\\}", String.valueOf(o)); | |||
| } | |||
| } | |||
| componentContent = getTableListContent(componentContent,datas); | |||
| return componentContent; | |||
| } | |||
| private String getTableListContent(String componentContent,JSONArray datas) { | |||
| if (null == datas || datas.size() <= 0) { | |||
| return componentContent; | |||
| } | |||
| @@ -36,7 +48,7 @@ public class PrintCustomedTableDataHandler{ | |||
| } | |||
| sb.append(">"); | |||
| for (int j = 0 ; j < titleTds.size() ; j ++) { | |||
| Node td = titleTds.get(i); | |||
| Node td = titleTds.get(j); | |||
| String tdclass = titleTr.attr("class"); | |||
| String tdstyle = titleTr.attr("style"); | |||
| String tdcolspan = titleTr.attr("colspan"); | |||
| @@ -53,12 +65,26 @@ public class PrintCustomedTableDataHandler{ | |||
| sb.append(">"); | |||
| //取什么属性 | |||
| String fieldName = td.attr("fieldName"); | |||
| sb.append(o.get(fieldName)); | |||
| if (StringUtils.isNotBlank(fieldName)) { | |||
| if (fieldName.contains(",")) { | |||
| String sep = td.attr("sep"); | |||
| String[] fs = fieldName.split(","); | |||
| if (null != fs) { | |||
| for (int k = 0 ; k<fs.length; k++) { | |||
| sb.append(o.get(fs[k])).append(sep); | |||
| } | |||
| } | |||
| }else { | |||
| sb.append(o.get(fieldName)); | |||
| } | |||
| } | |||
| sb.append("</td>"); | |||
| } | |||
| sb.append("</tr>"); | |||
| } | |||
| return null; | |||
| titleTr.parent().appendText(sb.toString()); | |||
| return doc.html(); | |||
| } | |||
| } | |||
| @@ -8,7 +8,6 @@ import com.iformall.domain.po.WxAllBill; | |||
| import com.iformall.domain.po.WxEnergyFees; | |||
| import com.iformall.domain.po.WxFinanceReceive; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.vo.PrintMerchantSettleVo; | |||
| import com.iformall.utils.DateUtils; | |||
| @Service | |||
| @@ -16,7 +15,6 @@ public class PrintMerchantSettleDataHandler{ | |||
| public Object getObjectValue(String name, Object o,Map<Long,WxMerchant> merchantMap,Map<Long,WxEnergyFees> feesMap) { | |||
| PrintMerchantSettleVo receive = (PrintMerchantSettleVo) o; | |||
| //根据科目来查询对应的信息 | |||
| // if (name.equals("id")) { | |||
| // return receive.getId(); | |||
| @@ -16,5 +16,5 @@ public interface WxFinancePrintService { | |||
| void update(WxFinancePrintTemplate record); | |||
| void copy(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); | |||
| } | |||
| @@ -30,8 +30,8 @@ public interface WxFinanceService { | |||
| //收付款 | |||
| PageInfo<WxFinanceReceiveVo> receiveVoListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | |||
| List<WxFinanceReceive> findReceiveList(WxFinanceReceive record); | |||
| List<WxAllBill> createReceive(WxFinanceReceive record,MallUserInfo user); | |||
| List<WxAllBill> createPay(WxFinanceReceive record,MallUserInfo user); | |||
| Map createReceive(WxFinanceReceive record,MallUserInfo user); | |||
| Map createPay(WxFinanceReceive record,MallUserInfo user); | |||
| WxFinanceReceive getReceiveById(TenantEntity tenantEntity,Long id); | |||
| void invalidReceive(WxFinanceReceive record,MallUserInfo user,String remark); | |||
| void redSetoffReceive(WxFinanceReceive record,MallUserInfo user); | |||
| @@ -24,6 +24,7 @@ import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.domain.vo.WxBillNotify; | |||
| import com.iformall.domain.vo.WxBillSum; | |||
| import com.iformall.enums.EnumBillAction; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumBillStatus; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| @@ -386,6 +387,29 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill | |||
| wxBillRent.updateTenantInfo(dto); | |||
| wxBillRent.setUpdatetime(new Date()); | |||
| 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; | |||
| } | |||
| } | |||
| if (isDeposit) { | |||
| String setoff = dbBill.getSetOff(); | |||
| if (StringUtils.isBlank(setoff)) { | |||
| setoff = "0"; | |||
| } | |||
| String pay = dbBill.getPay(); | |||
| if (StringUtils.isBlank(pay)) { | |||
| pay = "0"; | |||
| } | |||
| BigDecimal needReturn = new BigDecimal(pay).add(new BigDecimal(setoff)).subtract(new BigDecimal(wxBillRent.getReturnPay())); | |||
| if (needReturn.compareTo(new BigDecimal(0)) == 0) { | |||
| wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); | |||
| } | |||
| } | |||
| wxAllBillMapper.updateById(wxBillRent); | |||
| this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(), | |||
| 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.WxMerchant; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.vo.PrintMerchantSettleVo; | |||
| 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.EnumYesOrNo; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -39,6 +40,7 @@ import com.iformall.service.WxFinanceService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxShopService; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| @@ -180,9 +182,17 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| wxFinancePrintTemplateMapper.updateById(record); | |||
| } | |||
| private boolean isSetDefaultValue(JSONObject component) { | |||
| boolean isSetDefaultValue = false; | |||
| String componentType = component.getString("type"); | |||
| if ("braid-html".equals(componentType)) { | |||
| isSetDefaultValue = true; | |||
| } | |||
| return isSetDefaultValue; | |||
| } | |||
| @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); | |||
| if (null == template) { | |||
| return null; | |||
| @@ -234,14 +244,20 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| JSONObject ov = items.getJSONObject(j); | |||
| //是否是定制化的表格 | |||
| Integer isCustomedTable = ov.getInteger("isFmCustomizedTable"); | |||
| boolean isSetDefaultValue = isSetDefaultValue(ov); | |||
| if (null != isCustomedTable && EnumYesOrNo.YES.getCode().intValue() == isCustomedTable.intValue()) { | |||
| //表格解析 | |||
| String componentContent = ov.getString("value"); | |||
| if (null != billList) { | |||
| printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(billList))); | |||
| ov.put("defaultValue",printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(billList)),JSON.parseObject(JSON.toJSONString(re)))); | |||
| } | |||
| }else { | |||
| ov.put("value", printFinanceReceiveDataHandler.getObjectValue(ov.getString("name"),re,merchantMap,feesMap,shopNumber)); | |||
| if (isSetDefaultValue) { | |||
| ov.put("defaultValue", printFinanceReceiveDataHandler.getObjectValue(ov.getString("name"),re,merchantMap,feesMap,shopNumber)); | |||
| }else { | |||
| ov.put("defaultValue", printFinanceReceiveDataHandler.getObjectValue(ov.getString("name"),re,merchantMap,feesMap,shopNumber)); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -267,6 +283,8 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| JSONObject ov = items.getJSONObject(j); | |||
| //是否是定制化的表格 | |||
| Integer isCustomedTable = ov.getInteger("isFmCustomizedTable"); | |||
| boolean isSetDefaultValue = isSetDefaultValue(ov); | |||
| if (null != isCustomedTable && EnumYesOrNo.YES.getCode().intValue() == isCustomedTable.intValue()) { | |||
| //表格解析 | |||
| String componentContent = ov.getString("value"); | |||
| @@ -274,7 +292,11 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| // printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(billList))); | |||
| //} | |||
| }else { | |||
| ov.put("value", printBillDataHandler.getObjectValue(ov.getString("name"),re,merchantMap,feesMap)); | |||
| if (isSetDefaultValue) { | |||
| ov.put("defaultValue", printBillDataHandler.getObjectValue(ov.getString("name"),re,merchantMap,feesMap)); | |||
| }else { | |||
| ov.put("defaultValue", printBillDataHandler.getObjectValue(ov.getString("name"),re,merchantMap,feesMap)); | |||
| } | |||
| } | |||
| } | |||
| @@ -284,15 +306,10 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| } | |||
| return voList; | |||
| }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>(); | |||
| //TODO 获取结算单信息 | |||
| PrintMerchantSettleVo sv = null; | |||
| PrintVo vo = new PrintVo(); | |||
| vo.setDataId(templateId); | |||
| @@ -301,14 +318,50 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| JSONObject ov = items.getJSONObject(j); | |||
| //是否是定制化的表格 | |||
| Integer isCustomedTable = ov.getInteger("isFmCustomizedTable"); | |||
| boolean isSetDefaultValue = isSetDefaultValue(ov); | |||
| 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 oweTotal = new BigDecimal(0); | |||
| for (int k = 0 ; k< bq.getBillSumList().size() ; k++) { | |||
| WxBillSum billSum = bq.getBillSumList().get(k); | |||
| if (feesId.contains(billSum.getEnergyFeesId())) { | |||
| WxEnergyFees fee = feesMap.get(billSum.getEnergyFeesId()); | |||
| billSum.setTaxRate(fee.getTaxRate()); | |||
| sumlist.add(billSum); | |||
| receiveTotal = receiveTotal.add(billSum.getNeedPayNumber()); | |||
| payTotal = payTotal.add(billSum.getPaidNumber()); | |||
| oweTotal = oweTotal.add(billSum.getOweNumber()); | |||
| } | |||
| } | |||
| WxBillSum heji = new WxBillSum(); | |||
| heji.setBillName("合计"); | |||
| heji.setNeedPay(receiveTotal.toPlainString()); | |||
| sumlist.add(heji); | |||
| WxBillSum yishou = new WxBillSum(); | |||
| yishou.setBillName("已收"); | |||
| yishou.setNeedPay(payTotal.toPlainString()); | |||
| sumlist.add(yishou); | |||
| WxBillSum owe = new WxBillSum(); | |||
| owe.setBillName("本期应收"); | |||
| owe.setNeedPay(payTotal.toPlainString()); | |||
| sumlist.add(owe); | |||
| String componentContent = ov.getString("value"); | |||
| //if (null != billList) { | |||
| // printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(billList))); | |||
| //} | |||
| if (null != sumlist && sumlist.size() > 0 ) { | |||
| ov.put("defaultValue",printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(sumlist)),JSON.parseObject(JSON.toJSONString(bq)))); | |||
| } | |||
| }else { | |||
| ov.put("value", printMerchantSettleDataHandler.getObjectValue(ov.getString("name"),sv,merchantMap,feesMap)); | |||
| if (isSetDefaultValue) { | |||
| ov.put("defaultValue", printMerchantSettleDataHandler.getObjectValue(ov.getString("name"),bq,merchantMap,feesMap)); | |||
| }else { | |||
| ov.put("defaultValue", printMerchantSettleDataHandler.getObjectValue(ov.getString("name"),bq,merchantMap,feesMap)); | |||
| } | |||
| } | |||
| } | |||
| @@ -519,7 +519,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public List<WxAllBill> createReceive(WxFinanceReceive record,MallUserInfo user) { | |||
| public Map createReceive(WxFinanceReceive record,MallUserInfo user) { | |||
| //冲抵信息根据页面返回的账单抵扣信息直接保存入库 | |||
| //费用计算自动优先匹配时间最早的那个 | |||
| @@ -591,7 +591,11 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| addreceive.setMerchantId(record.getMerchantId()); | |||
| addreceive.setRemark(record.getRemark()); | |||
| wxFinanceReceiveMapper.insert(addreceive); | |||
| return bills; | |||
| Map retMap = new HashMap(); | |||
| retMap.put("addreceive", addreceive); | |||
| retMap.put("billlist", bills); | |||
| return retMap; | |||
| } | |||
| public boolean createBillReceive(FinanceReceiveCalcuteDTO calcuteDto,MallUserInfo user,WxFinanceReceive addreceive,WxAllBill be,WxMerchant merchant,WxBillPayWay payWay0) { | |||
| @@ -727,7 +731,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public List<WxAllBill> createPay(WxFinanceReceive record,MallUserInfo user) { | |||
| public Map createPay(WxFinanceReceive record,MallUserInfo user) { | |||
| //费用计算自动优先匹配时间最早的那个 | |||
| //单保存冲抵的时候,实收金额为0 | |||
| BigDecimal payTotal = new BigDecimal(0); | |||
| @@ -788,7 +792,11 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| addreceive.setMerchantId(record.getMerchantId()); | |||
| addreceive.setRemark(record.getRemark()); | |||
| wxFinanceReceiveMapper.insert(addreceive); | |||
| return bills; | |||
| Map retMap = new HashMap(); | |||
| retMap.put("addreceive", addreceive); | |||
| retMap.put("billlist", bills); | |||
| return retMap; | |||
| } | |||
| public boolean createBillPay(FinanceReceiveCalcuteDTO calcuteDto,MallUserInfo user,WxFinanceReceive addreceive,WxAllBill be,WxMerchant merchant,WxBillPayWay payWay0) { | |||
| @@ -73,18 +73,41 @@ | |||
| and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (`starttime` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and status not in (3,6,7)) | |||
| and ( | |||
| (`starttime` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and status not in (3,6,7) and bill_type not in (13,21,5)) | |||
| or | |||
| (`starttime` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) and bill_type in (13,21,5)) | |||
| ) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and (`starttime` > #{oweBillLastTime} and `starttime` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and status not in (3,6,7)) | |||
| and ( | |||
| (`starttime` > #{oweBillLastTime} and `starttime` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and status not in (3,6,7) and bill_type not in (13,21,5)) | |||
| or | |||
| (`starttime` > #{oweBillLastTime} and `starttime` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) and bill_type in (13,21,5)) | |||
| ) | |||
| </if> | |||
| <if test=" null != needPayStartDay"> | |||
| and (`starttime` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and status not in (3,6,7)) | |||
| and ( | |||
| (`starttime` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and status not in (3,6,7) and bill_type not in (13,21,5)) | |||
| or | |||
| (`starttime` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) and bill_type in (13,21,5)) | |||
| ) | |||
| </if> | |||
| <if test=" null != toPayMerchant"> | |||
| and ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') < 0 or status in (8,9)) | |||
| and ( | |||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') < 0 and bill_type not in (13,21,5)) | |||
| or | |||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') < 0 and bill_type in (13,21,5)) | |||
| or status in (8,9) | |||
| ) | |||
| </if> | |||
| <if test=" 1 == notifyed "> | |||
| and ( | |||
| (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and status not in (3,6,7) and bill_type not in (13,21,5)) | |||
| or | |||
| (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) and bill_type in (13,21,5)) | |||
| ) | |||
| </if> | |||
| <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and status not in (3,6,7) )</if> | |||
| <if test=" null != hasMerchant ">and `merchant_id` is not null</if> | |||
| <if test=" 1 == hasParentBillId ">and `parent_bill_id` is not null</if> | |||
| <if test=" 0 == hasParentBillId ">and `parent_bill_id` is null</if> | |||
| @@ -193,7 +216,9 @@ | |||
| select | |||
| bill_type, | |||
| count(1) total_count , | |||
| sum(CAST(`receive_pay` AS DECIMAL(20,2)) - CAST(`pay` AS DECIMAL(20,2)) - CAST(IFNULL(`set_off`,'0') AS DECIMAL(20,2)) + CAST(IFNULL(`return_pay`,'0') AS DECIMAL(20,2))) total_money, | |||
| case when bill_type in (13,21,5) then sum(CAST(`receive_pay` AS DECIMAL(20,2)) - CAST(`pay` AS DECIMAL(20,2)) - CAST(IFNULL(`set_off`,'0') AS DECIMAL(20,2)) ) | |||
| else sum(CAST(`receive_pay` AS DECIMAL(20,2)) - CAST(`pay` AS DECIMAL(20,2)) - CAST(IFNULL(`set_off`,'0') AS DECIMAL(20,2)) + CAST(IFNULL(`return_pay`,'0') AS DECIMAL(20,2))) | |||
| end as total_money, | |||
| MIN(starttime) min_begin_time from wx_all_bill | |||
| <include refid="dynamicWhereConditions"/> | |||
| group by bill_type | |||
| @@ -11,10 +11,11 @@ | |||
| <result column="print_data_type" jdbcType="VARCHAR" property="printDataType"/> | |||
| <result column="print_data_json" jdbcType="VARCHAR" property="printDataJson"/> | |||
| <result column="is_edit" jdbcType="INTEGER" property="isEdit"/> | |||
| <result column="default_value" jdbcType="VARCHAR" property="defaultValue"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`name`,`is_del`,`remark`,`type`,`sort`,`print_data_type`,`print_data_json`,`is_edit` | |||
| `id`,`name`,`is_del`,`remark`,`type`,`sort`,`print_data_type`,`print_data_json`,`is_edit`,`default_value` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||