Commit b07557f0 authored by jiaorz's avatar jiaorz

Merge branch 'jrz_dev' into base-modify

# Conflicts:
#	xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
parents 79f5c175 e729b789
package com.github.wxiaoqi.security.common.util; package com.github.wxiaoqi.security.common.util;
import java.util.HashSet;
import java.util.Random; import java.util.Random;
import java.util.Set;
/** /**
* 随机数工具 * 随机数工具
...@@ -31,10 +33,41 @@ public class RandomUtil ...@@ -31,10 +33,41 @@ public class RandomUtil
return String.valueOf((int) (random * num)); return String.valueOf((int) (random * num));
} }
/**
* 获取随机数字集合
* @param max
* @param n
* @param set
*/
public static void randomSet(int max, int n, Set<Integer> set) {
if (n > (max + 1) || max < 0) {
return;
}
for (int i = 0; i < n; i++) {
int num = (int) (Math.random() * (max));
set.add(num);
}
int setSize = set.size();
// 如果存入的数小于指定生成的个数,则调用递归再生成剩余个数的随机数,如此循环,直到达到指定大小
if (setSize < n) {
randomSet( max, n-setSize, set);// 递归
}
}
public static synchronized String gencRan(){ public static synchronized String gencRan(){
Random ran = new Random(System.nanoTime()); Random ran = new Random(System.nanoTime());
double nextDouble = ran.nextDouble(); double nextDouble = ran.nextDouble();
return String.valueOf(nextDouble).substring(2, 6); return String.valueOf(nextDouble).substring(2, 6);
} }
public static void main(String[] args) {
int max = 20;
int n = 5;
Set<Integer> set = new HashSet<>();
randomSet(max, n, set);
for(Integer a : set) {
System.out.println(a);
}
}
} }
...@@ -103,9 +103,9 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -103,9 +103,9 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
if (CollectionUtils.isEmpty(appUserManageVos)) { if (CollectionUtils.isEmpty(appUserManageVos)) {
return new PageInfo<AppUserManageVo>(); return new PageInfo<AppUserManageVo>();
} }
Set<Integer> usSet = appUserManageDTO.getCitySet(); // Set<Integer> usSet = appUserManageDTO.getCitySet();
List<AppUserManageVo> results = appUserManageVos.parallelStream().filter(us -> usSet.contains(us.getCityCode())).collect(Collectors.toList()); // List<AppUserManageVo> results = appUserManageVos.parallelStream().filter(us -> usSet.contains(us.getCityCode())).collect(Collectors.toList());
PageInfo<AppUserManageVo> pageInfo = PageInfo.of(results); PageInfo<AppUserManageVo> pageInfo = PageInfo.of(appUserManageVos);
return getAppUserManageVoPageInfo(pageInfo); return getAppUserManageVoPageInfo(pageInfo);
} }
......
...@@ -208,11 +208,12 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem ...@@ -208,11 +208,12 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
if (baseUserMemberVO != null) { if (baseUserMemberVO != null) {
return baseUserMemberVO; return baseUserMemberVO;
} }
return new BaseUserMemberVO(); return null;
} }
/** /**
* 设置用户会员 * 设置用户会员
* *
......
...@@ -45,19 +45,20 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -45,19 +45,20 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
@Autowired @Autowired
private VehicleFeign vehicleFeign; private VehicleFeign vehicleFeign;
private Integer ALL_PERMISSIONS=1;
/** /**
* 查询所有 * 查询所有
* @return * @return
*/ */
@PostMapping("/findAll") @PostMapping("/findAll")
public ObjectRestResponse<PageInfo<AppUserManageVo>> findAllByQuery(@RequestBody AppUserManageDTO appUserManageDTO, HttpServletRequest request) throws Exception { public ObjectRestResponse<PageInfo<AppUserManageVo>> findAllByQuery(@RequestBody AppUserManageDTO appUserManageDTO) throws Exception {
String token = userAuthConfig.getToken(request); String token = userAuthConfig.getToken(request);
ObjectRestResponse objectRestResponse = publicController.userinfoByToken(token); ObjectRestResponse objectRestResponse = publicController.userinfoByToken(token);
User user = (User) objectRestResponse.getData(); User user = (User) objectRestResponse.getData();
if (user==null){ if (user==null){
throw new BaseException("User error!"); throw new BaseException("User error!");
} }
if (user.getDataAll()==1) { if (ALL_PERMISSIONS.equals(user.getDataAll())) {
return ObjectRestResponse.succ(baseBiz.findAllByQuery(appUserManageDTO)); return ObjectRestResponse.succ(baseBiz.findAllByQuery(appUserManageDTO));
} }
ObjectRestResponse<Set<Integer>> setObjectRestResponse = vehicleFeign.corporationCity(user.getDataZone(), user.getDataCompany()); ObjectRestResponse<Set<Integer>> setObjectRestResponse = vehicleFeign.corporationCity(user.getDataZone(), user.getDataCompany());
......
...@@ -3,7 +3,6 @@ package com.github.wxiaoqi.security.admin.rest; ...@@ -3,7 +3,6 @@ package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.BaseUserMemberBiz; import com.github.wxiaoqi.security.admin.biz.BaseUserMemberBiz;
import com.github.wxiaoqi.security.admin.dto.BaseUserMemberVO; import com.github.wxiaoqi.security.admin.dto.BaseUserMemberVO;
import com.github.wxiaoqi.security.admin.dto.UserMemberDTO; import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserManage;
import com.github.wxiaoqi.security.admin.entity.BaseUserMember; import com.github.wxiaoqi.security.admin.entity.BaseUserMember;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
...@@ -15,7 +14,6 @@ import io.swagger.annotations.ApiOperation; ...@@ -15,7 +14,6 @@ import io.swagger.annotations.ApiOperation;
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 java.lang.reflect.InvocationTargetException;
import java.util.Objects; import java.util.Objects;
/** /**
...@@ -40,7 +38,9 @@ public class BaseUserMemberController extends BaseController<BaseUserMemberBiz, ...@@ -40,7 +38,9 @@ public class BaseUserMemberController extends BaseController<BaseUserMemberBiz,
@ApiOperation(value = "根据用户id获取用户会员信息") @ApiOperation(value = "根据用户id获取用户会员信息")
@GetMapping("/findOne/{userId}") @GetMapping("/findOne/{userId}")
public ObjectRestResponse<BaseUserMemberVO> findOneByUserId(@PathVariable Integer userId)throws Exception{ public ObjectRestResponse<BaseUserMemberVO> findOneByUserId(@PathVariable Integer userId)throws Exception{
return ObjectRestResponse.succ(baseBiz.findOneByUserId(userId)); BaseUserMemberVO oneByUserId = baseBiz.findOneByUserId(userId);
oneByUserId=(oneByUserId==null? new BaseUserMemberVO(): oneByUserId);
return ObjectRestResponse.succ(oneByUserId);
} }
......
...@@ -133,6 +133,12 @@ ...@@ -133,6 +133,12 @@
<if test="source !=null "> <if test="source !=null ">
and d.source = #{source} and d.source = #{source}
</if> </if>
<if test="citySet != null ">
and d.city_code in
<foreach collection="citySet" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
</if>
order by l.id ASC order by l.id ASC
</select> </select>
......
...@@ -87,7 +87,10 @@ ...@@ -87,7 +87,10 @@
<artifactId>spring-cloud-starter-openfeign</artifactId> <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency> </dependency>
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-all</artifactId> </dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-all</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
...@@ -95,8 +98,8 @@ ...@@ -95,8 +98,8 @@
</dependency> </dependency>
<!--<dependency>--> <!--<dependency>-->
<!--<groupId>org.springframework.amqp</groupId>--> <!--<groupId>org.springframework.amqp</groupId>-->
<!--<artifactId>spring-rabbit</artifactId>--> <!--<artifactId>spring-rabbit</artifactId>-->
<!--</dependency>--> <!--</dependency>-->
<dependency> <dependency>
......
...@@ -36,8 +36,14 @@ ...@@ -36,8 +36,14 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId> <artifactId>spring-cloud-config-server</artifactId>
</dependency> </dependency>
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-all</artifactId> </dependency> <dependency>
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-all</artifactId> </dependency> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-all</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-consul-all</artifactId>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId> <artifactId>spring-cloud-starter-openfeign</artifactId>
......
...@@ -36,7 +36,10 @@ ...@@ -36,7 +36,10 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId> <artifactId>spring-cloud-config-server</artifactId>
</dependency> </dependency>
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-all</artifactId> </dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-all</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -91,6 +91,26 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -91,6 +91,26 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
log.error(userId+"----已领优惠卷"); log.error(userId+"----已领优惠卷");
return null; return null;
} }
falg=checkLed(userId,couponId,coupon.getLimitCollar(),coupon.getQuota());
if(falg){
log.error(userId+"----已超过领取限制");
return null;
}
return led(coupon,userId);
}
//后台领劵(一个劵可以发多张)
public String adminUserLedCoupon(Integer userId,Integer couponId){
Coupon coupon=couponBiz.selectById(couponId);
if (coupon==null||coupon.getIsDel()!=0||coupon.getStatus()!=1){
log.error(userId+"----无可领取优惠卷");
return null;
}
boolean falg=checkLed(userId,couponId,coupon.getLimitCollar(),coupon.getQuota());
if(falg){
log.error(userId+"----已超过领取限制");
return null;
}
return led(coupon,userId); return led(coupon,userId);
} }
...@@ -123,7 +143,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -123,7 +143,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
//检查用户是否领卷 //检查用户是否领卷
public boolean checkUserLed(Integer userId,Integer id){ public boolean checkUserLed(Integer userId,Integer id){
Example example=new Example(UserCoupon.class); Example example=new Example(UserCoupon.class);
example.createCriteria().andEqualTo("userId",userId).andEqualTo("couponId",id); example.createCriteria().andEqualTo("userId",userId).andEqualTo("couponId",id).andEqualTo("isDel",0);
List<UserCoupon> list=selectByExample(example); List<UserCoupon> list=selectByExample(example);
if(list.size()>0){ if(list.size()>0){
log.error(userId+"----已领优惠卷"); log.error(userId+"----已领优惠卷");
...@@ -132,6 +152,31 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -132,6 +152,31 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
return false; return false;
} }
//检查用户是否可领卷
public boolean checkLed(Integer userId,Integer id,Integer limitCollar,Integer quota){
Example example=new Example(UserCoupon.class);
example.createCriteria().andEqualTo("userId",userId).andEqualTo("couponId",id).andEqualTo("isDel",0);
Integer num=selectCountByExample(example);
log.info("-用户已领劵--userId==="+userId+"----num==="+num+"----couponid==="+id);
if(num==null||num==0){
log.error(userId+"----无领此优惠卷----couponid==="+id);
return false;
}
if (limitCollar==null||num>=limitCollar){
log.error(userId+"----此优惠卷超过每人限领次数----couponid==="+id+"----limitCollar==="+limitCollar);
return true;
}
example.clear();
example.createCriteria().andEqualTo("couponId",id).andEqualTo("isDel",0);
num=selectCountByExample(example);
log.info("---发劵数量----num==="+num+"----limitCollar==="+limitCollar+"----quota==="+quota+"----couponid==="+id);
if (quota==null||quota==0||(num!=null&&num>0&&num>=quota)){
log.error(userId+"----此优惠卷超过发券数量----couponid==="+id+"----quota==="+quota);
return true;
}
return false;
}
//获取我的优惠卷 //获取我的优惠卷
public ObjectRestResponse getCouponList(Integer userId,int type,Integer channel,BigDecimal amout){ public ObjectRestResponse getCouponList(Integer userId,int type,Integer channel,BigDecimal amout){
if (userId==null||userId==0){ if (userId==null||userId==0){
...@@ -206,7 +251,6 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -206,7 +251,6 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
result.put("array",array); result.put("array",array);
return ObjectRestResponse.succ(result); return ObjectRestResponse.succ(result);
} }
//获取我的优惠卷 //获取我的优惠卷
public ObjectRestResponse getUserCouponList(Integer userId,int type,Integer channel,BigDecimal amout) { public ObjectRestResponse getUserCouponList(Integer userId,int type,Integer channel,BigDecimal amout) {
if (userId == null || userId == 0) { if (userId == null || userId == 0) {
...@@ -378,16 +422,17 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -378,16 +422,17 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
UserCoupon userCoupon; UserCoupon userCoupon;
List<UserCoupon> userCoupons = new ArrayList<>(); List<UserCoupon> userCoupons = new ArrayList<>();
for (int i=0;i<userCouponSendDTO.getCouponNum();i++){ for (int i=0;i<userCouponSendDTO.getCouponNum();i++){
userCoupon = new UserCoupon(); /*userCoupon = new UserCoupon();
userCoupon.setCouponId(userCouponSendDTO.getCouponId()); userCoupon.setCouponId(userCouponSendDTO.getCouponId());
userCoupon.setUserId(appUserLogin.getId()); userCoupon.setUserId(appUserLogin.getId());
userCoupon.setCrtTime(Instant.now().toEpochMilli()); userCoupon.setCrtTime(Instant.now().toEpochMilli());
userCoupon.setStartTime(couponVo.getValidStartTime()); userCoupon.setStartTime(couponVo.getValidStartTime());
userCoupon.setExpireTime(couponVo.getValidEndTime()); userCoupon.setExpireTime(couponVo.getValidEndTime());
userCoupon.setTickerNo(Snowflake.build()+""); userCoupon.setTickerNo(Snowflake.build()+"");
userCoupons.add(userCoupon); userCoupons.add(userCoupon);*/
adminUserLedCoupon(appUserLogin.getId(),userCouponSendDTO.getCouponId());
} }
return mapper.inserBatch(userCoupons); return 1;
} }
public long importUserCoupon(Integer couponId,List<String[]> userCounponData) { public long importUserCoupon(Integer couponId,List<String[]> userCounponData) {
...@@ -426,6 +471,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -426,6 +471,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
UserCoupon userCoupon=new UserCoupon(); UserCoupon userCoupon=new UserCoupon();
userCoupon.setUserId(userId); userCoupon.setUserId(userId);
userCoupon.setIsUse(0); userCoupon.setIsUse(0);
userCoupon.setIsDel(0);
Long couponNumber=selectCount(userCoupon); Long couponNumber=selectCount(userCoupon);
userInfoDTO.setCouponNumber(couponNumber); userInfoDTO.setCouponNumber(couponNumber);
return userInfoDTO; return userInfoDTO;
......
...@@ -162,6 +162,9 @@ public class OrderCancelBiz { ...@@ -162,6 +162,9 @@ public class OrderCancelBiz {
} }
//退款流程 //退款流程
orderRefundBiz.rentRefundProcess(hasUpdateOrder, timeLag, APP_ORDER+ "_"+ key); orderRefundBiz.rentRefundProcess(hasUpdateOrder, timeLag, APP_ORDER+ "_"+ key);
//站点总人数减少
tourFeign.updateTourGoodPersonNum(otd.getVerificationId(), TourFeign.TOTAL_PERSON, (otd.getTotalNumber() * -1));
} }
} }
......
...@@ -9,6 +9,7 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign; ...@@ -9,6 +9,7 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
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.RandomUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.GoodDataVO; import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
...@@ -18,15 +19,13 @@ import com.xxfc.platform.tour.mapper.*; ...@@ -18,15 +19,13 @@ import com.xxfc.platform.tour.mapper.*;
import com.xxfc.platform.tour.vo.TourGoodVo; import com.xxfc.platform.tour.vo.TourGoodVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 旅游商品表 * 旅游商品表
...@@ -325,6 +324,27 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -325,6 +324,27 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
return mapper.findAllByHome((page-1)*limit,limit); return mapper.findAllByHome((page-1)*limit,limit);
}; };
/**
* 获取指定数量的随机旅游路线
* @return
*/
public ObjectRestResponse findRandomVehicle(Integer number) {
number = number == null ? 3 : number;
Map<String, Object> param = new HashMap<>();
List<TourGood> list = mapper.getCoordinateList(param);
Set<TourGood> resultList = new HashSet<>();
if(CollectionUtils.isNotEmpty(list)) {
if(number == list.size()) {
return ObjectRestResponse.succ(list);
}
Set<Integer> set = new HashSet<>();
RandomUtil.randomSet(list.size(), number, set);
for(Integer i : set) {
resultList.add(list.get(i));
}
}
return ObjectRestResponse.succ(resultList);
}
} }
...@@ -52,5 +52,10 @@ public class TourGoodController extends BaseController<TourGoodBiz, TourGood> { ...@@ -52,5 +52,10 @@ public class TourGoodController extends BaseController<TourGoodBiz, TourGood> {
return baseBiz.getAllByHome(page,limit); return baseBiz.getAllByHome(page,limit);
} }
@ApiOperation("随机获取旅游路线")
@GetMapping(value = "/app/unauth/findRandomVehicle")
public ObjectRestResponse findRandomVehicle(Integer number) {
return baseBiz.findRandomVehicle(number);
}
} }
\ No newline at end of file
...@@ -102,7 +102,7 @@ public class CertificationController { ...@@ -102,7 +102,7 @@ public class CertificationController {
// } // }
// }); // });
// thread.start(); // thread.start();
} }
return result ; return result ;
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -251,16 +251,16 @@ public class CertificationService { ...@@ -251,16 +251,16 @@ public class CertificationService {
} }
idInformation.setExpirationDate(expirationDate); idInformation.setExpirationDate(expirationDate);
CertificationService cs = applicationContext.getBean(this.getClass()); CertificationService cs = applicationContext.getBean(this.getClass());
ObjectRestResponse objRR =cs.addIdInformation(idInformation); return cs.addIdInformation(idInformation);
log.info("----请求admin=========" + objRR); // log.info("----请求admin=========" + objRR);
if (objRR.getRel()) { // if (objRR.getRel()) {
return ObjectRestResponse.succ(objRR.getData()); // return ObjectRestResponse.succ(objRR.getData());
} // }
} }
} }
return ObjectRestResponse.succ(); return ObjectRestResponse.createFailedResult(ResultCode.INCOMPLETE_DATA,"网络异常,请稍后再试");
} }
...@@ -344,7 +344,8 @@ public class CertificationService { ...@@ -344,7 +344,8 @@ public class CertificationService {
// idInformation.setId(idInformation1.getId()); // idInformation.setId(idInformation1.getId());
// idInformation.setUpdTime(new Date()); // idInformation.setUpdTime(new Date());
// idInformationMapper.updateByPrimaryKeySelective(idInformation); // idInformationMapper.updateByPrimaryKeySelective(idInformation);
throw new BaseException("该身份证已存在,不要重复认证!"); log.error("该身份证已存在,不要重复认证");
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"该身份证已存在,不要重复认证");
} }
log.info("----addIdInformation---userid==="+idInformation.getUserLoginId()+"----name====" + idInformation.getName()+"---IdNumber==="+idInformation.getIdNumber()); log.info("----addIdInformation---userid==="+idInformation.getUserLoginId()+"----name====" + idInformation.getName()+"---IdNumber==="+idInformation.getIdNumber());
//认证成功后修改用户,用户认证状态 //认证成功后修改用户,用户认证状态
......
...@@ -436,17 +436,19 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -436,17 +436,19 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月 if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new BaseException(ResultCode.ONLY_BOOK_TWO_MONTH); throw new BaseException(ResultCode.ONLY_BOOK_TWO_MONTH);
} }
Map<String, Integer> map = vehicleBookHourInfoBiz.getPredictableHours(bookVehicleVo.getBookStartDate(), bookVehicleVo.getBookEndDate(), bookVehicleVo.getNotCheckTimeLegal()); //检验时间是否可以预定
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
Boolean rsEach = applyVehicle4EmployeePerMonth(bookVehicleVo.getVehicleId(),entry.getValue(),entry.getKey(), map);
if(Boolean.FALSE.equals(rsEach)){
throw new BaseException(ResultCode.VEHICLE_IS_BOOKED);
}
}
Map<String, Integer> map = new HashMap<>();
//加入预定申请记录 //加入预定申请记录
VehicleBookRecord vehicleBookRecord = null; VehicleBookRecord vehicleBookRecord = null;
if(bookVehicleVo.getVehicleBookRecordId() == null) { if(bookVehicleVo.getVehicleBookRecordId() == null) {
map = vehicleBookHourInfoBiz.getPredictableHours(bookVehicleVo.getBookStartDate(), bookVehicleVo.getBookEndDate(), bookVehicleVo.getNotCheckTimeLegal());
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
Boolean rsEach = applyVehicle4EmployeePerMonth(bookVehicleVo.getVehicleId(),entry.getValue(),entry.getKey(), map);
if(Boolean.FALSE.equals(rsEach)){
throw new BaseException(ResultCode.VEHICLE_IS_BOOKED);
}
}
vehicleBookRecord = new VehicleBookRecord(); vehicleBookRecord = new VehicleBookRecord();
BeanUtil.copyProperties(bookVehicleVo, vehicleBookRecord, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true)); BeanUtil.copyProperties(bookVehicleVo, vehicleBookRecord, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
vehicleBookRecord.setBookStartDate(startDay.toDate()); vehicleBookRecord.setBookStartDate(startDay.toDate());
...@@ -461,11 +463,18 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -461,11 +463,18 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
if(vehicleBookRecord == null) { if(vehicleBookRecord == null) {
throw new BaseException(ResCode.VEHICLE_BOOKED_RECORD_NOT_EXIST.getDesc(), ResCode.VEHICLE_BOOKED_RECORD_NOT_EXIST.getCode()); throw new BaseException(ResCode.VEHICLE_BOOKED_RECORD_NOT_EXIST.getDesc(), ResCode.VEHICLE_BOOKED_RECORD_NOT_EXIST.getCode());
} else { } else {
//先取消之前预定时间,然后再修改 //先取消预定,然后再修改
bookVehicleVo.setUnbookStartDate(new DateTime(vehicleBookRecord.getBookStartDate()).toString(DATE_TIME_FORMATTER)); bookVehicleVo.setUnbookStartDate(new DateTime(vehicleBookRecord.getBookStartDate()).toString(DATE_TIME_FORMATTER));
bookVehicleVo.setUnbookEndDate(new DateTime(vehicleBookRecord.getBookEndDate()).toString(DATE_TIME_FORMATTER)); bookVehicleVo.setUnbookEndDate(new DateTime(vehicleBookRecord.getBookEndDate()).toString(DATE_TIME_FORMATTER));
unbookVehicle(bookVehicleVo); unbookVehicle(bookVehicleVo);
map = vehicleBookHourInfoBiz.getPredictableHours(bookVehicleVo.getBookStartDate(), bookVehicleVo.getBookEndDate(), bookVehicleVo.getNotCheckTimeLegal());
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
Boolean rsEach = applyVehicle4EmployeePerMonth(bookVehicleVo.getVehicleId(),entry.getValue(),entry.getKey(), map);
if(Boolean.FALSE.equals(rsEach)){
throw new BaseException(ResultCode.VEHICLE_IS_BOOKED);
}
}
vehicleBookRecord.setBookStartDate(startDay.toDate()); vehicleBookRecord.setBookStartDate(startDay.toDate());
vehicleBookRecord.setBookEndDate(endDay.toDate()); vehicleBookRecord.setBookEndDate(endDay.toDate());
vehicleBookRecordBiz.updateSelectiveByIdRe(vehicleBookRecord); vehicleBookRecordBiz.updateSelectiveByIdRe(vehicleBookRecord);
...@@ -519,11 +528,9 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -519,11 +528,9 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
Integer andOperationFactor = andOpratorParam.get("andOperationFactor"); Integer andOperationFactor = andOpratorParam.get("andOperationFactor");
Integer andOperationRs = andOpratorParam.get("andOperationRs"); Integer andOperationRs = andOpratorParam.get("andOperationRs");
if(vehicleBookInfo != null && vehicleBookInfo.getBookedDate() != null && if(vehicleBookInfo != null && vehicleBookInfo.getBookedDate() != null &&
((vehicleBookInfo.getBookedDate() & andOperationFactor) != andOperationRs)){//已经被预定 ((vehicleBookInfo.getBookedDate() & andOperationFactor) != 0)){//已经被预定
//当天已经被预定检查小时是否也被预定 //当天已经被预定检查小时是否也被预定
return filterHourInfoBooked(vehicleId, hourInfo); return filterHourInfoBooked(vehicleId, hourInfo);
} else if ((vehicleBookInfo.getBookedDate() & andOperationFactor) == 0){//未被预定,查看时间是否被预定
return filterHourInfoBooked(vehicleId, hourInfo);
} }
return Boolean.TRUE; return Boolean.TRUE;
} }
......
...@@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper; ...@@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
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.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.RandomUtil;
import com.github.wxiaoqi.security.common.vo.GoodDataVO; import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode; import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
...@@ -20,8 +21,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport; ...@@ -20,8 +21,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls; import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.ArrayList; import java.util.*;
import java.util.List;
/** /**
* 车型 * 车型
...@@ -71,7 +71,28 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> { ...@@ -71,7 +71,28 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
} }
return null; return null;
}
/**
* 获取指定数量的随机车型
* @return
*/
public ObjectRestResponse findRandomVehicle(Integer number) {
number = number == null ? 3 : number;
VehicleModelQueryCondition vmqc = new VehicleModelQueryCondition();
List<VehicleModelVo> list = mapper.findVehicleModelPage(vmqc);
Set<VehicleModelVo> resultList = new HashSet<>();
if(CollectionUtils.isNotEmpty(list)) {
if(number == list.size()) {
return ObjectRestResponse.succ(list);
}
Set<Integer> set = new HashSet<>();
RandomUtil.randomSet(list.size(), number, set);
for(Integer i : set) {
resultList.add(list.get(i));
}
}
return ObjectRestResponse.succ(resultList);
} }
/** /**
......
...@@ -51,7 +51,7 @@ public class VehicleJobHandler extends IJobHandler { ...@@ -51,7 +51,7 @@ public class VehicleJobHandler extends IJobHandler {
int betweenMonth = Integer.valueOf(dictionary.getDetail()).intValue(); int betweenMonth = Integer.valueOf(dictionary.getDetail()).intValue();
int month = nowMonth + betweenMonth> 12 ? (betweenMonth + nowMonth) - 12 : nowMonth + betweenMonth; int month = nowMonth + betweenMonth> 12 ? (betweenMonth + nowMonth) - 12 : nowMonth + betweenMonth;
year = month > nowMonth ? year : year + 1; year = month > nowMonth ? year : year + 1;
String yearAndMonth = String.format("%d-%s", year, month>10?month:"0"+month); String yearAndMonth = String.format("%d-%s", year, month>=10?month:"0"+month);
XxlJobLogger.log("----查询到的车型ids:【{}】",existVehicleIds); XxlJobLogger.log("----查询到的车型ids:【{}】",existVehicleIds);
if (CollectionUtils.isNotEmpty(existVehicleIds)) { if (CollectionUtils.isNotEmpty(existVehicleIds)) {
List<VehicleBookInfo> bookInfos = existVehicleIds.stream().map(vehicleId -> { List<VehicleBookInfo> bookInfos = existVehicleIds.stream().map(vehicleId -> {
......
...@@ -125,6 +125,13 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi ...@@ -125,6 +125,13 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
return vehicleModelBiz.findVehicleModelPage(vmqc); return vehicleModelBiz.findVehicleModelPage(vmqc);
} }
@GetMapping(value = "/app/unauth/findRandomVehicle")
@IgnoreUserToken
@ApiOperation("获取随机车型")
public ObjectRestResponse findRandomVehicle(Integer number) {
return vehicleModelBiz.findRandomVehicle(number);
}
/** /**
* 添加车型 * 添加车型
......
...@@ -588,7 +588,7 @@ ...@@ -588,7 +588,7 @@
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true"> <if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
hasVehicle desc, hasVehicle desc,
</if> </if>
distance asc distance asc, model_id asc
</if> </if>
</select> </select>
......
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