From 3b7a214e91ba32be9e6c9d40cf672e9a77cb5dd8 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Tue, 10 Sep 2019 12:54:51 +0800 Subject: [PATCH 01/10] =?UTF-8?q?[=E5=88=86=E8=B4=A6=E8=B4=A6=E6=88=B7][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E5=90=8C=E4=B8=80=E4=B8=AA=E5=95=86?= =?UTF-8?q?=E5=9C=BA=E4=B8=8B=E6=9C=89=E4=B8=8D=E5=90=8C=E5=95=86=E6=88=B7?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=90=8C=E4=B8=80=E4=B8=AA=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=88=A0=E9=99=A4=E5=BE=AE=E4=BF=A1=E8=B4=A6?= =?UTF-8?q?=E6=88=B7]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WxProfitSharingReceiverServiceImpl.java | 115 ++++++++++-------- 1 file changed, 65 insertions(+), 50 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java index b779c3dd8..3364d4fc5 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java @@ -117,8 +117,9 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv receiver.setMerchantId(merchant.getId()); receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); receiver.setId(IdWorker.get().nextId()); - receiver.setCreateTime(new Date()); - receiver.setUpdateTime(new Date()); + Date date = new Date(); + receiver.setCreateTime(date); + receiver.setUpdateTime(date); receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); receiver.setIsUse(EnumProfitSharingUse.APPLY.getCode()); //passed from uplevel @@ -258,61 +259,75 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv if (receiver == null) return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage()); - //删除分账账户从微信服务器 - WxProfitSharingReceiverP wxProfitSharingReceiverP = new WxProfitSharingReceiverP(); - wxProfitSharingReceiverP.setAppid(appInfo.getParentAppId()); - wxProfitSharingReceiverP.setMch_id(payAccount.getMchId()); - wxProfitSharingReceiverP.setSub_appid(appInfo.getAppId()); - wxProfitSharingReceiverP.setSub_mch_id(payAccount.getSubMchId()); - wxProfitSharingReceiverP.setNonce_str(Utility.generate32UUID()); - wxProfitSharingReceiverP.setSign_type("HMAC-SHA256"); - - JSONObject receiverJSON = new JSONObject(); - receiverJSON.put("type", EnumProfitSharingReceiverType.getEnum(receiver.getReceiverType()).getMessage()); - receiverJSON.put("account", receiver.getReceiverAccount()); - - wxProfitSharingReceiverP.setReceiver(receiverJSON.toJSONString()); - String response; - try { - wxProfitSharingReceiverP.setSign(WxPayment.createSignHMAC(BeanUtils.toStringMap(wxProfitSharingReceiverP), payAccount.getApiKey())); - response = WxProfitSharing.delReceiver(BeanUtils.toStringMap(wxProfitSharingReceiverP)); - } catch (Exception e) { - logger.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + e.getMessage()); - return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED, e.getMessage()); - } - Map returnMap = WxPayment.xmlToMap(response); - String return_code = returnMap.get("return_code"); - if (!"SUCCESS".equals(return_code)) { - logger.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + returnMap.get("return_msg")); - return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), returnMap.get("return_msg")); - } + //检查此接受者是否注册在同一个商场的别的商户下 + final WxProfitSharingReceiver receiverParam = receiver; + WxProfitSharingReceiver params = new WxProfitSharingReceiver(); + params.setTenantId(receiver.getTenantId()); + params.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); + List receiverList = wxProfitSharingReceiverMapper.findList(params); + if (receiverList.stream().anyMatch(r -> ( + r.getReceiverType().equals(receiverParam.getReceiverType()) && + r.getReceiverAccount().equals(receiverParam.getReceiverAccount()) && + r.getTrueName().equals(receiverParam.getTrueName()) && + !r.getMerchantId().equals(receiverParam.getMerchantId()) + ))) { + //还有别的商户使用这个账号,不从微信服务器申请删除 + } else { + //删除分账账户从微信服务器 + WxProfitSharingReceiverP wxProfitSharingReceiverP = new WxProfitSharingReceiverP(); + wxProfitSharingReceiverP.setAppid(appInfo.getParentAppId()); + wxProfitSharingReceiverP.setMch_id(payAccount.getMchId()); + wxProfitSharingReceiverP.setSub_appid(appInfo.getAppId()); + wxProfitSharingReceiverP.setSub_mch_id(payAccount.getSubMchId()); + wxProfitSharingReceiverP.setNonce_str(Utility.generate32UUID()); + wxProfitSharingReceiverP.setSign_type("HMAC-SHA256"); + + JSONObject receiverJSON = new JSONObject(); + receiverJSON.put("type", EnumProfitSharingReceiverType.getEnum(receiver.getReceiverType()).getMessage()); + receiverJSON.put("account", receiver.getReceiverAccount()); + + wxProfitSharingReceiverP.setReceiver(receiverJSON.toJSONString()); + String response; + try { + wxProfitSharingReceiverP.setSign(WxPayment.createSignHMAC(BeanUtils.toStringMap(wxProfitSharingReceiverP), payAccount.getApiKey())); + response = WxProfitSharing.delReceiver(BeanUtils.toStringMap(wxProfitSharingReceiverP)); + } catch (Exception e) { + logger.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + e.getMessage()); + return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED, e.getMessage()); + } + Map returnMap = WxPayment.xmlToMap(response); + String return_code = returnMap.get("return_code"); + if (!"SUCCESS".equals(return_code)) { + logger.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + returnMap.get("return_msg")); + return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), returnMap.get("return_msg")); + } - String result_code = returnMap.get("result_code"); - if (!"SUCCESS".equals(result_code)) { + String result_code = returnMap.get("result_code"); + if (!"SUCCESS".equals(result_code)) { - if (returnMap.get("err_code").contains("USER_NOT_EXIST")) { - receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_INVALID.getCode()); - receiver.setUpdateTime(new Date()); - wxProfitSharingReceiverMapper.updateByPrimaryKeySelective(receiver); + if (returnMap.get("err_code").contains("USER_NOT_EXIST")) { + receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_INVALID.getCode()); + receiver.setUpdateTime(new Date()); + wxProfitSharingReceiverMapper.updateByPrimaryKeySelective(receiver); + } + logger.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + returnMap.get("err_code_des")); + return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), returnMap.get("err_code_des")); } - logger.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + returnMap.get("err_code_des")); - return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), returnMap.get("err_code_des")); - } - if (!WxPayment.verifyNotifyHMAC(returnMap, payAccount.getApiKey())) { - logger.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage()); - return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), "verifyNotifyHMAC"); - } + if (!WxPayment.verifyNotifyHMAC(returnMap, payAccount.getApiKey())) { + logger.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage()); + return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), "verifyNotifyHMAC"); + } - receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_INVALID.getCode()); - receiver.setUpdateTime(new Date()); - wxProfitSharingReceiverMapper.updateByPrimaryKeySelective(receiver); + receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_INVALID.getCode()); + receiver.setUpdateTime(new Date()); + wxProfitSharingReceiverMapper.updateByPrimaryKeySelective(receiver); - //发送短信 - if (send.equals(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode())) { - sendMsgByType(EnumMsgModel.DELETE_SHARING_ACCOUNT_NOTIFY_MERCHANT.getCode(), receiver.getMerchantId(), receiver.getReceiverAccount(), receiver.getTenantId()); + //发送短信 + if (send.equals(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode())) { + sendMsgByType(EnumMsgModel.DELETE_SHARING_ACCOUNT_NOTIFY_MERCHANT.getCode(), receiver.getMerchantId(), receiver.getReceiverAccount(), receiver.getTenantId()); + } } - return new ResultData(); } From b214e001bfcb4b820ea5b04ca46ed3e48821282b Mon Sep 17 00:00:00 2001 From: gongbiao Date: Tue, 10 Sep 2019 13:59:10 +0800 Subject: [PATCH 02/10] =?UTF-8?q?[BUG][=E4=BF=AE=E6=94=B9][=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E7=8E=AF=E5=A2=83=EF=BC=9A=E5=95=86=E6=88=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98?= =?UTF-8?q?-=E5=A4=9A=E5=95=86=E6=88=B7=E6=98=BE=E7=A4=BA]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/WxBillAllMapper.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index e39f08bc7..c231329ad 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -733,7 +733,6 @@ select tt.* from ( select m.tenant_id,m.id,m.name,ws.shop_number shopNumber,ws.type,m.link_person linkPerson,m.link_phone linkPhone, xb.title business,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.rent_shop_type, - round( (select sum(bill.receive_pay) from ( select merchant_id,receive_pay from wx_bill_rent where is_preview = 0 and status not in(3,6) @@ -805,10 +804,14 @@ select receive_pay money,merchant_id id from wx_bill_other_deposit where status = 3 )ss where ss.id = m.id )/100,2)) balance - - from wx_merchant m left join wx_merchant_shop wms on wms.merchant_id = m.id left join wx_shop ws on wms.shop_id = ws.id + + from wx_merchant m + left join (select ms.merchant_id,s.type,GROUP_CONCAT(s.shop_number) as shop_number + from wx_merchant_shop ms inner join wx_shop s on ms.shop_id=s.id where ms.is_del=0 + group by ms.merchant_id) ws on m.id=ws.merchant_id left join wx_business xb on(m.business_id = xb.id) left join wx_rent_contract rc on(rc.merchant_id = m.id) + where m.status=1 ) tt where tt.receivePay >0 and tt.payOut>0 and tt.tenant_id = #{tenantId} From b9acb65b59cf643c4fdf1b7971ca0f74a8e2f2d9 Mon Sep 17 00:00:00 2001 From: luozukai Date: Tue, 10 Sep 2019 14:03:00 +0800 Subject: [PATCH 03/10] =?UTF-8?q?[=E4=BF=AE=E6=94=B9][=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=8D=95][=E4=BF=AE=E6=94=B9=E4=B8=9A=E6=80=81=E5=88=86?= =?UTF-8?q?=E6=9E=90]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/iformall/controller/WxBillController.java | 2 -- mallinkService/src/main/resources/mapper/WxBillAllMapper.xml | 2 -- 2 files changed, 4 deletions(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java index 0ac69f54f..f1ba9e950 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java @@ -9,7 +9,6 @@ import com.iformall.domain.vo.WxBillAll; import com.iformall.enums.EnumMerchantStatus; import com.iformall.service.WxBillAllService; import com.iformall.service.WxBillSettleService; -import com.iformall.service.WxMerchantBUserService; import com.iformall.service.WxMerchantService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -19,7 +18,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; - import java.util.List; import java.util.Map; diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index c231329ad..97ba1936f 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -367,8 +367,6 @@ ) bill on(bb.bill_id=bill.id) where bb.settle_id = s.id and bb.type=1 ) - - - (select IFNULL(sum(settle_money),0) from wx_bill_settle_record where settle_id = s.id) ) receive_pay ,0 pay,0 owe,s.createtime receive_date,'' pay_date,0 expired_day,status,'' starttime,'' endtime,'' rent_shop_type,'' price_detail, 0 freeze from wx_bill_settle s where s.tenant_id=#{tenantId} and s.status >0 From 682cba11592aa1439eaa37ae2b4770351aeb62b2 Mon Sep 17 00:00:00 2001 From: luozukai Date: Tue, 10 Sep 2019 15:32:04 +0800 Subject: [PATCH 04/10] =?UTF-8?q?[=E4=BF=AE=E6=94=B9][=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=8D=95][=E4=BF=AE=E6=94=B9=E8=B7=B3=E7=82=B9=E7=8E=87?= =?UTF-8?q?=E8=AE=A1=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/service/impl/WxFlowServiceImpl.java | 4 ++-- .../service/impl/WxRentContractServiceImpl.java | 10 ++++++---- .../src/main/resources/mapper/WxBillAllMapper.xml | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index 65e4aa9ab..b4abb970c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -311,8 +311,8 @@ public class WxFlowServiceImpl implements WxFlowService { wxBillSettleService.updateFreezeOrStatus(settle.getPayBillIds(),EnumFreezeType.DEF.getCode(),EnumBillRentStatus.PAID.getCode()); }else if(EnumRentContractAppStatus.SETBACK.getCode().intValue() == applyStatus.intValue() || EnumRentContractAppStatus.REJECT.getCode().intValue() == applyStatus.intValue()) { //解冻 - wxBillSettleService.updateFreezeOrStatus(settle.getReceiveBillIds(), EnumFreezeType.DEF.getCode(),EnumBillRentStatus.PAID.getCode()); - wxBillSettleService.updateFreezeOrStatus(settle.getPayBillIds(),EnumFreezeType.DEF.getCode(),EnumBillRentStatus.PAID.getCode()); + wxBillSettleService.updateFreezeOrStatus(settle.getReceiveBillIds(), EnumFreezeType.DEF.getCode(),null); + wxBillSettleService.updateFreezeOrStatus(settle.getPayBillIds(),EnumFreezeType.DEF.getCode(),null); } wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); } 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 9c95294c4..6fb910a79 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -283,7 +283,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { ratioVo.setUseRatio("["); for (int i = 0; i < ratioList.size(); i++) { - BigDecimal revenue = new BigDecimal(revenueLong).divide(new BigDecimal(1000000)).setScale(4, RoundingMode.HALF_EVEN); + BigDecimal revenue = new BigDecimal(revenueLong).divide(new BigDecimal(1000000)).setScale(8, RoundingMode.HALF_EVEN); String e = ratioList.get(i); String[] array = e.split(":"); Integer ratio = Integer.parseInt(array[1]); @@ -316,7 +316,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (revenue.compareTo(start) >= 0 && revenue.compareTo(end)<= 0){ ratioVo.setRatio(ratio); ratioVo.setPrice(countPrice(ratioVo.getRatio(),revenueLong,timeType,period,from)); - ratioVo.setUseRatio(ratioVo.getUseRatio()+e+","); + ratioVo.setUseRatio(ratioVo.getUseRatio()+"'"+e+"',"); break; } }else if(e.indexOf(">") >= 0){ @@ -343,7 +343,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (revenue.compareTo(end) >= 0){ ratioVo.setRatio(ratio); - ratioVo.setUseRatio(ratioVo.getUseRatio()+e+","); + ratioVo.setUseRatio(ratioVo.getUseRatio()+"'"+e+"',"); //计算超出部分 BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)); @@ -354,12 +354,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { Integer frontatio = Integer.parseInt(array[1]); revenueArray = array[0].split("-"); - BigDecimal frontEnd = new BigDecimal(0); + BigDecimal frontEnd; if(EnumGetRatioFrom.BILL.getCode().equals(from)){ if(EnumMissTimeType.YEAR.getCode().equals(timeType)){ frontEnd = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount)); }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ frontEnd = new BigDecimal(revenueArray[1]).divide(new BigDecimal(30), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount)); + }else{ + frontEnd = new BigDecimal(revenueArray[1]); } }else{ frontEnd = new BigDecimal(revenueArray[1]); diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index 97ba1936f..42360c9f4 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -826,21 +826,22 @@ from ( 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,shop_info,NULL comments,'' price_detail,updatetime from wx_bill_rent_deposit where + endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze from wx_bill_rent_deposit where tenant_id=#{tenantId} 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,shop_info,NULL comments,'' price_detail,updatetime from wx_bill_property_deposit where + endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze from wx_bill_property_deposit where tenant_id=#{tenantId} union all select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime, - rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime + rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze from wx_bill_other_deposit where tenant_id=#{tenantId} ) bill where 1=1 + and bill.freeze = #{freeze} and bill.status = #{status} and bill.merchant_id=#{merchantId} From 41db740a469f2ecb6573d9b2163eceb33eeed7dc Mon Sep 17 00:00:00 2001 From: gongbiao Date: Tue, 10 Sep 2019 15:32:03 +0800 Subject: [PATCH 05/10] =?UTF-8?q?[=E8=B4=A6=E5=8D=95][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=85=B6=E4=BB=96=E6=8A=BC=E9=87=91=E6=97=B6?= =?UTF-8?q?=E6=AC=A0=E7=BC=B4=E9=87=91=E9=A2=9D]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/service/impl/WxBillAllServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 a3c3dd23c..cd045b6e3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -1184,7 +1184,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { Date date = new Date(); daily.setCreatetime(date); daily.setUpdatetime(date); - daily.setOwe(receivePay); + daily.setOwe(receivePay - pay); daily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); daily.setStarttime(bill.getStarttime()); daily.setEndtime(bill.getEndtime()); @@ -1249,7 +1249,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { Date date = new Date(); other.setCreatetime(date); other.setUpdatetime(date); - other.setOwe(receivePay); + other.setOwe(receivePay - pay); other.setIsDel(EnumDelStatus.NOT_DEL.getCode()); other.setStarttime(bill.getStarttime()); other.setEndtime(bill.getEndtime()); @@ -1316,7 +1316,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { otherDeposit.setCreatetime(date); otherDeposit.setUpdatetime(date); otherDeposit.setExpiredDay(0L); - otherDeposit.setOwe(receivePay); + otherDeposit.setOwe(receivePay - pay); otherDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); otherDeposit.setStarttime(bill.getStarttime()); otherDeposit.setEndtime(bill.getEndtime()); From 2a298e4e04ba0abe84e55223d16e0020a382e842 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Tue, 10 Sep 2019 15:33:37 +0800 Subject: [PATCH 06/10] =?UTF-8?q?[=E4=B8=9A=E6=80=81=E5=88=86=E6=9E=90][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E6=8E=92=E9=99=A4=E6=9C=AA=E8=AE=A1?= =?UTF-8?q?=E7=A7=9F=E7=9A=84=E5=90=88=E5=90=8C]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxBusinessServiceImpl.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java index e74af8e8a..be5b90051 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java @@ -4,10 +4,9 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.ResultData; import com.iformall.domain.po.*; -import com.iformall.enums.EnumBusinessConType; import com.iformall.enums.EnumBusinessFilter; import com.iformall.enums.EnumIsPreview; -import com.iformall.enums.EnumRentContractType; +import com.iformall.enums.EnumRentContractStatus; import com.iformall.mapper.WxBusinessMapper; import com.iformall.mapper.WxPropertyContractMapper; import com.iformall.mapper.WxRentContractMapper; @@ -20,9 +19,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; @Service public class WxBusinessServiceImpl implements WxBusinessService { @@ -80,7 +81,10 @@ public class WxBusinessServiceImpl implements WxBusinessService { query.setBusinessId((Integer) e.get("id")); List rentContractList = wxRentContractMapper.select(query); for (WxRentContract dbRent:rentContractList ) { - if(StringUtils.isBlank(dbRent.getRentInfo())){ + if (StringUtils.isBlank(dbRent.getRentInfo()) || + dbRent.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) || + dbRent.getStatus().equals(EnumRentContractStatus.RENT_PAID.getCode()) || + dbRent.getStatus().equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())) { System.out.println("rent rentInfo is null:{}"+dbRent.getId()); continue; } @@ -99,7 +103,10 @@ public class WxBusinessServiceImpl implements WxBusinessService { pquery.setBusinessId((Integer) e.get("id")); List propertyContractList = wxPropertyContractMapper.select(pquery); for (WxPropertyContract dbRent:propertyContractList) { - if(StringUtils.isBlank(dbRent.getRentInfo())){ + if (StringUtils.isBlank(dbRent.getRentInfo()) || + dbRent.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) || + dbRent.getStatus().equals(EnumRentContractStatus.RENT_PAID.getCode()) || + dbRent.getStatus().equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())) { System.out.println("property rentInfo is null:{}"+dbRent.getId()); continue; } From 05ec17472f7faf2a51190acf88326ec9b6b092f5 Mon Sep 17 00:00:00 2001 From: luozukai Date: Tue, 10 Sep 2019 15:58:05 +0800 Subject: [PATCH 07/10] =?UTF-8?q?[=E4=BF=AE=E6=94=B9][=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=8D=95][=E4=BF=AE=E6=94=B9=E8=B7=B3=E7=82=B9=E7=8E=87?= =?UTF-8?q?=E8=AE=A1=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/service/test/Test.java | 24 +++++++++++++++++-- .../java/com/iformall/mq/MqBaseProducer.java | 3 ++- .../mq/impl/RabbitMqMessageProducer.java | 17 +++++++++++-- .../mq/impl/RocketMqMessageProducer.java | 6 +++++ 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/mallinkAdmin/src/test/java/com/iformall/service/test/Test.java b/mallinkAdmin/src/test/java/com/iformall/service/test/Test.java index 6f66d1274..fdd19daf2 100644 --- a/mallinkAdmin/src/test/java/com/iformall/service/test/Test.java +++ b/mallinkAdmin/src/test/java/com/iformall/service/test/Test.java @@ -2,11 +2,13 @@ package com.iformall.service.test; import com.alibaba.fastjson.JSON; import com.iformall.domain.po.*; +import com.iformall.domain.po.msg.WxMsgRecord; import com.iformall.domain.vo.WxBillAll; -import com.iformall.enums.EnumSettleRecordWay; -import com.iformall.enums.EnumSettleStatus; +import com.iformall.enums.*; import com.iformall.mapper.WxBillSettleMapper; +import com.iformall.mq.MqBaseProducer; import com.iformall.service.*; +import com.iformall.utils.Constant; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.UsernamePasswordToken; @@ -32,6 +34,8 @@ import org.springframework.web.context.WebApplicationContext; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.Date; +import java.util.HashMap; +import java.util.Map; @Slf4j @AutoConfigureMockMvc @@ -62,6 +66,10 @@ public class Test { private MockMvc mockMvc; + @Autowired + MqBaseProducer mqBaseProducer; + + @Autowired private WxBillSettleService wxBillSettleService; @Autowired @@ -121,6 +129,18 @@ public class Test { wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); } + @org.junit.Test + public void testmq(){ + Map dynamicContentMap = new HashMap<>(); + dynamicContentMap.put("page", Constant.adminPage); + WxMsgRecord wxMsgRecord = new WxMsgRecord(); + wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); + wxMsgRecord.setModelType(EnumMsgModel.FLOW_ASSIGNEE_NODIFY.getCode()); + wxMsgRecord.setReceiver("18601973448"); + wxMsgRecord.setTenantId("456"); + wxMsgRecord.setDynamicContentMap(dynamicContentMap); + mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); + } } diff --git a/mallinkService/src/main/java/com/iformall/mq/MqBaseProducer.java b/mallinkService/src/main/java/com/iformall/mq/MqBaseProducer.java index 93c836a64..0494be5c8 100644 --- a/mallinkService/src/main/java/com/iformall/mq/MqBaseProducer.java +++ b/mallinkService/src/main/java/com/iformall/mq/MqBaseProducer.java @@ -1,8 +1,9 @@ package com.iformall.mq; import com.iformall.domain.po.msg.BaseMsg; +import org.springframework.amqp.rabbit.core.RabbitTemplate; -public interface MqBaseProducer { +public interface MqBaseProducer extends RabbitTemplate.ConfirmCallback{ void sendMessage(BaseMsg record, String topic, String tags, String keys); } diff --git a/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java b/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java index df79df4d5..87d94249c 100644 --- a/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java +++ b/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java @@ -1,7 +1,6 @@ package com.iformall.mq.impl; import com.iformall.domain.po.msg.BaseMsg; -import com.iformall.enums.EnumMsgRecordStatus; import com.iformall.mapper.WxMsgRecordMapper; import com.iformall.mq.MQConfig; import com.iformall.mq.MqBaseProducer; @@ -10,6 +9,7 @@ import com.iformall.utils.JsonUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.core.AmqpTemplate; +import org.springframework.amqp.rabbit.support.CorrelationData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; @@ -31,17 +31,30 @@ public class RabbitMqMessageProducer implements MqBaseProducer { @Autowired private WxMsgRecordService wxMsgRecordService; + @Override + public void confirm(CorrelationData correlationData, boolean b, String s) { + log.info("------correlationData"+correlationData.toString()); + System.out.println(); + if(b){ + System.out.println(); + }else{ + + } + } + @Override public void sendMessage(BaseMsg data, String topic, String tags, String keys) { try { data.setUuid(UUID.randomUUID().toString()); wxMsgRecordService.save(data); - rabbitTemplate.convertAndSend(topic, JsonUtil.obj2Json(data)); + CorrelationData correlationData = new CorrelationData("16746324"); + rabbitTemplate.convertAndSend(topic, JsonUtil.obj2Json(data),correlationData); // data.setMsgStatus(EnumMsgRecordStatus.SEND_SUCC.getCode()); // wxMsgRecordMapper.update(data); log.info(data.getUuid()+"发送mq成功。"); + } catch (Exception e) { log.error("RabbitMqMessageProducer: Send Message Error ", e); } diff --git a/mallinkService/src/main/java/com/iformall/mq/impl/RocketMqMessageProducer.java b/mallinkService/src/main/java/com/iformall/mq/impl/RocketMqMessageProducer.java index 25ac16e20..5493801db 100644 --- a/mallinkService/src/main/java/com/iformall/mq/impl/RocketMqMessageProducer.java +++ b/mallinkService/src/main/java/com/iformall/mq/impl/RocketMqMessageProducer.java @@ -14,6 +14,7 @@ import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.remoting.common.RemotingHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.amqp.rabbit.support.CorrelationData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; @@ -42,6 +43,11 @@ public class RocketMqMessageProducer implements MqBaseProducer { @Autowired private WxMsgRecordService wxMsgRecordService; + @Override + public void confirm(CorrelationData correlationData, boolean b, String s) { + + } + @PostConstruct public void start(){ try { From c5f11c66a29f3754399edc0119571e6e125f9ac0 Mon Sep 17 00:00:00 2001 From: luozukai Date: Tue, 10 Sep 2019 16:01:28 +0800 Subject: [PATCH 08/10] =?UTF-8?q?[=E4=BF=AE=E6=94=B9][=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=8D=95][=E4=BF=AE=E6=94=B9=E8=B7=B3=E7=82=B9=E7=8E=87?= =?UTF-8?q?=E8=AE=A1=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/mq/MqBaseProducer.java | 2 +- .../mq/impl/RabbitMqMessageProducer.java | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/mq/MqBaseProducer.java b/mallinkService/src/main/java/com/iformall/mq/MqBaseProducer.java index 0494be5c8..a7994bd02 100644 --- a/mallinkService/src/main/java/com/iformall/mq/MqBaseProducer.java +++ b/mallinkService/src/main/java/com/iformall/mq/MqBaseProducer.java @@ -3,7 +3,7 @@ package com.iformall.mq; import com.iformall.domain.po.msg.BaseMsg; import org.springframework.amqp.rabbit.core.RabbitTemplate; -public interface MqBaseProducer extends RabbitTemplate.ConfirmCallback{ +public interface MqBaseProducer { void sendMessage(BaseMsg record, String topic, String tags, String keys); } diff --git a/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java b/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java index 87d94249c..036ed2b58 100644 --- a/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java +++ b/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java @@ -30,17 +30,17 @@ public class RabbitMqMessageProducer implements MqBaseProducer { private WxMsgRecordMapper wxMsgRecordMapper; @Autowired private WxMsgRecordService wxMsgRecordService; - - @Override - public void confirm(CorrelationData correlationData, boolean b, String s) { - log.info("------correlationData"+correlationData.toString()); - System.out.println(); - if(b){ - System.out.println(); - }else{ - - } - } +// +// @Override +// public void confirm(CorrelationData correlationData, boolean b, String s) { +// log.info("------correlationData"+correlationData.toString()); +// System.out.println(); +// if(b){ +// System.out.println(); +// }else{ +// +// } +// } @Override public void sendMessage(BaseMsg data, String topic, String tags, String keys) { @@ -48,8 +48,8 @@ public class RabbitMqMessageProducer implements MqBaseProducer { data.setUuid(UUID.randomUUID().toString()); wxMsgRecordService.save(data); - CorrelationData correlationData = new CorrelationData("16746324"); - rabbitTemplate.convertAndSend(topic, JsonUtil.obj2Json(data),correlationData); + //CorrelationData correlationData = new CorrelationData("16746324"); + rabbitTemplate.convertAndSend(topic, JsonUtil.obj2Json(data)); // data.setMsgStatus(EnumMsgRecordStatus.SEND_SUCC.getCode()); // wxMsgRecordMapper.update(data); From 5c1e5f4c10705a5e97c3b1b34f697c07c5f499aa Mon Sep 17 00:00:00 2001 From: luozukai Date: Tue, 10 Sep 2019 16:02:55 +0800 Subject: [PATCH 09/10] =?UTF-8?q?[=E4=BF=AE=E6=94=B9][=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=8D=95][=E4=BF=AE=E6=94=B9=E8=B7=B3=E7=82=B9=E7=8E=87?= =?UTF-8?q?=E8=AE=A1=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/mq/impl/RocketMqMessageProducer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/mq/impl/RocketMqMessageProducer.java b/mallinkService/src/main/java/com/iformall/mq/impl/RocketMqMessageProducer.java index 5493801db..aaee62088 100644 --- a/mallinkService/src/main/java/com/iformall/mq/impl/RocketMqMessageProducer.java +++ b/mallinkService/src/main/java/com/iformall/mq/impl/RocketMqMessageProducer.java @@ -43,10 +43,10 @@ public class RocketMqMessageProducer implements MqBaseProducer { @Autowired private WxMsgRecordService wxMsgRecordService; - @Override - public void confirm(CorrelationData correlationData, boolean b, String s) { - - } +// @Override +// public void confirm(CorrelationData correlationData, boolean b, String s) { +// +// } @PostConstruct public void start(){ From 3bda9d3e28d6b850d9f41d239c4c6391de01545b Mon Sep 17 00:00:00 2001 From: luozukai Date: Tue, 10 Sep 2019 16:08:59 +0800 Subject: [PATCH 10/10] =?UTF-8?q?[=E4=BF=AE=E6=94=B9][=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=8D=95][=E4=BF=AE=E6=94=B9=E8=B7=B3=E7=82=B9=E7=8E=87?= =?UTF-8?q?=E8=AE=A1=E7=AE=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/service/impl/WxRentContractServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 6fb910a79..f16aa55d0 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -316,7 +316,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (revenue.compareTo(start) >= 0 && revenue.compareTo(end)<= 0){ ratioVo.setRatio(ratio); ratioVo.setPrice(countPrice(ratioVo.getRatio(),revenueLong,timeType,period,from)); - ratioVo.setUseRatio(ratioVo.getUseRatio()+"'"+e+"',"); + ratioVo.setUseRatio(ratioVo.getUseRatio()+"\""+e+"\","); break; } }else if(e.indexOf(">") >= 0){ @@ -343,7 +343,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (revenue.compareTo(end) >= 0){ ratioVo.setRatio(ratio); - ratioVo.setUseRatio(ratioVo.getUseRatio()+"'"+e+"',"); + ratioVo.setUseRatio(ratioVo.getUseRatio()+"\""+e+"\","); //计算超出部分 BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000));