Commit 2e958b5d authored by hezhen's avatar hezhen

Merge branch 'dev' into hz_dev

parents 575e4c22 efaca558
...@@ -68,21 +68,21 @@ public class Article { ...@@ -68,21 +68,21 @@ public class Article {
*/ */
@Column(name = "author") @Column(name = "author")
@ApiModelProperty(value = "作者") @ApiModelProperty(value = "作者")
private Integer author; private String author;
/** /**
* 发布人 * 发布人
*/ */
@Column(name = "publisher") @Column(name = "publisher")
@ApiModelProperty(value = "发布人") @ApiModelProperty(value = "发布人")
private Integer publisher; private String publisher;
/** /**
* 封面图 * 封面图
*/ */
@Column(name = "cover_image") @Column(name = "cover_image")
@ApiModelProperty(value = "封面图") @ApiModelProperty(value = "封面图")
private Integer coverImage; private String coverImage;
/** /**
* 权重 * 权重
...@@ -105,6 +105,11 @@ public class Article { ...@@ -105,6 +105,11 @@ public class Article {
@ApiModelProperty(value = "是否上下架:0-否,1-是") @ApiModelProperty(value = "是否上下架:0-否,1-是")
private Integer status; private Integer status;
@Column(name ="type")
@ApiModelProperty(value = "文章发布网站:0-所有,1-新欣房车官网,2-滴房车官网")
private Integer type;
/** /**
* 创建时间 * 创建时间
*/ */
......
...@@ -12,8 +12,8 @@ import tk.mybatis.spring.annotation.MapperScan; ...@@ -12,8 +12,8 @@ import tk.mybatis.spring.annotation.MapperScan;
* @author Administrator * @author Administrator
*/ */
@SpringBootApplication(scanBasePackages ={ @SpringBootApplication(scanBasePackages ={
"com.xxfc.platform.uccn", "com.github.wxiaoqi",
"com.github.wxiaoqi" "com.xxfc.platform"
}) })
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableAceAuthClient @EnableAceAuthClient
......
...@@ -7,18 +7,101 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; ...@@ -7,18 +7,101 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.uccn.entity.Article; import com.xxfc.platform.uccn.entity.Article;
import com.xxfc.platform.uccn.mapper.ArticleMapper; import com.xxfc.platform.uccn.mapper.ArticleMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.*;
import java.util.List;
/** /**
* @author Administrator * @author Administrator
*/ */
@Service @Service
public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
/**
* 随机文章条数
*/
private final Integer RANDOM_NUMBER=3;
/**
* 首页文章条数
*/
private final Integer HOME_PAGE_NUMBER=4;
public PageInfo getArticleList(Integer page, Integer limit) { /**
PageHelper.startPage(page,limit); * 文章列表
List articleList = mapper.getArticleList(); * @param page
* @param limit
* @param type
* @return
*/
public PageInfo getArticleList(Integer page, Integer limit, Integer type) {
PageHelper.startPage(page, limit);
List articleList = mapper.getArticleList(type);
return PageInfo.of(articleList); return PageInfo.of(articleList);
} }
/**
* 获取一条数据
* @param id
* @return
*/
public Article getOne(Integer id) {
Example example = Example.builder(Article.class).where(
WeekendSqls.<Article>custom()
.andEqualTo(Article::getId,id)
.andEqualTo(Article::getIsDel, 0)
.andEqualTo(Article::getStatus, 1)
).build();
Article article = mapper.selectOneByExample(example);
return article;
}
/**
* 随机获取三条连续的文章
* @param type
* @return
*/
public List getThree(Integer type) {
List<Article> articleList = mapper.getArticleList(type);
if (!Objects.isNull(articleList)) {
int size = articleList.size();
if (RANDOM_NUMBER>=size) {
return articleList;
}else {
Random random = new Random();
int r = random.nextInt(size -RANDOM_NUMBER+1);
List<Article> result = new ArrayList<>();
for (int i=0;i<RANDOM_NUMBER.intValue();i++){
int index= i+r;
result.add(articleList.get(index));
}
return result;
}
}
return new ArrayList();
}
/**
* 首页文章列表
* @param type
* @return
*/
public List getHomePageArticle(Integer type){
List<Article> articleList = mapper.getArticleList(type);
if (Objects.isNull(articleList)) {
return new ArrayList();
}else {
if (articleList.size()>HOME_PAGE_NUMBER) {
return articleList.subList(0,HOME_PAGE_NUMBER);
}else {
return articleList;
}
}
}
} }
package com.xxfc.platform.uccn.mapper; package com.xxfc.platform.uccn.mapper;
import com.xxfc.platform.uccn.entity.Article; import com.xxfc.platform.uccn.entity.Article;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
...@@ -9,5 +10,10 @@ import java.util.List; ...@@ -9,5 +10,10 @@ import java.util.List;
* @author Administrator * @author Administrator
*/ */
public interface ArticleMapper extends Mapper<Article> { public interface ArticleMapper extends Mapper<Article> {
List getArticleList(); /**
* 根据网站类型查询文章
* @param type
* @return
*/
List<Article> getArticleList(@Param("type") Integer type);
} }
...@@ -5,14 +5,15 @@ import com.github.wxiaoqi.security.common.rest.BaseController; ...@@ -5,14 +5,15 @@ import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.uccn.biz.ArticleBiz; import com.xxfc.platform.uccn.biz.ArticleBiz;
import com.xxfc.platform.uccn.entity.Article; import com.xxfc.platform.uccn.entity.Article;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import java.util.Map;
import org.springframework.web.bind.annotation.RestController;
/** /**
* 文章 * 文章
*
* @author Administrator * @author Administrator
*/ */
@RestController @RestController
...@@ -23,8 +24,28 @@ public class ArticleController extends BaseController<ArticleBiz, Article> { ...@@ -23,8 +24,28 @@ public class ArticleController extends BaseController<ArticleBiz, Article> {
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "获取文章列表") @ApiOperation(value = "获取文章列表")
public ObjectRestResponse getArticleList( public ObjectRestResponse getArticleList(
@RequestParam(name = "page",defaultValue = "1") Integer page, @RequestParam(name = "page", defaultValue = "1") Integer page,
@RequestParam(name = "limit",defaultValue = "10")Integer limit){ @RequestParam(name = "limit", defaultValue = "10") Integer limit,
return ObjectRestResponse.succ(baseBiz.getArticleList(page,limit)); @RequestParam(name = "type", defaultValue = "0") Integer type) {
return ObjectRestResponse.succ(baseBiz.getArticleList(page, limit, type));
}
@GetMapping("/one/{id}")
@ApiOperation(value = "获取一条数据")
public ObjectRestResponse getOne(@PathVariable Integer id) {
return ObjectRestResponse.succ(baseBiz.getOne(id));
}
@GetMapping("/three/{type}")
@ApiOperation(value = "随机获取三条数据")
public ObjectRestResponse randomAccessToThreeData(@PathVariable Integer type){
return ObjectRestResponse.succ(baseBiz.getThree(type));
}
@GetMapping("/homePage/{type}")
@ApiOperation(value = "获取首页文章列表")
public ObjectRestResponse getHomePageArticle(@PathVariable Integer type){
return ObjectRestResponse.succ(baseBiz.getHomePageArticle(type));
} }
} }
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
<mapper namespace="com.xxfc.platform.uccn.mapper.ArticleMapper"> <mapper namespace="com.xxfc.platform.uccn.mapper.ArticleMapper">
<select id="getArticleList" resultType="com.xxfc.platform.uccn.entity.Article"> <select id="getArticleList" resultType="com.xxfc.platform.uccn.entity.Article">
select title,epitome,add_time,cover_image from article where is_del=0 and status=1 order by weight,add_time DESC select title,epitome,add_time,cover_image from article
where is_del=0 and status=1 and (type=#{type} or type=0) order by weight DESC,add_time DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -89,6 +89,9 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -89,6 +89,9 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
private VehicleBookHourInfoBiz vehicleBookHourInfoBiz; private VehicleBookHourInfoBiz vehicleBookHourInfoBiz;
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
@Autowired
private VehicleBookInfoBiz vehicleBookInfoBiz;
@Override @Override
public UserFeign getUserFeign() { public UserFeign getUserFeign() {
...@@ -429,10 +432,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -429,10 +432,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
} }
//提取日期和相应的预定目标日期 //提取日期和相应的预定目标日期
Map<String,List<String>> yearMonthAndDate = Maps.newHashMap(); Map<String,List<String>> yearMonthAndDate = Maps.newHashMap();
DateTime startDay =DateTime.parse(bookVehicleVo.getBookStartDate(), DATE_TIME_FORMATTER); DateTime startDay = DateTime.parse(bookVehicleVo.getBookStartDate(), DATE_TIME_FORMATTER);
DateTime endDay =DateTime.parse(bookVehicleVo.getBookEndDate(), DATE_TIME_FORMATTER); DateTime endDay = DateTime.parse(bookVehicleVo.getBookEndDate(), DATE_TIME_FORMATTER);
//转换日期范围为列表,并检查是否合法 //转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay); fillDateList4DatePeriod(yearMonthAndDate, DateTime.parse(startDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER), DateTime.parse(endDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER));
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);
} }
...@@ -469,8 +472,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -469,8 +472,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
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()); map = vehicleBookHourInfoBiz.getPredictableHours(startDay.toString(DATE_TIME_FORMATTER), endDay.toString(DATE_TIME_FORMATTER), bookVehicleVo.getNotCheckTimeLegal());
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){ for(Map.Entry<String,List<String>> entry : yearMonthAndDate.entrySet()) {
Boolean rsEach = applyVehicle4EmployeePerMonth(bookVehicleVo.getVehicleId(),entry.getValue(),entry.getKey(), map); Boolean rsEach = applyVehicle4EmployeePerMonth(bookVehicleVo.getVehicleId(),entry.getValue(),entry.getKey(), map);
if(Boolean.FALSE.equals(rsEach)){ if(Boolean.FALSE.equals(rsEach)){
throw new BaseException(ResultCode.VEHICLE_IS_BOOKED); throw new BaseException(ResultCode.VEHICLE_IS_BOOKED);
...@@ -529,7 +532,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -529,7 +532,7 @@ 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);
} }
...@@ -835,7 +838,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -835,7 +838,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
* @param endDay * @param endDay
*/ */
private void fillDateList4DatePeriod(Map<String,List<String>> yearMonthAndDate,DateTime startDay,DateTime endDay){ private void fillDateList4DatePeriod(Map<String,List<String>> yearMonthAndDate,DateTime startDay,DateTime endDay){
for( DateTime curDate = startDay;curDate.compareTo(endDay)<=0;curDate=curDate.plusDays(1)){ for( DateTime curDate = startDay; curDate.compareTo(endDay) <= 0; curDate = curDate.plusDays(1)){
String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER); String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER);
if(curDateStr.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER))<0){ if(curDateStr.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER))<0){
throw new BaseException(ResultCode.ONLY_BOOK_FROM_TODAY); throw new BaseException(ResultCode.ONLY_BOOK_FROM_TODAY);
...@@ -853,15 +856,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -853,15 +856,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
} }
} }
private void uinbookDateList4DatePeriod(Map<String,List<String>> yearMonthAndDate,DateTime startDay,DateTime endDay){ private void unbookDateList4DatePeriod(Map<String,List<String>> yearMonthAndDate,DateTime startDay,DateTime endDay){
for( DateTime curDate = startDay;curDate.compareTo(endDay)<=0;curDate=curDate.plusDays(1)){
for( DateTime curDate = startDay; curDate.compareTo(endDay) <= 0; curDate = curDate.plusDays(1)){
String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER); String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER);
// if(curDateStr.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER))<0){ // if(curDateStr.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER))<0){
// throw new BaseException("只可以取消当前时间之后的车辆"); // throw new BaseException("只可以取消当前时间之后的车辆");
// } // }
String curYearMonth = curDate.toString(YEARMONTH_DATE_TIME_FORMATTER); String curYearMonth = curDate.toString(YEARMONTH_DATE_TIME_FORMATTER);
if(!yearMonthAndDate.containsKey(curYearMonth)){ if(!yearMonthAndDate.containsKey(curYearMonth)){
yearMonthAndDate.put(curYearMonth,Lists.newArrayList()); yearMonthAndDate.put(curYearMonth, Lists.newArrayList());
} }
List<String> curBookedDateList = yearMonthAndDate.get(curYearMonth); List<String> curBookedDateList = yearMonthAndDate.get(curYearMonth);
curBookedDateList.add(curDateStr); curBookedDateList.add(curDateStr);
...@@ -884,14 +888,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -884,14 +888,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
DateTime startDay =DateTime.parse(bookVehicleVo.getUnbookStartDate(), DATE_TIME_FORMATTER); DateTime startDay =DateTime.parse(bookVehicleVo.getUnbookStartDate(), DATE_TIME_FORMATTER);
DateTime endDay =DateTime.parse(bookVehicleVo.getUnbookEndDate(), DATE_TIME_FORMATTER); DateTime endDay =DateTime.parse(bookVehicleVo.getUnbookEndDate(), DATE_TIME_FORMATTER);
//转换日期范围为列表,并检查是否合法 //转换日期范围为列表,并检查是否合法
uinbookDateList4DatePeriod(yearMonthAndDate,startDay,endDay); unbookDateList4DatePeriod(yearMonthAndDate, DateTime.parse(startDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER), DateTime.parse(endDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER));
//原设计为 读取 bookVehicleVo.getNotCheckTimeLegal(), 现在取消/拒绝 true //原设计为 读取 bookVehicleVo.getNotCheckTimeLegal(), 现在取消/拒绝 true
Map<String, Integer> map = vehicleBookHourInfoBiz.getPredictableHours(bookVehicleVo.getUnbookStartDate(), bookVehicleVo.getUnbookEndDate(), Boolean.TRUE); Map<String, Integer> map = vehicleBookHourInfoBiz.getPredictableHours(bookVehicleVo.getUnbookStartDate(), bookVehicleVo.getUnbookEndDate(), Boolean.TRUE);
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月 if(yearMonthAndDate.size() > 3){//连续的日期最多夸3个月
throw new BaseException(ResultCode.ONLY_UNBOOK_TWO_MONTH); throw new BaseException(ResultCode.ONLY_UNBOOK_TWO_MONTH);
} }
Boolean rs = Boolean.TRUE; Boolean rs = Boolean.TRUE;
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){ for(Map.Entry<String, List<String>> entry : yearMonthAndDate.entrySet()){
Boolean rsEach = unbookVehiclePerMonth(bookVehicleVo.getVehicleId(),entry.getValue(),entry.getKey(), map); Boolean rsEach = unbookVehiclePerMonth(bookVehicleVo.getVehicleId(),entry.getValue(),entry.getKey(), map);
if(Boolean.FALSE.equals(rsEach)){ if(Boolean.FALSE.equals(rsEach)){
rs = Boolean.FALSE; rs = Boolean.FALSE;
...@@ -927,26 +931,28 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -927,26 +931,28 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
} }
public boolean unbookHourInfo(String vehicleId, Map<String, Integer> hourInfo, Map<String,Object> params) { public boolean unbookHourInfo(String vehicleId, Map<String, Integer> hourInfo, Map<String,Object> params) {
boolean flag = false;
for (Map.Entry<String, Integer> entry : hourInfo.entrySet()) { for (Map.Entry<String, Integer> entry : hourInfo.entrySet()) {
VehicleBookHourInfoDto vehicleBookHourInfoDto = new VehicleBookHourInfoDto(); VehicleBookHourInfoDto vehicleBookHourInfoDto = new VehicleBookHourInfoDto();
vehicleBookHourInfoDto.setYearMonthDay(entry.getKey()); vehicleBookHourInfoDto.setYearMonthDay(entry.getKey());
vehicleBookHourInfoDto.setVehicleId(vehicleId); vehicleBookHourInfoDto.setVehicleId(vehicleId);
List<VehicleBookHourInfo> vehicleBookHourInfos = vehicleBookHourInfoBiz.selectByVehicleAndDate(vehicleBookHourInfoDto); List<VehicleBookHourInfo> vehicleBookHourInfos = vehicleBookHourInfoBiz.selectByVehicleAndDate(vehicleBookHourInfoDto);
if (vehicleBookHourInfos != null && vehicleBookHourInfos.size() > 0) { if (vehicleBookHourInfos != null && vehicleBookHourInfos.size() > 0) {
vehicleBookHourInfos.get(0).setBookedHour((vehicleBookHourInfos.get(0).getBookedHour() & ~entry.getValue()));
if((vehicleBookHourInfos.get(0).getBookedHour() & ~entry.getValue()) == 0) { if((vehicleBookHourInfos.get(0).getBookedHour() & ~entry.getValue()) == 0) {
if(!flag) { //解决重复执行的问题 DateTime dateTime = DateTime.parse(entry.getKey(), DEFAULT_DATE_TIME_FORMATTER);
Integer effected = vehicleBookInfoMapper.updateBookedInfo(params); Integer andOperationFactor = 0;
andOperationFactor |= 1<< ( dateTime.dayOfMonth().get());
VehicleBookInfo vehicleBookInfo = getByVehicleIdAndYearMonth(vehicleId, dateTime.toString(YEARMONTH_DATE_TIME_FORMATTER));
if(vehicleBookInfo != null) {
vehicleBookInfo.setBookedDate(vehicleBookInfo.getBookedDate() & ~andOperationFactor);
int effected = vehicleBookInfoBiz.update(vehicleBookInfo);
if (effected < 1) { if (effected < 1) {
return Boolean.FALSE; return Boolean.FALSE;
} }
flag = true;
} }
} }
vehicleBookHourInfos.get(0).setBookedHour((vehicleBookHourInfos.get(0).getBookedHour() & ~entry.getValue()));
int effect = vehicleBookHourInfoBiz.updateByIdRe(vehicleBookHourInfos.get(0)); int effect = vehicleBookHourInfoBiz.updateByIdRe(vehicleBookHourInfos.get(0));
if (effect < 0) { if (effect < 1) {
return Boolean.FALSE; return Boolean.FALSE;
} else { } else {
continue; continue;
...@@ -958,6 +964,17 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -958,6 +964,17 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return Boolean.TRUE; return Boolean.TRUE;
} }
public Map<String, Integer> getDateInfo(String yearMonthDay) {
Map<String, Integer> map = new HashMap<>();
if(StringUtils.isNotBlank(yearMonthDay)) {
DateTime dateTime = DateTime.parse(yearMonthDay, YEARMONTH_DATE_TIME_FORMATTER);
Integer andOperationFactor = 0;
andOperationFactor |= 1<<(dateTime.dayOfMonth().get()-1);
map.put(dateTime.toString(YEARMONTH_DATE_TIME_FORMATTER), andOperationFactor);
}
return map;
}
/** /**
* 获取某月份相应预定日期查询条件 * 获取某月份相应预定日期查询条件
* @param yearMonthAndDate 年月 - 预定日期条件字符串(yyyy-MM-dd) * @param yearMonthAndDate 年月 - 预定日期条件字符串(yyyy-MM-dd)
......
...@@ -204,15 +204,15 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V ...@@ -204,15 +204,15 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
} }
// public static void main(String[] args) throws Exception{ public static void main(String[] args) throws Exception{
// VehicleBookHourInfoBiz vehicleBookHourInfoBiz = new VehicleBookHourInfoBiz(); VehicleBookHourInfoBiz vehicleBookHourInfoBiz = new VehicleBookHourInfoBiz();
// Map<String, Integer> map = vehicleBookHourInfoBiz.getPredictableHours("2019-08-26 10:00:00", "2019-08-27 10:00:00", Boolean.TRUE); Map<String, Integer> map = vehicleBookHourInfoBiz.getPredictableHours("2019-08-26 10:00:00", "2019-08-27 10:00:00", Boolean.TRUE);
// for(Map.Entry<String, Integer> entry : map.entrySet()) { for(Map.Entry<String, Integer> entry : map.entrySet()) {
// System.out.println(entry.getKey()); System.out.println(entry.getKey());
// System.out.println(entry.getValue()); System.out.println(entry.getValue());
// } }
// Integer a = 7936 & 2047; Integer a = 215712192 & 33554432;
// System.out.println(a); System.out.println(a);
// } }
} }
...@@ -131,4 +131,8 @@ public class VehicleBookInfoBiz extends BaseBiz<VehicleBookInfoMapper, VehicleBo ...@@ -131,4 +131,8 @@ public class VehicleBookInfoBiz extends BaseBiz<VehicleBookInfoMapper, VehicleBo
public void InsertBatch(List<VehicleBookInfo> bookInfos) { public void InsertBatch(List<VehicleBookInfo> bookInfos) {
mapper.insertBatch(bookInfos); mapper.insertBatch(bookInfos);
} }
public int update(VehicleBookInfo vehicleBookInfo) {
return mapper.updateById(vehicleBookInfo);
}
} }
...@@ -45,4 +45,6 @@ public interface VehicleBookInfoMapper extends Mapper<VehicleBookInfo> { ...@@ -45,4 +45,6 @@ public interface VehicleBookInfoMapper extends Mapper<VehicleBookInfo> {
public Integer del4YearMoth(Map<String, Object> params); public Integer del4YearMoth(Map<String, Object> params);
void insertBatch(@Param("vbfs") List<VehicleBookInfo> bookInfos); void insertBatch(@Param("vbfs") List<VehicleBookInfo> bookInfos);
public Integer updateById(VehicleBookInfo vehicleBookInfo);
} }
\ No newline at end of file
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
</foreach> </foreach>
</select> </select>
<insert id="insertIgnore" parameterType="com.xxfc.platform.vehicle.entity.VehicleBookInfo"> <insert id="insertIgnore" parameterType="com.xxfc.platform.vehicle.entity.VehicleBookInfo">
insert ignore into vehicle_book_info ( vehicle, `year_month`, booked_date) insert ignore into vehicle_book_info ( vehicle, `year_month`, booked_date)
values(#{vehicle},#{yearMonth},#{bookedDate}) values(#{vehicle},#{yearMonth},#{bookedDate})
...@@ -47,6 +46,12 @@ ...@@ -47,6 +46,12 @@
vehicle = #{vehicleId} and `year_month`=#{yearMonth} and vehicle = #{vehicleId} and `year_month`=#{yearMonth} and
booked_date &amp; #{andOperationFactor} = #{andOperationRs} booked_date &amp; #{andOperationFactor} = #{andOperationRs}
</update> </update>
<update id="updateById" parameterType="com.xxfc.platform.vehicle.entity.VehicleBookInfo">
update vehicle_book_info set
booked_date = #{bookedDate}
where
vehicle = #{vehicle} and `year_month`=#{yearMonth}
</update>
<select id="getByPage4YearMonth" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.VehicleBookInfo"> <select id="getByPage4YearMonth" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.VehicleBookInfo">
select id, vehicle, `year_month`, booked_date, create_time, update_time from vehicle_book_info where `year_month` = #{yearMonth} order by id limit #{pageStart},#{pageSize} select id, vehicle, `year_month`, booked_date, create_time, update_time from vehicle_book_info where `year_month` = #{yearMonth} order by id limit #{pageStart},#{pageSize}
......
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