From fb57b9e9f92a074fdd16e8aeceb969192ac518ec Mon Sep 17 00:00:00 2001 From: YiFei Kuang Date: Mon, 24 Mar 2025 13:25:38 +0800 Subject: [PATCH] fix bug-1 --- .../customer/CustomerController.java | 5 +- .../payment/FinancialDetailController.java | 10 ++ .../ghy/web/controller/tool/WxController.java | 126 +++++++++--------- .../payment/mapper/FinancialDetailMapper.java | 4 + .../request/FinancialAccountBillReq.java | 83 ++++++++++++ .../response/FinancialAccountBillResp.java | 30 +++++ .../response/FinancialCountResponse.java | 2 + .../service/FinancialDetailService.java | 5 + .../impl/FinancialDetailServiceImpl.java | 22 +++ .../financial/FinancialDetailMapper.xml | 55 ++++++++ 10 files changed, 279 insertions(+), 63 deletions(-) create mode 100644 ghy-payment/src/main/java/com/ghy/payment/request/FinancialAccountBillReq.java create mode 100644 ghy-payment/src/main/java/com/ghy/payment/response/FinancialAccountBillResp.java diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java index b9804ba3..e0c817b6 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java @@ -80,6 +80,7 @@ public class CustomerController extends BaseController { List customerIds = new ArrayList(){{ add(curCustomer.getCustomerId()); }}; + List nextLevelCustomerIds = new ArrayList<>(); if (customer.getIsDistributor()) { // 分销商需要查询所有下一级分销用户作为统计条件 Customer customerQry = new Customer(); @@ -87,8 +88,7 @@ public class CustomerController extends BaseController { customerQry.setStatus(Integer.valueOf(UserStatus.OK.getCode())); List nextLevelCustomers = customerService.getCustomerList(customerQry); teamNum = teamNum + nextLevelCustomers.stream().filter(x->PlaceStatus.CAN_PLACE.getCode().equals(x.getPlaceStatus())).count(); - List nextLevelCustomerIds = nextLevelCustomers.stream().map(Customer::getCustomerId).collect(Collectors.toList()); -// customerIds.addAll(nextLevelCustomerIds); + nextLevelCustomerIds = nextLevelCustomers.stream().map(Customer::getCustomerId).collect(Collectors.toList()); } // 本月第一天 @@ -138,6 +138,7 @@ public class CustomerController extends BaseController { // 本月订单数及本月订单额 OrderMaster orderParams1 = new OrderMaster(); + customerIds.addAll(nextLevelCustomerIds); orderParams1.setCustomerIds(customerIds); orderParams1.setCreateTimeStart(firstDayCurMonth.atStartOfDay()); List ordersCurMonth1 = orderMasterService.selectOrderMasterList(orderParams1); diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/payment/FinancialDetailController.java b/ghy-admin/src/main/java/com/ghy/web/controller/payment/FinancialDetailController.java index 1e4dcb6b..9e3951d0 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/payment/FinancialDetailController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/payment/FinancialDetailController.java @@ -9,6 +9,8 @@ import com.ghy.common.enums.BusinessType; import com.ghy.common.utils.ExceptionUtil; import com.ghy.common.utils.poi.ExcelUtil; import com.ghy.payment.domain.FinancialDetail; +import com.ghy.payment.request.FinancialAccountBillReq; +import com.ghy.payment.response.FinancialAccountBillResp; import com.ghy.payment.service.FinancialDetailService; import com.ghy.web.pojo.vo.FinancialCountRequest; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -68,6 +70,14 @@ public class FinancialDetailController extends BaseController { return getDataTable(list); } + @PostMapping("/app/listV2") + @ResponseBody + public TableDataInfo appListV2(@RequestBody FinancialAccountBillReq financialAccountBillReq) { + startPage(); + List list = financialDetailService.selectFinancialDetailListV2(financialAccountBillReq); + return getDataTable(list); + } + @Log(title = "财务细单管理", businessType = BusinessType.EXPORT) @RequiresPermissions("financial:detail:export") @PostMapping("/export") diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/tool/WxController.java b/ghy-admin/src/main/java/com/ghy/web/controller/tool/WxController.java index 981c8b54..bbb34df6 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/tool/WxController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/tool/WxController.java @@ -316,73 +316,77 @@ public class WxController extends BaseController { @GetMapping("/neCheck") @ResponseBody public AjaxResult neCheck(HttpServletRequest request) { - String url; - boolean flag = false; - String deptId = request.getHeader("deptId"); - String from = request.getHeader("from"); - SysDeptConfig sysDeptConfig = sysDeptConfigService.selectByDeptId(Long.parseLong(deptId)); - String code = request.getHeader("code"); - if("customer".equals(from)){ - url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + sysDeptConfig.getWxAppId() + "&secret=" + sysDeptConfig.getWxSecret() + "&js_code=" + code + "&grant_type=authorization_code"; - }else { - url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + sysDeptConfig.getServWxAppId() + "&secret=" + sysDeptConfig.getServWxSecret() + "&js_code=" + code + "&grant_type=authorization_code"; - } - String data = HttpUtils.sendGet(url, null); - JSONObject result = JSONObject.parseObject(data); - // 如果是师傅端,需要调用公众号的获取用户列表接口 -- 遍历列表去找到unionId和openid关联并入库 - if(!"customer".equals(from)){ - String openid = result.getString("openid"); - String unionId = result.getString("unionid"); - // 查询openid是否入库,已经入库则不管 - Worker param = new Worker(); - param.setOpenId(openid); - Worker worker = workerService.selectByOpenId(param); - if(worker != null){ - // 公众号token - String wxToken = WechatMsgUtils.getToken(); - String wxUserOpenidList = HttpUtils.sendGet("https://api.weixin.qq.com/cgi-bin/user/get?access_token="+wxToken+"&next_openid="); - logger.info("公众号获取的用户列表集合:{}", wxUserOpenidList); - JSONObject wxOpenidJson = JSONObject.parseObject(wxUserOpenidList); - JSONObject openIdListJson = wxOpenidJson.getJSONObject("data"); - List openidList = openIdListJson.getObject("openid", ArrayList.class); - List> batchList = ListUtil.partition(openidList, 99); - for (List childOpenidList : batchList) { - JSONArray openidJsonArray = new JSONArray(); - childOpenidList.forEach(model->{ - JSONObject openidJson = new JSONObject(); - openidJson.put("openid", model); - openidJson.put("lang", "zh_CN"); - openidJsonArray.add(openidJson); - }); - JSONObject jsonParam = new JSONObject(); - jsonParam.put("user_list", openidJsonArray); - String unionUrl = "https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token="+WechatMsgUtils.getToken();; - logger.info("调用获取用户信息,请求url:{}, 请求body:{}", unionUrl, jsonParam.toJSONString()); - String getUnionResult = HttpUtil.post(unionUrl, jsonParam.toJSONString()); - logger.info("获取公众号union列表:{}", getUnionResult); - JSONObject unionJson = JSONObject.parseObject(getUnionResult); - JSONArray unionJsonArray = unionJson.getJSONArray("user_info_list"); - for (int index = 0 ; index openidList = openIdListJson.getObject("openid", ArrayList.class); + List> batchList = ListUtil.partition(openidList, 99); + for (List childOpenidList : batchList) { + JSONArray openidJsonArray = new JSONArray(); + childOpenidList.forEach(model->{ + JSONObject openidJson = new JSONObject(); + openidJson.put("openid", model); + openidJson.put("lang", "zh_CN"); + openidJsonArray.add(openidJson); + }); + JSONObject jsonParam = new JSONObject(); + jsonParam.put("user_list", openidJsonArray); + String unionUrl = "https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token="+WechatMsgUtils.getToken();; + logger.info("调用获取用户信息,请求url:{}, 请求body:{}", unionUrl, jsonParam.toJSONString()); + String getUnionResult = HttpUtil.post(unionUrl, jsonParam.toJSONString()); + logger.info("获取公众号union列表:{}", getUnionResult); + JSONObject unionJson = JSONObject.parseObject(getUnionResult); + JSONArray unionJsonArray = unionJson.getJSONArray("user_info_list"); + for (int index = 0 ; index selectFinancialDetailList(FinancialDetail financialDetail); + List selectFinancialDetailListV2(FinancialAccountBillReq financialAccountBillReq); + /** * @param financialDetailId 财务细单id * @return 财务细单 diff --git a/ghy-payment/src/main/java/com/ghy/payment/request/FinancialAccountBillReq.java b/ghy-payment/src/main/java/com/ghy/payment/request/FinancialAccountBillReq.java new file mode 100644 index 00000000..8113af63 --- /dev/null +++ b/ghy-payment/src/main/java/com/ghy/payment/request/FinancialAccountBillReq.java @@ -0,0 +1,83 @@ +package com.ghy.payment.request; + +import lombok.Data; + +import java.util.Date; + +/** + * @author clunt + */ +@Data +public class FinancialAccountBillReq { + + private Long deptId; + + private String orderCode; + + private Long customerId; + + private Long workerId; + + private String beginTime; + + private String endTime; + + // 01.待分账 02.已分账 03.已取消 + private String billType; + + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public String getOrderCode() { + return orderCode; + } + + public void setOrderCode(String orderCode) { + this.orderCode = orderCode; + } + + public Long getCustomerId() { + return customerId; + } + + public void setCustomerId(Long customerId) { + this.customerId = customerId; + } + + public Long getWorkerId() { + return workerId; + } + + public void setWorkerId(Long workerId) { + this.workerId = workerId; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getBillType() { + return billType; + } + + public void setBillType(String billType) { + this.billType = billType; + } +} diff --git a/ghy-payment/src/main/java/com/ghy/payment/response/FinancialAccountBillResp.java b/ghy-payment/src/main/java/com/ghy/payment/response/FinancialAccountBillResp.java new file mode 100644 index 00000000..90097823 --- /dev/null +++ b/ghy-payment/src/main/java/com/ghy/payment/response/FinancialAccountBillResp.java @@ -0,0 +1,30 @@ +package com.ghy.payment.response; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author clunt + */ +@Data +public class FinancialAccountBillResp { +// om.code as order_code, +// fd.pay_money as pay_money, +// om.create_time as create_time, +// om.order_status as order_status, +// fm.pay_status as pay_status, +// fm.code as pay_code, +// fm.pay_time as pay_time + private String orderCode; + private BigDecimal payMoney; + private Date createTime; + private Integer orderStatus; + private String orderStatusDesc; + private Integer payStatus; + private String payStatusDesc; + private String payCode; + private Date payTime; + +} diff --git a/ghy-payment/src/main/java/com/ghy/payment/response/FinancialCountResponse.java b/ghy-payment/src/main/java/com/ghy/payment/response/FinancialCountResponse.java index c699c9b7..3af6cde8 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/response/FinancialCountResponse.java +++ b/ghy-payment/src/main/java/com/ghy/payment/response/FinancialCountResponse.java @@ -7,6 +7,8 @@ import java.util.List; @Data public class FinancialCountResponse { + private String orderCode; + private String createTime; private String payCount; diff --git a/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java b/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java index e9f36bee..22cdaeae 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java +++ b/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java @@ -1,6 +1,8 @@ package com.ghy.payment.service; import com.ghy.payment.domain.FinancialDetail; +import com.ghy.payment.request.FinancialAccountBillReq; +import com.ghy.payment.response.FinancialAccountBillResp; import com.ghy.payment.response.FinancialCountResponse; import java.util.List; @@ -123,4 +125,7 @@ public interface FinancialDetailService { * @param reverseId Adapay撤销支付ID */ void refundSucceeded(String reverseId); + + List selectFinancialDetailListV2(FinancialAccountBillReq financialAccountBillReq); + } diff --git a/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java b/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java index d9e50abd..f1e58e11 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java +++ b/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java @@ -5,6 +5,8 @@ import com.ghy.common.core.text.Convert; import com.ghy.common.enums.FinancialDetailType; import com.ghy.payment.domain.FinancialDetail; import com.ghy.payment.mapper.FinancialDetailMapper; +import com.ghy.payment.request.FinancialAccountBillReq; +import com.ghy.payment.response.FinancialAccountBillResp; import com.ghy.payment.response.FinancialCountResponse; import com.ghy.payment.service.FinancialDetailService; import org.springframework.stereotype.Service; @@ -93,6 +95,26 @@ public class FinancialDetailServiceImpl implements FinancialDetailService { return financialDetailMapper.selectFinancialDetailList(financialDetail); } + @Override + public List selectFinancialDetailListV2(FinancialAccountBillReq financialAccountBillReq) { + List list = financialDetailMapper.selectFinancialDetailListV2(financialAccountBillReq); + list.forEach(model->{ + if(model.getOrderStatus() == 6){ + model.setOrderStatusDesc("运营利润--已取消"); + }else if(model.getOrderStatus() == 5){ + model.setOrderStatusDesc("运营利润--已到账"); + }else { + model.setOrderStatusDesc("运营利润--待分账"); + } + if(model.getPayStatus() == 1){ + model.setPayStatusDesc("已支付"); + }else { + model.setPayStatusDesc("未支付"); + } + }); + return list; + } + @Override public FinancialDetail selectById(Long financialDetailId) { return financialDetailMapper.selectById(financialDetailId); diff --git a/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml b/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml index b31322ed..df3bf452 100644 --- a/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml +++ b/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml @@ -27,6 +27,16 @@ + + + + + + + + + + @@ -97,6 +107,51 @@ order by fd.create_time desc + +