From 72d83a5e8f80f975409abc52f5d29f15dc69eea0 Mon Sep 17 00:00:00 2001 From: luozukai Date: Thu, 22 Aug 2019 15:45:14 +0800 Subject: [PATCH 01/15] =?UTF-8?q?[=E5=90=88=E5=90=8C][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=B4=A6=E5=8D=95=E7=BB=93=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/service/impl/WxBillRentServiceImpl.java | 10 +++------- .../service/impl/WxRentContractServiceImpl.java | 11 +++++------ .../src/main/resources/mapper/WxBillRentMapper.xml | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java index 1213ba003..a87814659 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java @@ -283,7 +283,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { wxBillRent.setRevenue(record.getRevenue()); Integer ratio = 0; - if(wxRentContract.getPayRatio() != null){ + if(wxRentContract.getPayRatio() != null && wxRentContract.getPayRatio().intValue() > 0){ ratio = wxRentContract.getPayRatio(); }else{ if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){ @@ -319,17 +319,13 @@ public class WxBillRentServiceImpl implements WxBillRentService { Long oldPrice = wxBillRent.getReceivePay(); Long newPrice = newReceivePay; - //wxBillRent.setReceivePay(oldPrice.equals(newPrice) ? oldPrice : newPrice); wxBillRent.setUpdatetime(new Date()); //如果在跳点区间中,修改扣点率 - - wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){ - wxRentContract.setPayRatio(ratio); - wxRentContract.setUpdatetime(new Date()); - wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract); + wxBillRent.setPayRatio(new Long(ratio)); } + wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); if (!oldPrice.equals(newPrice)) { //日志 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 46ef1f505..d39a79595 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -378,12 +378,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { if(record.getRevenue() == null || record.getRevenue().longValue() <= 0){ record.setPrice(0l); }else{ - if(record.getPayRatio()!=null){ + if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ record.setPrice(countPrice(record.getPayRatio(),record.getRevenue())); }else{ int dayCount = record.getReceivePeriod() * 30; RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); - record.setPayRatio(ratioVo.getRatio()); + //record.setPayRatio(ratioVo.getRatio()); if(ratioVo.getBalance() != null){ //有超出部分,在getPayRatio里计算 record.setPrice(ratioVo.getBalance().longValue()); @@ -597,8 +597,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { wxBillRentMapper.insertBills(record.getPreviewBillRentList()); } - - public ResultData getResultDataForUpdate(WxRentContract record, Long userId,int from,Date oldRentStartDate) { //更新租赁合同信息 WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(record.getId()); @@ -607,6 +605,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } wxRentContract.setBusDiscountTime(record.getBusDiscountTime()); wxRentContract.setBusDiscountRatio(record.getBusDiscountRatio()); + wxRentContract.setPayRatio(record.getPayRatio()); int dayType = wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; @@ -617,12 +616,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { if(!EnumFromType.SWITCH.getCode().equals(from)){ if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - if(record.getPayRatio()!=null){ + if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ record.setPrice(countPrice(record.getPayRatio(),record.getRevenue())); }else{ int dayCount = record.getReceivePeriod() * 30; RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); - record.setPayRatio(ratioVo.getRatio()); + //record.setPayRatio(ratioVo.getRatio()); if(ratioVo.getBalance() != null){ //有超出部分,在getPayRatio里计算 record.setPrice(ratioVo.getBalance().longValue()); diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index e5a01497e..18d1bf7ae 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -97,7 +97,7 @@ select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`, case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,r.merchant_name, s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,r.type as rent_type, - r.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, + br.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, d.receive_pay deposit,d.`status` deposit_status,br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime, r.late_pay_day,r.late_pay_ratio From ff223f00d80a52924d559dc5a220801241a45a2f Mon Sep 17 00:00:00 2001 From: luozukai Date: Thu, 22 Aug 2019 16:08:11 +0800 Subject: [PATCH 02/15] =?UTF-8?q?[=E5=90=88=E5=90=8C][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=B4=A6=E5=8D=95=E7=BB=93=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxRentContractServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index d39a79595..9695ce1e2 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -278,7 +278,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { end = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount)); } if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(12)); + revenue = revenue.divide(new BigDecimal(12)).setScale(10, RoundingMode.HALF_EVEN); } }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ if(EnumGetRatioFrom.BILL.getCode().equals(from)) { @@ -287,7 +287,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){ if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(period)); + revenue = revenue.divide(new BigDecimal(period)).setScale(10, RoundingMode.HALF_EVEN);; } } @@ -305,7 +305,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { end = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount)); } if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(12)); + revenue = revenue.divide(new BigDecimal(12)).setScale(10, RoundingMode.HALF_EVEN);; } }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ if(EnumGetRatioFrom.BILL.getCode().equals(from)) { @@ -313,7 +313,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){ if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(period)); + revenue = revenue.divide(new BigDecimal(period)).setScale(10, RoundingMode.HALF_EVEN);; } } @@ -321,13 +321,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { ratioVo.setRatio(ratio); //计算超出部分 - BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)); + BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)).setScale(10, RoundingMode.HALF_EVEN);; BigDecimal balance = new BigDecimal(revenueLong).subtract(end.multiply(new BigDecimal(1000000))); BigDecimal price = balance.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); array = ratioList.get(i-1).split(":"); Integer frontatio = Integer.parseInt(array[1]); - BigDecimal frontRatio = new BigDecimal(frontatio).divide(new BigDecimal(10000)); + BigDecimal frontRatio = new BigDecimal(frontatio).divide(new BigDecimal(10000)).setScale(10, RoundingMode.HALF_EVEN);; BigDecimal frontPrice = end.multiply(new BigDecimal(1000000).multiply(frontRatio).setScale(2, RoundingMode.HALF_EVEN)); ratioVo.setBalance(price.add(frontPrice)); From 7893cbed310e7c7a6ca1035ac5ee4b6fcaecf2a3 Mon Sep 17 00:00:00 2001 From: luozukai Date: Thu, 22 Aug 2019 16:19:49 +0800 Subject: [PATCH 03/15] =?UTF-8?q?[=E5=90=88=E5=90=8C][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=B4=A6=E5=8D=95=E7=BB=93=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxRentContractServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 9695ce1e2..dd2133bf5 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -278,7 +278,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { end = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount)); } if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(12)).setScale(10, RoundingMode.HALF_EVEN); + revenue = revenue.divide(new BigDecimal(12),10, BigDecimal.ROUND_HALF_DOWN); } }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ if(EnumGetRatioFrom.BILL.getCode().equals(from)) { @@ -287,7 +287,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){ if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(period)).setScale(10, RoundingMode.HALF_EVEN);; + revenue = revenue.divide(new BigDecimal(period),10, BigDecimal.ROUND_HALF_DOWN); } } @@ -305,7 +305,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { end = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount)); } if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(12)).setScale(10, RoundingMode.HALF_EVEN);; + revenue = revenue.divide(new BigDecimal(12),10, BigDecimal.ROUND_HALF_DOWN); } }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ if(EnumGetRatioFrom.BILL.getCode().equals(from)) { @@ -313,7 +313,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){ if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(period)).setScale(10, RoundingMode.HALF_EVEN);; + revenue = revenue.divide(new BigDecimal(period),10, BigDecimal.ROUND_HALF_DOWN); } } @@ -321,13 +321,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { ratioVo.setRatio(ratio); //计算超出部分 - BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)).setScale(10, RoundingMode.HALF_EVEN);; + BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)); BigDecimal balance = new BigDecimal(revenueLong).subtract(end.multiply(new BigDecimal(1000000))); BigDecimal price = balance.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); array = ratioList.get(i-1).split(":"); Integer frontatio = Integer.parseInt(array[1]); - BigDecimal frontRatio = new BigDecimal(frontatio).divide(new BigDecimal(10000)).setScale(10, RoundingMode.HALF_EVEN);; + BigDecimal frontRatio = new BigDecimal(frontatio).divide(new BigDecimal(10000)); BigDecimal frontPrice = end.multiply(new BigDecimal(1000000).multiply(frontRatio).setScale(2, RoundingMode.HALF_EVEN)); ratioVo.setBalance(price.add(frontPrice)); From 017779c64bc0abb09789f8396eebcf0bd465b5e2 Mon Sep 17 00:00:00 2001 From: luozukai Date: Thu, 22 Aug 2019 16:33:59 +0800 Subject: [PATCH 04/15] =?UTF-8?q?[=E5=90=88=E5=90=8C][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=B4=A6=E5=8D=95=E7=BB=93=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/service/impl/WxRentContractServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index dd2133bf5..4a4f73c3b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -278,7 +278,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { end = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount)); } if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(12),10, BigDecimal.ROUND_HALF_DOWN); + revenue = revenue.multiply(new BigDecimal(12)); } }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ if(EnumGetRatioFrom.BILL.getCode().equals(from)) { @@ -287,7 +287,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){ if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(period),10, BigDecimal.ROUND_HALF_DOWN); + revenue = revenue.multiply(new BigDecimal(period)); } } @@ -305,7 +305,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { end = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount)); } if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(12),10, BigDecimal.ROUND_HALF_DOWN); + revenue = revenue.multiply(new BigDecimal(12)); } }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ if(EnumGetRatioFrom.BILL.getCode().equals(from)) { @@ -313,7 +313,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){ if(EnumGetRatioFrom.RENT.getCode().equals(from)) { - revenue = revenue.divide(new BigDecimal(period),10, BigDecimal.ROUND_HALF_DOWN); + revenue = revenue.multiply(new BigDecimal(period)); } } From d033a9ebb5e5ab0b0b8268058d0d063373e7bbfb Mon Sep 17 00:00:00 2001 From: luozukai Date: Thu, 22 Aug 2019 16:47:35 +0800 Subject: [PATCH 05/15] =?UTF-8?q?[=E5=90=88=E5=90=8C][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=B4=A6=E5=8D=95=E7=BB=93=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/service/impl/WxRentContractServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 4a4f73c3b..c2bb6fa38 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -258,10 +258,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { if(StringUtils.isBlank(busDiscountRatio)){ return ratioVo; } - BigDecimal revenue = new BigDecimal(revenueLong).divide(new BigDecimal(1000000)).setScale(4, RoundingMode.HALF_EVEN); List ratioList = JSONArray.parseArray(busDiscountRatio, String.class); for (int i = 0; i < ratioList.size(); i++) { + BigDecimal revenue = new BigDecimal(revenueLong).divide(new BigDecimal(1000000)).setScale(4, RoundingMode.HALF_EVEN); String e = ratioList.get(i); String[] array = e.split(":"); Integer ratio = Integer.parseInt(array[1]); @@ -388,7 +388,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //有超出部分,在getPayRatio里计算 record.setPrice(ratioVo.getBalance().longValue()); }else{ - record.setPrice(countPrice(record.getPayRatio(),record.getRevenue())); + record.setPrice(countPrice(ratioVo.getRatio(),record.getRevenue())); } } } @@ -626,7 +626,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //有超出部分,在getPayRatio里计算 record.setPrice(ratioVo.getBalance().longValue()); }else{ - record.setPrice(countPrice(record.getPayRatio(),record.getRevenue())); + record.setPrice(countPrice(ratioVo.getRatio(),record.getRevenue())); } } } else { From 3a94a8df338e6112a591c147cc2b95940c6fb4ad Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 22 Aug 2019 16:48:46 +0800 Subject: [PATCH 06/15] =?UTF-8?q?[=E8=B4=A6=E5=8D=95=E5=AF=B9=E8=B4=A6][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E5=85=B1=E7=94=A8=E8=B4=A6=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/iformall/domain/vo/WxBillAll.java | 3 +++ .../com/iformall/service/impl/WxBillAllServiceImpl.java | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java index a1729c9c0..438167ce9 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java @@ -140,4 +140,7 @@ public class WxBillAll extends BaseEntity { @Transient private Integer balance; + @io.swagger.annotations.ApiModelProperty(value = "多个状态", name = "statusStr") + private String statusStr; + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 9a377d4c7..fe703c0fc 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -1,5 +1,6 @@ package com.iformall.service.impl; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -120,13 +121,17 @@ public class WxBillAllServiceImpl implements WxBillAllService { public Map listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { //更新各账单状态 //updateBillStatus(record); + + if (StringUtils.isNotEmpty(record.getStatusStr())) { + List typeList = JSONArray.parseArray(record.getStatusStr(), Integer.class); + record.setTypeList(typeList); + } PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record)); Map result = new HashMap<>(); result.put("pageInfo", pageInfo); return result; } - @Override public List> listBillOweAndWaitPay(WxBillAll wxBillAll) { //更新各账单状态 From f8efbc7ecd8532d12198622f3333a385bcf438df Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 22 Aug 2019 17:03:36 +0800 Subject: [PATCH 07/15] =?UTF-8?q?[=E6=97=A5=E5=B8=B8=E8=B4=A6=E5=8D=95][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E6=B7=BB=E5=8A=A0=E7=94=B5=E8=B4=B9?= =?UTF-8?q?=E6=98=8E=E7=BB=86]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/service/impl/WxBillDailyServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java index 2e66ed6ca..5a7672b85 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java @@ -178,6 +178,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { wxBillDaily.setPayDate(record.getPayDate()); wxBillDaily.setUpdatetime(date); wxBillDaily.setPayWay(record.getPayWay()); + wxBillDaily.setPriceDetail(record.getPriceDetail()); try { wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); } catch (Exception e) { From 20f11e8eec24bb540dc35b2b93144ee64deb0fce Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 22 Aug 2019 17:19:05 +0800 Subject: [PATCH 08/15] =?UTF-8?q?[=E8=B4=A6=E5=8D=95=E5=AF=B9=E7=85=A7][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E8=B4=A6=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/iformall/domain/vo/WxBillAll.java | 4 ++-- .../iformall/service/impl/WxBillAllServiceImpl.java | 4 ++-- .../src/main/resources/mapper/WxBillAllMapper.xml | 12 ++++++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java index 438167ce9..b04d8fabf 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java @@ -140,7 +140,7 @@ public class WxBillAll extends BaseEntity { @Transient private Integer balance; - @io.swagger.annotations.ApiModelProperty(value = "多个状态", name = "statusStr") - private String statusStr; + @io.swagger.annotations.ApiModelProperty(value = "多个类型", name = "typeStr") + private String typeStr; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index fe703c0fc..78637436a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -122,8 +122,8 @@ public class WxBillAllServiceImpl implements WxBillAllService { //更新各账单状态 //updateBillStatus(record); - if (StringUtils.isNotEmpty(record.getStatusStr())) { - List typeList = JSONArray.parseArray(record.getStatusStr(), Integer.class); + if (StringUtils.isNotEmpty(record.getTypeStr())) { + List typeList = JSONArray.parseArray(record.getTypeStr(), Integer.class); record.setTypeList(typeList); } PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record)); diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index c74eaefb2..7e6860768 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -99,7 +99,7 @@ and bill.bill_type_value = #{billTypeValue} and bill.`status` = #{status} and bill.rent_shop_type = #{rentShopType} - + and bill.receive_date between #{starttime} and #{endtime} @@ -111,6 +111,14 @@ #{status} + + + and bill.`bill_type_value` in + + #{type} + + + order by ${sortColumns} order by bill.receive_date,bill.id desc,bill.merchant_id,bill.status @@ -291,7 +299,7 @@ #{type} - + and DATE_FORMAT(bill.receive_date,'%Y-%m') between #{starttime} and #{endtime} From ed8977f532bbf8250ce5bf93a232c3d8ca1056ca Mon Sep 17 00:00:00 2001 From: luozukai Date: Thu, 22 Aug 2019 17:28:46 +0800 Subject: [PATCH 09/15] =?UTF-8?q?[=E5=90=88=E5=90=8C][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=B4=A6=E5=8D=95=E7=BB=93=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/service/impl/WxBillRentServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java index a87814659..9e20905c5 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java @@ -287,7 +287,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { ratio = wxRentContract.getPayRatio(); }else{ if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){ - long dayCount = DateUtils.startToEnd(record.getStarttime(),record.getEndtime()); + long dayCount = DateUtils.startToEnd(wxBillRent.getStarttime(),wxBillRent.getEndtime()); if(EnumBusRatioTime.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){ if(startInt == endInt && months == 12){ //刚好1年 From 0c99f8b8b115cd51b74f95fa816b53fd3fd9162b Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 22 Aug 2019 17:32:38 +0800 Subject: [PATCH 10/15] =?UTF-8?q?[=E6=97=A5=E5=B8=B8=E8=B4=A6=E5=8D=95][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][B=E7=AB=AF=E6=98=BE=E7=A4=BA]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/WxBillAllMapper.xml | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index 7e6860768..fcb118f17 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -235,26 +235,30 @@ bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,DATEDIFF(now(),bill.receive_date) expiredDay,bill.status, bill.tenant_id tenantId,m.name merchantName,s.shop_number shopNumber,bill.starttime,bill.endtime,bill.name,pb.pay_bill_status payBillStatus, pb.pay_time_end tradeTime,pb.transaction_id transactionId,pb.pay_amount payAmount,bill.rent_shop_type - rentShopType from ( + rentShopType,bill.price_detail priceDetail from ( select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' - bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type + bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,'' + price_detail from wx_bill_rent where is_preview = 0 and tenant_id=#{tenantId} and rent_contract_id in (select id from wx_rent_contract where status in (2,3,4)) union all select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' - bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type + bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,'' + price_detail from wx_bill_rent_deposit where tenant_id=#{tenantId} and rent_contract_id in (select id from wx_rent_contract where status in (2,3,4)) union all select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' - bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type + bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,'' + price_detail from wx_bill_property where is_preview = 0 and tenant_id=#{tenantId} and property_contract_id in (select id from wx_property_contract where status in(2,3,4)) union all select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' - bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type + bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,'' + price_detail from wx_bill_property_deposit where tenant_id=#{tenantId} and property_contract_id in (select id from wx_property_contract where status in (2,3,4)) @@ -262,15 +266,17 @@ select id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value, case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type, 0 as need_pay,receive_pay, - pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type + pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,price_detail from wx_bill_daily where tenant_id=#{tenantId} union all select id,merchant_id,shop_id,tenant_id,name,7 bill_type_vaue,'其他费用' bill_type,0 as - need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type + need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,'' + price_detail from wx_bill_other where tenant_id=#{tenantId} union all select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as - need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type + need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,'' + price_detail from wx_bill_other_deposit where tenant_id=#{tenantId} ) bill left join wx_merchant m on bill.merchant_id=m.id From 2ded4f18f16f1d0857c31cb25c347b9027d3827d Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 22 Aug 2019 15:32:07 +0800 Subject: [PATCH 11/15] =?UTF-8?q?[POS][=E4=BF=AE=E6=94=B9]:POS=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=9B=E5=BB=BA,=20POS=E4=BC=9A=E5=91=98=E8=AF=86?= =?UTF-8?q?=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/controller/PosController.java | 17 +++++++++++++- .../controller/PosOrderController.java | 22 +++++++++++++------ .../service/impl/PosOrderServiceImpl.java | 1 + 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/PosController.java b/mallinkBApi/src/main/java/com/iformall/controller/PosController.java index bde3a1398..c2400a527 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/PosController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/PosController.java @@ -59,7 +59,7 @@ public class PosController extends BaseController { return posService.getQrCode(getTenantId()); } - @ApiOperation(value = "会员识别") + @ApiOperation(value = "会员识别", notes = "{\"mem_id\":\"string(可选)\",\"mem_phone\":\"string(可选)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(单位:分)(必填)\"}") @PostMapping("checkMem") public ResultData checkMem(@RequestBody Map params) { WxMerchantBUser user = getUser(); @@ -102,6 +102,21 @@ public class PosController extends BaseController { return posService.checkCouponOrderForIndepentVerify(user, verifyType, couponOrderIdStr); } + @ApiOperation(value = "券交易核销检查") + @PostMapping("checkCouponOrderForPayVerify") + public ResultData checkCouponOrderForPayVerify(@RequestBody Map params) { + WxMerchantBUser user = getUser(); + String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID + + if (StringUtils.isBlank(couponOrderIdStr)) { + String errMessage = "request params[coupon_order_id] error."; + logger.error(errMessage); + throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); + } + String verifyType = WxPayConstant.VERIFY_TYPE_PAY; + return posService.checkCouponOrderForIndepentVerify(user, verifyType, couponOrderIdStr); + } + @ApiOperation(value = "券预核销") @PostMapping("couponOrderPreVerify") public ResultData couponOrderPreVerify(@RequestBody Map params) { diff --git a/mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java b/mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java index 4298e6716..7dfe63744 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java @@ -1,8 +1,7 @@ package com.iformall.controller; import com.iformall.common.ErrorCode; -import com.iformall.service.PosBrunService; -import com.iformall.service.PosPayOrderService; +import com.iformall.domain.po.WxMerchantBUser; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; import org.slf4j.Logger; @@ -41,9 +40,10 @@ public class PosOrderController extends BaseController { return new ResultData(page); } - @ApiOperation("新增POS订单接口") - @PostMapping("add") + @ApiOperation(value = "新增POS订单接口", notes = "") + @PostMapping("addForPosPay") public ResultData add(@RequestBody PosOrder posOrder) { + WxMerchantBUser user = getUser(); if (posOrder == null) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); } @@ -52,13 +52,21 @@ public class PosOrderController extends BaseController { logger.error(errMessage); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); } - if (posOrder.getBuUserId() == null) { - String errMessage = "操作员为空"; + if (posOrder.getPaymentType() == null) { + String errMessage = "支付类型为空"; logger.error(errMessage); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); } + if (posOrder.getPayment() == null) { + String errMessage = "支付金额为空"; + logger.error(errMessage); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); + } + + posOrder.setTenantId(user.getTenantId()); + posOrder.setBuUserId(user.getId()); posOrderService.saveOrUpdate(posOrder); - return new ResultData(); + return new ResultData(posOrder); } @ApiOperation("根据id更新接口") diff --git a/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java index 33d526251..a26f7ccb6 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java @@ -31,6 +31,7 @@ public class PosOrderServiceImpl implements PosOrderService { if (record.getId() == null) { final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); + record.setPosOrderNo(String.valueOf(record.getId())); posOrderMapper.insertSelective(record); } else { posOrderMapper.updateByPrimaryKeySelective(record); From 2366d5a45c26655d8c417603be2b816fe47a0f52 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 22 Aug 2019 15:48:56 +0800 Subject: [PATCH 12/15] =?UTF-8?q?[POS][=E4=BF=AE=E6=94=B9]:POS=E4=BA=A4?= =?UTF-8?q?=E6=98=93=E6=A0=B8=E9=94=80=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/controller/PosController.java | 16 ++++++++++++++-- .../com/iformall/service/PosBrunService.java | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/PosController.java b/mallinkBApi/src/main/java/com/iformall/controller/PosController.java index c2400a527..80872cd09 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/PosController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/PosController.java @@ -102,19 +102,31 @@ public class PosController extends BaseController { return posService.checkCouponOrderForIndepentVerify(user, verifyType, couponOrderIdStr); } - @ApiOperation(value = "券交易核销检查") + @ApiOperation(value = "券交易核销检查", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}") @PostMapping("checkCouponOrderForPayVerify") public ResultData checkCouponOrderForPayVerify(@RequestBody Map params) { WxMerchantBUser user = getUser(); String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID + String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID + String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单金额 if (StringUtils.isBlank(couponOrderIdStr)) { String errMessage = "request params[coupon_order_id] error."; logger.error(errMessage); throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); } + if (StringUtils.isBlank(posOrderIdStr)) { + String errMessage = "request params[pos_order_id] error."; + logger.error(errMessage); + throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); + } + if (StringUtils.isBlank(posAmountStr)) { + String errMessage = "request params[pos_amount] error."; + logger.error(errMessage); + throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); + } String verifyType = WxPayConstant.VERIFY_TYPE_PAY; - return posService.checkCouponOrderForIndepentVerify(user, verifyType, couponOrderIdStr); + return posService.checkCouponOrderForPayVerify(user, verifyType, couponOrderIdStr, posOrderIdStr, posAmountStr); } @ApiOperation(value = "券预核销") diff --git a/mallinkBApi/src/main/java/com/iformall/service/PosBrunService.java b/mallinkBApi/src/main/java/com/iformall/service/PosBrunService.java index a1a1601e9..db6f75a95 100644 --- a/mallinkBApi/src/main/java/com/iformall/service/PosBrunService.java +++ b/mallinkBApi/src/main/java/com/iformall/service/PosBrunService.java @@ -228,7 +228,7 @@ public class PosBrunService { } /** - * 券独立核销检查 + * 券交易核销检查 * @param user * @param verifyType * @param couponOrderIdStr @@ -236,14 +236,14 @@ public class PosBrunService { * @param posAmountStr * @return */ - public ResultData checkCouponOrderForVerify(WxMerchantBUser user, + public ResultData checkCouponOrderForPayVerify(WxMerchantBUser user, String verifyType, String couponOrderIdStr, String posOrderIdStr, String posAmountStr) { try { String resStr = posUtil.checkCouponOrderForVerify(posUrl, posDevId, posReqKey, user.getTenantId(), String.valueOf(user.getMerchantId()), String.valueOf(user.getId()), - couponOrderIdStr, verifyType, posOrderIdStr, posAmountStr); + verifyType, couponOrderIdStr, posOrderIdStr, posAmountStr); if (resStr != null) { JSONObject retObj = JSON.parseObject(resStr); Map options = retObj; From 8dac8446bc7eca6b5a74237f294df30853e62a69 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 22 Aug 2019 15:58:44 +0800 Subject: [PATCH 13/15] =?UTF-8?q?[POS][=E4=BF=AE=E6=94=B9]:POS=E4=BA=A4?= =?UTF-8?q?=E6=98=93=E9=A2=84=E6=A0=B8=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/controller/PosController.java | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/PosController.java b/mallinkBApi/src/main/java/com/iformall/controller/PosController.java index 80872cd09..5b722b755 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/PosController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/PosController.java @@ -31,7 +31,7 @@ public class PosController extends BaseController { return posService.checkAvaiable(); } - @ApiOperation(value = "商户POS用户/B端用户登录检查") + @ApiOperation(value = "商户POS用户/B端用户登录检查", notes = "{\"phone\":\"string\", \"password\":\"string(单位:分)\"}") @PostMapping("checkUserPassword") public ResultData checkUserPassword(@RequestBody Map params) { WxMerchantBUser user = getUser(); @@ -59,6 +59,35 @@ public class PosController extends BaseController { return posService.getQrCode(getTenantId()); } + @ApiOperation(value = "券独立核销检查", notes = "{\"couponOrderId\":\"string\"}") + @PostMapping("checkCouponOrderForIndepentVerify") + public ResultData checkCouponOrderForIndepentVerify(@RequestBody Map params) { + WxMerchantBUser user = getUser(); + String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID + + if (StringUtils.isBlank(couponOrderIdStr)) { + String errMessage = "request params[coupon_order_id] error."; + logger.error(errMessage); + throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); + } + String verifyType = WxPayConstant.VERIFY_TYPE_INDEPENT; + return posService.checkCouponOrderForIndepentVerify(user, verifyType, couponOrderIdStr); + } + + @ApiOperation(value = "券独立核销", notes = "{\"couponOrderId\":\"string\", \"payment\":\"string(单位:分)\"}") + @PostMapping("posVerifyIndepent") + public ResultData posVerifyIndepent(@RequestBody Map params) { + WxMerchantBUser user = getUser(); + String couponOrderId = params.get("coupon_order_id"); + String payment = params.get("payment"); + if (StringUtils.isBlank(couponOrderId)) { + String errMessage = "券ID为空"; + logger.error(errMessage); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); + } + return posService.posVerifyIndepent(user, couponOrderId, payment); + } + @ApiOperation(value = "会员识别", notes = "{\"mem_id\":\"string(可选)\",\"mem_phone\":\"string(可选)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(单位:分)(必填)\"}") @PostMapping("checkMem") public ResultData checkMem(@RequestBody Map params) { @@ -87,21 +116,6 @@ public class PosController extends BaseController { return posService.checkMem(user, memIdStr, memPhoneStr, posOrderIdStr, posAmountStr); } - @ApiOperation(value = "券独立核销检查") - @PostMapping("checkCouponOrderForIndepentVerify") - public ResultData checkCouponOrderForIndepentVerify(@RequestBody Map params) { - WxMerchantBUser user = getUser(); - String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID - - if (StringUtils.isBlank(couponOrderIdStr)) { - String errMessage = "request params[coupon_order_id] error."; - logger.error(errMessage); - throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); - } - String verifyType = WxPayConstant.VERIFY_TYPE_INDEPENT; - return posService.checkCouponOrderForIndepentVerify(user, verifyType, couponOrderIdStr); - } - @ApiOperation(value = "券交易核销检查", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}") @PostMapping("checkCouponOrderForPayVerify") public ResultData checkCouponOrderForPayVerify(@RequestBody Map params) { @@ -129,7 +143,7 @@ public class PosController extends BaseController { return posService.checkCouponOrderForPayVerify(user, verifyType, couponOrderIdStr, posOrderIdStr, posAmountStr); } - @ApiOperation(value = "券预核销") + @ApiOperation(value = "券预核销", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}") @PostMapping("couponOrderPreVerify") public ResultData couponOrderPreVerify(@RequestBody Map params) { WxMerchantBUser user = getUser(); @@ -155,7 +169,7 @@ public class PosController extends BaseController { return posService.couponOrderPreVerify(user, couponOrderIdStr, posOrderIdStr, posAmountStr); } - @ApiOperation(value = "券预核销取消") + @ApiOperation(value = "券预核销取消", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}") @PostMapping("couponOrderPreVerifyCancel") public ResultData couponOrderPreVerifyCancel(@RequestBody Map params) { WxMerchantBUser user = getUser(); @@ -181,20 +195,6 @@ public class PosController extends BaseController { return posService.couponOrderPreVerifyCancel(user, couponOrderIdStr, posOrderIdStr, posAmountStr); } - @ApiOperation(value = "券独立核销", notes = "{\"couponOrderId\":\"string\", \"payment\":\"string(单位:分)\"}") - @PostMapping("posVerifyIndepent") - public ResultData posVerifyIndepent(@RequestBody Map params) { - WxMerchantBUser user = getUser(); - String couponOrderId = params.get("coupon_order_id"); - String payment = params.get("payment"); - if (StringUtils.isBlank(couponOrderId)) { - String errMessage = "券ID为空"; - logger.error(errMessage); - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); - } - return posService.posVerifyIndepent(user, couponOrderId, payment); - } - @ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}") @PostMapping("verifyForPos") public ResultData verifyForPos(@RequestBody Map paramMap) { From 3c42879554c33f769f255f90906db8c1f5e156fa Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 22 Aug 2019 17:46:38 +0800 Subject: [PATCH 14/15] =?UTF-8?q?[POS][=E4=BF=AE=E6=94=B9]:POS=E4=BA=A4?= =?UTF-8?q?=E6=98=93=E6=A0=B8=E9=94=80=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration/V201908221610__POS_CHANGED.sql | 2 + .../iformall/controller/PosController.java | 48 +++++--- .../com/iformall/service/PosBrunService.java | 115 +++++++++++++++++- .../java/com/iformall/domain/po/PosOrder.java | 2 + .../iformall/enums/EnumPosOrderStatus.java | 20 +-- .../java/com/iformall/pay/WxPayConstant.java | 1 + .../iformall/service/PosPayOrderService.java | 11 +- .../service/impl/PosOrderServiceImpl.java | 3 + .../service/impl/PosPayOrderServiceImpl.java | 6 + 9 files changed, 177 insertions(+), 31 deletions(-) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V201908221610__POS_CHANGED.sql diff --git a/mallinkAdmin/src/main/resources/db/migration/V201908221610__POS_CHANGED.sql b/mallinkAdmin/src/main/resources/db/migration/V201908221610__POS_CHANGED.sql new file mode 100644 index 000000000..ec829c8eb --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201908221610__POS_CHANGED.sql @@ -0,0 +1,2 @@ +alter table wx_pos_order +add `remain_amount` int(11) default NULL COMMENT '支付金额:允许有负数,退款时为负值。核销时,金额可以不填写' after `payment`; \ No newline at end of file diff --git a/mallinkBApi/src/main/java/com/iformall/controller/PosController.java b/mallinkBApi/src/main/java/com/iformall/controller/PosController.java index 5b722b755..57a89fcbb 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/PosController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/PosController.java @@ -59,7 +59,7 @@ public class PosController extends BaseController { return posService.getQrCode(getTenantId()); } - @ApiOperation(value = "券独立核销检查", notes = "{\"couponOrderId\":\"string\"}") + @ApiOperation(value = "券独立核销-1-检查", notes = "{\"couponOrderId\":\"string\"}") @PostMapping("checkCouponOrderForIndepentVerify") public ResultData checkCouponOrderForIndepentVerify(@RequestBody Map params) { WxMerchantBUser user = getUser(); @@ -74,7 +74,7 @@ public class PosController extends BaseController { return posService.checkCouponOrderForIndepentVerify(user, verifyType, couponOrderIdStr); } - @ApiOperation(value = "券独立核销", notes = "{\"couponOrderId\":\"string\", \"payment\":\"string(单位:分)\"}") + @ApiOperation(value = "券独立核销-2-核销", notes = "{\"couponOrderId\":\"string\", \"payment\":\"string(单位:分)\"}") @PostMapping("posVerifyIndepent") public ResultData posVerifyIndepent(@RequestBody Map params) { WxMerchantBUser user = getUser(); @@ -88,7 +88,7 @@ public class PosController extends BaseController { return posService.posVerifyIndepent(user, couponOrderId, payment); } - @ApiOperation(value = "会员识别", notes = "{\"mem_id\":\"string(可选)\",\"mem_phone\":\"string(可选)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(单位:分)(必填)\"}") + @ApiOperation(value = "会员支付-1-会员识别", notes = "{\"mem_id\":\"string(可选)\",\"mem_phone\":\"string(可选)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(单位:分)(必填)\"}") @PostMapping("checkMem") public ResultData checkMem(@RequestBody Map params) { WxMerchantBUser user = getUser(); @@ -116,7 +116,7 @@ public class PosController extends BaseController { return posService.checkMem(user, memIdStr, memPhoneStr, posOrderIdStr, posAmountStr); } - @ApiOperation(value = "券交易核销检查", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}") + @ApiOperation(value = "会员支付-2-交易核销检查", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}") @PostMapping("checkCouponOrderForPayVerify") public ResultData checkCouponOrderForPayVerify(@RequestBody Map params) { WxMerchantBUser user = getUser(); @@ -143,11 +143,12 @@ public class PosController extends BaseController { return posService.checkCouponOrderForPayVerify(user, verifyType, couponOrderIdStr, posOrderIdStr, posAmountStr); } - @ApiOperation(value = "券预核销", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}") + @ApiOperation(value = "会员支付-3-券预核销", notes = "{\"coupon_order_id\":\"string(必填)\",\"deduct_amount\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}") @PostMapping("couponOrderPreVerify") public ResultData couponOrderPreVerify(@RequestBody Map params) { WxMerchantBUser user = getUser(); String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID + String deductAmountStr = params.get(WxPayConstant.DEDUCT_AMOUNT); // 扣减金额 String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单金额(单位:分) @@ -156,6 +157,11 @@ public class PosController extends BaseController { logger.error(errMessage); throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); } + if (StringUtils.isBlank(deductAmountStr)) { + String errMessage = "request params[deduct_amount] error."; + logger.error(errMessage); + throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); + } if (StringUtils.isBlank(posOrderIdStr)) { String errMessage = "request params[pos_order_id] error."; logger.error(errMessage); @@ -166,10 +172,28 @@ public class PosController extends BaseController { logger.error(errMessage); throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); } - return posService.couponOrderPreVerify(user, couponOrderIdStr, posOrderIdStr, posAmountStr); + return posService.couponOrderPreVerify(user, couponOrderIdStr, deductAmountStr, posOrderIdStr, posAmountStr); + } + + + @ApiOperation(value = "会员支付-4-支付完成", notes = "{\"pos_order_id\":\"string\"}") + @PostMapping("posOrderFinished") + public ResultData posOrderFinished(@RequestBody Map params) { + WxMerchantBUser user = getUser(); + String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID + if (StringUtils.isBlank(posOrderIdStr)) { + String errMessage = "request params[pos_order_id] error."; + logger.error(errMessage); + throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); + } + // 1. 获取订单信息 + // 2. 获取所有的支付订单信息 + // 3. 同步给FMPOS + + return new ResultData(); } - @ApiOperation(value = "券预核销取消", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}") + @ApiOperation(value = "会员支付-10-券预核销取消", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}") @PostMapping("couponOrderPreVerifyCancel") public ResultData couponOrderPreVerifyCancel(@RequestBody Map params) { WxMerchantBUser user = getUser(); @@ -195,14 +219,4 @@ public class PosController extends BaseController { return posService.couponOrderPreVerifyCancel(user, couponOrderIdStr, posOrderIdStr, posAmountStr); } - @ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}") - @PostMapping("verifyForPos") - public ResultData verifyForPos(@RequestBody Map paramMap) { - // 0. 获取dev信息, tenantId信息 - // 1. check 查询 - // 2. create order - // 3. 独立核销 - - return new ResultData(); - } } diff --git a/mallinkBApi/src/main/java/com/iformall/service/PosBrunService.java b/mallinkBApi/src/main/java/com/iformall/service/PosBrunService.java index db6f75a95..c39122786 100644 --- a/mallinkBApi/src/main/java/com/iformall/service/PosBrunService.java +++ b/mallinkBApi/src/main/java/com/iformall/service/PosBrunService.java @@ -1,6 +1,7 @@ package com.iformall.service; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.iformall.common.ErrorCode; import com.iformall.common.Result; @@ -8,9 +9,7 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.PosOrder; import com.iformall.domain.po.PosPayOrder; import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.enums.EnumPosOrderStatus; -import com.iformall.enums.EnumPosOrderType; -import com.iformall.enums.EnumPosPayType; +import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.pay.WxPayConstant; import com.iformall.pay.WxPayment; @@ -23,6 +22,7 @@ import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.RequestBody; import java.util.Date; +import java.util.List; import java.util.Map; @Service @@ -273,8 +273,44 @@ public class PosBrunService { * @return */ public ResultData couponOrderPreVerify(WxMerchantBUser user, - String couponOrderIdStr, + String couponOrderIdStr, String deductAmountStr, String posOrderIdStr, String posAmountStr) { + Integer deductAmount, posAmount; + Long posOrderId; + try { + deductAmount = Integer.valueOf(deductAmountStr); + posAmount = Integer.valueOf(posAmountStr); + posOrderId = Long.valueOf(posOrderIdStr); + } catch (NumberFormatException e) { + logger.error(ErrorCode.SYS_PARAMETER_CAST_ERROR.getMessage()); + return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR); + } + // 1. 创建支付订单 + Date curDate = new Date(); + PosPayOrder posPayOrder = new PosPayOrder(); + posPayOrder.setTenantId(user.getTenantId()); + posPayOrder.setCreateTime(curDate); + posPayOrder.setUpdateTime(curDate); + posPayOrder.setOrderId(posOrderId); + posPayOrder.setBuUserId(user.getId()); + posPayOrder.setType(2); + posPayOrder.setPayFrom(10); + posPayOrder.setPayAmount(deductAmount); + posPayOrder.setPayTimeStart(curDate); + posPayOrder.setPayTimeEnd(curDate); + posPayOrder.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); + posPayOrder.setShare(0); + try { + posPayOrderService.saveOrUpdate(posPayOrder); + } catch (MallinkException e) { + logger.error(e.getMessage()); + return new ResultData(e.getErrorCode(), e.getMessage()); + } catch (Exception e) { + logger.error(e.getMessage()); + return new ResultData(Result.ERROR, e.getMessage()); + } + + // 2. POS预核销 try { String resStr = posUtil.couponOrderPreVerify(posUrl, posDevId, posReqKey, user.getTenantId(), String.valueOf(user.getMerchantId()), String.valueOf(user.getId()), @@ -285,7 +321,65 @@ public class PosBrunService { if (!WxPayment.verifyNotifyHMAC(options, posResKey)) { return new ResultData(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); } else { - return new ResultData(resStr); + if (retObj.getString(WxPayConstant.RETURN_CODE).equalsIgnoreCase(WxPayConstant.RET_SUCCESS) && + retObj.getString(WxPayConstant.RESULT_CODE).equalsIgnoreCase(WxPayConstant.RET_SUCCESS)) { + Integer remainAmount = posAmount; + // 获取 返回值 + JSONArray retArr = retObj.getJSONArray(WxPayConstant.RET); + for (int i = 0; i > retArr.size(); i++) { + JSONObject couponObj = retArr.getJSONObject(i); + if (couponObj == null) { + continue; + } + String deductAmountOfCouponStr = couponObj.getString(WxPayConstant.DEDUCT_AMOUNT); + Integer deductAmountofCoupon = Integer.valueOf(deductAmountOfCouponStr); + // 新 支付订单状态 + PosPayOrder updatePayOrder = new PosPayOrder(); + updatePayOrder.setId(Long.valueOf(couponObj.getLong(WxPayConstant.ID))); + updatePayOrder.setPayAmount(deductAmountofCoupon); + updatePayOrder.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); + updatePayOrder.setPayTimeEnd(new Date()); + try { + posPayOrderService.saveOrUpdate(updatePayOrder); + } catch (MallinkException e) { + logger.error(e.getMessage()); + return new ResultData(e.getErrorCode(), e.getMessage()); + } catch (Exception e) { + logger.error(e.getMessage()); + return new ResultData(Result.ERROR, e.getMessage()); + } + String remainAmountStr = couponObj.getString(WxPayConstant.REMAIN_AMOUNT); + Integer remainAmountofCoupon = Integer.valueOf(remainAmountStr); + remainAmount = remainAmountofCoupon; + } + // 更新 订单状态 + PosOrder updateOrder = new PosOrder(); + updateOrder.setId(posOrderId); + updateOrder.setRemainAmount(remainAmount); + updateOrder.setUpdateDate(new Date()); + if (remainAmount.equals(0)) { + updateOrder.setOrderStatus(EnumPosOrderStatus.PAYMENT_SUCCESS.getCode()); + retObj.put(WxPayConstant.ORDER_STATUS, EnumPosOrderStatus.PAYMENT_SUCCESS.getCode()); + retObj.put(WxPayConstant.DEDUCT_AMOUNT, 0); + } else { + updateOrder.setOrderStatus(EnumPosOrderStatus.PENDING.getCode()); + retObj.put(WxPayConstant.ORDER_STATUS, EnumPosOrderStatus.PENDING.getCode()); + retObj.put(WxPayConstant.DEDUCT_AMOUNT, remainAmount); + } + try { + posOrderService.saveOrUpdate(updateOrder); + } catch (MallinkException e) { + logger.error(e.getMessage()); + return new ResultData(e.getErrorCode(), e.getMessage()); + } catch (Exception e) { + logger.error(e.getMessage()); + return new ResultData(Result.ERROR, e.getMessage()); + } + return new ResultData(JSON.toJSONString(retObj)); + } else { + logger.error(resStr); + return new ResultData(Result.ERROR, retObj.getString(WxPayConstant.ERR_CODE_DESC)); + } } } else { return new ResultData(Result.ERROR, "无返回值"); @@ -446,6 +540,17 @@ public class PosBrunService { logger.error(e.getMessage()); return new ResultData(Result.ERROR, e.getMessage()); } + // 5. 同步给fm pos进程 + // 5.1 posOrder信息 + PosOrder syncOrder = posOrderService.getById(posOrder.getId()); + if (syncOrder != null) { + // 5.2 posPayOrder信息 + PosPayOrder q = new PosPayOrder(); + q.setOrderId(posOrder.getId()); + List posPayOrders = posPayOrderService.getList(q); + + } + return new ResultData(); } } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/PosOrder.java b/mallinkService/src/main/java/com/iformall/domain/po/PosOrder.java index d1fe3ec3f..ffb669e1d 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/PosOrder.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/PosOrder.java @@ -33,6 +33,8 @@ public class PosOrder implements Serializable { private Integer paymentType; @io.swagger.annotations.ApiModelProperty(value="支付金额:允许有负数,退款时为负值。核销时,金额可以不填写",name="paymentType") private Integer payment; + @io.swagger.annotations.ApiModelProperty(value="支付剩余金额",name="remainAmount") + private Integer remainAmount; @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") private Date createDate; @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumPosOrderStatus.java b/mallinkService/src/main/java/com/iformall/enums/EnumPosOrderStatus.java index 3d5db965c..7c9608948 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumPosOrderStatus.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumPosOrderStatus.java @@ -8,15 +8,19 @@ package com.iformall.enums; public enum EnumPosOrderStatus { PENDING_PAYMENT(0, "待付款"), - PAYMENT_SUCCESS(1, "已支付"), - OVERTIME_CANCEL(2, "已取消"), - PENDING_REFUND(3, "待退款"), - REFUND_SUCCESS(4,"已退款"), - REFUND_FAILD(5, "退款失败"), + PENDING(1, "支付中"), + PAYMENT_SUCCESS(2, "已支付"), + OVERTIME_CANCEL(3, "已取消"), + PENDING_REFUND(4, "待退款"), + REFUNDING(5, "退款中"), + REFUND_SUCCESS(6,"已退款"), + REFUND_FAILD(7, "退款失败"), PENDING_VERIFY(10, "待核销"), - VERIFY_SUCCESS(11, "已核销"), - VERIFY_CANCEL(12, "核销待退"), - VERIFY_CANCELED(13, "核销已退") + VERIFING(11, "核销中"), + VERIFY_SUCCESS(12, "已核销"), + VERIFY_CANCEL(13, "核销待退"), + VERIFY_CANCELING(14, "核销退中"), + VERIFY_CANCELED(15, "核销已退") ; diff --git a/mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java b/mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java index 8d2cf8628..fa755b23a 100644 --- a/mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java +++ b/mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java @@ -64,6 +64,7 @@ public class WxPayConstant { public final static String DEDUCT_AMOUNT = "deduct_amount"; public final static String REMAIN_AMOUNT = "remain_amount"; + public final static String ORDER_STATUS = "order_status"; public final static String REAL_AMOUNT = "real_amount"; public final static String SALE_PRICE = "sale_price"; diff --git a/mallinkService/src/main/java/com/iformall/service/PosPayOrderService.java b/mallinkService/src/main/java/com/iformall/service/PosPayOrderService.java index 823e36ab3..dd64c4aa9 100644 --- a/mallinkService/src/main/java/com/iformall/service/PosPayOrderService.java +++ b/mallinkService/src/main/java/com/iformall/service/PosPayOrderService.java @@ -1,9 +1,10 @@ package com.iformall.service; -import java.util.*; import com.github.pagehelper.PageInfo; import com.iformall.domain.po.PosPayOrder; +import java.util.List; + public interface PosPayOrderService { /** @@ -15,6 +16,14 @@ public interface PosPayOrderService { * @return */ PageInfo listAsPage(PosPayOrder record, Integer pageIndex, Integer pageSize); + + /** + * 根据实体查询列表 + * + * @param record + * @return + */ + List getList(PosPayOrder record); /** * 根据Id获得实体 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java index a26f7ccb6..8f831f748 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java @@ -32,6 +32,9 @@ public class PosOrderServiceImpl implements PosOrderService { final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); record.setPosOrderNo(String.valueOf(record.getId())); + if (record.getPayment() != null) { + record.setRemainAmount(record.getPayment()); + } posOrderMapper.insertSelective(record); } else { posOrderMapper.updateByPrimaryKeySelective(record); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/PosPayOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/PosPayOrderServiceImpl.java index 457077ccb..f29dfd866 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/PosPayOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/PosPayOrderServiceImpl.java @@ -22,6 +22,11 @@ public class PosPayOrderServiceImpl implements PosPayOrderService { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> posPayOrderMapper.findList(record)); } + @Override + public List getList(PosPayOrder record) { + return posPayOrderMapper.findList(record); + } + @Override public PosPayOrder getById(Long id) { return posPayOrderMapper.selectByPrimaryKey(id); @@ -33,6 +38,7 @@ public class PosPayOrderServiceImpl implements PosPayOrderService { //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); + record.setPayOrderNo(String.valueOf(record.getId())); posPayOrderMapper.insertSelective(record); } else { posPayOrderMapper.updateByPrimaryKeySelective(record); From e16da130fe509ae745c91c55164641b82292721f Mon Sep 17 00:00:00 2001 From: luozukai Date: Thu, 22 Aug 2019 18:55:36 +0800 Subject: [PATCH 15/15] =?UTF-8?q?[=E5=90=88=E5=90=8C][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=B4=A6=E5=8D=95=E7=BB=93=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/service/impl/WxRentContractServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index c2bb6fa38..9f5817c81 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -322,7 +322,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //计算超出部分 BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)); - BigDecimal balance = new BigDecimal(revenueLong).subtract(end.multiply(new BigDecimal(1000000))); + BigDecimal balance = revenue.subtract(end).multiply(new BigDecimal(1000000)); BigDecimal price = balance.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); array = ratioList.get(i-1).split(":");