Commit 2e060b19 authored by 周健威's avatar 周健威

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

parents af6b52f4 8bbe8e7c
package com.github.wxiaoqi.security.common.config.global; package com.github.wxiaoqi.security.common.config.global;
import com.github.wxiaoqi.security.common.handler.GlobalExceptionHandler;
import com.github.wxiaoqi.security.common.handler.PlatformExceptionHandler;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner; import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
...@@ -13,6 +17,17 @@ public class GlobalBasicConfiguration implements ApplicationRunner{ ...@@ -13,6 +17,17 @@ public class GlobalBasicConfiguration implements ApplicationRunner{
private static Logger log = LoggerFactory.getLogger(GlobalBasicConfiguration.class); private static Logger log = LoggerFactory.getLogger(GlobalBasicConfiguration.class);
private static Environment env; private static Environment env;
@Bean
@ConditionalOnMissingBean
private GlobalExceptionHandler addGlobalExceptionHandler() {
return new GlobalExceptionHandler();
}
@Bean
@ConditionalOnMissingBean
private PlatformExceptionHandler addPlatformExceptionHandler() {
return new PlatformExceptionHandler();
}
@Autowired @Autowired
private void setEnv(Environment env) { private void setEnv(Environment env) {
GlobalBasicConfiguration.env = env; GlobalBasicConfiguration.env = env;
......
...@@ -7,7 +7,7 @@ import ch.qos.logback.core.spi.FilterReply; ...@@ -7,7 +7,7 @@ import ch.qos.logback.core.spi.FilterReply;
public class AcceptFilter extends Filter<ILoggingEvent> { public class AcceptFilter extends Filter<ILoggingEvent> {
@Override @Override
public FilterReply decide(ILoggingEvent event) { public FilterReply decide(ILoggingEvent event) {
if(event.getLoggerName().startsWith("com.xxfc.platform") || event.getLoggerName().startsWith("com.github.wxiaoqi")) { if(event.getLoggerName().startsWith("com.xxfc.platform") || event.getLoggerName().startsWith("com.github.wxiaoqi") || event.getLoggerName().contains("Exception")) {
return FilterReply.ACCEPT; return FilterReply.ACCEPT;
} else { } else {
return FilterReply.DENY; return FilterReply.DENY;
......
...@@ -7,7 +7,7 @@ import ch.qos.logback.core.spi.FilterReply; ...@@ -7,7 +7,7 @@ import ch.qos.logback.core.spi.FilterReply;
public class DenyFilter extends Filter<ILoggingEvent> { public class DenyFilter extends Filter<ILoggingEvent> {
@Override @Override
public FilterReply decide(ILoggingEvent event) { public FilterReply decide(ILoggingEvent event) {
if (event.getLoggerName().startsWith("com.alibaba.nacos") || event.getLoggerName().startsWith("com.xxfc.platform") || event.getLoggerName().startsWith("com.github.wxiaoqi")) { if (event.getLoggerName().startsWith("com.alibaba.nacos") || event.getLoggerName().startsWith("com.xxfc.platform") || event.getLoggerName().startsWith("com.github.wxiaoqi") || event.getLoggerName().contains("Exception")) {
return FilterReply.DENY; return FilterReply.DENY;
} else { } else {
return FilterReply.ACCEPT; return FilterReply.ACCEPT;
......
...@@ -3,10 +3,13 @@ package com.github.wxiaoqi.security.common.handler; ...@@ -3,10 +3,13 @@ package com.github.wxiaoqi.security.common.handler;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.BaseResponse; import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice("com.xxfc.platform") @RestControllerAdvice("com.xxfc.platform")
@Slf4j
public class PlatformExceptionHandler { public class PlatformExceptionHandler {
@ExceptionHandler(value = {BaseException.class}) @ExceptionHandler(value = {BaseException.class})
...@@ -18,4 +21,25 @@ public class PlatformExceptionHandler { ...@@ -18,4 +21,25 @@ public class PlatformExceptionHandler {
return new BaseResponse(400,e.getMessage()); return new BaseResponse(400,e.getMessage());
} }
//服务器异常
@ExceptionHandler(Exception.class)
public ObjectRestResponse<?> exceptionHandler(Exception e){
Throwable cause = e.getCause();
if(cause != null && cause.toString().contains("Exception")) {
log.error(cause.getMessage(), e);
return assembleResult(ObjectRestResponse.createFailedResult(5000, "服务器开小差了,请稍后重试!"), "Server exception: " + e.getMessage());
}
log.error("Server exception: ", e);
return assembleResult(ObjectRestResponse.createFailedResult(5000, "服务器开小差了,请稍后重试!"), "Server exception: " + e.getMessage());
}
protected ObjectRestResponse<?> assembleResult(ObjectRestResponse<?> error, String msg) {
log.debug("Exception: " + msg);
return error;
}
protected ObjectRestResponse<?> assembleResult(ObjectRestResponse<?> error, Throwable e) {
return assembleResult(error, e.getClass().getSimpleName() + ": " + e.getMessage());
}
} }
...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.log.entity.LogEntity; ...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.log.entity.LogEntity;
import com.github.wxiaoqi.security.common.log.entity.XxLogEntity; import com.github.wxiaoqi.security.common.log.entity.XxLogEntity;
import com.github.wxiaoqi.security.common.msg.BaseResponse; import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -25,6 +26,7 @@ import java.util.concurrent.ThreadPoolExecutor; ...@@ -25,6 +26,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Service @Service
@Slf4j
public class CommonLogServiceImpl implements CommonLogService { public class CommonLogServiceImpl implements CommonLogService {
@Value("${spring.application.name}") @Value("${spring.application.name}")
...@@ -86,6 +88,9 @@ public class CommonLogServiceImpl implements CommonLogService { ...@@ -86,6 +88,9 @@ public class CommonLogServiceImpl implements CommonLogService {
} }
@Override @Override
public void run() { public void run() {
if(!xxLogEntity.getServletPath().contains("/vehicleInfo/app/unauth/getVehiclePlanList")) {
log.info("用户请求信息:xxLogEntity = {}", xxLogEntity.toString());
}
mongoTemplate.insert(xxLogEntity, xxLogEntity.getMongoKey()); mongoTemplate.insert(xxLogEntity, xxLogEntity.getMongoKey());
} }
} }
......
...@@ -14,13 +14,13 @@ import java.util.Date; ...@@ -14,13 +14,13 @@ import java.util.Date;
public class XxLogEntity implements Serializable { public class XxLogEntity implements Serializable {
private String app; private String app;
private String method;
private String createDate;
private String servletPath; private String servletPath;
private String requestPath;
private String requestData; private String requestData;
private String responseData; private String responseData;
private String createDate;
private String endDate; private String endDate;
private String requestPath;
private String method;
private String mongoKey; private String mongoKey;
public XxLogEntity() { public XxLogEntity() {
......
...@@ -25,6 +25,7 @@ import tk.mybatis.mapper.weekend.WeekendSqls; ...@@ -25,6 +25,7 @@ import tk.mybatis.mapper.weekend.WeekendSqls;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
...@@ -257,4 +258,10 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem ...@@ -257,4 +258,10 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
} }
public void deleteByUserIds(Collection<Integer> userIds) {
Example example = new Example(BaseUserMember.class);
Example.Criteria criteria = example.createCriteria();
criteria.andIn("userId",userIds);
mapper.deleteByExample(example);
}
} }
\ No newline at end of file
...@@ -364,4 +364,10 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> { ...@@ -364,4 +364,10 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
public void deleteByUserIds(Collection<Integer> userIds) {
Example example =new Example(MyWallet.class);
Example.Criteria criteria = example.createCriteria();
criteria.andIn("userId",userIds);
mapper.deleteByExample(example);
}
} }
...@@ -126,4 +126,11 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> { ...@@ -126,4 +126,11 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
public WalletCathSumDto sumCathAmount(Integer userId,Integer type){ public WalletCathSumDto sumCathAmount(Integer userId,Integer type){
return mapper.sumCathAmount(userId,type); return mapper.sumCathAmount(userId,type);
} }
public void deleteByUserIds(Collection<Integer> userIds) {
Example example = new Example(MyWalletCath.class);
Example.Criteria criteria = example.createCriteria();
criteria.andIn("userId",userIds);
mapper.deleteByExample(example);
}
} }
...@@ -76,7 +76,7 @@ public class UserBiz extends BaseBiz<UserMapper,User> { ...@@ -76,7 +76,7 @@ public class UserBiz extends BaseBiz<UserMapper,User> {
if(query.entrySet().size()>0) { if(query.entrySet().size()>0) {
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
for (Map.Entry<String, Object> entry : query.entrySet()) { for (Map.Entry<String, Object> entry : query.entrySet()) {
criteria.andLike(entry.getKey(), "%" + entry.getValue().toString() + "%"); criteria.orLike(entry.getKey(), "%" + entry.getValue().toString() + "%");
} }
} }
example.createCriteria().andGreaterThan("id",1); example.createCriteria().andGreaterThan("id",1);
...@@ -88,7 +88,7 @@ public class UserBiz extends BaseBiz<UserMapper,User> { ...@@ -88,7 +88,7 @@ public class UserBiz extends BaseBiz<UserMapper,User> {
if(query.entrySet().size()>0) { if(query.entrySet().size()>0) {
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
for (Map.Entry<String, Object> entry : query.entrySet()) { for (Map.Entry<String, Object> entry : query.entrySet()) {
criteria.andLike(entry.getKey(), "%" + entry.getValue().toString() + "%"); criteria.orLike(entry.getKey(), "%" + entry.getValue().toString() + "%");
} }
} }
if(StringUtils.isNotBlank(currentUser.getDataCompany())){ if(StringUtils.isNotBlank(currentUser.getDataCompany())){
......
...@@ -9,7 +9,6 @@ import com.github.wxiaoqi.security.admin.dto.AppUserManageDTO; ...@@ -9,7 +9,6 @@ import com.github.wxiaoqi.security.admin.dto.AppUserManageDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserManage; import com.github.wxiaoqi.security.admin.entity.AppUserManage;
import com.github.wxiaoqi.security.admin.entity.User; import com.github.wxiaoqi.security.admin.entity.User;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.admin.vo.AppUserManageVo; import com.github.wxiaoqi.security.admin.vo.AppUserManageVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
...@@ -17,16 +16,11 @@ import com.github.wxiaoqi.security.common.exception.BaseException; ...@@ -17,16 +16,11 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; 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.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
/** /**
* app用户管理类 * app用户管理类
......
package com.github.wxiaoqi.security.admin.rest; package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.AppUserDetailBiz; import com.github.wxiaoqi.security.admin.biz.*;
import com.github.wxiaoqi.security.admin.biz.AppUserLoginBiz;
import com.github.wxiaoqi.security.admin.biz.AppUserRelationBiz;
import com.github.wxiaoqi.security.admin.biz.AppUserSellingWaterBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.activity.feign.ActivityFeign; import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.feign.OrderFeign;
import lombok.RequiredArgsConstructor;
import org.apache.tomcat.util.threads.ThreadPoolExecutor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* @author libin * @author libin
...@@ -22,42 +24,55 @@ import java.util.*; ...@@ -22,42 +24,55 @@ import java.util.*;
* @description * @description
* @data 2019/7/24 15:11 * @data 2019/7/24 15:11
*/ */
@ConditionalOnProperty(prefix = "data.clean", name = "enable",havingValue = "true") @ConditionalOnProperty(prefix = "data.clean", name = "enable", havingValue = "true")
@RequiredArgsConstructor(onConstructor = @__({@Autowired}))
@RestController @RestController
@RequestMapping("/app/unauth/user_data") @RequestMapping("/app/unauth/user_data")
public class DataController { public class DataController {
@PostConstruct private final AppUserLoginBiz appUserLoginBiz;
public void init(){
System.out.println("启动了****************************"); private final AppUserDetailBiz appUserDetailBiz;
}
private final AppUserRelationBiz appUserRelationBiz;
private final AppUserSellingWaterBiz appUserSellingWaterBiz;
private final ActivityFeign activityFeign;
@Autowired private final MyWalletBiz walletBiz;
private AppUserLoginBiz appUserLoginBiz;
@Autowired private final MyWalletCathBiz walletCathBiz;
private AppUserDetailBiz appUserDetailBiz;
@Autowired private final BaseUserMemberBiz userMemberBiz;
private AppUserRelationBiz appUserRelationBiz;
@Autowired private final OrderFeign orderFeign;
private AppUserSellingWaterBiz appUserSellingWaterBiz;
@Autowired
private ActivityFeign activityFeign;
@GetMapping("/clearwithphone") @GetMapping("/clearwithphone")
public ObjectRestResponse<Void> clearData(@RequestParam("phones") List<String> phons) { public ObjectRestResponse<Void> clearData(@RequestParam("phones") List<String> phons) {
Map<String, Integer> phoneAndUserIdMapByPhones = appUserLoginBiz.findPhoneAndUserIdMapByPhones(phons); Map<String, Integer> phoneAndUserIdMapByPhones = appUserLoginBiz.findPhoneAndUserIdMapByPhones(phons);
if (Objects.nonNull(phoneAndUserIdMapByPhones)){ if (Objects.nonNull(phoneAndUserIdMapByPhones)) {
Collection<Integer> userIds = phoneAndUserIdMapByPhones.values(); Collection<Integer> userIds = phoneAndUserIdMapByPhones.values();
//1.删除登录表信息
appUserLoginBiz.deleteByPhones(phons); appUserLoginBiz.deleteByPhones(phons);
//2.删除用户详情信息
appUserDetailBiz.deleteByUserIds(userIds); appUserDetailBiz.deleteByUserIds(userIds);
//3.删除用户关系表信息
appUserRelationBiz.deleteByMemberIds(userIds); appUserRelationBiz.deleteByMemberIds(userIds);
//4.删除用户钱包
walletBiz.deleteByUserIds(userIds);
//5.删除用户提现记录
walletCathBiz.deleteByUserIds(userIds);
//6.删除会员信息
userMemberBiz.deleteByUserIds(userIds);
//7.删除佣金数据
appUserSellingWaterBiz.deleteByMemberIds(userIds); appUserSellingWaterBiz.deleteByMemberIds(userIds);
activityFeign.clearDate(new ArrayList<>(userIds)); //8.清除活动和用户优惠券信息
activityFeign.clearDate(new ArrayList(userIds));
//9.消除租车订单与旅游订单信息
// orderFeign.clearDateByUserIds(new ArrayList(userIds));
} }
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
...@@ -66,7 +81,7 @@ public class DataController { ...@@ -66,7 +81,7 @@ public class DataController {
public ObjectRestResponse<Void> clearRelationphone(@RequestParam("phones") List<String> phons) { public ObjectRestResponse<Void> clearRelationphone(@RequestParam("phones") List<String> phons) {
Map<String, Integer> phoneAndUserIdMapByPhones = appUserLoginBiz.findPhoneAndUserIdMapByPhones(phons); Map<String, Integer> phoneAndUserIdMapByPhones = appUserLoginBiz.findPhoneAndUserIdMapByPhones(phons);
if (Objects.nonNull(phoneAndUserIdMapByPhones)){ if (Objects.nonNull(phoneAndUserIdMapByPhones)) {
Collection<Integer> userIds = phoneAndUserIdMapByPhones.values(); Collection<Integer> userIds = phoneAndUserIdMapByPhones.values();
appUserRelationBiz.deleteByMemberIds(userIds); appUserRelationBiz.deleteByMemberIds(userIds);
appUserSellingWaterBiz.deleteByMemberIds(userIds); appUserSellingWaterBiz.deleteByMemberIds(userIds);
......
...@@ -5,18 +5,11 @@ import com.github.pagehelper.PageInfo; ...@@ -5,18 +5,11 @@ import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.constant.RestCode; import com.github.wxiaoqi.security.common.constant.RestCode;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.EntityUtils;
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.xxfc.platform.app.vo.appVersionQuery; import com.xxfc.platform.app.vo.appVersionQuery;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.RedisKey;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.RowBounds;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
...@@ -32,18 +25,13 @@ import com.xxfc.platform.app.entity.AppVersion; ...@@ -32,18 +25,13 @@ import com.xxfc.platform.app.entity.AppVersion;
import com.xxfc.platform.app.mapper.AppVersionMapper; import com.xxfc.platform.app.mapper.AppVersionMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
/** /**
* *
......
...@@ -4,37 +4,18 @@ import com.github.pagehelper.PageInfo; ...@@ -4,37 +4,18 @@ import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.constant.AppFormat; import com.github.wxiaoqi.security.admin.constant.AppFormat;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; 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.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.app.biz.AppVersionBiz; import com.xxfc.platform.app.biz.AppVersionBiz;
import com.xxfc.platform.app.entity.AppVersion; import com.xxfc.platform.app.entity.AppVersion;
import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.vo.appVersionQuery; import com.xxfc.platform.app.vo.appVersionQuery;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Delete;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RestController @RestController
@RequestMapping("version") @RequestMapping("version")
......
...@@ -94,12 +94,12 @@ public class OrderTourVerificationBiz{ ...@@ -94,12 +94,12 @@ public class OrderTourVerificationBiz{
// 出发时间 是否已经发车 // 出发时间 是否已经发车
Date departureDate = tourFeign.selectDepartureDataBySpeId(tourDetail.getSpePriceId()); Date departureDate = tourFeign.selectDepartureDataBySpeId(tourDetail.getSpePriceId());
Long departureTime = tourFeign.selectDepartureTimeByStartCompanyIdAndRouteId(tourDetail.getStartCompanyId(), tourDetail.getGoodId()); //Long departureTime = tourFeign.selectDepartureTimeByStartCompanyIdAndRouteId(tourDetail.getStartCompanyId(), tourDetail.getGoodId());
Integer departureStatus = tourFeign.selectDepartureStatusByVerificationId(verificationId); Integer departureStatus = tourFeign.selectDepartureStatusByVerificationId(verificationId);
LocalTime localDepartureTime = LocalTime.ofSecondOfDay(departureTime); //LocalTime localDepartureTime = LocalTime.ofSecondOfDay(departureTime);
departureDate.setHours(localDepartureTime.getHour()); departureDate.setHours(0);
departureDate.setMinutes(localDepartureTime.getMinute()); departureDate.setMinutes(0);
departureDate.setSeconds(localDepartureTime.getSecond()); departureDate.setSeconds(0);
if (Instant.now().toEpochMilli()<departureDate.toInstant().toEpochMilli()){ if (Instant.now().toEpochMilli()<departureDate.toInstant().toEpochMilli()){
return ObjectRestResponse.createFailedResultWithObj(400,"还未到发车时间",0); return ObjectRestResponse.createFailedResultWithObj(400,"还未到发车时间",0);
......
...@@ -204,7 +204,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -204,7 +204,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
vehicleDepartureVo.setExpectArrivalBranchCompanyId(orderRentVehicleDetail.getEndCompanyId()); vehicleDepartureVo.setExpectArrivalBranchCompanyId(orderRentVehicleDetail.getEndCompanyId());
vehicleDepartureVo.setMileage(orderVehicleCrosstownDto.getMileage()); vehicleDepartureVo.setMileage(orderVehicleCrosstownDto.getMileage());
vehicleDepartureVo.setUse("用户租车"); vehicleDepartureVo.setUse("用户租车");
vehicleDepartureVo.setBookRecordId(Integer.parseInt(orderRentVehicleDetail.getBookRecordId() + "")); vehicleDepartureVo.setBookRecordId(orderRentVehicleDetail.getBookRecordId());
vehicleDepartureVo.setUser(userDTO.getUsername()); vehicleDepartureVo.setUser(userDTO.getUsername());
vehicleDepartureVo.setUserTel(userDTO.getTelPhone()); vehicleDepartureVo.setUserTel(userDTO.getTelPhone());
vehicleDepartureVo.setCheckMan(orderVehicleCrosstownDto.getLicenseName()); vehicleDepartureVo.setCheckMan(orderVehicleCrosstownDto.getLicenseName());
......
...@@ -33,7 +33,11 @@ public class VehicleBookRecordVo extends VehicleBookRecord { ...@@ -33,7 +33,11 @@ public class VehicleBookRecordVo extends VehicleBookRecord {
private Integer liftStatus; private Integer liftStatus;
private Integer retStatus; private Integer retStatus;
private Integer state; private Integer state;
private Integer code;
List<VehicleUpkeepItem> vehicleUpkeepItems; List<VehicleUpkeepItem> vehicleUpkeepItems;
} }
...@@ -118,6 +118,7 @@ public class VehicleActiveService { ...@@ -118,6 +118,7 @@ public class VehicleActiveService {
departureLog.setBookRecordId(departureVo.getBookRecordId()); departureLog.setBookRecordId(departureVo.getBookRecordId());
departureLog.setDepartureRemark(departureVo.getRemark()); departureLog.setDepartureRemark(departureVo.getRemark());
if(vehicleBookRecord != null) { if(vehicleBookRecord != null) {
departureLog.setDepartureBranchCompanyId(vehicleBookRecord.getLiftCompany());
departureLog.setUse(BookType.getByCode(vehicleBookRecord.getBookType())); departureLog.setUse(BookType.getByCode(vehicleBookRecord.getBookType()));
departureLog.setUser(vehicleBookRecord.getVehicleUsername()); departureLog.setUser(vehicleBookRecord.getVehicleUsername());
departureLog.setUserTel(vehicleBookRecord.getVehicleUserPhone()); departureLog.setUserTel(vehicleBookRecord.getVehicleUserPhone());
...@@ -191,10 +192,15 @@ public class VehicleActiveService { ...@@ -191,10 +192,15 @@ public class VehicleActiveService {
ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getCode()); ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getCode());
} }
if (Mileagerest != null && Mileagerest1 >= Mileagerest) { if (Mileagerest != null && Mileagerest1 >= Mileagerest) {
VehicleBookRecord vehicleBookRecord = null;
if(arrivalVo.getBookRecordId() != null) {
vehicleBookRecord = vehicleBookRecordBiz.selectById(arrivalVo.getBookRecordId());
updateBookRecordStatus(vehicleBookRecord, 2);
}
// 写入车辆公里数,还车分公司id // 写入车辆公里数,还车分公司id
vehicle.setMileageLastUpdate(Mileagerest1); vehicle.setMileageLastUpdate(Mileagerest1);
vehicle.setParkBranchCompanyId(arrivalVo.getArrivalBranchCompanyId()); vehicle.setParkBranchCompanyId(vehicleBookRecord.getRetCompany());
vehicle.setExpectDestinationBranchCompanyId(0); vehicle.setExpectDestinationBranchCompanyId(0);
vehicleMapper.updateByPrimaryKeySelective(vehicle); vehicleMapper.updateByPrimaryKeySelective(vehicle);
...@@ -205,11 +211,6 @@ public class VehicleActiveService { ...@@ -205,11 +211,6 @@ public class VehicleActiveService {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE.getDesc(), throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE.getDesc(),
ResCode.VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE.getCode()); ResCode.VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE.getCode());
} }
VehicleBookRecord vehicleBookRecord = null;
if(arrivalVo.getBookRecordId() != null) {
vehicleBookRecord = vehicleBookRecordBiz.selectById(arrivalVo.getBookRecordId());
updateBookRecordStatus(vehicleBookRecord, 2);
}
// 出车记录 // 出车记录
......
...@@ -400,7 +400,7 @@ ...@@ -400,7 +400,7 @@
parameterType="com.xxfc.platform.vehicle.pojo.VehicleBookRecordQueryVo"> parameterType="com.xxfc.platform.vehicle.pojo.VehicleBookRecordQueryVo">
select bc3.name parkCompanyName,bc4.name subordinateBranchName, conv(v4.booked_hour,10,2) select bc3.name parkCompanyName,bc4.name subordinateBranchName, conv(v4.booked_hour,10,2)
startHour,conv(v5.booked_hour,10,2) endHour, bc1.`name` lift_company_name, bc2.`name` ret_company_name, startHour,conv(v5.booked_hour,10,2) endHour, bc1.`name` lift_company_name, bc2.`name` ret_company_name,
v3.number_plate,v1.* v3.number_plate,v1.*,v3.code
from vehicle_book_record v1 from vehicle_book_record v1
LEFT JOIN vehicle_book_hour_info v4 on v4.book_record_id = v1.id and YEAR(v4.year_month_day) = LEFT JOIN vehicle_book_hour_info v4 on v4.book_record_id = v1.id and YEAR(v4.year_month_day) =
YEAR(v1.book_start_date) AND MONTH(v4.year_month_day) = MONTH(v1.book_start_date) AND DAY(v4.year_month_day) YEAR(v1.book_start_date) AND MONTH(v4.year_month_day) = MONTH(v1.book_start_date) AND DAY(v4.year_month_day)
...@@ -421,6 +421,9 @@ ...@@ -421,6 +421,9 @@
<if test="numberPlate != null"> <if test="numberPlate != null">
and v3.number_plate = #{numberPlate} and v3.number_plate = #{numberPlate}
</if> </if>
<if test="code != null">
and v3.code = #{code}
</if>
<if test="bookType != null"> <if test="bookType != null">
and v1.book_type = #{bookType} and v1.book_type = #{bookType}
</if> </if>
...@@ -444,7 +447,7 @@ ...@@ -444,7 +447,7 @@
<select id="getBookRecordInfo" resultMap="searchBookRecord" parameterType="java.util.Map"> <select id="getBookRecordInfo" resultMap="searchBookRecord" parameterType="java.util.Map">
select (CASE v1.lift_company WHEN #{userCompany} THEN 1 ELSE 0 end) liftStatus,(CASE v1.ret_company WHEN select (CASE v1.lift_company WHEN #{userCompany} THEN 1 ELSE 0 end) liftStatus,(CASE v1.ret_company WHEN
#{userCompany} THEN 1 ELSE 0 end) retStatus,bc4.name subordinateBranchName, bc1.`name` lift_company_name, #{userCompany} THEN 1 ELSE 0 end) retStatus,bc4.name subordinateBranchName, bc1.`name` lift_company_name,
bc2.`name` ret_company_name, v3.number_plate,v1.* bc2.`name` ret_company_name, v3.number_plate,v1.*,v3.code
from vehicle_book_record v1 from vehicle_book_record v1
LEFT JOIN branch_company bc1 ON v1.lift_company = bc1.id LEFT JOIN branch_company bc1 ON v1.lift_company = bc1.id
LEFT JOIN branch_company bc2 on v1.ret_company = bc2.id LEFT JOIN branch_company bc2 on v1.ret_company = bc2.id
...@@ -482,6 +485,9 @@ ...@@ -482,6 +485,9 @@
<if test="status != null and status == -1 "> <if test="status != null and status == -1 ">
and v4.state = 1 and v4.state = 1
</if> </if>
<if test="code != null">
and v3.code = #{code}
</if>
and v1.book_user != -2 and v1.book_user != -2
</where> </where>
group by v1.id group by v1.id
......
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