Commit b086526f authored by hanfeng's avatar hanfeng

Merge branch 'base-modify' of http://10.5.52.3/youjj/cloud-platform into base-modify

parents 46c9f674 93302c81
......@@ -27,7 +27,7 @@
</properties>
<dependencies>
<!--<dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
......@@ -35,7 +35,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>-->
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
......@@ -53,22 +53,22 @@
<artifactId>mapper</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
</dependency>-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
</dependency>-->
<!-- fastjson.jar -->
<dependency>
<groupId>com.alibaba</groupId>
......
package com.github.wxiaoqi.security.common.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author libin
* @version 1.0
* @description 复杂类型校验
* @data 2019/6/13 13:42
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface BeanValid {
Class<?>[] value() default {};
}
package com.github.wxiaoqi.security.common.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author libin
* @version 1.0
* @description 简单参数类型校验
* @data 2019/6/13 13:42
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface SimpleValid {
}
......@@ -9,9 +9,13 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice("com.xxfc.platform")
public class PlatformExceptionHandler {
@ExceptionHandler(BaseException.class)
public BaseResponse baseExceptionHandler(BaseException e) {
return new BaseResponse(e.getStatus(), e.getMessage());
@ExceptionHandler(value = {BaseException.class,Exception.class})
public BaseResponse baseExceptionHandler(Exception e) {
if (e instanceof BaseException){
BaseException be = (BaseException) e;
return new BaseResponse(be.getStatus(), be.getMessage());
}
return new BaseResponse(400,e.getMessage());
}
}
......@@ -78,4 +78,12 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
Query query = new Query(params);
return baseBiz.selectByQuery(query);
}
@ApiOperation("根据参数查询,等于")
@RequestMapping(value = "/entityList",method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<List<Entity>> entityList(Entity entity){
//查询列表数据
return ObjectRestResponse.succ(baseBiz.selectList(entity));
}
}
package com.github.wxiaoqi.security.common.support.aop;
import cn.hutool.core.util.ArrayUtil;
import com.github.wxiaoqi.security.common.annotation.BeanValid;
import com.github.wxiaoqi.security.common.annotation.SimpleValid;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import lombok.Data;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import javax.validation.executable.ExecutableValidator;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.Objects;
import java.util.Set;
/**
* @author libin
* @version 1.0
* @description 切面验证
* @data 2019/6/13 13:46
*/
@Aspect
@Data
public class ValidParamAop {
/**
* 复合类型验证器
*/
private Validator validator;
/**
* 简单类型验证器
*/
private ExecutableValidator executableValidator;
@Pointcut("execution(* com.xxfc.platform..rest..*(..))")
public void validatorExpress(){}
@Around("validatorExpress()")
public Object validatorAround(ProceedingJoinPoint proceedingJoinPoint)throws Throwable{
//获取方法的所有参数
Object[] args = proceedingJoinPoint.getArgs();
if (ArrayUtil.isEmpty(args)){
//没有参数,不用验证
return proceedingJoinPoint.proceed();
}
MethodSignature methodSignature = (MethodSignature) proceedingJoinPoint.getSignature();
Method currentMethod = methodSignature.getMethod();
Parameter[] parameters = currentMethod.getParameters();
boolean hashSimpleValid = false;
int argLength = args.length;
for (int i =0;i<argLength;i++){
BeanValid beanValidAnnotation = parameters[i].getDeclaredAnnotation(BeanValid.class);
if (Objects.nonNull(beanValidAnnotation)){
if (args[i].getClass().isArray()){
Object[] arrayArg =(Object[])args[i];
for (Object item:arrayArg){
Set<ConstraintViolation<Object>> validateResult = this.validator.validate(item, beanValidAnnotation.value());
if (!validateResult.isEmpty()){
String message = validateResult.iterator().next().getMessage();
return ObjectRestResponse.createFailedResult(400,message);
}
}
}else {
Set<ConstraintViolation<Object>> validateResult = this.validator.validate(args[i], beanValidAnnotation.value());
if (!validateResult.isEmpty()){
String message = validateResult.iterator().next().getMessage();
return ObjectRestResponse.createFailedResult(400,message);
}
}
continue;
}
if (!hashSimpleValid){
SimpleValid simpleValidAnnotation = parameters[i].getDeclaredAnnotation(SimpleValid.class);
if (Objects.nonNull(simpleValidAnnotation)){
hashSimpleValid = true;
}
}
}
if (hashSimpleValid){
Object target = proceedingJoinPoint.getTarget();
Set<ConstraintViolation<Object>> validResult = this.executableValidator.validateParameters(target, currentMethod, args);
if(!validResult.isEmpty()){
String message = validResult.iterator().next().getMessage();
return ObjectRestResponse.createFailedResult(400,message);
}
}
return proceedingJoinPoint.proceed();
}
}
package com.github.wxiaoqi.security.common.support.config;
import com.github.wxiaoqi.security.common.support.aop.ValidParamAop;
import org.hibernate.validator.HibernateValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import javax.validation.executable.ExecutableValidator;
/**
* @author libin
* @version 1.0
* @description 验证器validator
* @data 2019/6/13 13:48
*/
@Configuration
public class ValidatorConfig {
/**
* 复合类型所用的验证器
* @return Validator
*/
@Bean
public Validator validator(){
// .failFast( true ) 为设置快速错误模式,默认为false
ValidatorFactory validatorFactory = Validation.byProvider( HibernateValidator.class )
.configure()
.failFast( true )
.buildValidatorFactory();
return validatorFactory.getValidator();
}
/**
* 简单类型所用的验证器
* @return ExecutableValidator
*/
@Bean
public ExecutableValidator executableValidator() {
return validator().forExecutables();
}
/**
* 装配验证器切面
* @param validator Bean验证器
* @param executableValidator 简单类型验证器
* @return ValidParamAop
*/
@Bean
public ValidParamAop validAop(Validator validator, ExecutableValidator executableValidator) {
ValidParamAop validParamAop = new ValidParamAop();
validParamAop.setValidator(validator);
validParamAop.setExecutableValidator(executableValidator);
return validParamAop;
}
}
......@@ -101,6 +101,16 @@
<groupId>com.github.wxiaoqi</groupId>
<artifactId>ace-common</artifactId>
<version>2.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
......
package com.github.wxiaoqi.security.admin.feign.dto;
import com.github.wxiaoqi.security.admin.entity.User;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
......@@ -10,61 +11,13 @@ import java.util.List;
import java.util.stream.Collectors;
@Data
public class UserDTO {
private Integer id;
private String username;
private String password;
private String name;
private String birthday;
private String address;
private String mobilePhone;
private String telPhone;
private String email;
private String sex;
private String type;
private Integer status;
private String description;
private Date crtTime;
private String crtUser;
private String crtName;
private String crtHost;
private Date updTime;
private String updUser;
private String updName;
private String updHost;
private Integer dataAll;
private String dataZone;
private String dataCompany;
public class UserDTO extends User {
public List<Integer> dataZone2List() {
return str2List(this.dataZone);
return str2List(getDataZone());
}
public List<Integer> dataCompany2List() {
return str2List(this.dataCompany);
return str2List(getDataCompany());
}
private List<Integer> str2List(String str) {
......
......@@ -2,15 +2,16 @@ package com.xxfc.platform.app;
import com.ace.cache.EnableAceCache;
import com.github.wxiaoqi.security.auth.client.EnableAceAuthClient;
import com.spring4all.swagger.EnableSwagger2Doc;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {
"com.xxfc.platform",
"com.github.wxiaoqi.*"
})
@EnableDiscoveryClient
@EnableScheduling
@EnableAceAuthClient
......
......@@ -10,7 +10,10 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@SpringBootApplication(scanBasePackages = {
"com.xxfc.platform",
"com.github.wxiaoqi.*"
},exclude = DataSourceAutoConfiguration.class)
@EnableDiscoveryClient
@EnableScheduling
@EnableAceAuthClient
......
......@@ -9,6 +9,8 @@ public enum OrderStatusEnum {
ORDER_CANCEL(2, "取消订单"),
ORDER_UNPAY(3, "待支付"),
ORDER_TOSTART(4, "待进行(待出行)"),
ORDER_WAIT(5, "出行中(进行中)"),
ORDER_FINISH(6, "已完成"),
;
/**
* 编码
......
......@@ -13,83 +13,105 @@ import lombok.Data;
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-05-24 21:56:10
* @date 2019-06-15 11:35:33
*/
@Table(name = "base_order")
@Data
@Table(name = "base_order")
public class BaseOrder implements Serializable {
private static final long serialVersionUID = 1L;
//主键
/**
* 主键
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键")
private Integer id;
//订单号
/**
* 订单号
*/
@Column(name = "no")
@ApiModelProperty(value = "订单号")
private String no;
//订单类型 1--租车;2--旅游
/**
* 名称
*/
@Column(name = "name")
@ApiModelProperty(value = "名称")
private String name;
/**
* 订单类型 1--租车;2--旅游
*/
@Column(name = "type")
@ApiModelProperty(value = "订单类型 1--租车;2--旅游")
private Integer type;
//订单详情id
/**
* 订单详情id
*/
@Column(name = "detail_id")
@ApiModelProperty(value = "订单详情id")
private Integer detailId;
//订单状态
/**
* 订单状态
0--删除
1--创建订单
2--取消
3--待付款
4--待出行
5--出行中(进行中)
6--已完成
*/
@Column(name = "status")
@ApiModelProperty(value = "订单状态\n" +
"0--删除\n" +
"1--创建订单\n" +
"2--取消\n" +
"3--待付款\n" +
"4--待出行\n" +
"5--出行中(进行中)\n" +
"6--已完成")
@ApiModelProperty(value = "订单状态"
+"0--删除"
+"1--创建订单"
+"2--取消"
+"3--待付款"
+"4--待出行"
+"5--出行中(进行中)"
+"6--已完成")
private Integer status;
//商品价格
/**
* 商品价格
*/
@Column(name = "goods_amount")
@ApiModelProperty(value = "商品价格")
private BigDecimal goodsAmount;
//实际价格
/**
* 订单价格
*/
@Column(name = "order_amount")
@ApiModelProperty(value = "订单价格")
private BigDecimal orderAmount;
//实际价格
/**
* 实际价格
*/
@Column(name = "real_amount")
@ApiModelProperty(value = "实际价格")
private BigDecimal realAmount;
//详情json信息
@Column(name = "detail_json")
@ApiModelProperty(value = "详情json信息")
private String detailJson;
//第三方类型(支付渠道)
/**
* 第三方类型(支付渠道)
*/
@Column(name = "third_type")
@ApiModelProperty(value = "第三方类型(支付渠道)")
private Integer thirdType;
//流水号
/**
* 流水号
*/
@Column(name = "out_trade_no")
@ApiModelProperty(value = "流水号")
private String outTradeNo;
/**
* 用户id
*/
@Column(name = "user_id")
@ApiModelProperty(value = "用户id")
private Integer userId;
/**
* 订单图片
*/
......@@ -98,56 +120,74 @@ public class BaseOrder implements Serializable {
private String picture;
/**
* 订单图片
*/
@Column(name = "name")
@ApiModelProperty(value = "名称")
private String name;
/**
* 取消原因
* 创建时间
*/
@Column(name = "cancel_reason")
@ApiModelProperty(value = "取消原因")
private String cancelReason;
//创建时间
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Date crtTime;
//创建者id
/**
* 创建者id
*/
@Column(name = "crt_user")
@ApiModelProperty(value = "创建者id")
private String crtUser;
//创建者名称
/**
* 创建者名称
*/
@Column(name = "crt_name")
@ApiModelProperty(value = "创建者名称")
private String crtName;
//创建者ip
@Column(name = "crt_host")
@ApiModelProperty(value = "创建者ip")
private String crtHost;
/**
* 用户id
*/
@Column(name = "user_id")
@ApiModelProperty(value = "用户id")
private Integer userId;
//更新时间
/**
* 更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Date updTime;
//更新者id
@Column(name = "upd_user")
@ApiModelProperty(value = "更新者id")
private String updUser;
/**
* 创建者ip
*/
@Column(name = "crt_host")
@ApiModelProperty(value = "创建者ip")
private String crtHost;
/**
* 取消原因
*/
@Column(name = "cancel_reason")
@ApiModelProperty(value = "取消原因")
private String cancelReason;
/**
* 退款流水号
*/
@Column(name = "refund_trade_no")
@ApiModelProperty(value = "退款流水号")
private String refundTradeNo;
/**
* 支付时间
*/
@Column(name = "pay_time")
@ApiModelProperty(value = "支付时间")
private Long payTime;
/**
* 退款时间
*/
@Column(name = "refund_time")
@ApiModelProperty(value = "退款时间")
private Long refundTime;
//更新者名称
@Column(name = "upd_name")
@ApiModelProperty(value = "更新者名称")
private String updName;
//更新者ip
@Column(name = "upd_host")
@ApiModelProperty(value = "更新者ip")
private String updHost;
}
package com.xxfc.platform.order.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -11,135 +13,244 @@ import lombok.Data;
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-05-27 15:13:55
* @date 2019-06-15 14:18:42
*/
@Data
@Table(name = "order_rent_vehicle_detail")
public class OrderRentVehicleDetail implements Serializable{
public class OrderRentVehicleDetail implements Serializable {
private static final long serialVersionUID = 1L;
//主键
/**
* 主键
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键")
private Integer id;
//基础订单id
/**
* 基础订单id
*/
@Column(name = "order_id")
@ApiModelProperty(value = "基础订单id")
private Integer orderId;
//基础订单id
/**
* 名称
*/
@Column(name = "name")
@ApiModelProperty(value = "名称")
private String name;
//创建时间
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
//更新时间
/**
* 更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
//开始时间
/**
* 开始时间
*/
@Column(name = "start_time")
@ApiModelProperty(value = "开始时间")
private Long startTime;
//结束时间
/**
* 结束时间
*/
@Column(name = "end_time")
@ApiModelProperty(value = "结束时间")
private Long endTime;
//天数
/**
* 天数
*/
@Column(name = "day_num")
@ApiModelProperty(value = "天数")
private Integer dayNum;
//取车地点
/**
* 取车地点
*/
@Column(name = "start_addr")
@ApiModelProperty(value = "取车地点")
private String startAddr;
//还车地点
/**
* 还车地点
*/
@Column(name = "end_addr")
@ApiModelProperty(value = "还车地点")
private String endAddr;
//车辆id
/**
* 车辆id
*/
@Column(name = "vehicle_id")
@ApiModelProperty(value = "车辆id")
private String vehicleId;
//费用详情
@Column(name = "cost_detail")
@ApiModelProperty(value = "费用详情")
private String costDetail;
//取车城市编号
/**
* 取车城市编号
*/
@Column(name = "start_city")
@ApiModelProperty(value = "取车城市编号")
private Integer startCity;
//还车城市编号
/**
* 还车城市编号
*/
@Column(name = "end_city")
@ApiModelProperty(value = "还车城市编号")
private Integer endCity;
//取车城市名称
/**
* 取车城市名称
*/
@Column(name = "start_city_name")
@ApiModelProperty(value = "取车城市名称")
private String startCityName;
//还车城市名称
/**
* 还车城市名称
*/
@Column(name = "end_city_name")
@ApiModelProperty(value = "还车城市名称")
private String endCityName;
//司机类型 1--公司司机;2--自己司机
/**
* 司机类型 1--公司司机;2--自己司机
*/
@Column(name = "driver_type")
@ApiModelProperty(value = "司机类型 1--公司司机;2--自己司机")
private Integer driverType;
//自己司机ids
/**
* 自己司机ids
*/
@Column(name = "my_driver_ids")
@ApiModelProperty(value = "自己司机ids")
private String myDriverIds;
//出发公司Id
/**
* 出发公司Id
*/
@Column(name = "start_company_id")
@ApiModelProperty(value = "出发公司Id")
private Integer startCompanyId;
//结束公司Id
/**
* 结束公司Id
*/
@Column(name = "end_company_id")
@ApiModelProperty(value = "结束公司Id")
private Integer endCompanyId;
//车型id
/**
* 车型id
*/
@Column(name = "model_id")
@ApiModelProperty(value = "车型id")
private Integer modelId;
//评分
/**
* 评分人
*/
@Column(name = "s_userid")
@ApiModelProperty(value = "评分人")
private Integer sUserid;
/**
* 评分
*/
@Column(name = "score")
@ApiModelProperty(value = "评分")
private Integer score;
//评分人
@Column(name = "s_userid")
@ApiModelProperty(value = "评分人")
private Integer sUserid;
/**
* 费用明细
*/
@Column(name = "cost_detail")
@ApiModelProperty(value = "费用明细")
private String costDetail;
//评分时间
/**
* 押金
*/
@Column(name = "deposit")
@ApiModelProperty(value = "押金")
private BigDecimal deposit;
/**
* 评分时间
*/
@Column(name = "s_time")
@ApiModelProperty(value = "评分时间")
private Long sTime;
@Column(name = "deposit")
@ApiModelProperty(value = "押金")
private Long deposit;
/**
* 交付人id
*/
@Column(name = "delivery_user")
@ApiModelProperty(value = "交付人id")
private Integer deliveryUser;
/**
* 交付人名称
*/
@Column(name = "delivery_name")
@ApiModelProperty(value = "交付人名称")
private String deliveryName;
/**
* 交付人手机号
*/
@Column(name = "delivery_phone")
@ApiModelProperty(value = "交付人手机号")
private String deliveryPhone;
/**
* 交车时间
*/
@Column(name = "delivery_time")
@ApiModelProperty(value = "交车时间")
private Long deliveryTime;
/**
* 收车人id
*/
@Column(name = "collect_user")
@ApiModelProperty(value = "收车人id")
private Integer collectUser;
/**
* 收车人名称
*/
@Column(name = "collect_name")
@ApiModelProperty(value = "收车人名称")
private String collectName;
/**
* 收车人手机号
*/
@Column(name = "collect_phone")
@ApiModelProperty(value = "收车人手机号")
private String collectPhone;
/**
* 收车时间
*/
@Column(name = "collect_time")
@ApiModelProperty(value = "收车时间")
private Long collectTime;
}
......@@ -12,124 +12,216 @@ import lombok.Data;
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-10 10:36:31
* @date 2019-06-15 14:18:42
*/
@Data
@Table(name = "order_tour_detail")
public class OrderTourDetail implements Serializable {
private static final long serialVersionUID = 1L;
//主键
/**
* 主键
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键")
private Integer id;
//基础订单id
/**
* 基础订单id
*/
@Column(name = "order_id")
@ApiModelProperty(value = "基础订单id")
private Integer orderId;
//名称
/**
* 名称
*/
@Column(name = "name")
@ApiModelProperty(value = "名称")
private String name;
//创建时间
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
//更新时间
/**
* 更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
//开始时间
/**
* 开始时间
*/
@Column(name = "start_time")
@ApiModelProperty(value = "开始时间")
private Long startTime;
//结束时间
/**
* 结束时间
*/
@Column(name = "end_time")
@ApiModelProperty(value = "结束时间")
private Long endTime;
//天数
/**
* 天数
*/
@Column(name = "day_num")
@ApiModelProperty(value = "天数")
private Integer dayNum;
//出发地点
/**
* 出发地点
*/
@Column(name = "start_addr")
@ApiModelProperty(value = "出发地点")
private String startAddr;
//还车地点
/**
* 还车地点
*/
@Column(name = "end_addr")
@ApiModelProperty(value = "还车地点")
private String endAddr;
//出游乘客ids
/**
* 出游乘客ids
*/
@Column(name = "tour_user_ids")
@ApiModelProperty(value = "出游乘客ids")
private String tourUserIds;
//出发公司Id
/**
* 成人人数
*/
@Column(name = "adult_num")
@ApiModelProperty(value = "成人人数")
private Integer adultNum;
/**
* 儿童人数
*/
@Column(name = "child_num")
@ApiModelProperty(value = "儿童人数")
private Integer childNum;
/**
* 出发公司Id
*/
@Column(name = "start_company_id")
@ApiModelProperty(value = "出发公司Id")
private Integer startCompanyId;
//费用明细
/**
* 费用明细
*/
@Column(name = "cost_detail")
@ApiModelProperty(value = "费用明细")
private String costDetail;
//商品id
/**
* 商品id
*/
@Column(name = "good_id")
@ApiModelProperty(value = "商品id")
private Integer goodId;
//规格ids
/**
* 总人数
*/
@Column(name = "total_number")
@ApiModelProperty(value = "总人数")
private Integer totalNumber;
/**
* 规格ids
*/
@Column(name = "spe_ids")
@ApiModelProperty(value = "规格ids")
private String speIds;
//具体商品(商品项)id
/**
* 具体商品(商品项)id
*/
@Column(name = "spe_price_id")
@ApiModelProperty(value = "具体商品(商品项)id")
private Integer spePriceId;
//联系人
/**
* 联系人
*/
@Column(name = "contact_man")
@ApiModelProperty(value = "联系人")
private String contactMan;
//联系电话
/**
* 联系电话
*/
@Column(name = "contact_phone")
@ApiModelProperty(value = "联系电话")
private String contactPhone;
//联系邮箱
/**
* 联系邮箱
*/
@Column(name = "contact_email")
@ApiModelProperty(value = "联系邮箱")
private String contactEmail;
//总人数
@Column(name = "total_number")
@ApiModelProperty(value = "总人数")
private Integer totalNumber;
/**
* 出发城市名称
*/
@Column(name = "start_city_name")
@ApiModelProperty(value = "出发城市名称")
private String startCityName;
//出发城市编号
/**
* 出发城市编号
*/
@Column(name = "start_city")
@ApiModelProperty(value = "出发城市编号")
private Integer startCity;
//出发城市名称
@Column(name = "start_city_name")
@ApiModelProperty(value = "出发城市名称")
private String startCityName;
/**
* 核销id
*/
@Column(name = "verification_id")
@ApiModelProperty(value = "核销id")
private Integer verificationId;
/**
* 核销人
*/
@Column(name = "verification_user")
@ApiModelProperty(value = "核销人")
private Integer verificationUser;
/**
* 核销人名称
*/
@Column(name = "verification_name")
@ApiModelProperty(value = "核销人名称")
private String verificationName;
/**
* 核销人联系电话
*/
@Column(name = "verification_phone")
@ApiModelProperty(value = "核销人联系电话")
private Integer verificationPhone;
/**
* 核销时间
*/
@Column(name = "verification_time")
@ApiModelProperty(value = "核销时间")
private Long verificationTime;
}
package com.xxfc.platform.order.pojo.order;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.math.BigDecimal;
@Data
public class OrderTourVerificationVO {
//基础订单id
@ApiModelProperty(value = "基础订单id")
private Integer orderId;
//订单号
@ApiModelProperty(value = "订单号")
private String no;
//订单类型 1--租车;2--旅游
@ApiModelProperty(value = "订单类型 1--租车;2--旅游")
private Integer type;
//订单状态
@ApiModelProperty(value = "订单状态\n" +
"0--删除\n" +
"1--创建订单\n" +
"2--取消\n" +
"3--待付款\n" +
"4--待出行\n" +
"5--出行中(进行中)\n" +
"6--已完成")
private Integer status;
//实际价格
@ApiModelProperty(value = "实际价格")
private BigDecimal realAmount;
//联系人
@ApiModelProperty(value = "联系人")
private String contactMan;
//联系电话
@ApiModelProperty(value = "联系电话")
private String contactPhone;
//总人数
@ApiModelProperty(value = "总人数")
private Integer totalNumber;
//成人人数
@ApiModelProperty(value = "成人人数")
private Integer adultNum;
//儿童人数
@ApiModelProperty(value = "儿童人数")
private Integer childNum;
}
......@@ -18,7 +18,6 @@ public class TourBO extends OrderTourDetail implements OrderDetail {
private BaseOrder order;
TourGood tourGood;
List<TourUser> tourUsers;
Integer number;
Integer childNumber;
AppUserDTO appUserDTO;
private Integer siteId;
}
......@@ -31,32 +31,32 @@
<build>
<!-- <finalName>xx-order-server</finalName>-->
<plugins>
<!-- &lt;!&ndash; 此插件用来生成通用mapper的代码 &ndash;&gt;-->
<!-- <plugin>-->
<!-- <groupId>org.mybatis.generator</groupId>-->
<!-- <artifactId>mybatis-generator-maven-plugin</artifactId>-->
<!-- <version>1.3.2</version>-->
<!-- <configuration>-->
<!-- <configurationFile>-->
<!-- ${basedir}/src/main/resources/builder/generatorConfig.xml-->
<!-- </configurationFile>-->
<!-- <overwrite>true</overwrite>-->
<!-- <verbose>true</verbose>-->
<!-- </configuration>-->
<!-- <dependencies>-->
<!-- <dependency>-->
<!-- <groupId>mysql</groupId>-->
<!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- <version>5.1.30</version>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>tk.mybatis</groupId>-->
<!-- <artifactId>mapper</artifactId>-->
<!-- <version>${mapper.version}</version>-->
<!-- </dependency>-->
<!-- </dependencies>-->
<!-- </plugin>-->
<!-- 此插件用来生成通用mapper的代码 -->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<configurationFile>
${basedir}/src/main/resources/builder/generatorConfig.xml
</configurationFile>
<overwrite>true</overwrite>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>${mapper.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
......
......@@ -10,7 +10,10 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {
"com.xxfc.platform",
"com.github.wxiaoqi.*"
})
@EnableDiscoveryClient
@EnableScheduling
@EnableAceAuthClient
......
package com.xxfc.platform.order.biz;
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.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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 旅游订单核销
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 18:18:33
*/
@Service
public class OrderTourVerificationBiz{
@Autowired
private OrderTourVerificationMapper verificationMapper;
@Autowired
private BaseOrderBiz baseOrderBiz;
@Autowired
private TourFeign tourFeign;
/**
* 分页查询旅游订单核销列表
* @param page
* @param limit
* @return
*/
public PageDataVO<OrderTourVerificationVO> getVerificationList(Integer page, Integer limit,Integer verificationId){
return PageDataVO.pageInfo(page,limit,()->verificationMapper.pageByParm(verificationId));
}
//核销
public ObjectRestResponse VerificationByOrder(Integer orderId){
BaseOrder baseOrder=baseOrderBiz.selectById(orderId);
if(baseOrder==null){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "订单不存在");
}
if(baseOrder.getStatus()!=OrderStatusEnum.ORDER_TOSTART.getCode()){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "订单不是已支付状态");
}
baseOrder=new BaseOrder();
baseOrder.setId(orderId);
baseOrder.setStatus(OrderStatusEnum.ORDER_FINISH.getCode());
baseOrderBiz.updateSelectiveById(baseOrder);
return ObjectRestResponse.succ();
}
//确定上车
public ObjectRestResponse finishByOrder(Integer verificationId){
return ObjectRestResponse.succ(tourFeign.updateTourGoodVerificationStatus(verificationId));
}
//核销列表
public ObjectRestResponse getVerifications(TourGoodOrderFindVo tourGoodOrderFindVo){
return ObjectRestResponse.succ(tourFeign.findTourGoodOrders(tourGoodOrderFindVo));
}
}
\ No newline at end of file
package com.xxfc.platform.order.config;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.BaseResponse;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
public class PlatformExceptionHandler {
@ExceptionHandler(BaseException.class)
public BaseResponse baseExceptionHandler(BaseException e) {
return new BaseResponse(e.getStatus(), e.getMessage());
}
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.pojo.order.OrderTourVerificationVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 旅游订单详情
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 18:18:33
*/
public interface OrderTourVerificationMapper {
public List<OrderTourVerificationVO> pageByParm(@Param("verificationId")Integer verificationId);
}
......@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.PageHelper;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.context.BaseContextHandler;
......@@ -34,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.math.BigDecimal;
......@@ -49,6 +52,9 @@ public class BaseOrderController extends CommonBaseController {
@Autowired
ThirdFeign thirdFeign;
@Autowired
UserFeign userFeign;
@Value("${gateway.host}")
String host;
......@@ -73,25 +79,22 @@ public class BaseOrderController extends CommonBaseController {
return new ObjectRestResponse<>().data(PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper())));
}
// @ApiOperation("订单详情")
// @RequestMapping(value = "/{no}",method = RequestMethod.GET)
// @IgnoreClientToken
// @RequestMapping(value = "/company/page",method = RequestMethod.GET)
// @ResponseBody
// public ObjectRestResponse<OrderPageVO> get(@PathVariable String no){
// @ApiOperation(value = "结合后台人员所属公司查询订单列表")
// @IgnoreClientToken
// public ObjectRestResponse<PageDataVO<OrderPageVO>> companyList(QueryOrderDTO dto){
// //查询列表数据
// if(StringUtils.isBlank(BaseContextHandler.getUserID())) {
// throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
// }
// Query query = initQuery(no);
// PageDataVO<OrderPageVO> page = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper()));
// if(page.getData().isEmpty()) {
// throw new BaseException(ResultCode.NOTEXIST_CODE);
// }
// return new ObjectRestResponse<>().data(page.getData().get(0));
// dto.setCrtCompanyId(userFeign.userinfoByToken(BaseContextHandler.getToken()).getData().getCompanyId());
// Query query = new Query(dto);
// return new ObjectRestResponse<>().data(PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper())));
// }
@ApiOperation("根据订单详情处理信息")
@RequestMapping(value = "/handle/{no}",method = RequestMethod.GET)
@ApiOperation("订单详情")
@RequestMapping(value = "/{no}",method = RequestMethod.GET)
@IgnoreClientToken
@ResponseBody
public ObjectRestResponse<OrderPageVO> get(@PathVariable String no){
......@@ -99,6 +102,7 @@ public class BaseOrderController extends CommonBaseController {
if(StringUtils.isBlank(BaseContextHandler.getUserID())) {
throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
}
Query query = initQuery(no);
PageDataVO<OrderPageVO> page = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper()));
if(page.getData().isEmpty()) {
......@@ -107,6 +111,41 @@ public class BaseOrderController extends CommonBaseController {
return new ObjectRestResponse<>().data(page.getData().get(0));
}
@ApiOperation("结合后台人员所属公司查询订单详情")
@RequestMapping(value = "/company/{no}",method = RequestMethod.GET)
@IgnoreClientToken
@ResponseBody
public ObjectRestResponse<OrderPageVO> companyGet(@PathVariable String no){
//查询列表数据
if(StringUtils.isBlank(BaseContextHandler.getUserID())) {
throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
}
Query query = initCompanyQuery(no);
PageDataVO<OrderPageVO> page = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper()));
if(page.getData().isEmpty()) {
throw new BaseException(ResultCode.NOTEXIST_CODE);
}
return new ObjectRestResponse<>().data(page.getData().get(0));
}
// @ApiOperation("根据订单详情处理信息")
// @RequestMapping(value = "/handle/{no}",method = RequestMethod.GET)
// @IgnoreClientToken
// @ResponseBody
// public ObjectRestResponse<OrderPageVO> get(@PathVariable String no){
// //查询列表数据
// if(StringUtils.isBlank(BaseContextHandler.getUserID())) {
// throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
// }
// Query query = initQuery(no);
// PageDataVO<OrderPageVO> page = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper()));
// if(page.getData().isEmpty()) {
// throw new BaseException(ResultCode.NOTEXIST_CODE);
// }
// return new ObjectRestResponse<>().data(page.getData().get(0));
// }
private Query initQuery(String no) {
QueryOrderDetailDTO qodd = new QueryOrderDetailDTO();
qodd.setCrtUser(Integer.valueOf(BaseContextHandler.getUserID()));
......@@ -117,6 +156,18 @@ public class BaseOrderController extends CommonBaseController {
return query;
}
private Query initCompanyQuery(String no) {
QueryOrderDetailDTO qodd = new QueryOrderDetailDTO();
//查询公司id
UserDTO userDto = userFeign.userinfoByToken(BaseContextHandler.getToken()).getData();
qodd.setCrtCompanyId(userDto.getCompanyId());
qodd.setNo(no);
qodd.setLimit(1);
qodd.setPage(1);
Query query = new Query(qodd);
return query;
}
@RequestMapping(value = "/pay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "订单支付")
......@@ -201,6 +252,9 @@ public class BaseOrderController extends CommonBaseController {
@ApiModelProperty(hidden = false)
private Integer crtUser;
@ApiModelProperty(hidden = false)
private Integer crtCompanyId;
@ApiModelProperty(value = "订单状态\n" +
"0--删除\n" +
"1--创建订单\n" +
......
......@@ -5,6 +5,7 @@ import com.xxfc.platform.order.biz.OrderCostDetailBiz;
import com.xxfc.platform.order.entity.OrderCostDetail;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import springfox.documentation.annotations.ApiIgnore;
@Controller
@RequestMapping("orderCostDetail")
......
......@@ -21,6 +21,7 @@ import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@Controller
@RequestMapping("orderRentVehicle")
......
......@@ -5,6 +5,7 @@ import com.xxfc.platform.order.biz.OrderTemplateBiz;
import com.xxfc.platform.order.entity.OrderTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import springfox.documentation.annotations.ApiIgnore;
@Controller
@RequestMapping("orderTemplate")
......
......@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
@Controller
@RequestMapping("orderTour")
......@@ -67,6 +68,8 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
public ObjectRestResponse<TourPriceVO> calculatePrice(CalculatePriceVO vo){
TourBO bo = BeanUtil.toBean(vo, TourBO.class);
bo.setAppUserDTO(getUserInfo());
bo.setAdultNum(vo.getNumber());
bo.setChildNum(vo.getChildNumber());
return ObjectRestResponse.succ(orderTourService.calculatePrice(bo));
}
......
package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
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.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.xxfc.platform.order.biz.OrderTourDetailBiz;
import com.xxfc.platform.order.biz.OrderTourVerificationBiz;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderTourDetail;
import com.xxfc.platform.order.pojo.AddTourDTO;
import com.xxfc.platform.order.pojo.order.TourBO;
import com.xxfc.platform.order.pojo.price.TourPriceVO;
import com.xxfc.platform.order.service.OrderTourService;
import com.xxfc.platform.tour.feign.TourFeign;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("tour")
@IgnoreClientToken
@Api(value="旅游订单核销",tags={"旅游订单核销"})
public class OrderTourVerificationController extends CommonBaseController {
@Autowired
OrderTourVerificationBiz verificationBiz;
@Autowired
protected UserAuthConfig userAuthConfig;
@Autowired
UserFeign userFeign;
public AppUserDTO getUserInfo(){
return userFeign.userDetailByToken(userAuthConfig.getToken(request)).getData();
}
@RequestMapping(value = "/verification/orderlist",method = RequestMethod.GET)
@ApiOperation(value = "旅游核销订单列表")
public ObjectRestResponse orderlist(
@RequestParam(value = "page",defaultValue = "1") Integer page,
@RequestParam(value = "limit",defaultValue = "10") Integer limit,
@RequestParam(value = "verificationId",defaultValue = "0") Integer verificationId
){
return ObjectRestResponse.succ(verificationBiz.getVerificationList(page,limit,verificationId));
}
@RequestMapping(value = "/verification/check",method = RequestMethod.POST)
@ApiOperation(value = "旅游核销")
public ObjectRestResponse<BaseOrder> check(
@RequestParam(value = "orderId",defaultValue = "0") Integer orderId
){
return verificationBiz.VerificationByOrder(orderId);
}
@RequestMapping(value = "/verification/finish",method = RequestMethod.POST)
@ApiOperation(value = "确定发车")
public ObjectRestResponse<BaseOrder> finishOrder(
@RequestParam(value = "verificationId",defaultValue = "0") Integer verificationId
){
return verificationBiz.finishByOrder(verificationId);
}
@RequestMapping(value = "/verification/list",method = RequestMethod.GET)
@ApiOperation(value = "旅游核销订单列表")
public ObjectRestResponse list(TourGoodOrderFindVo tourGoodOrderFindVo){
return verificationBiz.getVerifications(tourGoodOrderFindVo);
}
}
\ No newline at end of file
......@@ -26,6 +26,7 @@ import com.xxfc.platform.order.pojo.price.RentVehiclePriceVO;
import com.xxfc.platform.order.pojo.price.TourPriceVO;
import com.xxfc.platform.tour.dto.TourSpePriceDTO;
import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.entity.TourGoodVerification;
import com.xxfc.platform.tour.entity.TourUser;
import com.xxfc.platform.tour.feign.TourFeign;
import com.xxfc.platform.tour.vo.TourSpePriceVo;
......@@ -111,6 +112,13 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
bo.setStartCity(sysRegion.getId().intValue());
bo.setStartCityName(sysRegion.getName());
//设置verificationId 核销id
bo.setVerificationId(tourFeign.entityList(BeanUtil.beanToMap(new TourGoodVerification(){{
setSpeId(bo.getSpePriceId());
setGoodId(bo.getGoodId());
setSiteId(bo.getSiteId());
}})).getData().get(0).getId());
//扣減庫存
tourFeign.stock(bo.getSpePriceId(), bo.getTotalNumber());
......@@ -145,18 +153,18 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
return IS_CHILD.equals(tourUser.getIsChild());
}).collect(Collectors.toList());
detail.setNumber(childs.size());
detail.setChildNumber(notChilds.size());
detail.setAdultNum(notChilds.size());
detail.setChildNum(childs.size());
detail.setTotalNumber(users.size());
}else{
detail.setTotalNumber(detail.getNumber() + detail.getChildNumber());
detail.setTotalNumber(detail.getAdultNum() + detail.getChildNum());
}
//计算旅游价格
ObjectRestResponse<TourSpePriceVo> objectRestResponse = tourFeign.refund(new TourSpePriceDTO(){{
setChildNumber(detail.getChildNumber());
setNumber(detail.getNumber());
setChildNumber(detail.getChildNum());
setNumber(detail.getAdultNum());
setLevel(LEVEL_DEFAULT);
setSpeId(detail.getSpePriceId());
setUserId(detail.getAppUserDTO().getUserid());
......@@ -178,8 +186,8 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
tpv.setOrderAmount(orderAmount);
tpv.setGoodsAmount(goodsAmount);
tpv.setRealAmount(realAmount);
tpv.setNumber(detail.getNumber());
tpv.setChildNumber(detail.getChildNumber());
tpv.setNumber(detail.getAdultNum());
tpv.setChildNumber(detail.getChildNum());
//设置收费明细
costDetail(tpv, handlechildren(detail));
......@@ -188,10 +196,10 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
private String handlechildren(TourBO detail) {
StringBuffer childrenStr = new StringBuffer("");
if(NUMBER_ZERO < detail.getNumber()) {
if(NUMBER_ZERO < detail.getAdultNum()) {
childrenStr.append(",${tem_0201}");
}
if(NUMBER_ZERO < detail.getChildNumber()) {
if(NUMBER_ZERO < detail.getChildNum()) {
childrenStr.append(",${tem_0202}");
}
......
......@@ -15,9 +15,9 @@
</plugin>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/vehicle?useUnicode=true&amp;characterEncoding=UTF8"
connectionURL="jdbc:mysql://10.5.52.3:3306/xxfc_order?useUnicode=true&amp;characterEncoding=UTF8"
userId="root"
password="xx2019fc">
password="sslcloud123*()">
</jdbcConnection>
<javaModelGenerator targetPackage="${targetModelPackage}" targetProject="${targetJavaProject}"/>
......@@ -37,7 +37,7 @@
<!-- </table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<table tableName="vehicle_upkeep_item" domainObjectName="VehicleUpkeepItem"></table>
<table tableName="vehicle_upkeep_log" domainObjectName="VehicleUpkeepLog"></table>
<table tableName="base_order" domainObjectName="baseOrder"></table>
<!-- <table tableName="vehicle_upkeep_log" domainObjectName="VehicleUpkeepLog"></table>-->
</context>
</generatorConfiguration>
\ No newline at end of file
......@@ -29,7 +29,7 @@
<result javaType="Integer" column="type" property="type"></result>
<discriminator javaType="Integer" column="type">
<case value="1" resultType="com.xxfc.platform.order.pojo.order.OrderPageVO">
<association column="detail_id" property="orderRentVehicleDetail" select="com.xxfc.platform.order.mapper.OrderRentVehicleDetailMapper.selectByPrimaryKey" javaType="com.xxfc.platform.order.entity.OrderRentVehicleDetail"></association>
<association column="{id=detail_id}" property="orderRentVehicleDetail" select="com.xxfc.platform.order.mapper.OrderRentVehicleDetailMapper.pageByParm" javaType="com.xxfc.platform.order.entity.OrderRentVehicleDetail"></association>
</case>
<case value="2" resultType="com.xxfc.platform.order.pojo.order.OrderPageVO">
<association column="detail_id" property="orderTourDetail" select="com.xxfc.platform.order.mapper.OrderTourDetailMapper.selectByPrimaryKey" javaType="com.xxfc.platform.order.entity.OrderTourDetail"></association>
......@@ -44,6 +44,9 @@
<if test="crtUser != null">
and crt_user = #{crtUser}
</if>
<if test="crtCompanyId != null">
and crt_user = #{crtCompanyId}
</if>
<if test="status != null">
and status = #{status}
</if>
......
......@@ -18,4 +18,21 @@
<select id="getPScore" resultType="Integer" >
SELECT round(IFNULL (AVG(score),0)) score FROM order_rent_vehicle_detail WHERE model_id=#{modelId}
</select>
<select id="pageByParm" parameterType="Map" resultType="com.xxfc.platform.order.entity.OrderRentVehicleDetail">
select *
from order_rent_vehicle_detail
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="startCompanyId != null">
and start_company_id = #{startCompanyId}
</if>
<if test="endCompanyId != null">
and end_company_id = #{endCompanyId}
</if>
</where>
order by crt_time desc
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.order.mapper.OrderTourVerificationMapper">
<!--获取旅游核销列表-->
<select id="pageByParm" resultType="com.xxfc.platform.order.pojo.order.OrderTourVerificationVO">
SELECT o.no,o.real_amount as realAmount,o.`status`,o.type,d.contact_man as contactMan,d.contact_phone as contactPhone,
d.total_number as totalNumber,d.adult_num as adultNum,d.child_num as childNum
FROM base_order o LEFT JOIN
order_tour_detail d ON o.id=d.order_id
WHERE o.`type`=2 and o.`status`>2 and d.verification_id=#{verificationId}
ORDER BY o.status
</select>
</mapper>
\ No newline at end of file
......@@ -31,6 +31,9 @@ public class GoodSpePriceDTO {
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
@ApiModelProperty("商品id")
private Integer goodId;
//规格id
@ApiModelProperty(value = "规格id")
private String speId;
......
......@@ -19,28 +19,35 @@ import lombok.Data;
public class TourGoodSite implements Serializable {
private static final long serialVersionUID = 1L;
//
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("")
@ApiModelProperty("主键")
private Integer id;
//路线id
/**
* 商品id
*/
@Column(name = "good_id")
@ApiModelProperty(value = "路线id")
@ApiModelProperty(value = "商品id")
private Integer goodId;
//站点名称
/**
* 站点名称
*/
@Column(name = "name")
@ApiModelProperty(value = "站点名称")
private String name;
//站点地址
/**
* 站点地址
*/
@Column(name = "address")
@ApiModelProperty(value = "站点地址")
private String address;
//分公司id
/**
* 分公司id
*/
@Column(name = "company_id")
@ApiModelProperty(value = "分公司id")
private String companyId;
......@@ -73,54 +80,72 @@ public class TourGoodSite implements Serializable {
@ApiModelProperty("地址-市(名称)")
private Integer cityName;
//出发时间
/**
* 出发时间
*/
@Column(name = "depart_time")
@ApiModelProperty(value = "出发时间")
private Long departTime;
//站点经度
/**
* 站点经度
*/
@Column(name = "longitude")
@ApiModelProperty(value = "站点经度")
private Double longitude;
//站点纬度
/**
* 站点纬度
*/
@Column(name = "latitude")
@ApiModelProperty(value = "站点纬度")
private Double latitude;
//类型:0起点,1-途径点;2-终点
/**
* 类型:0起点,1-途径点;2-终点
*/
@Column(name = "type")
@ApiModelProperty(value = "类型:0起点,1-途径点;2-终点")
private Integer type;
//排序
/**
* 排序
*/
@Column(name = "rank")
@ApiModelProperty(value = "排序")
private Integer rank;
//状态 0正常 1关闭
/**
* 状态 0正常 1关闭
*/
@Column(name = "status")
@ApiModelProperty(value = "状态 0正常 1关闭")
private Integer status;
//创建时间
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间")
private Long crtTime;
//更新时间
/**
* 更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
//站点介绍
/**
* 站点介绍
*/
@Column(name = "intro")
@ApiModelProperty(value = "站点介绍")
private String intro;
//是否删除;0-正常;1-删除
/**
* 是否删除;0-正常;1-删除
*/
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除;0-正常;1-删除")
private Integer isDel;
......
......@@ -19,38 +19,48 @@ import lombok.Data;
public class TourGoodSpe implements Serializable {
private static final long serialVersionUID = 1L;
//
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("")
private Integer id;
//商品id
/**
* 商品id
*/
@Column(name = "good_id")
@ApiModelProperty(value = "商品id")
private Integer goodId;
//规格名
/**
* 规格名
*/
@Column(name = "title")
@ApiModelProperty(value = "规格名")
private String title;
//父id
/**
* 父id
*/
@Column(name = "parent_id")
@ApiModelProperty(value = "父id")
private Integer parentId;
//创建时间
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
//更新时间
/**
* 更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
//是否删除:0-正常;1-删除
/**
* 是否删除:0-正常;1-删除
*/
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除:0-正常;1-删除")
private Integer isDel;
......
......@@ -20,66 +20,85 @@ import lombok.Data;
public class TourGoodSpePrice implements Serializable {
private static final long serialVersionUID = 1L;
//
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("")
private Integer id;
//商品id
/**
* 商品id
*/
@Column(name = "good_id")
@ApiModelProperty(value = "商品id")
private Integer goodId;
//出行时间
/**
* 出行时间
*/
@Column(name = "start_time")
@ApiModelProperty(value = "出行时间")
private Date startTime;
//结束时间
/**
* 结束时间
*/
@Column(name = "end_time")
@ApiModelProperty(value = "结束时间")
private Date endTime;
//规格id
/**
* 规格id
*/
@Column(name = "spe_id")
@ApiModelProperty(value = "规格id")
private String speId;
//价格
/**
* 价格
*/
@Column(name = "price")
@ApiModelProperty(value = "价格")
private BigDecimal price;
//儿童价格
/**
* 儿童价格
*/
@Column(name = "child_price")
@ApiModelProperty(value = "儿童价格")
private BigDecimal childPrice;
//会员价格
/**
* 会员价格
*/
@Column(name = "member_price")
@ApiModelProperty(value = "会员价格")
private String memberPrice;
//库存
/**
* 库存
*/
@Column(name = "stock")
@ApiModelProperty(value = "库存")
private Integer stock;
//创建时间
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
//更新时间
/**
* 更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
//是否删除:0-正常;1-删除
/**
* 是否删除:0-正常;1-删除
*/
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除:0-正常;1-删除")
private Integer isDel;
}
package com.xxfc.platform.tour.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -16,6 +17,7 @@ import lombok.Data;
*/
@Data
@Table(name = "tour_good_verification")
@ApiModel("旅游线路核销明细")
public class TourGoodVerification implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -28,10 +30,10 @@ public class TourGoodVerification implements Serializable {
private Integer id;
/**
* 分公司id
* 商品规格id
*/
@Column(name = "spe_id")
@ApiModelProperty(value = "日期规格id")
@ApiModelProperty(value = "商品规格id")
private Integer speId;
/**
......@@ -42,7 +44,7 @@ public class TourGoodVerification implements Serializable {
private Integer goodId;
/**
* 旅游路线id
* 出发路线id
*/
@Column(name = "site_id")
@ApiModelProperty(value = "出发路线id")
......@@ -77,5 +79,4 @@ public class TourGoodVerification implements Serializable {
@ApiModelProperty(value = "是否删除:0-正常;1-删除")
private Integer isDel;
}
package com.xxfc.platform.tour.feign;
import com.github.wxiaoqi.security.common.msg.ListRestResponse;
import com.github.wxiaoqi.security.common.annotation.BeanValid;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.tour.dto.TourSpePriceDTO;
import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.entity.TourGoodVerification;
import com.xxfc.platform.tour.entity.TourUser;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
import com.xxfc.platform.tour.vo.TourGoodOrderVo;
import com.xxfc.platform.tour.vo.TourSpePriceVo;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
......@@ -41,4 +45,31 @@ public interface TourFeign {
@GetMapping("/tourUser/app/unauth/getTourUsers")
public ObjectRestResponse<List<TourUser>> getTourUsers(@RequestParam String ids);
@GetMapping("/tourGoodVerification/entityList")
public ObjectRestResponse<List<TourGoodVerification>> entityList(@RequestParam Map<String, Object> entity);
/**
* 更新发车状态
* @param verficationId
* @return
*/
@PutMapping("/tourGood/verfication/status")
ObjectRestResponse<Void> updateTourGoodVerificationStatus(@RequestParam("verficationId") Integer verficationId);
/**
* 更新总人数或上车人数
* @param verficationId
* @param properties
* @return
*/
@PutMapping("/tourGood/verfication/personnums")
ObjectRestResponse<Void> updateTourGoodPersonNum(@RequestParam("verficationId") Integer verficationId,@RequestParam("properties") String properties);
/**
* 查询订单列表
* @param tourGoodOrderFindVo
* @return
*/
@GetMapping("/orders")
ObjectRestResponse<PageDataVO<TourGoodOrderVo>> findTourGoodOrders(@BeanValid TourGoodOrderFindVo tourGoodOrderFindVo);
}
package com.xxfc.platform.tour.vo;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
/**
* @author libin
* @version 1.0
* @description 订单列表查询条件
* @data 2019/6/14 16:32
*/
@Data
public class TourGoodOrderFindVo extends PageParam {
/**
* 公司id
*/
@NotEmpty(message = "公司id不能为空")
private Integer companyId;
/**
* 订单状态
*/
@NotEmpty(message = "订单状态不能为空")
private Integer orderStatus;
/**
*出发时间
*/
@NotEmpty(message = "出发时间不断能空")
private Date trvaelTime;
private String travelDate;
}
package com.xxfc.platform.tour.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @author libin
* @version 1.0
* @description 旅游订单列表
* @data 2019/6/14 15:19
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TourGoodOrderVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 核销订单id
*/
private Integer id;
/**
* 商品名称
*/
private String name;
/**
* 封面
*/
private String coverUrl;
/**
* 出行时间
*/
private String travelTime;
/**
* 总人数
*/
private int headcount;
/**
* 未上车人数
*/
private int tripOfNum;
/**
* 已上车人数
*/
private int leaveOfnum;
/**
* 是否出行 '状态:0-未出行;1-已出行'
*/
private Integer travelStatus;
/**
* 开始出行日期
*/
private Date startDate;
/**
* 开始出行时间
*/
private Date startTime;
}
......@@ -8,15 +8,25 @@ import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
import tk.mybatis.spring.annotation.MapperScan;
@SpringBootApplication
/**
* @author libin
* @version 1.0
* @description 旅游
* @data 2019/6/14 11:19
*/
@SpringBootApplication(scanBasePackages = {
"com.xxfc.platform",
"com.github.wxiaoqi.*"
})
@EnableDiscoveryClient
@EnableScheduling
@EnableAceAuthClient
@EnableFeignClients({"com.github.wxiaoqi.security.auth.client.feign", "com.github.wxiaoqi.security.admin.feign","com.xxfc.platform"})
@EnableAceCache
@EnableCaching
@tk.mybatis.spring.annotation.MapperScan(basePackages = "com.xxfc.platform.tour.mapper")
@MapperScan(basePackages = "com.xxfc.platform.tour.mapper")
public class TourApplication {
public static void main(String[] args) {
......
......@@ -6,6 +6,8 @@ import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGoodBanner;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
/**
* 商品轮播图
*
......@@ -15,4 +17,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class TourGoodBannerBiz extends BaseBiz<TourGoodBannerMapper,TourGoodBanner> {
//删除轮播
public void delGoodBanner(Integer goodId, List<Integer> ids){ mapper.delBanner(goodId,ids); }
}
\ No newline at end of file
......@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -45,6 +46,8 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
private TourGoodTagBiz tagBiz;
@Autowired
private TourGoodSpeBiz speBiz;
@Autowired
private TourGoodVerificationBiz verificationBiz;
@Autowired
private UserFeign userFeign;
......@@ -106,8 +109,10 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
mapper.updateByPrimaryKeySelective(good);
}
if(goodId>0){
List<GoodBannerDTO> bannerList=dto.getBannerDTOS();
if(bannerList.size()>0){
List<Integer> bannerIds=new ArrayList<>();
for (GoodBannerDTO bannerDTO:bannerList){
Integer bannerId=bannerDTO.getId();
TourGoodBanner goodBanner=new TourGoodBanner();
......@@ -117,11 +122,20 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
bannerBiz.insertSelective(goodBanner);
}else {
bannerBiz.updateSelectiveById(goodBanner);
bannerIds.add(bannerId);
}
}
if(bannerIds.size()>0){
bannerBiz.delGoodBanner(null,bannerIds);
}
}else{
bannerBiz.delGoodBanner(goodId,null);
}
List<GoodSiteDTO> siteDTOList=dto.getSiteDTOS();
List<Integer> sites=new ArrayList<>();
if(siteDTOList.size()>0){
List<Integer> siteIds=new ArrayList<>();
for (GoodSiteDTO siteDTO:siteDTOList){
Integer siteId=siteDTO.getId();
TourGoodSite site=new TourGoodSite();
......@@ -129,14 +143,22 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
site.setGoodId(goodId);
if(siteId==null||siteId==0){
siteBiz.insertSelective(site);
siteId=site.getId();
}else {
siteBiz.updateById(site);
siteIds.add(siteId);
}
if(site.getType()==0){
sites.add(siteId);
}
}
if(siteIds.size()>0){
siteBiz.delGoodSite(null,siteIds);
}
}
List<GoodTagDTO> tagList=dto.getTagDTOS();
if(siteDTOList.size()>0){
List<Integer> tagIds=new ArrayList<>();
for (GoodTagDTO tagDTO:tagList){
Integer tagId=tagDTO.getId();
TourGoodTag tag=new TourGoodTag();
......@@ -146,11 +168,19 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
tagBiz.insertSelective(tag);
}else {
tagBiz.updateById(tag);
tagIds.add(tagId);
}
}
if(tagIds.size()>0){
tagBiz.delGoodTag(null,tagIds);
}
}else{
tagBiz.delGoodTag(goodId,null);
}
List<GoodSpePriceDTO> priceDTOList=dto.getPriceDTOS();
List<Integer> prices=new ArrayList<>();
if(siteDTOList.size()>0){
List<Integer> priceIds=new ArrayList<>();
for (GoodSpePriceDTO priceDTO:priceDTOList){
Integer priceId=priceDTO.getId();
TourGoodSpePrice spePrice=new TourGoodSpePrice();
......@@ -183,11 +213,52 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
}
if(priceId==null||priceId==0){
speBiz.insertSelective(spePrice);
priceId=spePrice.getId();
}else {
speBiz.updateById(spePrice);
priceIds.add(priceId);
}
prices.add(priceId);
}
if(priceIds.size()>0){
speBiz.delGoodSpe(null,priceIds);
}
}
if(sites.size()>0){
List<Integer> vids=new ArrayList<>();
List<TourGoodVerification> verifications=new ArrayList<>();
for (Integer siteId:sites){
if(prices.size()>0){
for(Integer priceId:prices){
TourGoodVerification verification=new TourGoodVerification();
verification.setGoodId(goodId);
verification.setSiteId(siteId);
verification.setSpeId(priceId);
verification.setIsDel(0);
TourGoodVerification verification1=verificationBiz.selectOne(verification);
if(verification1==null){
verification.setTotalPerson(0);
verification.setVerificationPerson(0);
verification.setStatus(0);
verifications.add(verification);
}else {
vids.add(verification1.getId());
}
}
}
}
if(vids.size()>0){
verificationBiz.delGoodVerification(vids);
}
if(verifications.size()>0){
verificationBiz.addBathTourGoodVerification(verifications);
}
}
List<TourGoodVerification> verifications=new ArrayList<>();
}
} catch (IllegalAccessException e) {
e.printStackTrace();
......
......@@ -6,6 +6,8 @@ import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGoodSite;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
/**
* 路线站点表
*
......@@ -15,4 +17,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class TourGoodSiteBiz extends BaseBiz<TourGoodSiteMapper,TourGoodSite> {
//删除站点
public void delGoodSite(Integer goodId, List<Integer> ids){ mapper.delSite(goodId,ids);}
}
\ No newline at end of file
......@@ -15,6 +15,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
/**
* 旅游商品规格表
......@@ -92,5 +93,8 @@ public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpeP
}
}
//删除
public void delGoodSpe(Integer goodId, List<Integer> ids){ mapper.delSpe(goodId,ids);}
}
\ No newline at end of file
......@@ -6,6 +6,8 @@ import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGoodTag;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
/**
* 商品标签表
*
......@@ -16,4 +18,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
@Service
public class TourGoodTagBiz extends BaseBiz<TourGoodTagMapper,TourGoodTag> {
//删除标签
public void delGoodTag(Integer goodId, List<Integer> ids){ mapper.delTag(goodId,ids);}
}
\ No newline at end of file
package com.xxfc.platform.tour.biz;
import cn.hutool.core.date.DateUtil;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
import com.xxfc.platform.tour.vo.TourGoodOrderVo;
import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGoodVerification;
import com.xxfc.platform.tour.mapper.TourGoodVerificationMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.*;
/**
* 旅游线路核销明细
*
......@@ -14,4 +20,58 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class TourGoodVerificationBiz extends BaseBiz<TourGoodVerificationMapper,TourGoodVerification> {
//删除线路核销
public void delGoodVerification(List<Integer> ids){ mapper.delVerification(ids);}
/**
* 批量插入核销
* @param tourGoodVerifications
*/
public void addBathTourGoodVerification(List<TourGoodVerification> tourGoodVerifications){
for (TourGoodVerification tourGoodVerification:tourGoodVerifications){
mapper.insertTourGoodVerification(tourGoodVerification);
}
}
/**
* 分页查询订单列表
* @param tourGoodOrderFindVo
* @return
*/
public PageDataVO<TourGoodOrderVo> findTourGoodOrdersPage(TourGoodOrderFindVo tourGoodOrderFindVo) {
Date trvaelTime = tourGoodOrderFindVo.getTrvaelTime();
String dateStr = DateUtil.format(trvaelTime, "YYYY-MM-dd");
tourGoodOrderFindVo.setTravelDate(dateStr);
PageDataVO<TourGoodOrderVo> tourGoodOrderVoPageDataVO= PageDataVO.pageInfo(tourGoodOrderFindVo.getPage(), tourGoodOrderFindVo.getLimit(), () -> mapper.findVerificationAll(tourGoodOrderFindVo));
List<TourGoodOrderVo> tourGoodOrderVos = tourGoodOrderVoPageDataVO.getData();
tourGoodOrderVos.stream().peek(tourGoodOrderVo -> {
tourGoodOrderVo.setLeaveOfnum(tourGoodOrderVo.getHeadcount()-tourGoodOrderVo.getTripOfNum());
String startDateStr = DateUtil.format(tourGoodOrderVo.getStartDate(),"YYYY.MM.dd");
tourGoodOrderVo.setTravelTime(startDateStr);
}).count();
return tourGoodOrderVoPageDataVO;
}
/**
* 更改发车状态
* @param verficationId
* @return
*/
public int updateTourGoodVerificationStatus(Integer verficationId){
return mapper.updateStatusByGoodIdAndSpeIdAndSiteId(verficationId,0);
}
/**
* 更新总人数 或 上车人数
* @param verficationId
* @param properties
* @return
*/
public int updateTourGoodPersonNum(Integer verficationId,String properties){
return mapper.updateTourGoodPerNumbs(verficationId,properties);
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.tour.dto.TourTagBannerDTO;
import com.xxfc.platform.tour.mapper.TourTagBannerMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
......@@ -108,7 +109,13 @@ public class TourTagBannerBiz extends BaseBiz<TourTagBannerMapper,TourTagBanner>
@Transactional(rollbackFor = Exception.class)
public void updateTourBannerByBatch(List<TourTagBannerDTO> tourTagBannerDTOS,UserDTO userDTO) {
List<Long> tourTagBannerIds = tourTagBannerDTOS.stream().filter(tourTagBannerDTO -> Objects.nonNull(tourTagBannerDTO.getId())).map(TourTagBannerDTO::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(tourTagBannerIds)){
mapper.updateTourBannerStatusByTagannerIdsAndTagId(tourTagBannerIds,tourTagBannerDTOS.get(0).getTagId(),1);
}else {
if (CollectionUtils.isNotEmpty(tourTagBannerDTOS)){
mapper.updateTourTagBannerStatusByTagId(tourTagBannerDTOS.get(0).getTagId(),1,Instant.now().toEpochMilli());
}
}
tourTagBannerDTOS.stream().filter(tourTagBannerDTO -> Objects.isNull(tourTagBannerDTO.getId())).peek(tourTagBannerDTO -> {
save(tourTagBannerDTO,userDTO);
}).count();
......
......@@ -198,8 +198,8 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
* @param name
* @return
*/
public boolean checkTagNameExist(String name) {
List<TourTag> tourTags = mapper.findByTagName(name);
public boolean checkTagNameExist(String name,Integer id) {
List<TourTag> tourTags = mapper.findByTagName(name,id);
return CollectionUtils.isNotEmpty(tourTags);
}
......
......@@ -18,4 +18,7 @@ public interface TourGoodBannerMapper extends Mapper<TourGoodBanner> {
//查询旅游路线列表
public List<GoodBannerDTO> getBannerList(@Param("goodId")Integer goodId);
//删除Banner
public int delBanner(@Param("goodId")Integer goodId,@Param("list")List<Integer> ids);
}
......@@ -19,4 +19,7 @@ public interface TourGoodSiteMapper extends Mapper<TourGoodSite> {
public List<TourDepartVo> getlistByGoodId(@Param("goodId") Integer goodId);
//删除站点
public int delSite(@Param("goodId")Integer goodId,@Param("list")List<Integer> ids);
}
......@@ -21,6 +21,9 @@ public interface TourGoodSpePriceMapper extends Mapper<TourGoodSpePrice> {
//减库存
int updStockById(@Param("id") Integer id,@Param("number") Integer number);
//删除站点
public int delSpe(@Param("goodId")Integer goodId,@Param("list")List<Integer> ids);
}
......@@ -20,6 +20,9 @@ public interface TourGoodTagMapper extends Mapper<TourGoodTag> {
//查询旅游标签
public List<GoodTagDTO> getGoodTagList(@Param("goodId") Integer goodId);
//删除站点
public int delTag(@Param("goodId")Integer goodId,@Param("list")List<Integer> ids);
}
......@@ -2,8 +2,15 @@ package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourGoodVerification;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
import com.xxfc.platform.tour.vo.TourGoodOrderVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* 旅游线路核销明细
*
......@@ -13,4 +20,39 @@ import tk.mybatis.mapper.common.Mapper;
*/
public interface TourGoodVerificationMapper extends Mapper<TourGoodVerification> {
//删除线路核销
public int delVerification( @Param("list") List<Integer> ids);
/**
* 保存线路核销
* @param tourGoodVerification
* @return
*/
@Insert("insert into tour_good_verification(`spe_id`,`site_id`,`good_id`)values(#{speId} ,#{siteId} ,#{goodId}) where `spe_id`<>#{spId} and `site_id`<>#{siteId} and `good_id`<>#{goodId}")
int insertTourGoodVerification(TourGoodVerification tourGoodVerification);
/**
* 更新总人数 或 上车人数
* @param properties
* @return
*/
@Update("update tour_good_verification set ${properties}=${properties}+1 where `id`=#{verficationId}")
int updateTourGoodPerNumbs(@Param("verficationId") Integer verficationId,@Param("properties") String properties);
/**
* 更新出发状态
* @param status
* @param verficationId
* @return
*/
@Update("update tour_good_verification set `status`=#{status} where where `id`=#{verficationId}")
int updateStatusByGoodIdAndSpeIdAndSiteId(@Param("verficationId") Integer verficationId,@Param("status") Integer status);
/**
* 查询核销订单
* @param tourGoodOrderFindVo
* @return
*/
List<TourGoodOrderVo> findVerificationAll(TourGoodOrderFindVo tourGoodOrderFindVo );
}
......@@ -17,9 +17,20 @@ import java.util.List;
*/
@Repository
public interface TourTagMapper extends Mapper<TourTag> {
/**
* 根据热度查询标签
* @param tag
* @return
*/
@Select("select * from tour_tag where is_del=#{isDel} and is_hot=#{isHot} order by rank ASC")
List<TourTag> findHotListTag(TourTag tag);
/**
* 根据删除状态查询标签
* @param tagBanner
* @return
*/
@Select("select * from tour_tag where is_del=#{isDel} order by rank ASC")
@ResultMap(value = "tourTagMap")
List<TourTag> findAllByIsDel(TourTag tagBanner);
......@@ -49,16 +60,37 @@ public interface TourTagMapper extends Mapper<TourTag> {
@Update("update tour_tag set `is_del`=#{status} where `id`=#{id}")
int updateTourTagStatusById(@Param("id") Integer id, @Param("status") int status);
/**
* 编辑标签
* @param tourTagDTO
* @return
*/
@Update("update tour_tag set `name`=#{name},`img`=#{img},`describe`=#{describe},`link`=#{link}" +
",`rank`=#{rank},`upd_time`=#{updTime} where `id`=#{id}")
int updateTourTag(TourTagDTO tourTagDTO);
/**
* 更新标签热度
* @param id
* @param state
* @return
*/
@Update("update tour_tag set `is_hot`=#{state} where `id`=#{id}")
int updateTourTagHotSate(@Param("id") Integer id, @Param("state") Integer state);
@Select("select * from tour_tag where name=#{name}")
List<TourTag> findByTagName(String name);
/**
* 检测标签名是否存在
* @param name
* @param id
* @return
*/
List<TourTag> findByTagName(@Param("name") String name,@Param("id") Integer id);
/**
*根据状态查询 标签
* @param status
* @return
*/
@Select("select `id`,`name` from tour_tag where `is_del`=#{status}")
List<TourTag> selectByStuatus(Integer status);
}
package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.common.annotation.BeanValid;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.tour.biz.TourGoodVerificationBiz;
import com.xxfc.platform.tour.entity.TourGoodVerification;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
import com.xxfc.platform.tour.vo.TourGoodOrderVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/tourGood/verfication")
@IgnoreClientToken
public class TourGoodVerificationController extends BaseController<TourGoodVerificationBiz, TourGoodVerification> {
/**
* 查询订单列表
* @param tourGoodOrderFindVo
* @return
*/
@ApiOperation("订单列表的查询")
@GetMapping("/orders")
public ObjectRestResponse<PageDataVO<TourGoodOrderVo>> findTourGoodOrders(@BeanValid TourGoodOrderFindVo tourGoodOrderFindVo){
PageDataVO<TourGoodOrderVo> tourGoodOrderPageDataVo = getBaseBiz().findTourGoodOrdersPage(tourGoodOrderFindVo);
return ObjectRestResponse.succ(tourGoodOrderPageDataVo);
}
/**
* 更新发车状态
* @param verficationId
* @return
*/
@PutMapping("/status")
@ApiOperation("更新发车状态")
public ObjectRestResponse<Void> updateTourGoodVerificationStatus(@RequestParam("verficationId") Integer verficationId){
int effectRows = getBaseBiz().updateTourGoodVerificationStatus(verficationId);
if (effectRows>0){
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail();
}
/**
* 更新总人数或上车人数
* @param verficationId
* @param properties
* @return
*/
@PutMapping("/personnums")
@ApiOperation("更新总人数或上车人数")
public ObjectRestResponse<Void> updateTourGoodPersonNum(@RequestParam("verficationId") Integer verficationId,@RequestParam("properties") String properties){
int effectRows = getBaseBiz().updateTourGoodPersonNum(verficationId,properties);
if (effectRows>0){
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail();
}
}
\ No newline at end of file
......@@ -125,8 +125,8 @@ public class TourTagAdminController extends TourBaseController<TourTagBiz> {
*/
@GetMapping("/exist")
@ApiOperation("校验标签名是否存在")
public ObjectRestResponse checkTagNameExists(@RequestParam("name") String name){
boolean exist = getBaseBiz().checkTagNameExist(name);
public ObjectRestResponse checkTagNameExists(@RequestParam("name") String name,@RequestParam(value = "id",required = false) Integer id){
boolean exist = getBaseBiz().checkTagNameExist(name,id);
return ObjectRestResponse.succ(exist);
}
......
......@@ -20,4 +20,22 @@
select * FROM tour_good_banner where good_id=#{goodId} and is_del=0
</select>
<update id="delBanner">
update tour_good_banner set is_del=1
where 1=1
<if test="goodId !=null and goodId >0 ">
and good_id=#{goodId}
</if>
<if test="list!=null ">
and id not in (
<trim suffixOverrides=",">
<foreach collection="list" item="id">
#{id},
</foreach>
</trim>
)
</if>
</update>
</mapper>
\ No newline at end of file
......@@ -42,6 +42,22 @@
SELECT * FROM tour_good_site
WHERE good_id=#{goodId} and is_del=0
</select>
<update id="delSite">
update tour_good_site set is_del=1
where 1=1
<if test="goodId !=null and goodId >0 ">
and good_id=#{goodId}
</if>
<if test="list!=null ">
and id not in (
<trim suffixOverrides=",">
<foreach collection="list" item="id">
#{id},
</foreach>
</trim>
)
</if>
</update>
</mapper>
\ No newline at end of file
......@@ -46,6 +46,24 @@
update tour_good_spe_price set stock=stock-#{number} where id=#{id}
</update>
<update id="delSpe">
update tour_good_spe_price set is_del=1
where 1=1
<if test="goodId !=null and goodId >0 ">
and good_id=#{goodId}
</if>
<if test="list!=null ">
and id not in (
<trim suffixOverrides=",">
<foreach collection="list" item="id">
#{id},
</foreach>
</trim>
)
</if>
</update>
</mapper>
\ No newline at end of file
......@@ -26,4 +26,22 @@
WHERE g.id=#{goodId} and tag.is_del=0
</select>
<update id="delTag">
update tour_good_tag set is_del=1
where 1=1
<if test="goodId !=null and goodId >0 ">
and good_id=#{goodId}
</if>
<if test="list!=null ">
and id not in (
<trim suffixOverrides=",">
<foreach collection="list" item="id">
#{id},
</foreach>
</trim>
)
</if>
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="package com.xxfc.platform.tour.mapper.TourGoodVerificationMapper">
<mapper namespace="com.xxfc.platform.tour.mapper.TourGoodVerificationMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="package com.xxfc.platform.tour.entity.TourGoodVerification" id="tourGoodVerificationMap">
<resultMap type="com.xxfc.platform.tour.entity.TourGoodVerification" id="tourGoodVerificationMap">
<result property="id" column="id"/>
<result property="companyId" column="company_id"/>
<result property="speId" column="spe_id"/>
<result property="siteId" column="site_id"/>
<result property="goodId" column="good_id"/>
<result property="departTime" column="depart_time"/>
<result property="totalPerson" column="total_person"/>
<result property="verificationPerson" column="verification_person"/>
<result property="status" column="status"/>
<result property="isDel" column="is_del"/>
</resultMap>
<update id="delVerification">
update tour_good_verification set is_del=1
where total_person=0 and verification_person=0
<if test="list!=null ">
and id not in (
<trim suffixOverrides=",">
<foreach collection="list" item="id">
#{id},
</foreach>
</trim>
)
</if>
</update>
<select id="findVerificationAll" resultType="com.xxfc.platform.tour.vo.TourGoodOrderVo">
select * from (SELECT v.id as `id`,v.total_person as `headcount`,v.status as `travelStatus`,v.verification_person as `tripOfNum`,g.name as `name`,
g.cover as `coverUrl`,p.start_time as `startDate`,s.depart_time as `startTime`FROM tour_good_verification v
LEFT JOIN tour_good_site s ON v.site_id=s.id
LEFT JOIN tour_good g ON v.good_id=g.id
LEFT JOIN tour_good_spe_price p ON v.spe_id=p.id
WHERE s.company_id=#{companyId} and v.status=#{orderStatus} and p.start_time=#{travelDate} ) as `goodOrder`
</select>
</mapper>
\ No newline at end of file
......@@ -23,4 +23,9 @@
values(#{name},#{img},#{describe},#{rank},#{ctrTime})
</insert>
<select id="findByTagName" resultMap="tourTagMap">
select * from tour_tag where name=#{name} <if test="id!=null">
AND `id` not in (#{id})
</if>;
</select>
</mapper>
\ No newline at end of file
......@@ -9,7 +9,10 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {
"com.xxfc.platform",
"com.github.wxiaoqi.*"
})
@EnableDiscoveryClient
@EnableAceAuthClient
@EnableAceCache
......
......@@ -8,15 +8,16 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {
"com.xxfc.platform",
"com.github.wxiaoqi.*"
})
@EnableDiscoveryClient
@EnableScheduling
@EnableAceAuthClient
@EnableFeignClients({"com.github.wxiaoqi.security.auth.client.feign", "com.github.wxiaoqi.security.admin.feign","com.xxfc.platform.vehicle.feign"})
@EnableAceCache
@tk.mybatis.spring.annotation.MapperScan(basePackages = "com.xxfc.platform.vehicle.mapper")
//@MapperScan("com.xxfc.platform.vehicle.mapper")
public class VehicleApplication {
public static void main(String[] args) {
......
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