Browse Source

[停车][修改]:停车缴费统计问题

release_toaliyun_real
Stormeye Wu 6 years ago
parent
commit
11ab3cd4d2
6 changed files with 123 additions and 98 deletions
  1. +9
    -0
      mallinkCallback/src/main/java/com/iformall/controller/callback/WxCarCallBackController.java
  2. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCarCmdLogMapper.java
  3. +3
    -1
      mallinkService/src/main/java/com/iformall/service/WxCarCmdLogService.java
  4. +6
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java
  5. +12
    -0
      mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml
  6. +91
    -97
      mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml

+ 9
- 0
mallinkCallback/src/main/java/com/iformall/controller/callback/WxCarCallBackController.java View File

@@ -306,6 +306,15 @@ public class WxCarCallBackController extends BaseController {
map.put("synId", orderId); map.put("synId", orderId);
String tenant_id = wxCarCmdLogService.getTenantIdBySynId(map); String tenant_id = wxCarCmdLogService.getTenantIdBySynId(map);


// 检查是否有重复数据
map.put("tenantId", tenant_id);
map.put("orderId", orderId);
Long count = wxCarCmdLogService.getCountByOrderId(map);
if(count > 1) {
logger.error("ETCP order已入库: " + orderId);
return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage());
}

Date currentDate = new Date(); Date currentDate = new Date();
WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); WxCarCmdLog wxCarCmdLog = new WxCarCmdLog();
if(StringUtils.isNotBlank(tenant_id)) { if(StringUtils.isNotBlank(tenant_id)) {


+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCarCmdLogMapper.java View File

@@ -27,4 +27,6 @@ public interface WxCarCmdLogMapper extends CommonMapper<WxCarCmdLog, Long> {
List<String> queryTenantIdBySynId(HashMap<String,String> params); List<String> queryTenantIdBySynId(HashMap<String,String> params);


Long queryWeekCarPayCount(HashMap<String,Object> params); Long queryWeekCarPayCount(HashMap<String,Object> params);

Long queryPaidInfoByOrderId(HashMap<String,String> params);
} }

+ 3
- 1
mallinkService/src/main/java/com/iformall/service/WxCarCmdLogService.java View File

@@ -28,7 +28,7 @@ public interface WxCarCmdLogService {
*/ */
WxCarCmdLog getById(Long id); WxCarCmdLog getById(Long id);
/**
/**
* 保存或更新实体 * 保存或更新实体
* *
* @param record * @param record
@@ -50,6 +50,8 @@ public interface WxCarCmdLogService {
*/ */
String getTenantIdBySynId(HashMap<String, String> params); String getTenantIdBySynId(HashMap<String, String> params);


Long getCountByOrderId(HashMap<String, String> params);









+ 6
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java View File

@@ -60,6 +60,12 @@ public class WxCarCmdLogServiceImpl implements WxCarCmdLogService {
return null; return null;
} }


@Override
public
Long getCountByOrderId(HashMap<String, String> params) {
return wxCarCmdLogMapper.queryPaidInfoByOrderId(params);
}



+ 12
- 0
mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml View File

@@ -126,6 +126,18 @@
select `tenant_id` from wx_car_cmd_log select `tenant_id` from wx_car_cmd_log
where cmd_type = 601 and json_extract(cmd_json, "$.synId") = #{synId} where cmd_type = 601 and json_extract(cmd_json, "$.synId") = #{synId}
</select> </select>

<select id="queryPaidInfoByOrderId" parameterType="hashmap" resultType="Long">
select count(id)
from wx_car_cmd_log
where cmd_type = 604
<if test=" null != tenantId">
and tenant_id = #{tenantId}
</if>
<if test=" null != orderId">
and json_extract(cmd_json, "$.orderId") = #{orderId}
</if>
</select>


</mapper> </mapper>

+ 91
- 97
mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml View File

@@ -1,106 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iformall.mapper.WxCarPayRecordMapper"> <mapper namespace="com.iformall.mapper.WxCarPayRecordMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCarPayRecord">
<id column="id" property="id"/>
<result column="tenant_id" property="tenantId"/>
<result column="vendor_type" property="vendorType"/>
<result column="syn_id" property="synId"/>
<result column="park_id" property="parkId"/>
<result column="park_name" property="parkName"/>
<result column="user_type" property="userType"/>
<result column="plate_number" property="plateNumber"/>
<result column="entrance_time" property="entranceTime"/>
<result column="exit_time" property="exitTime"/>
<result column="fee" property="fee"/>
<result column="fee_time" property="feeTime"/>
<result column="coupon" property="coupon"/>
<result column="coupon_code" property="couponCode"/>
<result column="fix_parking_id" property="fixParkingId"/>
<result column="remaining_days" property="remainingDays"/>
<result column="discount_amount" property="discountAmount"/>
<result column="paid_service_fee" property="paidServiceFee"/>
<result column="phone" property="phone"/>
<result column="create_date" property="createDate"/>
<result column="update_date" property="updateDate"/>
<result column="stayed_time" property="stayedTime"/>
</resultMap>
<sql id="allColumns">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCarPayRecord">
<id column="id" property="id"/>
<result column="tenant_id" property="tenantId"/>
<result column="vendor_type" property="vendorType"/>
<result column="syn_id" property="synId"/>
<result column="park_id" property="parkId"/>
<result column="park_name" property="parkName"/>
<result column="user_type" property="userType"/>
<result column="plate_number" property="plateNumber"/>
<result column="entrance_time" property="entranceTime"/>
<result column="exit_time" property="exitTime"/>
<result column="fee" property="fee"/>
<result column="fee_time" property="feeTime"/>
<result column="coupon" property="coupon"/>
<result column="coupon_code" property="couponCode"/>
<result column="fix_parking_id" property="fixParkingId"/>
<result column="remaining_days" property="remainingDays"/>
<result column="discount_amount" property="discountAmount"/>
<result column="paid_service_fee" property="paidServiceFee"/>
<result column="phone" property="phone"/>
<result column="create_date" property="createDate"/>
<result column="update_date" property="updateDate"/>
<result column="stayed_time" property="stayedTime"/>
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`vendor_type`,`create_date`,`update_date`,syn_id,park_id,park_name,user_type, `id`,`tenant_id`,`vendor_type`,`create_date`,`update_date`,syn_id,park_id,park_name,user_type,
plate_number,entrance_time,exit_time,fee,fee_time,coupon,coupon_code,fix_parking_id,remaining_days,discount_amount,phone plate_number,entrance_time,exit_time,fee,fee_time,coupon,coupon_code,fix_parking_id,remaining_days,discount_amount,phone
,paid_service_fee,create_date,update_date,floor(stayed_time/60) stayed_time ,paid_service_fee,create_date,update_date,floor(stayed_time/60) stayed_time
</sql> </sql>


<sql id="dynamicWhereConditions">
where 1 = 1

<if test=" null != id ">
and `id` = #{id}

</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}

