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; ...@@ -19,10 +19,20 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class StaffStatisticsFindDTO extends PageParam { public class StaffStatisticsFindDTO extends PageParam {
private Date startDate; private Date startDate;
private Long startTime;
private Long endTime;
private Date endDate; private Date endDate;
private String companyName; private String companyName;
private String postionName; private String postionName;
private Integer userPostionId; private Integer userPostionId;
private Integer companyId; private Integer companyId;
private List<Integer> userIds; 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; package com.github.wxiaoqi.security.admin.feign.dto;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -102,4 +103,20 @@ public class AppUserDTO { ...@@ -102,4 +103,20 @@ public class AppUserDTO {
private Integer parentPositionTempId; private Integer parentPositionTempId;
//用户分公司id //用户分公司id
private Integer parentCompanyId; 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 { ...@@ -223,7 +223,9 @@ public class StaffStatisticsBiz {
} }
List<StaffStatisticsBo> staffStatisticsBos = processStaffStatistics(allStaffs, staffStatisticsFindDTO); List<StaffStatisticsBo> staffStatisticsBos = processStaffStatistics(allStaffs, staffStatisticsFindDTO);
if (staffStatisticsFindDTO.getPage() == 1) { 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); result.put(TOTAL_VAL, staffStatisticsTotalBo);
} }
pageDataVO.setData(staffStatisticsBos); pageDataVO.setData(staffStatisticsBos);
......
...@@ -282,33 +282,44 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id= ...@@ -282,33 +282,44 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id=
</if>) as `saff` </if>) as `saff`
left join ( left join (
select auswp.user_id, IFNULL(auswp.upIncome, 0) - IFNULL(auswd.dowIncome, 0) as `sellAmount` 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` from `app_user_selling_water`
where <![CDATA[position_id<>6]]> where <![CDATA[position_id<>6]]>
and status = 0 and status = 0
<if test="startDate!=null and endDate!=null"> <if test="startDate!=null and endDate!=null">
and `crt_time` between #{startDate} and #{endDate} and `crt_time` between #{startTime} and #{endTime}
</if> </if>
<if test="startDate!=null and endDate==null"> <if test="startDate!=null and endDate==null">
and <![CDATA[ and <![CDATA[
`crt_time` >=#{startDate} `crt_time` >=#{startTime}
]]> ]]>
</if> </if>
<if test="startDate==null and endDate!=null"> <if test="startDate==null and endDate!=null">
and <![CDATA[ and <![CDATA[
`crt_time` <=#{endDate} `crt_time` <=#{endTime}
]]> ]]>
</if> </if>
group by user_id) as auswp 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` from `app_user_selling_water`
where <![CDATA[position_id<>6]]> where <![CDATA[position_id<>6]]>
and status = 1 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 group by user_id) as auswd
on auswd.user_id = auswp.user_id on auswd.user_id = auswp.user_id
) as `sell` on sell.user_id=saff.userId ) as `sell` on sell.user_id=saff.userId
order by sell.sellAmount desc order by sell.sellAmount desc
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -132,23 +132,23 @@ public class MsgBiz { ...@@ -132,23 +132,23 @@ public class MsgBiz {
if (appUserDTO != null) { if (appUserDTO != null) {
userId = appUserDTO.getImUserid(); userId = appUserDTO.getImUserid();
} }
number = number == null ? 10 : number; number = number == null ? 10 : number;
Query query = new Query(Criteria.where("body.type").is(4).and("count.praise").gt(getNumber()).and("visible").is(1)); Query query = new Query(Criteria.where("body.type").is(4).and("count.praise").gt(getNumber()).and("visible").is(1));
if (StringUtils.isNotBlank(messageId)) { if (StringUtils.isNotBlank(messageId)) {
query.addCriteria(Criteria.where("_id").ne(new ObjectId(messageId))); query.addCriteria(Criteria.where("_id").ne(new ObjectId(messageId)));
} }
query.with(new Sort(Sort.Direction.DESC, "count.praise")); query.with(new Sort(Sort.Direction.DESC, "count.praise"));
List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId); List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
List<MsgVo> msgVoList = replaceMsgResult(msgList);
Set<Msg> resultList = new HashSet<>(); Set<MsgVo> resultList = new HashSet<>();
if(CollectionUtils.isNotEmpty(msgList)) { if(CollectionUtils.isNotEmpty(msgVoList)) {
if(number >= msgList.size()) { if(number >= msgVoList.size()) {
return ObjectRestResponse.succ(msgList); return ObjectRestResponse.succ(msgVoList);
} }
Set<Integer> set = new HashSet<>(); Set<Integer> set = new HashSet<>();
RandomUtil.randomSet(msgList.size(), number, set, number); RandomUtil.randomSet(msgVoList.size(), number, set, number);
for(Integer i : set) { for(Integer i : set) {
resultList.add(msgList.get(i)); resultList.add(msgVoList.get(i));
} }
} }
return ObjectRestResponse.succ(resultList); return ObjectRestResponse.succ(resultList);
......
...@@ -505,13 +505,13 @@ public class OrderMsgBiz { ...@@ -505,13 +505,13 @@ public class OrderMsgBiz {
private void handelSmsParam(OrderRentVehicleDetail orvd, BaseOrder baseOrder, List<String> smsParams, AppUserDTO appUserDTO, int handelType) { private void handelSmsParam(OrderRentVehicleDetail orvd, BaseOrder baseOrder, List<String> smsParams, AppUserDTO appUserDTO, int handelType) {
if(RENT_DELIVERY == handelType) { if(RENT_DELIVERY == handelType) {
smsParams.add(appUserDTO.getRealname()); smsParams.add(appUserDTO.obtainRealname());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime()))); smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime())));
smsParams.add(orvd.getEndAddr()); smsParams.add(orvd.getEndAddr());
smsParams.add(baseOrder.getName()); smsParams.add(baseOrder.getName());
smsParams.add(appUserDTO.getUsername()); smsParams.add(appUserDTO.getUsername());
}else { }else {
smsParams.add(appUserDTO.getRealname()); smsParams.add(appUserDTO.obtainRealname());
smsParams.add(baseOrder.getName()); smsParams.add(baseOrder.getName());
smsParams.add(orvd.getStartAddr()); smsParams.add(orvd.getStartAddr());
smsParams.add(orvd.getEndAddr()); smsParams.add(orvd.getEndAddr());
...@@ -526,16 +526,20 @@ public class OrderMsgBiz { ...@@ -526,16 +526,20 @@ public class OrderMsgBiz {
switch (paramHandelType) { switch (paramHandelType) {
case SmsTemplateDTO.PAY_A : case SmsTemplateDTO.PAY_A :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) { if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname()); smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else { }else {
smsParams.add(USER_N+ appUserDTO.getRealname()); smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
} }
smsParams.add(baseOrder.getRealAmount().toString()); smsParams.add(baseOrder.getRealAmount().toString());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime()))); smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(startCompanyDetail.detailAddr()); smsParams.add(startCompanyDetail.detailAddr());
break; break;
case SmsTemplateDTO.PAY_B : 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(orvd.getFreeDays().toString());
smsParams.add(appUserDTO.getRentFreeDays().toString()); smsParams.add(appUserDTO.getRentFreeDays().toString());
smsParams.add(baseOrder.getRealAmount().toString()); smsParams.add(baseOrder.getRealAmount().toString());
...@@ -556,31 +560,28 @@ public class OrderMsgBiz { ...@@ -556,31 +560,28 @@ public class OrderMsgBiz {
break; break;
case SmsTemplateDTO.CANCEL_A : case SmsTemplateDTO.CANCEL_A :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) { if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname()); smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else { }else {
smsParams.add(USER_N+ appUserDTO.getRealname()); smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
} }
break; break;
case SmsTemplateDTO.CANCEL_B : case SmsTemplateDTO.CANCEL_B :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) { if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname()); smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else { }else {
smsParams.add(USER_N+ appUserDTO.getRealname()); smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
} }
break; break;
case SmsTemplateDTO.PAY_I : case SmsTemplateDTO.PAY_I :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) { if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname()); smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else { }else {
smsParams.add(USER_N+ appUserDTO.getRealname()); smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
} }
smsParams.add(startCompanyDetail.getAddrDetail()); smsParams.add(startCompanyDetail.getAddrDetail());
break; break;
case SmsTemplateDTO.PAY_J : case SmsTemplateDTO.PAY_J :
String realName = appUserDTO.getRealname(); String realName = appUserDTO.obtainRealnameNUL();
if(StrUtil.isBlank(realName)){
realName = "";
}
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) { if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ realName); smsParams.add(USER_M+ realName);
}else { }else {
...@@ -599,9 +600,9 @@ public class OrderMsgBiz { ...@@ -599,9 +600,9 @@ public class OrderMsgBiz {
switch (paramHandelType) { switch (paramHandelType) {
case SmsTemplateDTO.CANCEL_C : case SmsTemplateDTO.CANCEL_C :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) { if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname()); smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else { }else {
smsParams.add(USER_N+ appUserDTO.getRealname()); smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
} }
smsParams.add(violateAmount.toString()); smsParams.add(violateAmount.toString());
smsParams.add(refundAmount.toString()); smsParams.add(refundAmount.toString());
...@@ -614,9 +615,9 @@ public class OrderMsgBiz { ...@@ -614,9 +615,9 @@ public class OrderMsgBiz {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData(); Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Long rentDepositAutoRefundTime = new Long(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_DEPOSIT_AUTO_REFUND_TIME).getDetail()); 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()) ) { if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname()); smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else { }else {
smsParams.add(USER_N+ appUserDTO.getRealname()); smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
} }
smsParams.add(baseOrder.getNo()); smsParams.add(baseOrder.getNo());
smsParams.add(originalAmount.toString()); smsParams.add(originalAmount.toString());
...@@ -627,9 +628,9 @@ public class OrderMsgBiz { ...@@ -627,9 +628,9 @@ public class OrderMsgBiz {
break; break;
case SmsTemplateDTO.REFUND_B: case SmsTemplateDTO.REFUND_B:
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) { if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname()); smsParams.add(USER_M+ appUserDTO.obtainRealnameNUL());
}else { }else {
smsParams.add(USER_N+ appUserDTO.getRealname()); smsParams.add(USER_N+ appUserDTO.obtainRealnameNUL());
} }
smsParams.add(baseOrder.getNo()); smsParams.add(baseOrder.getNo());
smsParams.add(originalAmount.toString()); smsParams.add(originalAmount.toString());
...@@ -649,7 +650,7 @@ public class OrderMsgBiz { ...@@ -649,7 +650,7 @@ public class OrderMsgBiz {
} }
switch (paramHandelType) { switch (paramHandelType) {
case SmsTemplateDTO.PAY_C : case SmsTemplateDTO.PAY_C :
smsParams.add(appUserDTO.getRealname()); smsParams.add(appUserDTO.obtainRealname());
smsParams.add(appUserDTO.getUsername()); smsParams.add(appUserDTO.getUsername());
smsParams.add(baseOrder.getName()); smsParams.add(baseOrder.getName());
smsParams.add(sCompany.getName()); smsParams.add(sCompany.getName());
...@@ -657,41 +658,38 @@ public class OrderMsgBiz { ...@@ -657,41 +658,38 @@ public class OrderMsgBiz {
smsParams.add(eCompany.getName()); smsParams.add(eCompany.getName());
smsParams.add(eCompany.getVehiceServicePhone()); smsParams.add(eCompany.getVehiceServicePhone());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime()))); smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime()))); smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getEndTime())));
smsParams.add(orvd.obtainRealDayNum().toString()); smsParams.add(orvd.getDayNum().toString());
break; break;
case SmsTemplateDTO.PAY_D : case SmsTemplateDTO.PAY_D :
smsParams.add(appUserDTO.getRealname()); smsParams.add(appUserDTO.obtainRealname());
smsParams.add(appUserDTO.getUsername()); smsParams.add(appUserDTO.getUsername());
smsParams.add(baseOrder.getName()); smsParams.add(baseOrder.getName());
smsParams.add(sCompany.getName()); smsParams.add(sCompany.getName());
smsParams.add(eCompany.getName()); smsParams.add(eCompany.getName());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime()))); smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime()))); smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getEndTime())));
smsParams.add(orvd.obtainRealDayNum().toString()); smsParams.add(orvd.getDayNum().toString());
break; break;
case SmsTemplateDTO.PAY_E : case SmsTemplateDTO.PAY_E :
smsParams.add(appUserDTO.getRealname()); smsParams.add(appUserDTO.obtainRealname());
smsParams.add(appUserDTO.getUsername()); 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(eCompany.getName());
smsParams.add(baseOrder.getName()); smsParams.add(baseOrder.getName());
break; break;
case SmsTemplateDTO.CANCEL_E : case SmsTemplateDTO.CANCEL_E :
smsParams.add(appUserDTO.getRealname()); smsParams.add(appUserDTO.obtainRealname());
smsParams.add(appUserDTO.getUsername()); smsParams.add(appUserDTO.getUsername());
smsParams.add(baseOrder.getName()); smsParams.add(baseOrder.getName());
smsParams.add(sCompany.getName()); smsParams.add(sCompany.getName());
smsParams.add(eCompany.getName()); smsParams.add(eCompany.getName());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime()))); smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime()))); smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getEndTime())));
smsParams.add(orvd.obtainRealDayNum().toString()); smsParams.add(orvd.getDayNum().toString());
break; break;
case SmsTemplateDTO.PAY_H : case SmsTemplateDTO.PAY_H :
String realName = appUserDTO.getRealname(); String realName = appUserDTO.obtainRealname();
if(StrUtil.isBlank(realName)){
realName = "匿名";
}
smsParams.add(realName); smsParams.add(realName);
smsParams.add(appUserDTO.getUsername()); smsParams.add(appUserDTO.getUsername());
smsParams.add(baseOrder.getName()); smsParams.add(baseOrder.getName());
...@@ -700,10 +698,7 @@ public class OrderMsgBiz { ...@@ -700,10 +698,7 @@ public class OrderMsgBiz {
smsParams.add(DateUtil.formatDateTime(DateUtil.date(otd.getStartTime()))); smsParams.add(DateUtil.formatDateTime(DateUtil.date(otd.getStartTime())));
break; break;
case SmsTemplateDTO.CANCEL_F : case SmsTemplateDTO.CANCEL_F :
String realName2 = appUserDTO.getRealname(); String realName2 = appUserDTO.obtainRealname();
if(StrUtil.isBlank(realName2)){
realName2 = "匿名";
}
smsParams.add(realName2); smsParams.add(realName2);
smsParams.add(appUserDTO.getUsername()); smsParams.add(appUserDTO.getUsername());
smsParams.add(baseOrder.getName()); smsParams.add(baseOrder.getName());
......
...@@ -647,7 +647,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{ ...@@ -647,7 +647,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
* @param refundReason 退款原因 * @param refundReason 退款原因
* @param outRequestNo 退款标志号 * @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(); AlipayClient alipayClient = getAlipayClient();
AlipayTradeRefundModel model = new AlipayTradeRefundModel(); AlipayTradeRefundModel model = new AlipayTradeRefundModel();
BigDecimal realAmount = new BigDecimal(refundAmount.toString()).divide(new BigDecimal("100"), 2, BigDecimal.ROUND_UP); 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>{ ...@@ -664,6 +664,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
e.printStackTrace(); e.printStackTrace();
} }
log.info("response: {}"+response.getBody()); log.info("response: {}"+response.getBody());
return response;
} }
public static void main(String[] args) throws AlipayApiException { public static void main(String[] args) throws AlipayApiException {
OrderPayBiz orderPayBiz = new OrderPayBiz(); OrderPayBiz orderPayBiz = new OrderPayBiz();
......
package com.xxfc.platform.universal.biz; package com.xxfc.platform.universal.biz;
import com.alibaba.fastjson.JSONObject; 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.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.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig; import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil; import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
...@@ -142,4 +144,38 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> { ...@@ -142,4 +144,38 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
} }
return JsonResultUtil.createFailedResult(40004, "退款失败!"); 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; package com.xxfc.platform.universal.controller;
import com.alibaba.fastjson.JSONObject; 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.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil; import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.universal.biz.OrderRefundBiz; import com.xxfc.platform.universal.biz.OrderRefundBiz;
import com.xxfc.platform.universal.entity.OrderRefund; import com.xxfc.platform.universal.entity.OrderRefund;
import com.xxfc.platform.universal.vo.OrderRefundVo; import com.xxfc.platform.universal.vo.OrderRefundVo;
import org.springframework.web.bind.annotation.RequestBody; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("refund") @RequestMapping("refund")
...@@ -26,4 +25,10 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe ...@@ -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; ...@@ -12,6 +12,10 @@ import com.xxfc.platform.vehicle.mapper.BranchCompanyVehicleCountMapper;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCountVo; import com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCountVo;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyVehicleCountDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyVehicleCountDTO;
import lombok.extern.slf4j.Slf4j; 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.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -24,6 +28,8 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo ...@@ -24,6 +28,8 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo
@Autowired @Autowired
VehicleBiz vehicleBiz; VehicleBiz vehicleBiz;
public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd");
public ObjectRestResponse add(BranchCompanyVehicleCount branchCompanyVehicleCount) { public ObjectRestResponse add(BranchCompanyVehicleCount branchCompanyVehicleCount) {
if (branchCompanyVehicleCount == null) { if (branchCompanyVehicleCount == null) {
...@@ -88,6 +94,10 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo ...@@ -88,6 +94,10 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo
Integer type = branchCompanyVehicleCountDTO.getType() == null ? 1 : branchCompanyVehicleCountDTO.getType(); Integer type = branchCompanyVehicleCountDTO.getType() == null ? 1 : branchCompanyVehicleCountDTO.getType();
branchCompanyVehicleCountDTO.setPage(page); branchCompanyVehicleCountDTO.setPage(page);
branchCompanyVehicleCountDTO.setLimit(limit); 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); Query query = new Query(branchCompanyVehicleCountDTO);
if (type == 1) {//按天 if (type == 1) {//按天
return ObjectRestResponse.succ(countByDay(query)); return ObjectRestResponse.succ(countByDay(query));
......
...@@ -592,9 +592,21 @@ ...@@ -592,9 +592,21 @@
<!--导出分公司停靠所有车辆--> <!--导出分公司停靠所有车辆-->
<select id="getAllVehicleInfo" resultType="com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCountVo"> <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 SELECT
LEFT JOIN branch_company b on b.id = v.park_branch_company_id b.id AS companyId,
GROUP BY b.id 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>
<select id="lockByCode" resultType="com.xxfc.platform.vehicle.entity.Vehicle" <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