更新对账单增加租户的条件

This commit is contained in:
panshuling321 2022-05-10 17:36:43 +08:00
parent d9b223cbe3
commit 4dd1e166fe
11 changed files with 101 additions and 52 deletions

View File

@ -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,7 +48,7 @@ public class XhpcTradebillInternetBillController extends BaseController {
@GetMapping("/checkPage")
public TableDataInfo getCheckPage(
public TableDataInfo getCheckPage(HttpServletRequest request,
@RequestParam(required = false) String tenantId,
@RequestParam(required = false) Long operatorId,
@RequestParam(required = false) Long chargingStationId,
@ -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<String, Object> 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<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId);

View File

@ -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<String, Object> 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<String, Object> 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));
}

View File

@ -115,5 +115,7 @@ public class XhpcTradebillInternetCheckRecordDomain implements Serializable {
private String source;
private String tenantId;
private static final long serialVersionUID = 1L;
}

View File

@ -58,5 +58,7 @@ public class XhpcTradebillPaymentCheckRecordDomain implements Serializable {
private String remark;
private String tenantId;
private static final long serialVersionUID = 1L;
}

View File

@ -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<XhpcTradebillInternetCheckRecordDomain> internetCheckRecordDomainList);
Integer insertInternetCheckList(XhpcTradebillUploadRecordDomain recordDomain, List<XhpcTradebillInternetCheckRecordDomain> internetCheckRecordDomainList);
/**

View File

@ -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<XhpcTradebillPaymentCheckRecordDomain> paymentCheckList);
Integer insertPaymentCheckList(XhpcTradebillUploadRecordDomain recordDomain, List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckList);
Map<String, Object> getStatusTotal(Map<String, Object> params);

View File

@ -55,67 +55,66 @@ public class CommonServiceImpl implements CommonService {
domain.setCheckedCount(0);
uploadRecordMapper.insertSelective(domain);
XhpcTradebillUploadRecordDomain resDomain = uploadRecordMapper.selectByUrl(domain.getUrl());
List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckRecordDomainList = null;
List<XhpcTradebillInternetCheckRecordDomain> recordDomainList = null;
Map<String, Integer> 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("内部错误");

View File

@ -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<XhpcTradebillInternetCheckRecordDomain> internetCheckRecordDomainList) {
public Integer insertInternetCheckList(XhpcTradebillUploadRecordDomain recordDomain, List<XhpcTradebillInternetCheckRecordDomain> 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);
}

View File

@ -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<XhpcTradebillPaymentCheckRecordDomain> paymentCheckList) {
public Integer insertPaymentCheckList(XhpcTradebillUploadRecordDomain recordDomain, List<XhpcTradebillPaymentCheckRecordDomain> 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);
}

View File

@ -39,6 +39,7 @@
<result column="internet_pay_amount" jdbcType="DECIMAL" property="internetPayAmount"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="status" jdbcType="SMALLINT" property="status"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
</resultMap>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByParams" resultType="java.util.Map">
@ -114,26 +115,27 @@
<select id="selectTotalGroupbyStatus" resultType="java.util.Map">
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
<where>
<if test="params.uploadId != null and params.upload!='' and params.uploadId !=0">
and upload_id = #{params.uploadId}
and xticr.upload_id = #{params.uploadId}
</if>
<if test="params.orderNumber != null and params.orderNumber!=''">
and internet_serial_number like concat('%',#{params.orderNumber}, '%')
and xticr.internet_serial_number like concat('%',#{params.orderNumber}, '%')
</if>
<if test="params.stationName != null and params.stationName!=''">
and internet_charge_station like concat('%', #{params.internetName},'%')
and xticr.internet_charge_station like concat('%', #{params.internetName},'%')
</if>
<if test="params.internetName != null and params.internetName!=''">
and internet_name like concat('%', #{params.internetName}, '%')
and xticr.internet_name like concat('%', #{params.internetName}, '%')
</if>
<if test="params.status != null and params.status!=''">
and status = #{params.status}
and xticr.status = #{params.status}
</if>
<if test="params.tenantId != null and params.tenantId!=''">
and p.tenant_id = #{params.tenantId}
and xticr.tenant_id = #{params.tenantId}
</if>
<if test="params.operatorId != null ">
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})
</if>
</where>
group by status
group by xticr.status
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
@ -178,7 +180,7 @@
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)
values (now(), #{createBy}, now(),
#{updateBy}, #{uploadId}, #{historyOrderNo},
#{userId}, #{internetName},
@ -197,7 +199,7 @@
#{internetOrderAmount},
#{internetPowerAmount}, #{internetServerAmount},
#{internetDiscountAmount},
#{internetPayAmount}, #{remark}, #{status,jdbcType=SMALLINT})
#{internetPayAmount}, #{remark}, #{status,jdbcType=SMALLINT}, #{tenantId})
</insert>
<insert id="insertCheckList" keyColumn="id" keyProperty="id"
@ -215,8 +217,7 @@
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`
) values
internet_pay_amount, remark, `status`, tenant_id) values
<foreach collection="list" item="check" index="index" separator=",">
(
now(), #{check.createBy}, now(),
@ -239,7 +240,7 @@
#{check.internetPowerAmount}, #{check.internetServerAmount},
#{check.internetDiscountAmount},
#{check.internetPayAmount}, #{check.remark},
#{check.status})
#{check.status}, #{check.tenantId})
</foreach>
</insert>
@ -352,6 +353,9 @@
<if test="status != null">
`status`,
</if>
<if test="tenantId != null">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
now(),
@ -458,6 +462,9 @@
<if test="status != null">
#{status},
</if>
<if test="tenantId != null">
#{tenantId},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"

View File

@ -21,11 +21,12 @@
<result column="payment_pay_time" jdbcType="TIMESTAMP" property="paymentPayTime"/>
<result column="status" jdbcType="SMALLINT" property="status"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
</resultMap>
<sql id="Base_Column_List">
id, create_time, create_by, update_time, update_by, upload_id, order_type, 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_number, payment_user_id, payment_amount, payment_pay_time, `status`, remark, tenant_id
</sql>
@ -73,6 +74,9 @@
<if test="params.status != null and params.status !=''">
and p.status=#{params.status}
</if>
<if test="params.tenantId != null and params.tenantId !=''">
and p.tenant_id=#{params.tenantId}
</if>
</where>
order by p.upload_id desc, status asc
</select>
@ -91,6 +95,9 @@
<if test="params.paymentPayNumber!=null and params.paymentPayNumber!=''">
and payment_pay_number like concat('%', #{params.orderNumber},'%')
</if>
<if test="params.tenantId!=null and params.tenantId!=''">
and tenant_id=#{params.tenantId}
</if>
</where>
group by status
</select>
@ -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})
</insert>
<insert id="insertCheckList" keyColumn="id" keyProperty="id"
@ -135,10 +142,9 @@
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) values
payment_pay_time, `status`, remark, tenant_id) values
<foreach collection="list" item="check" index="index" separator=",">
(
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})
</foreach>
</insert>
@ -208,6 +213,9 @@
<if test="remark != null">
remark,
</if>
<if test="tenantId != null">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
now(),
@ -260,6 +268,9 @@
<if test="remark != null">
#{remark},
</if>
<if test="tenantId != null">
#{tenantId},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"