Commit 5931a53c authored by 周健威's avatar 周健威

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

parents faa0408d 03895874
package com.xxfc.platform.order.biz;
import cn.hutool.core.bean.BeanUtil;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderTourDetail;
import com.xxfc.platform.order.mapper.OrderTourVerificationMapper;
import com.xxfc.platform.order.pojo.order.OrderTourVerificationVO;
import com.xxfc.platform.tour.feign.TourFeign;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 旅游订单核销
*
......@@ -29,6 +34,8 @@ public class OrderTourVerificationBiz{
@Autowired
private BaseOrderBiz baseOrderBiz;
@Autowired
private OrderTourDetailBiz tourDetailBiz;
@Autowired
private TourFeign tourFeign;
/**
......@@ -43,18 +50,43 @@ public class OrderTourVerificationBiz{
}
//核销
public ObjectRestResponse VerificationByOrder(Integer orderId){
BaseOrder baseOrder=baseOrderBiz.selectById(orderId);
public ObjectRestResponse VerificationByOrder(String no, List<BranchCompany> list, UserDTO userDTO){
BaseOrder baseOrder=new BaseOrder();
baseOrder.setNo(no);
baseOrder=baseOrderBiz.selectOne(baseOrder);
if(baseOrder==null){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "订单不存在");
}
if(baseOrder.getStatus()!=OrderStatusEnum.ORDER_TOSTART.getCode()){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "订单不是已支付状态");
}
Integer orderId=baseOrder.getId();
OrderTourDetail tourDetail=new OrderTourDetail();
tourDetail.setOrderId(orderId);
tourDetail=tourDetailBiz.selectOne(tourDetail);
if(tourDetail==null){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "订单不存在");
}
Integer verificationId=tourDetail.getVerificationId();
Integer total_number=tourDetail.getTotalNumber();
if(userDTO.getDataAll()==2){
Integer companyId=tourDetail.getStartCompanyId();
if(companyId!=null){
boolean falg=isPower(list,companyId);
if(!falg){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "无权限操作");
}
}
}
baseOrder=new BaseOrder();
baseOrder.setId(orderId);
baseOrder.setStatus(OrderStatusEnum.ORDER_FINISH.getCode());
baseOrderBiz.updateSelectiveById(baseOrder);
tourDetail.setVerificationUser(userDTO.getId());
tourDetail.setVerificationName(userDTO.getName());
tourDetail.setVerificationTime(System.currentTimeMillis());
tourDetailBiz.updateSelectiveById(tourDetail);
tourFeign.updateTourGoodPersonNum(verificationId,"verification_person",total_number);
return ObjectRestResponse.succ();
}
......@@ -70,6 +102,20 @@ public class OrderTourVerificationBiz{
return ObjectRestResponse.succ(tourFeign.findTourGoodOrders(BeanUtil.beanToMap(tourGoodOrderFindVo)));
}
public boolean isPower(List<BranchCompany> list,Integer companyId){
boolean falg=false;
if(list.size()>0){
for (BranchCompany company:list) {
if(company.getId()==companyId){
falg=true;
break;
}
}
}
return falg;
}
......
......@@ -10,12 +10,16 @@ import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.xxfc.platform.order.biz.OrderTourVerificationBiz;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("tour")
@IgnoreClientToken
......@@ -48,9 +52,18 @@ public class OrderTourVerificationController extends CommonBaseController {
@RequestMapping(value = "/verification/check",method = RequestMethod.POST)
@ApiOperation(value = "旅游核销")
public ObjectRestResponse<BaseOrder> check(
@RequestParam(value = "orderId",defaultValue = "0") Integer orderId
@RequestParam(value = "no",defaultValue = "") String no
){
return verificationBiz.VerificationByOrder(orderId);
UserDTO userDTO=getUserInfo();
if(userDTO==null){
return ObjectRestResponse.createDefaultFail();
}
List<BranchCompany> list=new ArrayList<>();
if(userDTO.getDataAll()==2){
list=vehicleFeign.companyAll(userDTO.getDataAll(),userDTO.getDataCompany(),userDTO.getDataZone());
}
return verificationBiz.VerificationByOrder(no,list,userDTO);
}
@RequestMapping(value = "/verification/finish",method = RequestMethod.POST)
......
......@@ -9,6 +9,8 @@ import com.xxfc.platform.tour.entity.TourGoodVerification;
import com.xxfc.platform.tour.mapper.TourGoodVerificationMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalTime;
import java.util.*;
......@@ -49,21 +51,21 @@ public class TourGoodVerificationBiz extends BaseBiz<TourGoodVerificationMapper,
List<TourGoodOrderVo> tourGoodOrderVos = tourGoodOrderVoPageDataVO.getData();
tourGoodOrderVos.stream().peek(tourGoodOrderVo -> {
tourGoodOrderVo.setLeaveOfNum(tourGoodOrderVo.getHeadCount()-tourGoodOrderVo.getTripOfNum());
String startDateStr = DateUtil.format(tourGoodOrderVo.getStartDate(),"YYYY.MM.dd");
String startDateStr = DateUtil.format(tourGoodOrderVo.getStartDate(),"YYYY-MM-dd");
tourGoodOrderVo.setTravelTime(startDateStr);
Long startTime = tourGoodOrderVo.getStartTime();
if (null!=startTime){
LocalTime localTime = LocalTime.ofSecondOfDay(startTime);
/* LocalTime localTime = LocalTime.ofSecondOfDay(startTime);
String timeStr = String.format("%s:%s:%s",localTime.getHour()==0?"00":localTime.getHour(),
localTime.getMinute()==0?"00":localTime.getMinute(),localTime.getSecond()==0?"00":localTime.getSecond());
localTime.getMinute()==0?"00":localTime.getMinute(),localTime.getSecond()==0?"00":localTime.getSecond());*/
String timeStr=new SimpleDateFormat("HH:mm").format(startTime);
tourGoodOrderVo.setTravelTime(String.format("%s %s",tourGoodOrderVo.getTravelTime(),timeStr));
}
}).count();
return tourGoodOrderVoPageDataVO;
}
/**
* 更改发车状态
* @param verficationId
......
......@@ -2,6 +2,7 @@ package com.xxfc.platform.vehicle.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.entity.VehicleModel;
......@@ -46,6 +47,9 @@ public interface VehicleFeign {
public RestResponse<Integer> proveVehicleBooking(@PathVariable Long bookRecordId);
//获取分公司列表
@GetMapping("/branchCompany/list")
public List<Integer> companyList(@RequestParam(value = "dataZone") String dataZone,@RequestParam(value = "dataCompany")String dataCompany);
@GetMapping("/branchCompany/all")
public List<BranchCompany> companyAll(
@RequestParam(value = "dataAll")Integer dataAll,
@RequestParam(value = "dataCompany")String dataCompany,
@RequestParam(value = "dataZone")String dataZone);
}
......@@ -19,6 +19,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -133,4 +134,21 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
UserDTO userDTO = userFeign.userinfoByToken(userAuthConfig.getToken(request)).getData();
return RestResponse.data(baseBiz.getListByUser(userDTO));
}
//获取分公司列表
@GetMapping("all")
public List<BranchCompany> companyAll(
@RequestParam(value = "dataAll",defaultValue = "2")Integer dataAll,
@RequestParam(value = "dataCompany",defaultValue = "")String dataCompany,
@RequestParam(value = "dataZone",defaultValue = "")String dataZone
) {
UserDTO userDTO=new UserDTO();
userDTO.setDataAll(dataAll);
if(StringUtils.isNotBlank(dataCompany)){
userDTO.setDataCompany(dataCompany);
}
if(StringUtils.isNotBlank(dataZone)){
userDTO.setDataZone(dataZone);
}
return baseBiz.getListByUser(userDTO);
}
}
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