Commit d42def83 authored by hanfeng's avatar hanfeng

Merge branch 'base-modify' into dev

# Conflicts:
#	xx-uccn/xx-uccn-server/src/main/java/com/xxfc/platform/uccn/biz/ArticleBiz.java
parents 09ebe880 13151cd2
......@@ -36,6 +36,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -83,7 +85,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
public OrderVehicleCrosstown get(Integer id) {
return selectById(id);
}
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd");
public List<OrderVehicleCrosstownDto> selectByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
List<OrderVehicleCrosstownDto> list = mapper.selectByOrderId(orderVehicleCrosstownDto);
......@@ -157,7 +159,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
@Transactional(rollbackFor = Exception.class)
public ObjectRestResponse<OrderVehicleCrosstownDto> add(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
log.info("添加的参数:orderVehicaleCrosstown = {}", orderVehicleCrosstownDto);
log.info("交还车参数:orderVehicaleCrosstown = {}", orderVehicleCrosstownDto);
UserDTO userDTO = userInfoBiz.getAdminUserInfo();
if (userDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, "token is null or invalid");
......@@ -307,14 +309,14 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
baseOrder = baseOrderBiz.updateSelectiveByIdReT(baseOrder);
} else if (baseOrder.getStatus() == OrderStatusEnum.ORDER_WAIT.getCode()) { //还车
//提前还车,结束时间大于当前时间
DateTime nowTime = DateTime.now();
DateTime endTime = new DateTime(orderRentVehicleDetail.getEndTime());
DateTime startTime = new DateTime(orderRentVehicleDetail.getStartTime());
DateTime nowTime = DateTime.parse(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER);
DateTime endTime = DateTime.parse(new DateTime(orderRentVehicleDetail.getEndTime()).toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER);
DateTime startTime = DateTime.parse(new DateTime(orderRentVehicleDetail.getStartTime()).toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER);
//实际预定的天数
int actualDay = getDaysBetweenDateTime(startTime, endTime);
if (orderRentVehicleDetail.getEndTime() > nowTime.getMillis()) {
//提前的天数
int noUsedDay = getDaysBetweenDateTime(nowTime, endTime);
//提前的天数, 当天就算使用一天
int noUsedDay = getDaysBetweenDateTime(nowTime, endTime) - 1;
//退还未使用的天数,或者金额,扣除违约金,实际未使用天数的金额,最多3000元
InProgressVO inProgressVO = orderCalculateBiz.inProgressCalculate(baseOrder, actualDay - noUsedDay);
if (inProgressVO != null) {
......@@ -328,7 +330,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
}
BigDecimal cost = new BigDecimal(0);
cost.add(inProgressVO.getExtraAmount()).add(inProgressVO.getViolateAmount());
updateCrossRefund(orderVehicleCrosstown, cost, OrderViolateEnum.AFTER.getCode());
updateCrossRefund(orderVehicleCrosstown, cost, OrderViolateEnum.BEFORE.getCode());
//延期还车,结束时间小于当前时间
} else if (orderRentVehicleDetail.getEndTime() < nowTime.getMillis()) {
//延期的天数, 延期违约金是延期天数*200%
......
......@@ -106,7 +106,7 @@ public class Article {
private Integer status;
@Column(name ="type")
@Column(name = "type")
@ApiModelProperty(value = "文章发布网站:0-所有,1-新欣房车官网,2-滴房车官网")
private Integer type;
......@@ -114,7 +114,7 @@ public class Article {
* 创建时间
*/
@Column(name = "cre_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date creTime;
......@@ -123,7 +123,7 @@ public class Article {
* 修改时间
*/
@Column(name = "upd_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updTime;
......@@ -132,11 +132,24 @@ public class Article {
* 上架时间
*/
@Column(name = "add_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "上架时间")
private Date addTime;
@ApiModelProperty("seo*html标签优化")
private String alt;
@Column(name = "tag_title")
@ApiModelProperty("title标签内容")
private String tagTitle;
@Column(name = "keywords")
@ApiModelProperty("title标签内容")
private String keywords;
@Column(name = "description")
@ApiModelProperty("description")
private String description;
}
......@@ -3,6 +3,7 @@ package com.xxfc.platform.uccn.biz;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.uccn.comstnt.UrlType;
import com.xxfc.platform.uccn.entity.Article;
import com.xxfc.platform.uccn.mapper.ArticleMapper;
......@@ -64,7 +65,8 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
if (UrlType.OFFICIAL_WEBSITE.getCode().equals(urlType)) {
criteria.andEqualTo("status", 1);
}
return mapper.selectOneByExample(example);
Article article = mapper.selectOneByExample(example);
return article;
}
......@@ -118,6 +120,10 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
// }
}
/**
* 添加文章
* @param article
*/
@Transactional(rollbackFor = Exception.class)
public void add(Article article) {
if (article == null) {
......@@ -132,6 +138,10 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
article.setType(0);
}
if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) {
throw new BaseException("必须设置seo");
}
if (article.getStatus()==1){
article.setAddTime(new Date());
}
......@@ -140,6 +150,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
}
/**
* 后台文章列表
* @param query
* @return
*/
public PageInfo findAll(ArticleQuery query) {
PageHelper.startPage(query.getPage(),query.getLimit());
Example exa = Example.builder(Article.class).where(
......@@ -151,13 +166,22 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return PageInfo.of(articles);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int updateSelectiveByIdRe(Article article){
article.setUpdTime(new Date());
if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) {
throw new BaseException("必须设置seo");
}
return mapper.updateByPrimaryKeySelective(article);
}
/**
* 上架
* @param id
* @return
*/
public int putaway(Integer id) {
Article article = new Article();
article.setId(id);
......@@ -167,6 +191,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return mapper.updateByPrimaryKeySelective(article);
}
/**
* 下架
* @param id
* @return
*/
public int soldOut(Integer id) {
Article article = new Article();
article.setId(id);
......@@ -175,6 +204,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return mapper.updateByPrimaryKeySelective(article);
}
/**
* 删除
* @param id
* @return
*/
public int remove(Integer id) {
Article article = new Article();
article.setId(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