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

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/UserFeign.java
parents 4e8966b8 d83fb531
......@@ -10,7 +10,9 @@ ace-modules/ace-tool/src/main/resources/application-dev.yml
**/src/test
**/logs
xx-order/xx-order-server/logs/**
xx-order/xx-order-server/src/test/java/**
*.log
logs/**
/src/main/test/**
......@@ -32,6 +32,8 @@ public class RabbitConstant {
//钱包
public static final String KEY_WALLET_ADD = "wallet.add";
public static final String KEY_WALLET_WITH_DRAW="wallet.withdraw";
static {
exchangeTopicSet = new HashSet<String>() {{
add(ADMIN_TOPIC);
......
package com.github.wxiaoqi.security.admin.constant;
/**
* @author libin
* @version 1.0
* @description 提现状态
* @data 2019/10/18 12:30
*/
public enum WithDrawStatusEnum {
/**
* 提现审核中
*/
AUDIT(0),
/**
* 提现成功
*/
SUCCESS(1),
/**
* 提现失败
*/
FAIL(2),
/**
* 提现审核同意
*/
AGREE(1),
/**
* 提现审核拒绝
*/
REJECT(2);
private int code;
WithDrawStatusEnum(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}
package com.github.wxiaoqi.security.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
......@@ -12,6 +14,8 @@ import java.math.BigDecimal;
* @data 2019/7/18 9:50
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WalletDetailListDTO {
private Integer id;
......
......@@ -5,7 +5,9 @@ import java.math.BigDecimal;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
......@@ -16,6 +18,8 @@ import lombok.Data;
* @date 2019-07-11 14:14:54
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "my_wallet_cath")
public class MyWalletCath implements Serializable {
private static final long serialVersionUID = 1L;
......
......@@ -133,4 +133,11 @@ public interface UserFeign {
@GetMapping("/member/user")
BaseUserMember findBaseUserMemberByUserId(@RequestParam(value = "userId") Integer userId);
@GetMapping("/wallet/withdraw_do")
public ObjectRestResponse<Void> withDrawprocess(@RequestParam(value = "orderNo") String orderNo,
@RequestParam(value = "cono",required = false) String cono,
@RequestParam(value = "reason",required = false) String reason,
@RequestParam(value = "isSuccess") Boolean isSuccess);
}
......@@ -12,6 +12,7 @@ import com.github.wxiaoqi.security.admin.vo.WalletCathPageVo;
import com.github.wxiaoqi.security.admin.vo.WalletCathVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.universal.constant.PayWay;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
......@@ -64,11 +65,11 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
BeanUtils.copyProperties(walletCath, walletCathVo);
totalWithdraw = totalWithdraw.add(walletCathVo.getAmount());
//微信
if (walletCath.getCathType()==0){
if (walletCath.getCathType()== PayWay.WX_PAY.getCode()){
walletCathVo.setAccountNumberDesc(String.format("%s%s%s","提现到微信(",walletCath.getAccountName(),")"));
}
//支付宝
if (walletCath.getCathType()==1){
if (walletCath.getCathType()==PayWay.ALI_PAY.getCode()){
walletCathVo.setAccountNumberDesc(String.format("%s%s%s","提现到支付宝(",walletCath.getAccountName(),")"));
}
walletCatchPageVos.add(walletCathVo);
......@@ -147,4 +148,10 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
public void insertSelective(MyWalletCath entity) {
mapper.insertSelective(entity);
}
public MyWalletCath findWalletCatchByOrderNo(String orderNo) {
MyWalletCath myWalletCath = new MyWalletCath();
myWalletCath.setOrderNo(orderNo);
return mapper.selectOne(myWalletCath);
}
}
package com.github.wxiaoqi.security.admin.biz;
import cn.hutool.core.date.DateTime;
import com.github.wxiaoqi.security.admin.dto.UserInfoDTO;
import com.github.wxiaoqi.security.admin.entity.MyWallet;
import com.github.wxiaoqi.security.admin.entity.MyWalletDetail;
import com.github.wxiaoqi.security.admin.mapper.MyWalletDetailMapper;
import com.github.wxiaoqi.security.admin.mapper.MyWalletMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
......@@ -18,7 +16,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......
......@@ -7,9 +7,11 @@ import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
/**
* rabbitmq配置类
* 包含: 不知道什么orderWater队列
*
* @author zhoujw
* @date 2019/7/15
*/
......@@ -24,8 +26,10 @@ public class RabbitAdminConfig extends RabbitCommonConfig {
//支付完成后永久绑定关系
public static final String ORDER_RELATION_QUEUE = "order.relation.queue";
static {
myQueue = new ArrayList<BindDTO>(){{
myQueue = new ArrayList<BindDTO>() {{
//支付完成后永久绑定关系
add(new BindDTO(ORDER_RELATION_QUEUE, ORDER_TOPIC, KEY_ORDER_PAY));
//拥金计算
......
......@@ -13,6 +13,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
......@@ -42,7 +43,7 @@ public class MyWalletController {
@GetMapping
public ObjectRestResponse<AppletWalletVo> findMyWallet(HttpServletRequest request){
public ObjectRestResponse<AppletWalletVo> findMyWallet(HttpServletRequest request) {
try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
AppletWalletVo wallet = myWalletBiz.findMyWallet(Integer.valueOf(infoFromToken.getId()));
......@@ -56,35 +57,35 @@ public class MyWalletController {
@GetMapping("/checkCode")
@ApiOperation("检查验证码")
public ObjectRestResponse checkCode(
@RequestParam(value = "phone",defaultValue = "")String phone,
@RequestParam(value = "mobilecode",defaultValue = "")String mobilecod
){
return myWalletBiz.checkCode(phone,mobilecod);
@RequestParam(value = "phone", defaultValue = "") String phone,
@RequestParam(value = "mobilecode", defaultValue = "") String mobilecod
) {
return myWalletBiz.checkCode(phone, mobilecod);
}
@PostMapping("/setPwd")
@ApiOperation("设置密码")
public ObjectRestResponse setPwd(
@RequestParam(value = "phone",defaultValue = "")String phone,
@RequestParam(value = "mobilecode",defaultValue = "")String mobilecod,
@RequestParam(value = "password",defaultValue = "")String password,
@RequestParam(value = "type",defaultValue = "1")Integer type,
HttpServletRequest request){
@RequestParam(value = "phone", defaultValue = "") String phone,
@RequestParam(value = "mobilecode", defaultValue = "") String mobilecod,
@RequestParam(value = "password", defaultValue = "") String password,
@RequestParam(value = "type", defaultValue = "1") Integer type,
HttpServletRequest request) {
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.setPwd(userId,phone,mobilecod,password,type);
}catch (Exception e) {
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.setPwd(userId, phone, mobilecod, password, type);
} catch (Exception e) {
throw new BaseException(e);
}
}
@GetMapping("/checkSetPwd")
@ApiOperation("检查用户是否设置过支付密码")
public ObjectRestResponse checkSetPwd(HttpServletRequest request){
public ObjectRestResponse checkSetPwd(HttpServletRequest request) {
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.checkSetPwd(userId);
}catch (Exception e) {
} catch (Exception e) {
throw new BaseException(e);
}
}
......@@ -92,50 +93,58 @@ public class MyWalletController {
@GetMapping("/checkAmount")
@ApiOperation("检查提成下一步操作")
public ObjectRestResponse checkAmount(
@RequestParam(value = "amount",defaultValue = "0.00") BigDecimal amount,
HttpServletRequest request){
@RequestParam(value = "amount", defaultValue = "0.00") BigDecimal amount,
HttpServletRequest request) {
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.checkAmount(userId,amount,null);
}catch (Exception e) {
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.checkAmount(userId, amount, null);
} catch (Exception e) {
throw new BaseException(e);
}
}
@PostMapping("/applyCath")
@ApiOperation("提现申请")
public ObjectRestResponse applyCath(@RequestBody ApplyCathVo applyCathVo, HttpServletRequest request){
public ObjectRestResponse applyCath(@RequestBody ApplyCathVo applyCathVo, HttpServletRequest request) {
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
applyCathVo.setUserId(userId);
return myWalletBiz.applyCath(applyCathVo);
}catch (Exception e) {
} catch (Exception e) {
throw new BaseException(e);
}
}
@GetMapping("/txAlipayList")
@ApiOperation("获取支付账号列表")
public ObjectRestResponse txAlipayList(HttpServletRequest request){
public ObjectRestResponse txAlipayList(HttpServletRequest request) {
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return ObjectRestResponse.succ(alipayBiz.getListByUserId(userId)) ;
}catch (Exception e) {
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return ObjectRestResponse.succ(alipayBiz.getListByUserId(userId));
} catch (Exception e) {
throw new BaseException(e);
}
}
@ApiOperation("获取支付账号(微信|支付宝|银行卡)")
@GetMapping("/pay_account_list")
public ObjectRestResponse listPayAccount(HttpServletRequest request){
public ObjectRestResponse listPayAccount(HttpServletRequest request) {
try {
Integer userId = Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
List<PayAccountVo> payAccountVos = myWalletBiz.listPayAccountByUserId(userId);
return ObjectRestResponse.succ(payAccountVos);
}catch (Exception ex){
} catch (Exception ex) {
throw new BaseException(ex);
}
}
@GetMapping("/withdraw_do")
public ObjectRestResponse<Void> withDrawprocess(@RequestParam(value = "orderNo") String orderNo,
@RequestParam(value = "cono", required = false) String cono,
@RequestParam(value = "reason", required = false) String reason,
@RequestParam(value = "isSuccess") Boolean isSuccess) {
myWalletBiz.withDrawProcess(orderNo, cono, reason, isSuccess);
return ObjectRestResponse.succ();
}
}
......@@ -39,8 +39,6 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
private final Integer headOfficeId = 1;
@Value("${order.day}")
private Integer day;
/**
* 总公司id默认为1
......@@ -50,7 +48,7 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
private OrderAccountBiz accountBiz;
@Transactional(rollbackFor = Exception.class)
public boolean saveDailyMembersOrderRecord() {
public boolean saveDailyMembersOrderRecord(Integer day) {
try {
List<OrderAccountDTO> accountList = accountBiz.getOrderAccountByOrderType(OrderTypeEnum.MEMBER.getCode(), day);
......
......@@ -25,11 +25,11 @@ public class DailyOrderStatisticsBiz extends BaseBiz<DailyOrderStatisticsMapper,
@Autowired
private DailyMembersOrderStatisticsBiz membersStatisticsBiz;
@Scheduled(cron = "0 0 2 * * ?")
public boolean statisticalOrder(){
boolean vehicleFlag = vehicleStatisticsBiz.saveDailyVehicleOrderRecord();
boolean travelFlag = travelStatisticsBiz.saveDailyTravelOrderRecord();
boolean membersFlag= membersStatisticsBiz.saveDailyMembersOrderRecord();
// @Scheduled(cron = "0 0 2 * * ?")
public boolean statisticalOrder(Integer day){
boolean vehicleFlag = vehicleStatisticsBiz.saveDailyVehicleOrderRecord(day);
boolean travelFlag = travelStatisticsBiz.saveDailyTravelOrderRecord(day);
boolean membersFlag= membersStatisticsBiz.saveDailyMembersOrderRecord(day);
if (vehicleFlag&&travelFlag&&membersFlag){
log.info("----statisticalOrder:成功-----");
......
......@@ -39,8 +39,6 @@ import java.util.stream.Collectors;
@Service
@Slf4j
public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStatisticsMapper, DailyTravelOrderStatistics> {
@Value("${order.day}")
private Integer day;
@Autowired
......@@ -108,10 +106,10 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
* @return
*/
@Transactional(rollbackFor = Exception.class)
public boolean saveDailyTravelOrderRecord() {
public boolean saveDailyTravelOrderRecord(Integer day) {
try {
//获取每日订单统计
List<DailyTravelOrderStatistics> orderStatistics = getDailyTravelOrderStatistics();
List<DailyTravelOrderStatistics> orderStatistics = getDailyTravelOrderStatistics(day);
log.info("Travel:统计完成");
if (CollectionUtils.isNotEmpty(orderStatistics)) {
for (DailyTravelOrderStatistics orderStatistic : orderStatistics) {
......@@ -153,7 +151,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
}
return true;
}
private List<DailyTravelOrderStatistics> getDailyTravelOrderStatistics() {
private List<DailyTravelOrderStatistics> getDailyTravelOrderStatistics(Integer day) {
//获取当天所有订单账目
List<OrderAccountDTO> accountList = accountBiz.getOrderAccountByOrderType(OrderTypeEnum.TOUR.getCode(), day);
if (CollectionUtils.isEmpty(accountList)) {
......
......@@ -52,11 +52,6 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
*/
private final Integer TYPE_OTHER = 3;
/**
* 统计几天前的数据
*/
@Value("${order.day}")
private Integer day;
@Autowired
......@@ -246,10 +241,10 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
* @return
*/
@Transactional(rollbackFor = Exception.class)
public boolean saveDailyVehicleOrderRecord() {
public boolean saveDailyVehicleOrderRecord(Integer day) {
try {
//获取每日订单统计
List<DailyVehicleOrderStatistics> orderStatistics = getDailyVehicleOrderRecord();
List<DailyVehicleOrderStatistics> orderStatistics = getDailyVehicleOrderRecord(day);
log.info("Vehicle:统计完成");
if (CollectionUtils.isNotEmpty(orderStatistics)) {
for (DailyVehicleOrderStatistics orderStatistic : orderStatistics) {
......@@ -292,8 +287,9 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
* 获取所有分公司每日统计记录
*
* @return
* @param day
*/
private List<DailyVehicleOrderStatistics> getDailyVehicleOrderRecord() {
private List<DailyVehicleOrderStatistics> getDailyVehicleOrderRecord(Integer day) {
//获取当天所有订单账目
List<OrderAccountDTO> accountList = accountBiz.getOrderAccountByOrderType(OrderTypeEnum.RENT_VEHICLE.getCode(), day);
if (CollectionUtils.isEmpty(accountList)) {
......
......@@ -518,8 +518,6 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
* @return
*/
public List<OrderAccountDTO> getOrderAccountByOrderType(Integer code, Integer day) {
return mapper.getOrderAccountByOrderType(code,day);
}
......
package com.xxfc.platform.order.jobhandler;
import com.xxfc.platform.order.biz.BaseOrderBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.google.common.collect.Lists;
import com.xxfc.platform.order.biz.DailyOrderStatisticsBiz;
import com.xxfc.platform.order.biz.DailyVehicleOrderStatisticsBiz;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 每天2定时统计前一天的数据
* 每天2点定时统计前一天的数据
*
* @author Administrator
*/
@JobHandler(value = "baseOrderStatisticsHandler")
......@@ -22,26 +34,100 @@ public class BaseOrderStatisticsJobHandler extends IJobHandler {
@Autowired
private DailyOrderStatisticsBiz statisticsBiz;
@Value("${order.day:1}")
private Integer day;
/**
* 每日定时执行订单统计
*
* @param date 重新统计起止日期.可以为:起止时间(yyyy-MM-dd),开始时间/结束时间(yyyy-MM-dd/yyyy-MM-dd)
* @return
*/
@Override
public ReturnT<String> execute(String s){
public ReturnT<String> execute(String date) {
try {
log.info("-----定时器进入---baseOrderStatisticsHandler---" + date);
XxlJobLogger.log("-----定时器进入---baseOrderStatisticsHandler---" + date);
ArrayList<Integer> arrayList = Lists.newArrayList();
if (StringUtils.isBlank(date)) {
arrayList.add(day);
} else {
arrayList = dateDifferenceSet(date);
}
log.info("获取到当前需要执行的日期,距离当前时间的天数集合" + arrayList);
XxlJobLogger.log("获取到当前需要执行的日期,距离当前时间的天数集合" + arrayList);
DateTime now = DateTime.now();
XxlJobLogger.log("-----定时器进入---baseOrderStatisticsHandler---");
log.info("-----定时器进入---baseOrderStatisticsHandler---");
// boolean flag = statisticsBiz.statisticalOrder();
// if (flag) {
return ReturnT.SUCCESS;
// }
// else {
// returnT.setCode(500);
// returnT.setMsg("失败");
// return returnT;
// }
for (Integer day : arrayList) {
boolean flag = statisticsBiz.statisticalOrder(day);
DateTime dateTime = now.plusDays(-day);
log.info("执行状态:" + dateTime.toString("yyyy-MM-dd")+"="+flag);
XxlJobLogger.log("执行状态:" + dateTime.toString("yyyy-MM-dd")+"="+flag);
}
return new ReturnT<>(ReturnT.SUCCESS_CODE,"执行成功");
} catch (Exception e) {
XxlJobLogger.log(e);
return FAIL;
} finally {
log.error(e.getMessage());
return new ReturnT<>(ReturnT.FAIL_CODE,"执行失败");
}
}
private ArrayList<Integer> dateDifferenceSet(String date) throws ParseException {
Long maxDate;
Long minDate;
Long currentTime= System.currentTimeMillis();
if (date.contains("/")) {
String[] dates = date.split("/");
Long date1 = getDateByString(dates[0]);
Long date2 = getDateByString(dates[1]);
if (date1<date2) {
maxDate=date2;
minDate=date1;
}else{
maxDate=date1;
minDate=date2;
}
if (minDate<currentTime&&maxDate>currentTime){
maxDate=currentTime;
}else if (minDate>currentTime){
throw new BaseException("设置的日期,大于当前日期!");
}
}else {
Long dt = getDateByString(date);
if (dt>currentTime) {
throw new BaseException("设置的日期,大于当前日期!");
}
minDate=dt;
maxDate=currentTime;
}
//距离今天的最大天数差
int maxDay = (int) ((currentTime-minDate)/(24*60*60*1000));
//距离今天的最小天数差
int minDay = (int) ((currentTime-maxDate)/(24*60*60*1000));
return getListByMinDayAndMaxDay(minDay,maxDay);
}
private Long getDateByString(String date) throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
return dateFormat.parse(date).getTime();
}
private ArrayList<Integer> getListByMinDayAndMaxDay(int minDay,int maxDay){
ArrayList<Integer> arrayList = Lists.newArrayList();
for (int day=maxDay;day>=minDay;day--){
arrayList.add(day);
}
return arrayList;
}
}
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.OrderApplication;
import com.xxfc.platform.order.biz.DailyOrderStatisticsBiz;
import com.xxfc.platform.order.biz.OrderStatisticsBiz;
import com.xxfc.platform.order.jobhandler.BaseOrderStatisticsJobHandler;
import com.xxfc.platform.order.pojo.HomePageOrderData;
import org.joda.time.DateTime;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author libin
* @version 1.0
......@@ -29,17 +30,53 @@ public class ServiceTest {
@Autowired
private OrderStatisticsBiz statisticsBiz;
@Autowired
private BaseOrderStatisticsJobHandler handler;
@Test
public void testSchedu(){
dailyOrderStatisticsBiz.statisticalOrder();
dailyOrderStatisticsBiz.statisticalOrder(1);
}
@Test
public void test() throws ParseException {
String d="2019-09-01";
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date parse = dateFormat.parse(d);
System.out.println(parse);
}
@Test
public void test(){
public void test2() {
DateTime dateTime = DateTime.parse("2019-10-10");
System.out.println(dateTime);
}
@Test
public void test3() {
DateTime dateTime = DateTime.parse("2019-10-10");
Date date = dateTime.toDate();
DateTime dateTime1 = DateTime.parse("2019-12-10");
Date date1 = dateTime1.toDate();
System.out.println(date);
System.out.println(date1);
System.out.println(date.before(date1));
System.out.println(date.after(date1));
}
@Test
public void test4(){
HomePageOrderData totalOrder = statisticsBiz.getTotalOrder(null);
System.out.println(totalOrder);
}
@Test
public void handlerTeset() {
handler.execute("2019-08-15");
}
}
......@@ -5,12 +5,14 @@ import com.xxfc.platform.summit.dto.ActivityShowDto;
import com.xxfc.platform.summit.entity.Activity;
import com.xxfc.platform.summit.entity.ActivityShow;
import com.xxfc.platform.summit.mapper.ActivityShowMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtilsBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.GetMapping;
import sun.rmi.runtime.Log;
import java.lang.reflect.InvocationTargetException;
......@@ -18,6 +20,7 @@ import java.lang.reflect.InvocationTargetException;
* @author Administrator
*/
@Service
@Slf4j
public class ActivityShowBiz extends BaseBiz<ActivityShowMapper, ActivityShow> {
@Autowired
......@@ -46,6 +49,7 @@ public class ActivityShowBiz extends BaseBiz<ActivityShowMapper, ActivityShow> {
}
} catch (Exception e) {
e.printStackTrace();
log.error(e.toString());
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false;
}
......
......@@ -12,7 +12,7 @@
and title like CONCAT('%',#{title},'%')
</if>
<if test="startTime != null">
and from_unixtime(start_time,'%Y-%m-%e %H')=from_unixtime(unix_timestamp(), '%Y-%m-%e %H')
and from_unixtime(start_time/1000,'%Y-%m-%e %H')=from_unixtime(unix_timestamp(), '%Y-%m-%e %H')
</if>
<if test="status != null and status == 1">
and (status=#{status} or (status=0 and (start_time/1000) &gt;= unix_timestamp()) )
......
package com.xxfc.platform.universal.constant;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 15:22
*/
public enum AliPayErrorEnum {
PAYEE_USER_INFO_ERROR("支付宝账号和姓名不匹配,请确认姓名是否正确", "请联系收款方确认收款用户姓名正确性"),
PAYER_USER_INFO_ERROR("付款用户姓名或其它信息不一致", "请检查接口传递的付款方用户姓名正确性。"),
PAYER_DATA_INCOMPLETE("根据监管部门的要求,需要付款用户补充身份信息才能继续操作", "根据监管部门的要求,需要付款用户登录支付宝站内或手机客户端补充身份信息才能继续操作"),
CERT_MISS_ACC_LIMIT("您连续10天余额账户的资金都超过5000元,根据监管部门的要求,需要付款用户补充身份信息才能继续操作", "您连续10天余额账户的资金都超过5000元,根据监管部门的要求,需要付款用户登录支付宝站内或手机客户端补充身份信息才能继续操作"),
PAYEE_ACC_OCUPIED("该手机号对应多个支付宝账户,请传入收款方姓名确定正确的收款账号", "如果未传入payee_real_name,请传递payee_real_name;如果传递了payee_real_name,是因为收款登录号对应多个账户且账户名相同,请联系收款方更换登录号"),
ACCOUNT_NOT_EXIST("根据监管部门的要求,请补全你的身份信息,开立余额账户", "请付款方登录支付宝站内或手机客户端补全身份信息"),
PAYER_CERT_EXPIRED("根据监管部门的要求,需要付款用户更新身份信息才能继续操作", "根据监管部门的要求,需要付款用户登录支付宝站内或手机客户端更新身份信息才能继续操作"),
PERMIT_NON_BANK_LIMIT_PAYEE("根据监管部门的要求,对方未完善身份信息或未开立余额账户,无法收款", "请联系收款方登录支付宝站内或手机客户端完善身份信息后,重试"),
EXCEED_LIMIT_PERSONAL_SM_AMOUNT("转账给个人支付宝账户单笔最多5万元", "转账给个人支付宝账户单笔最多5万元。"),
EXCEED_LIMIT_ENT_SM_AMOUNT("转账给企业支付宝账户单笔最多10万元", "转账给企业支付宝账户单笔最多10万元"),
EXCEED_LIMIT_SM_MIN_AMOUNT("单笔最低转账金额0.1元", "请修改转账金额"),
EXCEED_LIMIT_DM_MAX_AMOUNT("单日最多可转100万元", "单日最多可转100万元"),
EXCEED_LIMIT_UNRN_DM_AMOUNT("收款账户未实名,单日最多可收款1000元", "收款账户未实名,单日最多可收款1000元"),
PAYER_PAYEE_CANNOT_SAME("收付款方不能相同", "请检查一下收款方信息填写是否为付款方本人");
private String subReason;
private String solution;
AliPayErrorEnum(String subReason, String solution) {
this.subReason = subReason;
this.solution = solution;
}
public String getSubReason() {
return subReason;
}
public void setSubReason(String subReason) {
this.subReason = subReason;
}
public String getSolution() {
return solution;
}
public void setSolution(String solution) {
this.solution = solution;
}
}
package com.xxfc.platform.universal.constant;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/18 10:49
*/
public enum PayWay {
/**
* 微信支付
*/
WX_PAY(0,"微信"),
/**
* 支付宝
*/
ALI_PAY(1,"支付宝"),
/**
* 银行
*/
BANK(2,"银行");
private int code;
private String desc;
PayWay(int code,String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package com.xxfc.platform.universal.constant;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 15:23
*/
public enum WxPayErrorEnum {
SEND_FAILED("付款错误,请查单确认付款结果","请查单确认付款结果,以查单结果为准"),
SYSTEMERROR("微信内部接口调用发生错误,请稍后重试","微信内部接口调用发生错误"),
FREQ_LIMIT("接口请求频率超时接口限制","调用接口过于频繁,请稍后再试,如果要继续付款必须使用原商户订单号重试"),
MONEY_LIMIT("已经达到今日付款总额上限","付款额度已经超限,请参考接口使用条件,如果要继续付款必须使用原商户订单号重试"),
V2_ACCOUNT_SIMPLE_BAN("微信支付账户未知名,无法付款","不支持给非实名用户付款,如果要继续付款必须使用原商户订单号重试"),
SENDNUM_LIMIT("今日付款次数超过限制","向用户付款的次数超限了,请参考接口使用条件,如果要继续付款必须使用原商户订单号重试");
private String subReason;
private String solution;
WxPayErrorEnum(String subReason, String solution) {
this.subReason = subReason;
this.solution = solution;
}
public String getSubReason() {
return subReason;
}
public void setSubReason(String subReason) {
this.subReason = subReason;
}
public String getSolution() {
return solution;
}
}
......@@ -5,12 +5,14 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class FundPayVo {
public class FundPayVo implements Serializable {
private static final long serialVersionUID = 1L;
//转账单号
private String outBizNo;
......@@ -32,5 +34,7 @@ public class FundPayVo {
private String checkName;
private String orderNo;
}
package com.xxfc.platform.universal.weixin.api;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.MD5Util;
import com.github.wxiaoqi.security.common.util.OrderUtil;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
......@@ -108,10 +109,9 @@ public class WXSuppToUserPay {
// System.out.println(map.get("payment_time"));
}
public static Map<String,String> WeiXinTiXian(String openid,String partnerTradeNo,String check_name,String amount,String desc,String spbill_create_ip) throws Exception
public static Map<String,String> WeiXinTiXian(String openid,String partnerTradeNo,String check_name,String amount,String desc,String spbill_create_ip)
{
WXSuppToUserPay prePay = new WXSuppToUserPay();
prePay.setMch_appid(SystemConfig.WINXIN_AppID);
prePay.setMchid(SystemConfig.WINXIN_PARTNER);
prePay.setNonce_str( OrderUtil.CreateNoncestr());
......@@ -123,7 +123,14 @@ public class WXSuppToUserPay {
prePay.setSpbill_create_ip(spbill_create_ip);
String result =postXML(suppTouser,prePay.getXMLTuiKuan());
result = result.replaceAll("<![CDATA[|]]>", "").replaceAll("支付成功", "pay sucess");
Map<String, String> map = XMLUtil.doXMLParse(result);
Map<String, String> map = null;
try {
map = XMLUtil.doXMLParse(result);
} catch (JDOMException e) {
throw new BaseException("微信转账参数xml解析错误",e);
} catch (IOException e) {
throw new BaseException("微信转账参数xml解析读写IO异常",e);
}
return map;
}
public static String postXML(String uri, String xml) {
......
......@@ -20,6 +20,7 @@ import com.github.wxiaoqi.security.common.util.UUIDUtils;
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;
import com.xxfc.platform.universal.constant.PayWay;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.entity.OrderPay;
import com.xxfc.platform.universal.mapper.OrderPayMapper;
......@@ -27,15 +28,11 @@ import com.xxfc.platform.universal.utils.SignUtils;
import com.xxfc.platform.universal.vo.FundPayVo;
import com.xxfc.platform.universal.vo.OrderPayVo;
import com.xxfc.platform.universal.weixin.api.*;
import com.xxfc.platform.universal.weixin.constant.AliNeedPayErrorEnum;
import com.xxfc.platform.universal.weixin.constant.PaySubErrorCodeEnum;
import com.xxfc.platform.universal.weixin.constant.WxNeedPayErrorEnum;
import com.xxfc.platform.universal.weixin.constant.WxResponseProperties;
import com.xxfc.platform.universal.constant.WxResponseProperties;
import com.xxfc.platform.universal.weixin.util.HTTPUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -44,7 +41,6 @@ import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import static com.xxfc.platform.universal.constant.DictionaryKey.PAY_DEMOTION;
import static com.xxfc.platform.universal.constant.DictionaryKey.UNIVERSAL_PAY;
......@@ -58,7 +54,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.UNIVERSAL_PAY;
*/
@Service
@Slf4j
public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements InitializingBean {
public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
@Autowired
DictionaryBiz dictionaryBiz;
......@@ -75,10 +71,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
@Value("${wx.appSercet}")
private String wy_secret;
private List<String> wxNeedPayErrorCodes;
private List<String> aliNeedPayErrorCodes;
private static final String SUCCESS = "SUCCESS";
......@@ -390,13 +382,15 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
* @return
* @throws Exception
*/
public String fundTrans(FundPayVo fundPayVo) throws Exception {
if (fundPayVo.getType() == 0) {
public String fundTrans(FundPayVo fundPayVo) throws BaseException {
String cono = OrderUtil.GetOrderNumber("");
fundPayVo.setOutBizNo(cono);
if (fundPayVo.getType() == PayWay.WX_PAY.getCode()) {
//微信
fundPayVo.setCheckName("NO_CHECK");
return wxpayfundTrans(fundPayVo);
}
if (fundPayVo.getType() == 1) {
if (fundPayVo.getType() == PayWay.ALI_PAY.getCode()) {
//支付宝
return alipayfundTrans(getAlipayClient(), fundPayVo);
}
......@@ -409,7 +403,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
* @param alipayClient
* @throws AlipayApiException
*/
public String alipayfundTrans(AlipayClient alipayClient, FundPayVo fundPayVo) throws AlipayApiException {
public String alipayfundTrans(AlipayClient alipayClient, FundPayVo fundPayVo){
AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
request.setBizContent("{" +
"\"out_biz_no\":\"" + fundPayVo.getOutBizNo() + "\"," +
......@@ -419,33 +413,25 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
"\"payer_show_name\":\"" + fundPayVo.getPayerShowName() + "\"," +
"\"remark\":\"" + fundPayVo.getRemark() + "\"" +
" }");
AlipayFundTransToaccountTransferResponse response = alipayClient.execute(request);
AlipayFundTransToaccountTransferResponse response = null;
try {
response = alipayClient.execute(request);
} catch (AlipayApiException e) {
throw new BaseException("支付宝转账api调用错误",e);
}
if (response.isSuccess()) {
log.info("转账调用成功");
return fundPayVo.getOutBizNo();
} else {
log.info("转账调用失败");
String subCode = response.getSubCode();
if (aliNeedPayErrorCodes.contains(subCode)) {
throw new BaseException(AliNeedPayErrorEnum.valueOf(subCode).getDesc(),PaySubErrorCodeEnum.PAY_NEED_ERROR.getSubCode());
}
throw new BaseException("支付宝转账失败:【错误码:" + response.getSubCode() + " 错误信息:" + response.getSubMsg() + "】",PaySubErrorCodeEnum.PAY_ERROR.getSubCode());
throw new BaseException(response.getSubMsg(),response.getSubCode());
}
}
public String wxpayfundTrans(FundPayVo fundPayVo) throws Exception {
public String wxpayfundTrans(FundPayVo fundPayVo) {
Map<String, String> map = WXSuppToUserPay.WeiXinTiXian(fundPayVo.getAmount(),fundPayVo.getOutBizNo(),fundPayVo.getCheckName(), fundPayVo.getAmount(), fundPayVo.getRemark(), fundPayVo.getCreatIp());
log.info("微信转账【{}】", map);
if (SUCCESS.equals(map.get(WxResponseProperties.RETURN_CODE)) && SUCCESS.equals(map.get(WxResponseProperties.RESULT_CODE))) {
return map.get(WxResponseProperties.PARTNER_TRADE_NO);
}
String errorCode = map.get(WxResponseProperties.ERROR_CODE);
if (wxNeedPayErrorCodes.contains(errorCode)) {
throw new BaseException(WxNeedPayErrorEnum.valueOf(errorCode).getDesc(), PaySubErrorCodeEnum.PAY_NEED_ERROR.getSubCode());
} else {
throw new BaseException("微信转账失败:【错误码" + errorCode + " 错误信息:" + map.get(WxResponseProperties.ERR_CODE_DES) + "】", PaySubErrorCodeEnum.PAY_ERROR.getSubCode());
}
throw new BaseException(map.get(WxResponseProperties.ERR_CODE_DES),map.get(WxResponseProperties.ERROR_CODE));
}
......@@ -647,16 +633,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
fundPayVo.setAmount("0.1");
fundPayVo.setPayeeAccount("2088212169302286");
AlipayClient alipayClient = orderPayBiz.getAlipayClient();
try {
System.out.println(orderPayBiz.alipayfundTrans(alipayClient, fundPayVo));
} catch (AlipayApiException e) {
e.printStackTrace();
}
}
@Override
public void afterPropertiesSet() throws Exception {
wxNeedPayErrorCodes = EnumSet.allOf(WxNeedPayErrorEnum.class).stream().map(WxNeedPayErrorEnum::name).collect(Collectors.toList());
aliNeedPayErrorCodes = EnumSet.allOf(AliNeedPayErrorEnum.class).stream().map(AliNeedPayErrorEnum::name).collect(Collectors.toList());
}
}
package com.xxfc.platform.universal.config;
import com.github.wxiaoqi.security.common.config.rabbit.BindDTO;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitCommonConfig;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.ADMIN_TOPIC;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.KEY_WALLET_WITH_DRAW;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 17:23
*/
@Configuration
public class RabbitUniversalConfig extends RabbitCommonConfig {
/**
* 提现支付
*/
public static final String WITH_DRAW_QUEUE = "withdraw.wallet.queue";
static {
myQueue = new ArrayList<BindDTO>() {{
//钱包提现
add(new BindDTO(WITH_DRAW_QUEUE, ADMIN_TOPIC, KEY_WALLET_WITH_DRAW));
}};
}
}
package com.xxfc.platform.universal.handler;
import com.alibaba.fastjson.JSON;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.universal.biz.OrderPayBiz;
import com.xxfc.platform.universal.constant.AliPayErrorEnum;
import com.xxfc.platform.universal.constant.PayWay;
import com.xxfc.platform.universal.constant.WxPayErrorEnum;
import com.xxfc.platform.universal.vo.FundPayVo;
import com.xxfc.platform.universal.constant.AliNeedPayErrorEnum;
import com.xxfc.platform.universal.constant.WxNeedPayErrorEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Component;
import com.rabbitmq.client.Channel;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.xxfc.platform.universal.config.RabbitUniversalConfig.WITH_DRAW_QUEUE;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 17:20
*/
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
public class WithDrawMqHandler implements InitializingBean {
private List<String> needPayErrorCodes;
private List<String> wxPayErrorCodes;
private List<String> aliPayErrorCodes;
private final UserFeign userFeign;
private final OrderPayBiz orderPayBiz;
@Resource(name = "redisTemplate")
private ValueOperations valueOperations;
private final RedisTemplate<String, String> redisTemplate;
private static final int MAX_RETRY = 3;
private static final String DEFAULT_ERROR_MSG = "当前操作有误,如有疑问请咨询客服";
/**
* 钱包提现
*
* @param
*/
@RabbitListener(queues = WITH_DRAW_QUEUE)
public void integralHandler(Message message, @Headers Map<String, Object> headers, Channel channel) {
FundPayVo fundPayVo = null;
String pay_way = "";
Integer cathType = null;
String orderNo = "";
try {
String msg = new String(message.getBody(), "UTF-8");
fundPayVo = JSON.parseObject(msg, FundPayVo.class);
cathType = fundPayVo.getType();
pay_way = fundPayVo.getType() == PayWay.WX_PAY.getCode() ?
PayWay.WX_PAY.getDesc() : fundPayVo.getType() == PayWay.ALI_PAY.getCode() ?
PayWay.ALI_PAY.getDesc() : fundPayVo.getType() == PayWay.BANK.getCode() ?
PayWay.BANK.getDesc() : "";
String cono = orderPayBiz.fundTrans(fundPayVo);
orderNo = fundPayVo.getOrderNo();
log.info("提现成功:【商户订单号:{}】-->【{}】", cono,msg);
userFeign.withDrawprocess(fundPayVo.getOrderNo(), cono, "", true);
Long deliveryTag = (Long) headers.get(AmqpHeaders.DELIVERY_TAG);
// 手动签收
basicAck(channel, deliveryTag, false, pay_way);
} catch (UnsupportedEncodingException e) {
basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, false, pay_way);
String reason = String.format("%s%s%s", pay_way, "转账失败", "[不支持的编码:UTF-8]");
userFeign.withDrawprocess(fundPayVo.getOrderNo(), "", reason, false);
log.info("{}:【{}】", reason, e);
} catch (BaseException e) {
//错误码
String subCode = e.getSubCode();
//再次发消息
if (needPayErrorCodes.contains(subCode)) {
Long count = valueOperations.increment(orderNo);
if (count <= MAX_RETRY) {
//重新把消息放回队列
basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, true, pay_way);
return;
}
redisTemplate.delete(orderNo);
}
String msg = "";
if (wxPayErrorCodes.contains(subCode) && cathType != null && cathType == PayWay.WX_PAY.getCode()) {
msg = WxPayErrorEnum.valueOf(subCode).getSubReason();
}
if (aliPayErrorCodes.contains(subCode) && cathType != null && cathType == PayWay.ALI_PAY.getCode()) {
msg = AliPayErrorEnum.valueOf(subCode).getSubReason();
}
msg = StringUtils.isEmpty(msg) ? DEFAULT_ERROR_MSG : msg;
userFeign.withDrawprocess(fundPayVo.getOrderNo(), "", msg, false);
//放弃此消息
basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, false, pay_way);
}
}
private void basicAck(Channel channel, long deliveryTag, boolean multiple, String pay_way) {
try {
channel.basicAck(deliveryTag, multiple);
} catch (IOException ex) {
log.info("{}提现转账消息签收失败:【{}】", pay_way, ex);
}
}
private void basicNack(Channel channel, long deliveryTag, boolean multiple, boolean requeue, String pay_way) {
try {
channel.basicNack(deliveryTag, multiple, requeue);
} catch (IOException ex) {
log.info("{}提现转账消息{}失败:【{}】", pay_way, requeue ? "重回队列" : "丢弃", ex);
}
}
@Override
public void afterPropertiesSet() throws Exception {
needPayErrorCodes = Stream.concat(EnumSet.allOf(WxNeedPayErrorEnum.class).stream().map(WxNeedPayErrorEnum::name), EnumSet.allOf(AliNeedPayErrorEnum.class).stream().map(AliNeedPayErrorEnum::name))
.distinct()
.collect(Collectors.toList());
wxPayErrorCodes = EnumSet.allOf(WxPayErrorEnum.class).stream().map(WxPayErrorEnum::name).collect(Collectors.toList());
aliPayErrorCodes = EnumSet.allOf(AliPayErrorEnum.class).stream().map(AliPayErrorEnum::name).collect(Collectors.toList());
}
}
......@@ -134,6 +134,7 @@ public class VehicleModel implements Serializable {
private Integer hotSign;
@ApiModelProperty(value = "是否删除")
@Column(name = "isdel")
private Integer isdel;
@Column(name = "rent_discount_status")
@ApiModelProperty(value = "租车优惠状态 0--没有优惠;1--会员折扣;2--固定值")
......
......@@ -49,6 +49,11 @@ public class VehiclePageQueryVo {
* 用途类型:租赁房车(1)、展车等,对应关系见车辆常量表
*/
private Integer useType;
/**
* 托管人
*/
private String belongToName;
/**
* 预定目标日期(开始)
*/
......
......@@ -1491,6 +1491,29 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return count > 0;
}
public Boolean checkVinExist(String vin, String id) {
Example example = new Example(Vehicle.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("vin", vin);
criteria.andEqualTo("isDel",0);
if (StringUtils.isNotEmpty(id)) {
criteria.andNotEqualTo("id", id);
}
int count = mapper.selectCountByExample(example);
return count > 0;
}
public Boolean checkEngineNumExist(String engineNum, String id) {
Example example = new Example(Vehicle.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("engineNum", engineNum);
criteria.andEqualTo("isDel",0);
if (StringUtils.isNotEmpty(id)) {
criteria.andNotEqualTo("id", id);
}
int count = mapper.selectCountByExample(example);
return count > 0;
}
public List<String> findbyPlateNumberAndVehicleCod(String plateNumber,String vehicleCode) {
List<String> vehicleIds = Lists.newArrayList();
......
......@@ -34,17 +34,17 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
@Autowired
VehicleMapper vehicleMapper;
public PageInfo<VehicleDepartureLogVo> page(String numberPlate,Integer code,Integer zoneId,Integer departureId, String time, Integer page, Integer limit) {
public PageInfo<VehicleDepartureLogVo> page(String numberPlate,Integer code,Integer zoneId,Integer departureId, String startTime,String endTime, Integer page, Integer limit) {
PageHelper.startPage(page, limit);
return new PageInfo<>(mapper.selectVoAll(numberPlate,code,zoneId,departureId,time));
return new PageInfo<>(mapper.selectVoAll(numberPlate,code,zoneId,departureId,startTime, endTime));
}
public PageInfo<VehicleDepartureLogVo> pageNotAllData(String numberPlate,Integer code,Integer zoneId,Integer departureId, String time, Integer page, Integer limit, List<Integer> companyList) {
public PageInfo<VehicleDepartureLogVo> pageNotAllData(String numberPlate,Integer code,Integer zoneId,Integer departureId, String startTime,String endTime, Integer page, Integer limit, List<Integer> companyList) {
PageHelper.startPage(page, limit);
if (companyList == null || companyList.size() == 0) {
companyList = Arrays.asList(-1);
}
return new PageInfo<>(mapper.selectVoAllNotAllData(numberPlate,code,zoneId,departureId,time, companyList));
return new PageInfo<>(mapper.selectVoAllNotAllData(numberPlate,code,zoneId,departureId,startTime, endTime, companyList));
}
public PageInfo<VehicleDepartureLogVo> findByVehicle(String vehicleId, Integer page, Integer limit) {
......
......@@ -20,13 +20,16 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
@Param("code") Integer code,
@Param("zoneId") Integer zoneId,
@Param("departureId") Integer departureId,
@Param("time") String time);
@Param("startTime") String startTime,
@Param("endTime") String endTime
);
List<VehicleDepartureLogVo> selectVoAllNotAllData(@Param("numberPlate") String numberPlate,
@Param("code") Integer code,
@Param("zoneId") Integer zoneId,
@Param("departureId") Integer departureId,
@Param("time") String time,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("companyList") List<Integer> companyList);
Integer selectMileageByVehicleId(String vehicleId);
......
......@@ -412,7 +412,7 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
companyList.clear();
companyList.add(vehiclePlanDto.getParkBranchCompanyId());
} else {
return ObjectRestResponse.succ();
return ObjectRestResponse.succ(Maps.newHashMap());
}
}
}
......@@ -422,7 +422,7 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
companyList.clear();
companyList.add(vehiclePlanDto.getSubordinateBranch());
} else {
return ObjectRestResponse.succ();
return ObjectRestResponse.succ(Maps.newHashMap());
}
}
}
......@@ -561,6 +561,17 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
return ObjectRestResponse.succ(exist);
}
@GetMapping("/exist_vin/{vin}")
public ObjectRestResponse<Boolean> checkVinExist(@PathVariable(value = "vin") String vin,@RequestParam(value = "id") String id){
Boolean exist = vehicleBiz.checkVinExist(vin,id);
return ObjectRestResponse.succ(exist);
}
@GetMapping("/exist_engineNum/{engineNum}")
public ObjectRestResponse<Boolean> checkEngineNumExist(@PathVariable(value = "engineNum") String engineNum,@RequestParam(value = "id") String id){
Boolean exist = vehicleBiz.checkEngineNumExist(engineNum,id);
return ObjectRestResponse.succ(exist);
}
@GetMapping("/findVehicleIds")
public List<String> findbyPlateNumberAndVehicleCod(@RequestParam(value = "plateNumber",required = false) String plateNumber,@RequestParam(value = "vehicleCode",required = false) String vehicleCode){
......
......@@ -36,7 +36,7 @@ public class VehicleDepartureController {
/**
* @param numberPlate 车牌
* @param code 车辆编码
* @param time
* @param
* @param departureId 出发分公司id
* @param page
* @param limit
......@@ -45,7 +45,7 @@ public class VehicleDepartureController {
*/
@GetMapping("page")
public RestResponse page(String numberPlate,
@RequestParam(value = "code", required = false) Integer code, String time,
@RequestParam(value = "code", required = false) Integer code, String startTime, String endTime,
@RequestParam(value = "zoneId",required = false) Integer zoneId,
@RequestParam(value = "departureId", required = false) Integer departureId,
Integer page, Integer limit, HttpServletRequest request) {
......@@ -57,15 +57,15 @@ public class VehicleDepartureController {
if (userDTO != null) {
if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany());
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, zoneId,departureId, time, page, limit, companyList));
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, zoneId,departureId, startTime, endTime, page, limit, companyList));
}
}
return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, zoneId,departureId, time, page, limit));
return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, zoneId,departureId, startTime, endTime, page, limit));
}
@GetMapping("small/page")
@IgnoreUserToken
public RestResponse pageBySmall(String numberPlate, @RequestParam(value = "code", required = false) Integer code, String time, Integer page, Integer limit, Integer uid, HttpServletRequest request) {
public RestResponse pageBySmall(String numberPlate, @RequestParam(value = "code", required = false) Integer code, String startTime, String endTime,Integer page, Integer limit, Integer uid, HttpServletRequest request) {
if (page == null || limit == null) {
page = 1;
limit = 10;
......@@ -74,10 +74,10 @@ public class VehicleDepartureController {
if (userDTO != null) {
if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany());
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, null,null, time, page, limit, companyList));
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, null,null, startTime,endTime, page, limit, companyList));
}
}
return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, null,null, time, page, limit));
return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, null,null, startTime,endTime, page, limit));
}
/**
......
......@@ -91,6 +91,6 @@
<if test="cityCode != null">
AND `addr_city`=#{cityCode}
</if>
) AS `cb` ON cb.id = bc.company_base_id ORDER BY `id`
) AS `cb` ON cb.id = bc.company_base_id ORDER BY bc.id
</select>
</mapper>
\ No newline at end of file
......@@ -472,7 +472,7 @@
CONCAT(#{selectedMonth}, "%"))
</if>
<if test="numberPlate != null">
and v3.number_plate = #{numberPlate}
and v3.number_plate like concat('%', #{numberPlate}, '%')
</if>
<if test="bookType != null">
and v1.book_type = #{bookType}
......
......@@ -100,18 +100,12 @@
<if test="numberPlate != null and numberPlate != ''">
and vehicle.number_plate = #{numberPlate}
</if>
<if test="time != null and time != ''">
and (vehicle_departure_log.arrival_time >= str_to_date(#{time}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.arrival_time)=TO_DAYS(str_to_date(#{time}, '%Y-%m-%d %H'))
or vehicle_departure_log.arrival_time is null
)
<if test="startTime != null and startTime != ''">
and
(
vehicle_departure_log.departure_time &lt;= str_to_date(#{time}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.departure_time)=TO_DAYS(str_to_date(#{time}, '%Y-%m-%d %H'))
or vehicle_departure_log.departure_time is null
)
vehicle_departure_log.departure_time &gt;= str_to_date(#{startTime}, '%Y-%m-%d %H')
</if>
<if test="endTime != null and endTime != ''">
and vehicle_departure_log.arrival_time &gt;= str_to_date(#{endTime}, '%Y-%m-%d %H')
</if>
<if test="code!=null">
and vehicle.code=#{code}
......@@ -158,17 +152,17 @@
)
)
</if>
<if test="time != null and time != ''">
and (vehicle_departure_log.arrival_time >= str_to_date(#{time}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.arrival_time)=TO_DAYS(str_to_date(#{time}, '%Y-%m-%d %H'))
or vehicle_departure_log.arrival_time is null
)
<if test="startTime != null and startTime != ''">
and
(
vehicle_departure_log.departure_time &lt;= str_to_date(#{time}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.departure_time)=TO_DAYS(str_to_date(#{time}, '%Y-%m-%d %H'))
vehicle_departure_log.departure_time &lt;= str_to_date(#{startTime}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.departure_time)=TO_DAYS(str_to_date(#{startTime}, '%Y-%m-%d %H'))
or vehicle_departure_log.departure_time is null
)
</if>
<if test="endTime != null and endTime != ''">
and vehicle_departure_log.arrival_time >= str_to_date(#{endTime}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.arrival_time)=TO_DAYS(str_to_date(#{endTime}, '%Y-%m-%d %H'))
or vehicle_departure_log.arrival_time is null
</if>
<if test="code!=null">
and vehicle.code=#{code}
......
......@@ -88,6 +88,8 @@
LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
-- 所属分公司
LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id
LEFT JOIN vehicle_book_record v2 on v2.vehicle_id = v.id
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
where
v.is_del=0
<if test="mRangeDateEnd !=null">
......@@ -114,6 +116,9 @@
<if test="insuranceCompany !=null">
and v.insurance_company = #{insuranceCompany}
</if>
<if test="belongToName !=null">
and v.belong_to_name = #{belongToName}
</if>
<if test="vin !=null and vin != ''">
and v.vin = #{vin}
</if>
......@@ -123,9 +128,15 @@
<if test="code !=null">
and v.code = #{code}
</if>
<if test="status !=null">
<if test="status !=null and status != 6 and status != 7">
and v.status = #{status}
</if>
<if test="status !=null and status == 6">
and v3.id is not NULL and v2.book_type = 3 and v3.state = 0
</if>
<if test="status !=null and status == 7">
and v3.id is not NULL and v2.book_type = 6 and v3.state = 0
</if>
<if test="numberPlate !=null and numberPlate != ''">
and v.number_plate like concat('%',#{numberPlate},'%')
</if>
......@@ -266,6 +277,9 @@
<if test="insuranceCompany !=null">
and v.insurance_company = #{insuranceCompany}
</if>
<if test="belongToName !=null">
and v.belong_to_name = #{belongToName}
</if>
<if test="vin !=null and vin != ''">
and v.vin = #{vin}
</if>
......
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