Commit 633b65ca authored by jiaorz's avatar jiaorz

Merge branch 'master-vehicle-count-bug'

parents 3f37cbd2 7f276018
......@@ -647,7 +647,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
* @param refundReason 退款原因
* @param outRequestNo 退款标志号
*/
public void testTradeRefund(String tradNo, Integer refundAmount, String refundReason, String outRequestNo) {
public AlipayTradeRefundResponse testTradeRefund(String tradNo, Integer refundAmount, String refundReason, String outRequestNo) {
AlipayClient alipayClient = getAlipayClient();
AlipayTradeRefundModel model = new AlipayTradeRefundModel();
BigDecimal realAmount = new BigDecimal(refundAmount.toString()).divide(new BigDecimal("100"), 2, BigDecimal.ROUND_UP);
......@@ -664,6 +664,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
e.printStackTrace();
}
log.info("response: {}"+response.getBody());
return response;
}
public static void main(String[] args) throws AlipayApiException {
OrderPayBiz orderPayBiz = new OrderPayBiz();
......
package com.xxfc.platform.universal.biz;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.response.AlipayTradeRefundResponse;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
......@@ -142,4 +144,38 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
}
return JsonResultUtil.createFailedResult(40004, "退款失败!");
}
public ObjectRestResponse tradeRefund(String tradNo, Integer refundAmount, String refundReason, String outRequestNo) {
AlipayTradeRefundResponse refundResponse = payBiz.testTradeRefund(tradNo, refundAmount, refundReason, outRequestNo);
log.info("预授权转支付退款: {}", refundResponse.getBody());
if (refundResponse == null) {
return ObjectRestResponse.createFailedResult(1002, "预授权转支付失败!");
}
OrderRefund orderRefund = selectByTradNo(tradNo);
if (orderRefund == null) {
return ObjectRestResponse.createFailedResult(1003, "预授权转支付商户订单不存在!");
}
orderRefund.setRefundTradeNo(outRequestNo);
orderRefund.setId(null);
if (refundResponse.getTradeNo() != null) {
orderRefund.setSerialNumber(refundResponse.getTradeNo());
}
orderRefund.setRefundAmount(refundAmount);
orderRefund.setRefundDesc(refundReason + " 预授权转支付商户订单号是:" + tradNo);
orderRefund.setFinishTime(System.currentTimeMillis());
orderRefund.setCrtTime(System.currentTimeMillis());
orderRefund.setUpdTime(System.currentTimeMillis());
mapper.insertSelective(orderRefund);
return ObjectRestResponse.succ(orderRefund);
}
public OrderRefund selectByTradNo(String refundTradeNo) {
if (StringUtils.isNotBlank(refundTradeNo)) {
Example example = new Example(OrderRefund.class);
example.createCriteria().andEqualTo("refundTradeNo", refundTradeNo);
OrderRefund orderRefund = mapper.selectOneByExample(example);
return orderRefund;
}
return null;
}
}
\ No newline at end of file
package com.xxfc.platform.universal.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.universal.biz.OrderRefundBiz;
import com.xxfc.platform.universal.entity.OrderRefund;
import com.xxfc.platform.universal.vo.OrderRefundVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("refund")
......@@ -26,4 +25,10 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
}
}
@GetMapping(value = "/app/unauth/tradRefund")
@ApiOperation("预授权转支付接口")
public ObjectRestResponse tradRefund(String tradNo, Integer refundAmount, String refundReason, String outRequestNo) {
return baseBiz.tradeRefund(tradNo, refundAmount, refundReason, outRequestNo);
}
}
\ No newline at end of file
......@@ -12,6 +12,10 @@ import com.xxfc.platform.vehicle.mapper.BranchCompanyVehicleCountMapper;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCountVo;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyVehicleCountDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
......@@ -24,6 +28,8 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo
@Autowired
VehicleBiz vehicleBiz;
public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd");
public ObjectRestResponse add(BranchCompanyVehicleCount branchCompanyVehicleCount) {
if (branchCompanyVehicleCount == null) {
......@@ -88,6 +94,10 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo
Integer type = branchCompanyVehicleCountDTO.getType() == null ? 1 : branchCompanyVehicleCountDTO.getType();
branchCompanyVehicleCountDTO.setPage(page);
branchCompanyVehicleCountDTO.setLimit(limit);
if (StringUtils.isBlank(branchCompanyVehicleCountDTO.getStartTime()) || StringUtils.isBlank(branchCompanyVehicleCountDTO.getEndTime())) {
branchCompanyVehicleCountDTO.setStartTime(DateTime.now().minusDays(1).toString(DATE_TIME_FORMATTER));
branchCompanyVehicleCountDTO.setEndTime(DateTime.now().minusDays(1).toString(DATE_TIME_FORMATTER));
}
Query query = new Query(branchCompanyVehicleCountDTO);
if (type == 1) {//按天
return ObjectRestResponse.succ(countByDay(query));
......
......@@ -592,9 +592,21 @@
<!--导出分公司停靠所有车辆-->
<select id="getAllVehicleInfo" resultType="com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCountVo">
select b.id as companyId, DATE_FORMAT(now(),'%Y') as countYear, DATE_FORMAT(now(),'%m') as countMonth,DATE_FORMAT(now(),'%u') as countWeek,DATE_FORMAT(now(),'%Y-%m-%d') as countDate,count(*) as vehicleNum from vehicle v
LEFT JOIN branch_company b on b.id = v.park_branch_company_id
GROUP BY b.id
SELECT
b.id AS companyId,
DATE_FORMAT(
DATE_SUB(NOW(), INTERVAL 1 DAY),
'%Y'
) AS countYear,
DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY), '%m') AS countMonth,
DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY), '%u') AS countWeek,
DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY), '%Y-%m-%d') AS countDate,
count(*) AS vehicleNum
FROM
vehicle v
LEFT JOIN branch_company b ON b.id = v.park_branch_company_id
GROUP BY
b.id
</select>
<select id="lockByCode" resultType="com.xxfc.platform.vehicle.entity.Vehicle"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment