Commit 05dfbed8 authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/base-modify' into base-modify

parents 0bbd220c ad71c960
package com.xxfc.platform.app.biz; package com.xxfc.platform.app.biz;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.util.EntityUtils; import com.github.wxiaoqi.security.common.util.EntityUtils;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.entity.vo.WithDrawRuleVo; import com.xxfc.platform.app.entity.vo.WithDrawRuleVo;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -12,6 +15,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -12,6 +15,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 系统配置表 * 系统配置表
...@@ -35,7 +39,7 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> { ...@@ -35,7 +39,7 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
*/ */
public int updateConfig(Cofig cofig) { public int updateConfig(Cofig cofig) {
EntityUtils.setUpdatedInfo(cofig); EntityUtils.setUpdatedInfo(cofig);
return mapper.updateConfig(cofig); return mapper.updateByPrimaryKeySelective(cofig);
} }
public WithDrawRuleVo getWithDrawRule(){ public WithDrawRuleVo getWithDrawRule(){
...@@ -52,4 +56,22 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> { ...@@ -52,4 +56,22 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
withDrawRuleVo.setDescription(cofig.getValue()); withDrawRuleVo.setDescription(cofig.getValue());
return withDrawRuleVo; return withDrawRuleVo;
} }
public void updateConfigStatus(int id) {
Cofig cofig = new Cofig();
cofig.setId(id);
cofig.setIsDel(1);
mapper.updateByPrimaryKeySelective(cofig);
}
public TableResultResponse<Cofig> listWithPage(Map<String, Object> params) {
Query query = new Query(params);
Example example = new Example(Cofig.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",0);
PageDataVO<Cofig> cofigPage = PageDataVO.pageInfo(query.getPage(), query.getLimit(), () -> mapper.selectByExample(example));
return new TableResultResponse<>(cofigPage.getTotalCount(),cofigPage.getData()) ;
}
} }
\ No newline at end of file
package com.xxfc.platform.app.rest.admin; package com.xxfc.platform.app.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.app.biz.CofigBiz; import com.xxfc.platform.app.biz.CofigBiz;
import com.xxfc.platform.app.entity.Cofig; import com.xxfc.platform.app.entity.Cofig;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import java.util.List;
import java.util.Map;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
...@@ -20,6 +23,11 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -20,6 +23,11 @@ import org.springframework.web.bind.annotation.RestController;
public class CofigAdminController extends BaseController<CofigBiz,Cofig> { public class CofigAdminController extends BaseController<CofigBiz,Cofig> {
@Override
public TableResultResponse<Cofig> list(@RequestParam Map<String, Object> params) {
return getBaseBiz().listWithPage(params);
}
/** /**
* 修改通用配置 * 修改通用配置
* @param cofig * @param cofig
...@@ -33,4 +41,11 @@ public class CofigAdminController extends BaseController<CofigBiz,Cofig> { ...@@ -33,4 +41,11 @@ public class CofigAdminController extends BaseController<CofigBiz,Cofig> {
} }
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
@Override
public ObjectRestResponse<Cofig> remove(@PathVariable int id) {
getBaseBiz().updateConfigStatus(id);
return ObjectRestResponse.succ();
}
} }
\ No newline at end of file
...@@ -234,5 +234,5 @@ public class BaseOrder implements Serializable { ...@@ -234,5 +234,5 @@ public class BaseOrder implements Serializable {
*/ */
@ApiModelProperty(value = "优惠券优惠的价格") @ApiModelProperty(value = "优惠券优惠的价格")
@Column(name = "coupon_amount") @Column(name = "coupon_amount")
private Integer couponAmount; private BigDecimal couponAmount;
} }
...@@ -94,6 +94,12 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{ ...@@ -94,6 +94,12 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
@ApiModelProperty(value = "是否使用出租免费天数") @ApiModelProperty(value = "是否使用出租免费天数")
private Integer rentFreeDay; private Integer rentFreeDay;
/**
* 优惠券*
*/
@ApiModelProperty(value = "优惠卷卷号")
private String tickerNos;
public void setStartTime(Long startTime) { public void setStartTime(Long startTime) {
this.startTime = startTime; this.startTime = startTime;
this.bookStartDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8))); this.bookStartDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
......
...@@ -70,8 +70,8 @@ public class AddTourDTO extends AddOrderCommonDTO{ ...@@ -70,8 +70,8 @@ public class AddTourDTO extends AddOrderCommonDTO{
Integer hasInsure; Integer hasInsure;
/** /**
* 优惠券ids * 优惠券*
*/ */
@ApiModelProperty(value = "优惠券ids") @ApiModelProperty(value = "优惠卷卷号")
private String couponIds; private String tickerNos;
} }
...@@ -58,6 +58,7 @@ public class OrderRentVehicleController extends CommonBaseController { ...@@ -58,6 +58,7 @@ public class OrderRentVehicleController extends CommonBaseController {
setBookEndDate(vo.getBookEndDate()); setBookEndDate(vo.getBookEndDate());
}}); }});
bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData()); bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData());
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos())? Arrays.asList(vo.getTickerNos().split(",")):null);
orderRentVehicleService.createOrder(bo); orderRentVehicleService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder()); return ObjectRestResponse.succ(bo.getOrder());
} }
......
package com.xxfc.platform.order.rest; package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
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;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
...@@ -28,6 +29,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -28,6 +29,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Arrays;
@Controller @Controller
@RequestMapping("orderTour") @RequestMapping("orderTour")
@IgnoreClientToken @IgnoreClientToken
...@@ -55,6 +58,7 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order ...@@ -55,6 +58,7 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
@ApiOperation(value = "确认旅游订单") @ApiOperation(value = "确认旅游订单")
public ObjectRestResponse<BaseOrder> add(@RequestBody AddTourDTO vo){ public ObjectRestResponse<BaseOrder> add(@RequestBody AddTourDTO vo){
TourBO bo = BeanUtil.toBean(vo, TourBO.class); TourBO bo = BeanUtil.toBean(vo, TourBO.class);
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos())? Arrays.asList(vo.getTickerNos().split(",")):null);
orderTourService.createOrder(bo); orderTourService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder()); return ObjectRestResponse.succ(bo.getOrder());
} }
...@@ -70,6 +74,7 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order ...@@ -70,6 +74,7 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
bo.setChildNum(vo.getChildNumber()); bo.setChildNum(vo.getChildNumber());
TourGood tourGood = tourFeign.usableGet(bo.getGoodId()).getData(); TourGood tourGood = tourFeign.usableGet(bo.getGoodId()).getData();
bo.setTourGood(tourGood); bo.setTourGood(tourGood);
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos())? Arrays.asList(vo.getTickerNos().split(",")):null);
return ObjectRestResponse.succ(orderTourService.calculatePrice(bo)); return ObjectRestResponse.succ(orderTourService.calculatePrice(bo));
} }
...@@ -96,5 +101,11 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order ...@@ -96,5 +101,11 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
@ApiModelProperty(value = "是否保险标记 1--要保险;0--不需要") @ApiModelProperty(value = "是否保险标记 1--要保险;0--不需要")
Integer hasInsure; Integer hasInsure;
/**
* 优惠券*
*/
@ApiModelProperty(value = "优惠卷卷号")
private String tickerNos;
} }
} }
\ No newline at end of file
...@@ -142,9 +142,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -142,9 +142,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
} }
//如果有使用优惠券,则扣减 //如果有使用优惠券,则扣减
// if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) >= 0) { if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) < 0) {
// activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo().get(0), bo.getOrder().getNo(), channel, bo.getOrder().getGoodsAmount(), ActivityFeign.TYPE_USE);
// } }
super.handleDetail(bo); super.handleDetail(bo);
......
...@@ -138,6 +138,11 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -138,6 +138,11 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//扣減庫存 //扣減庫存
tourFeign.stock(bo.getSpePriceId(), bo.getTotalNumber(), TourFeign.STOCK_SUBTRACT); tourFeign.stock(bo.getSpePriceId(), bo.getTotalNumber(), TourFeign.STOCK_SUBTRACT);
//如果有使用优惠券,则扣减
if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) < 0) {
activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo().get(0), bo.getOrder().getNo(), channel, bo.getOrder().getGoodsAmount(), ActivityFeign.TYPE_USE);
}
super.handleDetail(bo); super.handleDetail(bo);
//发送定时取消订单(30分钟) //发送定时取消订单(30分钟)
......
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