Commit 6b4f63f9 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/holiday-price' into holiday-price

parents 4112f7a2 5bd0611e
...@@ -197,8 +197,10 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -197,8 +197,10 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
BigDecimal commission = sellingWater.getCommission(); BigDecimal commission = sellingWater.getCommission();
log.info("订单完成计算用户拥金----finishOrderWater----id====" + id + "---commission==" + commission + "----orderType===" + orderType); log.info("订单完成计算用户拥金----finishOrderWater----id====" + id + "---commission==" + commission + "----orderType===" + orderType);
amount = amount.add(commission); amount = amount.add(commission);
} }
log.info("订单完成计算用户拥金----finishOrderWater----orderId====" + orderId + "---amount==" + amount); BigDecimal unbooked=amount;
log.info("订单完成计算用户拥金----finishOrderWater----orderId====" + orderId + "---amount==" + amount+"---unbooked=="+unbooked);
if(orderType==1){ if(orderType==1){
List<OrderGoodsDTO> goodsDTOList =orderWaterDTO.getGoodsDTOList(); List<OrderGoodsDTO> goodsDTOList =orderWaterDTO.getGoodsDTOList();
log.info("租车订单完成-----goodsDTOList==="+goodsDTOList); log.info("租车订单完成-----goodsDTOList==="+goodsDTOList);
...@@ -247,7 +249,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -247,7 +249,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
detail.setSource(1); detail.setSource(1);
myWaterBiz.updMyWater(detail); myWaterBiz.updMyWater(detail);
if (orderType == 1 || orderType == 2) { if (orderType == 1 || orderType == 2) {
myWaterBiz.updMyWalletUnbooked(userId, amount, 2); myWaterBiz.updMyWalletUnbooked(userId, unbooked, 2);
} }
} }
......
...@@ -63,8 +63,15 @@ FROM ...@@ -63,8 +63,15 @@ FROM
--> -->
SELECT w.*,o.commission as commission ,o.type AS `sellerStatus` FROM ( SELECT w.*,o.commission as commission ,<!--o.type--> CASE
SELECT t.order_no,IFNULL(SUM(t.z),0)-IFNULL(SUM(t.f),0) as commission,IF(SUM(t.f)>0,'1',0)as type FROM ( WHEN fcommission>0 THEN
(CASE
WHEN o.commission=0 THEN 1
ELSE 0 END )
ELSE 0 END AS `sellerStatus` FROM (
SELECT t.order_no,IFNULL(SUM(t.z),0)-IFNULL(SUM(t.f),0) as commission,<!--IF(SUM(t.f)>0,'1',0)as type -->
IFNULL(SUM(t.f), 0) as fcommission
FROM (
SELECT order_no,commission as z,0 as f FROM app_user_selling_water WHERE user_id=#{userId} SELECT order_no,commission as z,0 as f FROM app_user_selling_water WHERE user_id=#{userId}
AND `status`=0 and commission>0 AND `status`=0 and commission>0
......
...@@ -23,6 +23,7 @@ import org.springframework.beans.BeanUtils; ...@@ -23,6 +23,7 @@ import org.springframework.beans.BeanUtils;
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 org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -69,18 +70,18 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr ...@@ -69,18 +70,18 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
* @param vehicleModelCalendarPrices * @param vehicleModelCalendarPrices
* @param userId * @param userId
*/ */
public void addVehicleModelCalendarPrice(List<VehicleModelCalendarPriceSaveDTO> vehicleModelCalendarPrices, Integer userId) { public void addVehicleModelCalendarPrice(List<VehicleModelCalendarPriceSaveDTO> vehicleModelCalendarPrices, String date,Integer userId) {
if (CollectionUtils.isNotEmpty(vehicleModelCalendarPrices)) { if (CollectionUtils.isNotEmpty(vehicleModelCalendarPrices)) {
List<VehicleModelCalendarPrice> vehicleModelCalendarPriceList = new ArrayList<>(); List<VehicleModelCalendarPrice> vehicleModelCalendarPriceList = new ArrayList<>();
List<Date> dateList = vehicleModelCalendarPrices.stream().peek(x -> { List<Date> dateList = vehicleModelCalendarPrices.stream().peek(x -> {
VehicleModelCalendarPrice calendarPrice = new VehicleModelCalendarPrice(); VehicleModelCalendarPrice calendarPrice = new VehicleModelCalendarPrice();
BeanUtils.copyProperties(x, calendarPrice); BeanUtils.copyProperties(x, calendarPrice);
Date date = DateUtils.localDateToDate(LocalDate.parse(x.getDate())); Date dte = DateUtils.localDateToDate(LocalDate.parse(x.getDate()));
calendarPrice.setVehicleModelDay(date); calendarPrice.setVehicleModelDay(dte);
calendarPrice.setCrtTime(new Date()); calendarPrice.setCrtTime(new Date());
calendarPrice.setCrtUserId(userId); calendarPrice.setCrtUserId(userId);
calendarPrice.setIsDel(0); calendarPrice.setIsDel(0);
x.setVehicleModelDay(date); x.setVehicleModelDay(dte);
vehicleModelCalendarPriceList.add(calendarPrice); vehicleModelCalendarPriceList.add(calendarPrice);
}).map(VehicleModelCalendarPriceSaveDTO::getVehicleModelDay).distinct().collect(Collectors.toList()); }).map(VehicleModelCalendarPriceSaveDTO::getVehicleModelDay).distinct().collect(Collectors.toList());
...@@ -92,11 +93,18 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr ...@@ -92,11 +93,18 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
vehicleModelCalendarPrice.setIsDel(1); vehicleModelCalendarPrice.setIsDel(1);
Example example = new Example(VehicleModelCalendarPrice.class); Example example = new Example(VehicleModelCalendarPrice.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
if (CollectionUtils.isEmpty(dateList) && StringUtils.hasText(date)){
criteria.andEqualTo("vehicleModelDay",DateUtils.localDateToDate(LocalDate.parse(date)));
}else{
criteria.andIn("vehicleModelDay", dateList); criteria.andIn("vehicleModelDay", dateList);
}
mapper.updateByExampleSelective(vehicleModelCalendarPrice, example); mapper.updateByExampleSelective(vehicleModelCalendarPrice, example);
//2.插入新的数据 //2.插入新的数据
if (!CollectionUtils.isNotEmpty(dateList)){
mapper.insertList(vehicleModelCalendarPriceList); mapper.insertList(vehicleModelCalendarPriceList);
} }
}
} }
......
...@@ -31,8 +31,8 @@ public class VehicleModelCalendarPriceAdminController { ...@@ -31,8 +31,8 @@ public class VehicleModelCalendarPriceAdminController {
@ApiOperation("车型日历价格设置") @ApiOperation("车型日历价格设置")
@PostMapping("/add_edit") @PostMapping("/add_edit")
public ObjectRestResponse<Void> add(@RequestBody List<VehicleModelCalendarPriceSaveDTO> vehicleModelCalendarPriceSaveDTO, UserDTO userDTO){ public ObjectRestResponse<Void> add(@RequestBody List<VehicleModelCalendarPriceSaveDTO> vehicleModelCalendarPriceSaveDTO, @RequestParam("date") String date ,UserDTO userDTO){
vehicleModelCalendarPriceBiz.addVehicleModelCalendarPrice(vehicleModelCalendarPriceSaveDTO,userDTO.getId()); vehicleModelCalendarPriceBiz.addVehicleModelCalendarPrice(vehicleModelCalendarPriceSaveDTO,date,userDTO.getId());
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
......
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