From 4dd1e166fe8219c0f6722b5be4516b38c266003a Mon Sep 17 00:00:00 2001 From: panshuling321 Date: Tue, 10 May 2022 17:36:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AF=B9=E8=B4=A6=E5=8D=95?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=9F=E6=88=B7=E7=9A=84=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XhpcTradebillInternetBillController.java | 21 +++++++++-- .../XhpcTradebillPaymentBillController.java | 15 ++++++-- ...hpcTradebillInternetCheckRecordDomain.java | 2 + ...XhpcTradebillPaymentCheckRecordDomain.java | 2 + .../activity/service/InternetBillService.java | 3 +- .../activity/service/PaymentBillService.java | 3 +- .../service/impl/CommonServiceImpl.java | 31 ++++++++-------- .../service/impl/InternetBillServiceImpl.java | 6 ++- .../service/impl/PaymentBillServiceImpl.java | 6 ++- ...XhpcTradebillInternetCheckRecordMapper.xml | 37 +++++++++++-------- .../XhpcTradebillPaymentCheckRecordMapper.xml | 27 ++++++++++---- 11 files changed, 101 insertions(+), 52 deletions(-) diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcTradebillInternetBillController.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcTradebillInternetBillController.java index 16ddbd0b..57fd610f 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcTradebillInternetBillController.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcTradebillInternetBillController.java @@ -3,14 +3,18 @@ package com.xhpc.activity.controller; import com.xhpc.activity.domain.XhpcTradebillInternetCheckRecordDomain; import com.xhpc.activity.service.InternetBillService; +import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.log.annotation.Log; import com.xhpc.common.log.enums.BusinessType; +import com.xhpc.common.util.LogUserUtils; +import com.xhpc.system.api.model.LoginUser; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.Map; @@ -23,6 +27,8 @@ public class XhpcTradebillInternetBillController extends BaseController { @Resource InternetBillService internetBillService; + @Resource + LogUserUtils logUserUtils; @GetMapping("/checkList/{uploadId}") public AjaxResult getCheckList(@RequestParam(required = false) Integer uploadId, @@ -42,8 +48,8 @@ public class XhpcTradebillInternetBillController extends BaseController { @GetMapping("/checkPage") - public TableDataInfo getCheckPage( - @RequestParam(required = false) String tenantId, + public TableDataInfo getCheckPage(HttpServletRequest request, + @RequestParam(required = false) String tenantId, @RequestParam(required = false) Long operatorId, @RequestParam(required = false) Long chargingStationId, @RequestParam(required = false) Integer uploadId, @@ -51,6 +57,10 @@ public class XhpcTradebillInternetBillController extends BaseController { @RequestParam(required = false) String station, @RequestParam(required = false) String internetName, @RequestParam(required = false) Integer status){ + LoginUser loginUser = logUserUtils.getLogUser(request); + if (StringUtils.isEmpty(tenantId)){ + tenantId = loginUser.getTenantId(); + } Map params = new HashMap<>(); params.put("tenantId", tenantId); @@ -61,14 +71,13 @@ public class XhpcTradebillInternetBillController extends BaseController { params.put("stationName", station); params.put("internetName", internetName); params.put("status", status); - startPage(); return getDataTable(internetBillService.getInternetCheckList(params)); } @GetMapping("/statusTotal") - public AjaxResult getStatusTotal( + public AjaxResult getStatusTotal(HttpServletRequest request, @RequestParam(required = false) String tenantId, @RequestParam(required = false) Long operatorId, @RequestParam(required = false) Long chargingStationId, @@ -77,6 +86,10 @@ public class XhpcTradebillInternetBillController extends BaseController { @RequestParam(required = false) String stationName, @RequestParam(required = false) String internetName, @RequestParam(required = false) Integer status){ + LoginUser loginUser = logUserUtils.getLogUser(request); + if (StringUtils.isEmpty(tenantId)){ + tenantId = loginUser.getTenantId(); + } Map params = new HashMap<>(); params.put("tenantId", tenantId); diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcTradebillPaymentBillController.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcTradebillPaymentBillController.java index ace4c0a7..4355781a 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcTradebillPaymentBillController.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcTradebillPaymentBillController.java @@ -8,9 +8,12 @@ import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.log.annotation.Log; import com.xhpc.common.log.enums.BusinessType; +import com.xhpc.common.util.LogUserUtils; +import com.xhpc.system.api.model.LoginUser; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.Map; @@ -22,6 +25,9 @@ public class XhpcTradebillPaymentBillController extends BaseController { @Resource PaymentBillService paymentBillService; + @Resource + LogUserUtils logUserUtils; + @GetMapping("/checkList/{uploadId}") public AjaxResult getCheckList(@RequestParam(required = false) Integer uploadId, @@ -38,32 +44,35 @@ public class XhpcTradebillPaymentBillController extends BaseController { @GetMapping("/checkPage") - public TableDataInfo getCheckPage(@RequestParam(required = false) Integer uploadId, + public TableDataInfo getCheckPage(HttpServletRequest request, @RequestParam(required = false) Integer uploadId, @RequestParam(required = false) String orderNumber, @RequestParam(required = false) String userId, @RequestParam(required = false) Integer status){ - + LoginUser loginUser = logUserUtils.getLogUser(request); startPage(); Map params = new HashMap<>(); params.put("uploadId", uploadId); params.put("orderNumber",orderNumber); params.put("userId", userId); params.put("status", status); + params.put("tenantId", loginUser.getTenantId()); return getDataTable(paymentBillService.getPaymentCheckList(params)); } @GetMapping("/statusTotal") - public AjaxResult getStatusTotal(@RequestParam(required = false) Integer uploadId, + public AjaxResult getStatusTotal(HttpServletRequest request, @RequestParam(required = false) Integer uploadId, @RequestParam(required = false) String orderNumber, @RequestParam(required = false) String userId, @RequestParam(required = false) Integer status){ + LoginUser loginUser = logUserUtils.getLogUser(request); Map params = new HashMap<>(); params.put("uploadId", uploadId); params.put("orderNumber",orderNumber); params.put("userId", userId); params.put("status", status); + params.put("tenantId", loginUser.getTenantId()); return AjaxResult.success(paymentBillService.getStatusTotal(params)); } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcTradebillInternetCheckRecordDomain.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcTradebillInternetCheckRecordDomain.java index f7633a64..3b918554 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcTradebillInternetCheckRecordDomain.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcTradebillInternetCheckRecordDomain.java @@ -115,5 +115,7 @@ public class XhpcTradebillInternetCheckRecordDomain implements Serializable { private String source; + private String tenantId; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcTradebillPaymentCheckRecordDomain.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcTradebillPaymentCheckRecordDomain.java index ad598e93..11f434ee 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcTradebillPaymentCheckRecordDomain.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcTradebillPaymentCheckRecordDomain.java @@ -58,5 +58,7 @@ public class XhpcTradebillPaymentCheckRecordDomain implements Serializable { private String remark; + private String tenantId; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/InternetBillService.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/InternetBillService.java index 80f26ae2..8d6492ee 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/InternetBillService.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/InternetBillService.java @@ -2,6 +2,7 @@ package com.xhpc.activity.service; import com.xhpc.activity.domain.XhpcTradebillInternetCheckRecordDomain; +import com.xhpc.activity.domain.XhpcTradebillUploadRecordDomain; import javax.servlet.http.HttpServletResponse; import java.io.File; @@ -17,7 +18,7 @@ public interface InternetBillService { boolean updateInfoByDomain(XhpcTradebillInternetCheckRecordDomain domain); - Integer insertInternetCheckList(int uploadId, List internetCheckRecordDomainList); + Integer insertInternetCheckList(XhpcTradebillUploadRecordDomain recordDomain, List internetCheckRecordDomainList); /** diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/PaymentBillService.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/PaymentBillService.java index 4e5a621a..1b70d695 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/PaymentBillService.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/PaymentBillService.java @@ -2,6 +2,7 @@ package com.xhpc.activity.service; import com.xhpc.activity.domain.XhpcTradebillPaymentCheckRecordDomain; +import com.xhpc.activity.domain.XhpcTradebillUploadRecordDomain; import javax.servlet.http.HttpServletResponse; import java.io.File; @@ -16,7 +17,7 @@ public interface PaymentBillService { boolean updateInfoByDomain(XhpcTradebillPaymentCheckRecordDomain domain); - Integer insertPaymentCheckList(int uploadId, List paymentCheckList); + Integer insertPaymentCheckList(XhpcTradebillUploadRecordDomain recordDomain, List paymentCheckList); Map getStatusTotal(Map params); diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/CommonServiceImpl.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/CommonServiceImpl.java index f6bcb394..511b559e 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/CommonServiceImpl.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/CommonServiceImpl.java @@ -55,67 +55,66 @@ public class CommonServiceImpl implements CommonService { domain.setCheckedCount(0); uploadRecordMapper.insertSelective(domain); - XhpcTradebillUploadRecordDomain resDomain = uploadRecordMapper.selectByUrl(domain.getUrl()); List paymentCheckRecordDomainList = null; List recordDomainList = null; Map totalMap = new HashMap<>(); int insertCount = 0; - resDomain.setStatus(2); + domain.setStatus(2); try { switch (domain.getType()) { case 1: case 2: // 微信支付 paymentCheckRecordDomainList = paymentBillService.getWechatDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId()); - insertCount = paymentBillService.insertPaymentCheckList(resDomain.getId(), paymentCheckRecordDomainList); + insertCount = paymentBillService.insertPaymentCheckList(domain, paymentCheckRecordDomainList); totalMap = computePaymentRecord(paymentCheckRecordDomainList); break; case 3: case 4: // 支付宝支付 paymentCheckRecordDomainList = paymentBillService.getAliPayDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId()); - insertCount = paymentBillService.insertPaymentCheckList(resDomain.getId(), paymentCheckRecordDomainList); + insertCount = paymentBillService.insertPaymentCheckList(domain, paymentCheckRecordDomainList); totalMap = computePaymentRecord(paymentCheckRecordDomainList); break; case 5: // 恒大 recordDomainList = internetBillService.getHdInternetDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId()); - insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList); + insertCount = internetBillService.insertInternetCheckList(domain, recordDomainList); totalMap = computeInternetRecord(recordDomainList); break; case 6: // 小桔 recordDomainList = internetBillService.getXjInternetDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId()); - insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList); + insertCount = internetBillService.insertInternetCheckList(domain, recordDomainList); totalMap = computeInternetRecord(recordDomainList); break; case 7: // 新电途 recordDomainList = internetBillService.getXDTInternetDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId()); - insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList); + insertCount = internetBillService.insertInternetCheckList(domain, recordDomainList); totalMap = computeInternetRecord(recordDomainList); break; case 8: // 快电 recordDomainList = internetBillService.getKDInternetDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId()); - insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList); + insertCount = internetBillService.insertInternetCheckList(domain, recordDomainList); totalMap = computeInternetRecord(recordDomainList); break; default: - resDomain.setStatus(1); + domain.setStatus(1); totalMap.put("successCount", 0); totalMap.put("failCount", 0); totalMap.put("checkCount", 0); totalMap.put("uncheckCount", 0); break; } - resDomain.setStatus(1); - resDomain.setSuccessCount(totalMap.get("successCount")); - resDomain.setFailCount(totalMap.get("failCount")); - resDomain.setCheckedCount(totalMap.get("checkCount")); - resDomain.setUncheckCount(totalMap.get("uncheckCount")); - uploadRecordMapper.updateByPrimaryKey(resDomain); - return resDomain; + domain.setStatus(1); + domain.setSuccessCount(totalMap.get("successCount")); + domain.setFailCount(totalMap.get("failCount")); + domain.setCheckedCount(totalMap.get("checkCount")); + domain.setUncheckCount(totalMap.get("uncheckCount")); + uploadRecordMapper.updateByPrimaryKey(domain); + return domain; } catch (Exception exception){ exception.printStackTrace(); throw new CustomException("内部错误"); diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/InternetBillServiceImpl.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/InternetBillServiceImpl.java index ff513061..42de669a 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/InternetBillServiceImpl.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/InternetBillServiceImpl.java @@ -7,6 +7,7 @@ import cn.hutool.core.text.csv.CsvReader; import cn.hutool.core.text.csv.CsvUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.poi.excel.ExcelWriter; +import com.xhpc.activity.domain.XhpcTradebillUploadRecordDomain; import com.xhpc.common.core.exception.CustomException; import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.poi.ExcelUtil; @@ -66,11 +67,12 @@ public class InternetBillServiceImpl implements InternetBillService { @Override - public Integer insertInternetCheckList(int uploadId, List internetCheckRecordDomainList) { + public Integer insertInternetCheckList(XhpcTradebillUploadRecordDomain recordDomain, List internetCheckRecordDomainList) { Long userId = SecurityUtils.getUserId(); for (XhpcTradebillInternetCheckRecordDomain domain : internetCheckRecordDomainList) { - domain.setUploadId(uploadId); + domain.setUploadId(recordDomain.getId()); + domain.setTenantId(recordDomain.getTenantId()); domain.setCreateBy(userId); domain.setUpdateBy(userId); } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/PaymentBillServiceImpl.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/PaymentBillServiceImpl.java index 3db72e81..6a59a902 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/PaymentBillServiceImpl.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/PaymentBillServiceImpl.java @@ -9,6 +9,7 @@ import cn.hutool.core.text.csv.CsvUtil; import cn.hutool.core.util.CharsetUtil; import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelWriter; +import com.xhpc.activity.domain.XhpcTradebillUploadRecordDomain; import com.xhpc.common.core.exception.CustomException; import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.activity.domain.XhpcTradebillPaymentCheckRecordDomain; @@ -63,11 +64,12 @@ public class PaymentBillServiceImpl implements PaymentBillService { @Override - public Integer insertPaymentCheckList(int uploadId, List paymentCheckList) { + public Integer insertPaymentCheckList(XhpcTradebillUploadRecordDomain recordDomain, List paymentCheckList) { Long userId = SecurityUtils.getUserId(); for (XhpcTradebillPaymentCheckRecordDomain domain : paymentCheckList) { - domain.setUploadId(uploadId); + domain.setUploadId(recordDomain.getId()); + domain.setTenantId(recordDomain.getTenantId()); domain.setCreateBy(userId); domain.setUpdateBy(userId); } diff --git a/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcTradebillInternetCheckRecordMapper.xml b/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcTradebillInternetCheckRecordMapper.xml index 11ec3646..712790a8 100644 --- a/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcTradebillInternetCheckRecordMapper.xml +++ b/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcTradebillInternetCheckRecordMapper.xml @@ -39,6 +39,7 @@ + id, create_time, create_by, update_time, update_by, upload_id, history_order_no, @@ -48,7 +49,7 @@ platform_discount_amount, platform_pay_amount, internet_serial_number, internet_charge_station, internet_start_soc, internet_end_soc, internet_charging_degree, internet_charging_time, internet_start_time, internet_end_time, internet_order_amount, internet_power_amount, internet_server_amount, internet_discount_amount, - internet_pay_amount, remark, `status` + internet_pay_amount, remark, `status`, tenant_id select - status, count(id) as 'total' - from xhpc_tradebill_internet_check_record + xticr.status, count(xticr.id) as 'total' + from xhpc_tradebill_internet_check_record xticr + left join xhpc_history_order xho on xho.history_order_id=xticr.history_order_no - and upload_id = #{params.uploadId} + and xticr.upload_id = #{params.uploadId} - and internet_serial_number like concat('%',#{params.orderNumber}, '%') + and xticr.internet_serial_number like concat('%',#{params.orderNumber}, '%') - and internet_charge_station like concat('%', #{params.internetName},'%') + and xticr.internet_charge_station like concat('%', #{params.internetName},'%') - and internet_name like concat('%', #{params.internetName}, '%') + and xticr.internet_name like concat('%', #{params.internetName}, '%') - and status = #{params.status} + and xticr.status = #{params.status} - and p.tenant_id = #{params.tenantId} + and xticr.tenant_id = #{params.tenantId} and xho.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId}) @@ -145,7 +147,7 @@ and xho.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{params.logOperatorId}) - group by status + group by xticr.status @@ -91,6 +95,9 @@ and payment_pay_number like concat('%', #{params.orderNumber},'%') + + and tenant_id=#{params.tenantId} + group by status @@ -116,7 +123,7 @@ payment_channel, platform_order_number, platform_pay_number, platform_user_id, platform_amount, platform_pay_time, payment_pay_number, payment_user_id, payment_amount, - payment_pay_time, `status`, remark) + payment_pay_time, `status`, remark, tenant_id) values (now(), #{createBy}, now(), #{updateBy}, #{uploadId}, #{orderType}, #{paymentChannel}, #{platformOrderNumber}, @@ -125,7 +132,7 @@ #{platformPayTime}, #{paymentPayNumber}, #{paymentUserId}, #{paymentAmount}, - #{paymentPayTime}, #{status}, #{remark}) + #{paymentPayTime}, #{status}, #{remark}, #{tenantId}) - ( - now(), #{check.createBy}, now(), + (now(), #{check.createBy}, now(), #{check.updateBy}, #{check.uploadId}, #{check.orderType}, #{check.paymentChannel}, #{check.platformOrderNumber}, @@ -148,8 +154,7 @@ #{check.paymentPayNumber}, #{check.paymentUserId}, #{check.paymentAmount}, #{check.paymentPayTime}, #{check.status}, - #{check.remark} - ) + #{check.remark}, #{check.tenantId}) @@ -208,6 +213,9 @@ remark, + + tenant_id, + now(), @@ -260,6 +268,9 @@ #{remark}, + + #{tenantId}, +