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

Merge branch 'master' into feature-delay-add

# Conflicts:
#	xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderMsgBiz.java
parents 1c893bdb 21ff9ff5
......@@ -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();
}
}
package com.github.wxiaoqi.security.admin.feign.dto;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -102,4 +103,20 @@ public class AppUserDTO {
private Integer parentPositionTempId;
//用户分公司id
private Integer parentCompanyId;
public String obtainRealname() {
if(StrUtil.isBlank(getRealname())) {
return "匿名";
}else {
return getRealname();
}
}
public String obtainRealnameNUL() {
if(StrUtil.isBlank(getRealname())) {
return "";
}else {
return getRealname();
}
}
}
......@@ -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
......@@ -139,16 +139,16 @@ public class MsgBiz {
}
query.with(new Sort(Sort.Direction.DESC, "count.praise"));
List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
Set<Msg> resultList = new HashSet<>();
if(CollectionUtils.isNotEmpty(msgList)) {
if(number >= msgList.size()) {
return ObjectRestResponse.succ(msgList);
List<MsgVo> msgVoList = replaceMsgResult(msgList);
Set<MsgVo> resultList = new HashSet<>();
if(CollectionUtils.isNotEmpty(msgVoList)) {
if(number >= msgVoList.size()) {
return ObjectRestResponse.succ(msgVoList);
}
Set<Integer> set = new HashSet<>();
RandomUtil.randomSet(msgList.size(), number, set, number);
RandomUtil.randomSet(msgVoList.size(), number, set, number);
for(Integer i : set) {
resultList.add(msgList.get(i));
resultList.add(msgVoList.get(i));
}
}
return ObjectRestResponse.succ(resultList);
......
......@@ -505,13 +505,13 @@ public class OrderMsgBiz {
private void handelSmsParam(OrderRentVehicleDetail orvd, BaseOrder baseOrder, List<String> smsParams, AppUserDTO appUserDTO, int handelType) {
if(RENT_DELIVERY == handelType) {
smsParams.add(appUserDTO.getRealname());
smsParams.add(appUserDTO.obtainRealname());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime())));
smsParams.add(orvd.getEndAddr());
smsParams.add(baseOrder.getName());
smsParams.add(appUserDTO.getUsername());
}else {
smsParams.add(appUserDTO.getRealname());
smsParams.add(appUserDTO.obtainRealname());
smsParams.add(baseOrder.getName());
smsParams.add(orvd.getStartAddr());
smsParams.add(orvd.getEndAddr());
......@@ -526,16 +526,20 @@ public class OrderMsgBiz {
switch (paramHandelType) {
case SmsTemplateDTO.PAY_A :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
}
smsParams.add(baseOrder.getRealAmount().toString());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(startCompanyDetail.detailAddr());
break;
case SmsTemplateDTO.PAY_B :
smsParams.add(appUserDTO.getRealname());
String realName_B = appUserDTO.obtainRealnameNUL();
if(StrUtil.isNotBlank(realName_B)) {
realName_B = "您好";
}
smsParams.add(realName_B);
smsParams.add(orvd.getFreeDays().toString());
smsParams.add(appUserDTO.getRentFreeDays().toString());
smsParams.add(baseOrder.getRealAmount().toString());
......@@ -556,31 +560,28 @@ public class OrderMsgBiz {
break;
case SmsTemplateDTO.CANCEL_A :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
}
break;
case SmsTemplateDTO.CANCEL_B :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
}
break;
case SmsTemplateDTO.PAY_I :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
}
smsParams.add(startCompanyDetail.getAddrDetail());
break;
case SmsTemplateDTO.PAY_J :
String realName = appUserDTO.getRealname();
if(StrUtil.isBlank(realName)){
realName = "";
}
String realName = appUserDTO.obtainRealnameNUL();
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ realName);
}else {
......@@ -599,9 +600,9 @@ public class OrderMsgBiz {
switch (paramHandelType) {
case SmsTemplateDTO.CANCEL_C :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
}
smsParams.add(violateAmount.toString());
smsParams.add(refundAmount.toString());
......@@ -614,9 +615,9 @@ public class OrderMsgBiz {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Long rentDepositAutoRefundTime = new Long(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_DEPOSIT_AUTO_REFUND_TIME).getDetail());
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
}
smsParams.add(baseOrder.getNo());
smsParams.add(originalAmount.toString());
......@@ -627,9 +628,9 @@ public class OrderMsgBiz {
break;
case SmsTemplateDTO.REFUND_B:
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
}
smsParams.add(baseOrder.getNo());
smsParams.add(originalAmount.toString());
......@@ -649,7 +650,7 @@ public class OrderMsgBiz {
}
switch (paramHandelType) {
case SmsTemplateDTO.PAY_C :
smsParams.add(appUserDTO.getRealname());
smsParams.add(appUserDTO.obtainRealname());
smsParams.add(appUserDTO.getUsername());
smsParams.add(baseOrder.getName());
smsParams.add(sCompany.getName());
......@@ -657,41 +658,38 @@ public class OrderMsgBiz {
smsParams.add(eCompany.getName());
smsParams.add(eCompany.getVehiceServicePhone());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime())));
smsParams.add(orvd.obtainRealDayNum().toString());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getEndTime())));
smsParams.add(orvd.getDayNum().toString());
break;
case SmsTemplateDTO.PAY_D :
smsParams.add(appUserDTO.getRealname());
smsParams.add(appUserDTO.obtainRealname());
smsParams.add(appUserDTO.getUsername());
smsParams.add(baseOrder.getName());
smsParams.add(sCompany.getName());
smsParams.add(eCompany.getName());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime())));
smsParams.add(orvd.obtainRealDayNum().toString());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getEndTime())));
smsParams.add(orvd.getDayNum().toString());
break;
case SmsTemplateDTO.PAY_E :
smsParams.add(appUserDTO.getRealname());
smsParams.add(appUserDTO.obtainRealname());
smsParams.add(appUserDTO.getUsername());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getEndTime())));
smsParams.add(eCompany.getName());
smsParams.add(baseOrder.getName());
break;
case SmsTemplateDTO.CANCEL_E :
smsParams.add(appUserDTO.getRealname());
smsParams.add(appUserDTO.obtainRealname());
smsParams.add(appUserDTO.getUsername());
smsParams.add(baseOrder.getName());
smsParams.add(sCompany.getName());
smsParams.add(eCompany.getName());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime())));
smsParams.add(orvd.obtainRealDayNum().toString());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getEndTime())));
smsParams.add(orvd.getDayNum().toString());
break;
case SmsTemplateDTO.PAY_H :
String realName = appUserDTO.getRealname();
if(StrUtil.isBlank(realName)){
realName = "匿名";
}
String realName = appUserDTO.obtainRealname();
smsParams.add(realName);
smsParams.add(appUserDTO.getUsername());
smsParams.add(baseOrder.getName());
......@@ -700,10 +698,7 @@ public class OrderMsgBiz {
smsParams.add(DateUtil.formatDateTime(DateUtil.date(otd.getStartTime())));
break;
case SmsTemplateDTO.CANCEL_F :
String realName2 = appUserDTO.getRealname();
if(StrUtil.isBlank(realName2)){
realName2 = "匿名";
}
String realName2 = appUserDTO.obtainRealname();
smsParams.add(realName2);
smsParams.add(appUserDTO.getUsername());
smsParams.add(baseOrder.getName());
......
......@@ -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