</if>

<if test=" null != vendorType ">
and `vendor_type` = #{vendorType}

</if>


<if test=" null != startDate">
and create_date >= #{startDate}
</if>
<if test=" null != endDate">
and create_date &lt;= #{endDate}
</if>
<if test=" 1 == isPay">
and fee is not null
and fee != ''
</if>

<if test=" null != sortColumns"> order by ${sortColumns}</if>
<if test=" null == sortColumns"> order by create_date desc </if>


</sql>

<select id="findCarPayListByPage" parameterType="com.iformall.domain.po.WxCarPayRecord" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_car_pay_record
<include refid="dynamicWhereConditions"/>
</select>

<select id="findCarPayList" parameterType="com.iformall.domain.po.WxCarPayRecord" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_car_pay_record
<include refid="dynamicWhereConditions"/>
</select>


<update id="updateBySynId" parameterType="com.iformall.domain.po.WxCarPayRecord">
update wx_car_pay_record set update_date = now()
<if test="null != exitTime">
,exit_time = #{exitTime}
</if>
<if test="null != stayedTime">
,stayed_time = #{stayedTime}
</if>
<if test="null != fee">
,fee = #{fee}
</if>
<if test="null != feeTime">
,fee_time = #{feeTime}
</if>
<if test="null != paidServiceFee">
,paid_service_fee = #{paidServiceFee}
</if>

where syn_id = #{synId}
</update>
<sql id="dynamicWhereConditions">
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != vendorType ">
and `vendor_type` = #{vendorType}
</if>

<if test=" null != startDate">
and create_date >= #{startDate}
</if>
<if test=" null != endDate">
and create_date &lt;= #{endDate}
</if>
<if test=" 1 == isPay">
and fee is not null
and fee != ''
</if>

<if test=" null != sortColumns">order by ${sortColumns}</if>
<if test=" null == sortColumns">order by create_date desc</if>
</sql>

<select id="findCarPayListByPage" parameterType="com.iformall.domain.po.WxCarPayRecord" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_car_pay_record
<include refid="dynamicWhereConditions"/>
</select>

<select id="findCarPayList" parameterType="com.iformall.domain.po.WxCarPayRecord" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_car_pay_record
<include refid="dynamicWhereConditions"/>
</select>


<update id="updateBySynId" parameterType="com.iformall.domain.po.WxCarPayRecord">
update wx_car_pay_record set update_date = now()
<if test="null != exitTime">
,exit_time = #{exitTime}
</if>
<if test="null != stayedTime">
,stayed_time = #{stayedTime}
</if>
<if test="null != fee">
,fee = #{fee}
</if>
<if test="null != feeTime">
,fee_time = #{feeTime}
</if>
<if test="null != paidServiceFee">
,paid_service_fee = #{paidServiceFee}
</if>

where syn_id = #{synId}
</update>
</mapper> </mapper>

Loading…
Cancel
Save