Ver a proveniência

[停车][修改]:停车数据入库修改,15分钟内缴费记录update,不再insert

release_toaliyun_real
Stormeye Wu há 6 anos
ascendente
cometimento
c9f57cee67
3 ficheiros alterados com 30 adições e 10 eliminações
  1. +23
    -9
      mallinkCallback/src/main/java/com/iformall/controller/callback/WxCarCallBackController.java
  2. +4
    -1
      mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml
  3. +3
    -0
      mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml

+ 23
- 9
mallinkCallback/src/main/java/com/iformall/controller/callback/WxCarCallBackController.java Ver ficheiro

@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;


import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@@ -382,13 +383,24 @@ public class WxCarCallBackController extends BaseController {
if(StringUtils.isNotBlank(tenantId)) { if(StringUtils.isNotBlank(tenantId)) {
map.put("tenantId", tenantId); map.put("tenantId", tenantId);
} }
String paidServiceFee = paramMap.get(ETCPUtil.ETCP_PAID_SERVICE_FEE);
String fee = paramMap.get(ETCPUtil.ETCP_FEE);
Date feeTime = null;

if(StringUtils.isNotBlank(etcpTime)) {
try {
feeTime = dateFormat.parse(etcpTime);
} catch (ParseException e) {
logger.error("解析fee time出错" + etcpTime);
}
}
map.put("plateNumber", carNumber); map.put("plateNumber", carNumber);
map.put("orderId", orderId); map.put("orderId", orderId);
map.put("fee", fee);
map.put("feeTime", etcpTime); map.put("feeTime", etcpTime);
WxCarCmdLog carCmdLog = wxCarCmdLogService.getByOrderId(map); WxCarCmdLog carCmdLog = wxCarCmdLogService.getByOrderId(map);
if(carCmdLog != null) { if(carCmdLog != null) {
logger.error("ETCP order已入库: " + orderId);
return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage());
logger.error("ETCP order paid 已入库: " + orderId);
} }


Date currentDate = new Date(); Date currentDate = new Date();
@@ -396,6 +408,10 @@ public class WxCarCallBackController extends BaseController {
if(StringUtils.isNotBlank(tenantId)) { if(StringUtils.isNotBlank(tenantId)) {
wxCarCmdLog.setTenantId(tenantId); wxCarCmdLog.setTenantId(tenantId);
} }
if(carCmdLog != null) {
// 如果有15分钟的已支付的数据,自动覆盖
wxCarCmdLog.setId(carCmdLog.getId());
}
wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode()); wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode());
wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap));
@@ -408,16 +424,13 @@ public class WxCarCallBackController extends BaseController {
return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString()); return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString());
} }


String paidServiceFee = paramMap.get(ETCPUtil.ETCP_PAID_SERVICE_FEE);
String fee = paramMap.get(ETCPUtil.ETCP_FEE);

try { try {
// 保存WxCarPayRecord // 保存WxCarPayRecord
WxCarPayRecord record = new WxCarPayRecord(); WxCarPayRecord record = new WxCarPayRecord();
record.setSynId(orderId); record.setSynId(orderId);
record.setFee(fee); record.setFee(fee);
if(StringUtils.isNotBlank(etcpTime)) {
record.setFeeTime(dateFormat.parse(etcpTime));
if(feeTime != null) {
record.setFeeTime(feeTime);
} }
record.setPaidServiceFee(paidServiceFee); record.setPaidServiceFee(paidServiceFee);
record.setVendorType(wxCarCmdLog.getVendorType()); record.setVendorType(wxCarCmdLog.getVendorType());
@@ -426,9 +439,10 @@ public class WxCarCallBackController extends BaseController {


WxCarPayRecord query = new WxCarPayRecord(); WxCarPayRecord query = new WxCarPayRecord();
query.setSynId(orderId); query.setSynId(orderId);
if(StringUtils.isNotBlank(etcpTime)) {
query.setFeeTime(dateFormat.parse(etcpTime));
if(feeTime != null) {
query.setFeeTime(feeTime);
} }
// 缴费时间在15分钟以内,更新之前的数据, ETCP会把之前的缴费自动退款
PageInfo<WxCarPayRecord> page = wxCarPayRecordService.findCarPayListByPage(query,1,2); PageInfo<WxCarPayRecord> page = wxCarPayRecordService.findCarPayListByPage(query,1,2);
if(page != null && page.getList().size() > 0){ if(page != null && page.getList().size() > 0){
if(page.getList().size() >= 2){ if(page.getList().size() >= 2){


+ 4
- 1
mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml Ver ficheiro

@@ -136,8 +136,11 @@
<if test=" null != orderId"> <if test=" null != orderId">
and order_id = #{orderId} and order_id = #{orderId}
</if> </if>
<if test=" null != fee">
and JSON_EXTRACT(cmd_json,'$.fee') = #{fee}
</if>
<if test=" null != feeTime"> <if test=" null != feeTime">
and fee_time = #{feeTime}
and TIMESTAMPDIFF(MINUTE, `fee_time`, #{feeTime}) &lt;= 15
</if> </if>
</select> </select>




+ 3
- 0
mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml Ver ficheiro

@@ -44,6 +44,9 @@
<if test=" null != feeTimeStr "> <if test=" null != feeTimeStr ">
and `fee_time` = #{feeTimeStr} and `fee_time` = #{feeTimeStr}
</if> </if>
<if test=" null != feeTime ">
and TIMESTAMPDIFF(MINUTE, `fee_time`, #{feeTime}) &lt;= 15
</if>
<if test=" null != tenantId "> <if test=" null != tenantId ">
and `tenant_id` = #{tenantId} and `tenant_id` = #{tenantId}
</if> </if>


Carregando…
Cancelar
Guardar