Commit b534afe4 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/master'

parents 043c5bdf 633b65ca
......@@ -19,10 +19,20 @@ import java.util.List;
@NoArgsConstructor
public class StaffStatisticsFindDTO extends PageParam {
private Date startDate;
private Long startTime;
private Long endTime;
private Date endDate;
private String companyName;
private String postionName;
private Integer userPostionId;
private Integer companyId;
private List<Integer> userIds;
public Long getStartTime() {
return startDate==null?0:startDate.getTime();
}
public Long getEndTime() {
return endDate==null?0:endDate.getTime();
}
}
......@@ -223,7 +223,9 @@ public class StaffStatisticsBiz {
}
List<StaffStatisticsBo> staffStatisticsBos = processStaffStatistics(allStaffs, staffStatisticsFindDTO);
if (staffStatisticsFindDTO.getPage() == 1) {
StaffStatisticsTotalBo staffStatisticsTotalBo = getStaffStatisticsTotalBo(allStaffs.size(), staffStatisticsBos);
List<UserStaffBo> userStaffBos = appUserDetailBiz.findStaffsByIdsAndCompanyAndPostion(staffStatisticsFindDTO);
List<StaffStatisticsBo> totalStaffStatisticsBos = processStaffStatistics(userStaffBos, staffStatisticsFindDTO);
StaffStatisticsTotalBo staffStatisticsTotalBo = getStaffStatisticsTotalBo(userStaffBos.size(), totalStaffStatisticsBos);
result.put(TOTAL_VAL, staffStatisticsTotalBo);
}
pageDataVO.setData(staffStatisticsBos);
......
......@@ -282,33 +282,44 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id=
</if>) as `saff`
left join (
select auswp.user_id, IFNULL(auswp.upIncome, 0) - IFNULL(auswd.dowIncome, 0) as `sellAmount`
from (select `user_id`, sum(price) as `upIncome`
from (select `user_id`, sum(commission / (extract/100.0)) as `upIncome`
from `app_user_selling_water`
where <![CDATA[position_id<>6]]>
and status = 0
<if test="startDate!=null and endDate!=null">
and `crt_time` between #{startDate} and #{endDate}
and `crt_time` between #{startTime} and #{endTime}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`crt_time` >=#{startDate}
`crt_time` >=#{startTime}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`crt_time` <=#{endDate}
`crt_time` <=#{endTime}
]]>
</if>
group by user_id) as auswp
left join (select `user_id`, sum(price) as `dowIncome`
left join (select `user_id`, sum(commission / (extract/100.0)) as `dowIncome`
from `app_user_selling_water`
where <![CDATA[position_id<>6]]>
and status = 1
<if test="startDate!=null and endDate!=null">
and `crt_time` between #{startTime} and #{endTime}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`crt_time` >=#{startTime}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`crt_time` <=#{endTime}
]]>
</if>
group by user_id) as auswd
on auswd.user_id = auswp.user_id
) as `sell` on sell.user_id=saff.userId
order by sell.sellAmount desc
</select>
</mapper>
\ No newline at end of file
......@@ -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