| @@ -142,8 +142,24 @@ public class WxAllBill extends TenantEntity { | |||||
| if (StringUtils.isBlank(returnPay)) { | if (StringUtils.isBlank(returnPay)) { | ||||
| returnPay = "0"; | 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)) { | if (StringUtils.isNotBlank(receivePay) && StringUtils.isNotBlank(pay)) { | ||||
| String o = new BigDecimal(receivePay).subtract(new BigDecimal(pay)).add(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 o; | ||||
| } | } | ||||
| return "0"; | return "0"; | ||||
| @@ -38,6 +38,8 @@ public class WxFinancePrintData extends BaseEntity { | |||||
| private String printDataJson; | private String printDataJson; | ||||
| @io.swagger.annotations.ApiModelProperty(value="是否可编辑",name="isEdit") | @io.swagger.annotations.ApiModelProperty(value="是否可编辑",name="isEdit") | ||||
| private Integer isEdit; | private Integer isEdit; | ||||
| @io.swagger.annotations.ApiModelProperty(value="默认值",name="defaultValue") | |||||
| private String defaultValue; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Object printComponents; | private Object printComponents; | ||||
| @@ -8,6 +8,7 @@ import java.util.Date; | |||||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | ||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import com.iformall.utils.DateUtils; | |||||
| @Data | @Data | ||||
| public class WxBillSum implements Serializable { | public class WxBillSum implements Serializable { | ||||
| @@ -33,7 +34,23 @@ public class WxBillSum implements Serializable { | |||||
| private BigDecimal oweNumber; | private BigDecimal oweNumber; | ||||
| private Date minDate; | 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; | 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"; | private String servicePay = "0"; | ||||
| @@ -146,5 +163,7 @@ public class WxBillSum implements Serializable { | |||||
| private String billName; | private String billName; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Integer billType; | private Integer billType; | ||||
| @TableField(exist = false) | |||||
| private String taxRate; | |||||
| } | } | ||||
| @@ -79,6 +79,7 @@ public class PrintComponentHandler implements Serializable { | |||||
| html.setTitle(data.getName()); | html.setTitle(data.getName()); | ||||
| html.setIsEdit(data.getIsEdit()); | html.setIsEdit(data.getIsEdit()); | ||||
| html.setValue(dataJson.getString("html")); | html.setValue(dataJson.getString("html")); | ||||
| html.setDefaultValue(data.getDefaultValue()); | |||||
| return html; | return html; | ||||
| }else if ("braid-html-table".equals(data.getPrintDataType())) { | }else if ("braid-html-table".equals(data.getPrintDataType())) { | ||||
| PrintHtml html = new PrintHtml(); | PrintHtml html = new PrintHtml(); | ||||
| @@ -86,6 +87,7 @@ public class PrintComponentHandler implements Serializable { | |||||
| html.setIsEdit(data.getIsEdit()); | html.setIsEdit(data.getIsEdit()); | ||||
| html.setValue(dataJson.getString("html")); | html.setValue(dataJson.getString("html")); | ||||
| html.setIsFmCustomizedTable(EnumYesOrNo.YES.getCode()); | html.setIsFmCustomizedTable(EnumYesOrNo.YES.getCode()); | ||||
| html.setDefaultValue(data.getDefaultValue()); | |||||
| return html; | return html; | ||||
| } | } | ||||
| return null; | return null; | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.print.data; | package com.iformall.print.data; | ||||
| import java.util.Iterator; | |||||
| import java.util.List; | import java.util.List; | ||||
| import org.jsoup.Jsoup; | import org.jsoup.Jsoup; | ||||
| @@ -15,7 +16,19 @@ import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||||
| public class PrintCustomedTableDataHandler{ | 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) { | if (null == datas || datas.size() <= 0) { | ||||
| return componentContent; | return componentContent; | ||||
| } | } | ||||
| @@ -71,7 +84,7 @@ public class PrintCustomedTableDataHandler{ | |||||
| } | } | ||||
| sb.append("</tr>"); | sb.append("</tr>"); | ||||
| } | } | ||||
| return null; | |||||
| return sb.toString(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -395,10 +395,20 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| String owe = wxBillRent.getOwe(); | |||||
| // if (isDeposit && ) { | |||||
| // | |||||
| // } | |||||
| 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); | wxAllBillMapper.updateById(wxBillRent); | ||||
| this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(), | ||||
| @@ -240,7 +240,7 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||||
| //表格解析 | //表格解析 | ||||
| String componentContent = ov.getString("value"); | String componentContent = ov.getString("value"); | ||||
| if (null != billList) { | if (null != billList) { | ||||
| printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(billList))); | |||||
| printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(billList)),JSON.parseObject(JSON.toJSONString(re))); | |||||
| } | } | ||||
| }else { | }else { | ||||
| ov.put("value", printFinanceReceiveDataHandler.getObjectValue(ov.getString("name"),re,merchantMap,feesMap,shopNumber)); | ov.put("value", printFinanceReceiveDataHandler.getObjectValue(ov.getString("name"),re,merchantMap,feesMap,shopNumber)); | ||||
| @@ -303,23 +303,40 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||||
| List<WxBillSum> sumlist = new ArrayList<WxBillSum>(); | List<WxBillSum> sumlist = new ArrayList<WxBillSum>(); | ||||
| BigDecimal receiveTotal = new BigDecimal(0); | BigDecimal receiveTotal = new BigDecimal(0); | ||||
| BigDecimal payTotal = new BigDecimal(0); | BigDecimal payTotal = new BigDecimal(0); | ||||
| BigDecimal setoffTotal = new BigDecimal(0); | |||||
| BigDecimal returnTotal = new BigDecimal(0); | |||||
| BigDecimal oweTotal = new BigDecimal(0); | |||||
| for (int k = 0 ; k< bq.getBillSumList().size() ; k++) { | for (int k = 0 ; k< bq.getBillSumList().size() ; k++) { | ||||
| WxBillSum billSum = bq.getBillSumList().get(k); | WxBillSum billSum = bq.getBillSumList().get(k); | ||||
| if (feesId.contains(billSum.getEnergyFeesId())) { | if (feesId.contains(billSum.getEnergyFeesId())) { | ||||
| WxEnergyFees fee = feesMap.get(billSum.getEnergyFeesId()); | |||||
| billSum.setTaxRate(fee.getTaxRate()); | |||||
| sumlist.add(billSum); | 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"); | String componentContent = ov.getString("value"); | ||||
| // if (null != billList) { | |||||
| // printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(billList))); | |||||
| // } | |||||
| if (null != sumlist && sumlist.size() > 0 ) { | |||||
| printCustomedTableDataHandler.getTableContent(componentContent, JSON.parseArray(JSON.toJSONString(sumlist)),JSON.parseObject(JSON.toJSONString(bq))); | |||||
| } | |||||
| }else { | }else { | ||||
| //ov.put("value", printMerchantSettleDataHandler.getObjectValue(ov.getString("name"),sv,merchantMap,feesMap)); | |||||
| ov.put("value", printMerchantSettleDataHandler.getObjectValue(ov.getString("name"),bq,merchantMap,feesMap)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -73,18 +73,41 @@ | |||||
| and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} | and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} | ||||
| </if> | </if> | ||||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | <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> | ||||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | <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> | ||||
| <if test=" null != needPayStartDay"> | <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> | ||||
| <if test=" null != toPayMerchant"> | <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> | ||||
| <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=" null != hasMerchant ">and `merchant_id` is not null</if> | ||||
| <if test=" 1 == hasParentBillId ">and `parent_bill_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> | <if test=" 0 == hasParentBillId ">and `parent_bill_id` is null</if> | ||||
| @@ -193,7 +216,9 @@ | |||||
| select | select | ||||
| bill_type, | bill_type, | ||||
| count(1) total_count , | 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 | MIN(starttime) min_begin_time from wx_all_bill | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| group by bill_type | group by bill_type | ||||
| @@ -11,10 +11,11 @@ | |||||
| <result column="print_data_type" jdbcType="VARCHAR" property="printDataType"/> | <result column="print_data_type" jdbcType="VARCHAR" property="printDataType"/> | ||||
| <result column="print_data_json" jdbcType="VARCHAR" property="printDataJson"/> | <result column="print_data_json" jdbcType="VARCHAR" property="printDataJson"/> | ||||
| <result column="is_edit" jdbcType="INTEGER" property="isEdit"/> | <result column="is_edit" jdbcType="INTEGER" property="isEdit"/> | ||||
| <result column="default_value" jdbcType="VARCHAR" property="defaultValue"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <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> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||