Commit 45f6a3b5 authored by libin's avatar libin

banner

parents d3769c23 76db2a7d
...@@ -13,7 +13,7 @@ import tk.mybatis.spring.annotation.MapperScan; ...@@ -13,7 +13,7 @@ import tk.mybatis.spring.annotation.MapperScan;
*/ */
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableFeignClients(defaultConfiguration = HeaderConfig.class) @EnableFeignClients
@MapperScan("com.github.wxiaoqi.security.auth.mapper") @MapperScan("com.github.wxiaoqi.security.auth.mapper")
//@EnableAutoConfiguration //@EnableAutoConfiguration
public class AuthBootstrap { public class AuthBootstrap {
......
...@@ -6,6 +6,7 @@ package com.github.wxiaoqi.security.common.constant; ...@@ -6,6 +6,7 @@ package com.github.wxiaoqi.security.common.constant;
public class CommonConstants { public class CommonConstants {
public static final Integer SYS_TRUE = 1; public static final Integer SYS_TRUE = 1;
public static final Integer SYS_FALSE = 0; public static final Integer SYS_FALSE = 0;
public static final Integer SYS_JSON_TRUE = 200;
public final static String RESOURCE_TYPE_MENU = "menu"; public final static String RESOURCE_TYPE_MENU = "menu";
public final static String RESOURCE_TYPE_BTN = "button"; public final static String RESOURCE_TYPE_BTN = "button";
// 用户token异常 // 用户token异常
......
...@@ -54,7 +54,7 @@ public class BaseException extends RuntimeException { ...@@ -54,7 +54,7 @@ public class BaseException extends RuntimeException {
} }
public BaseException(int code, Map<String, Object> map) { public BaseException(int code, Map<String, Object> map) {
super(ResultCode.getMsg(code)); super(ResultCode.getMsg(code) + (map == null? "" : map.toString()));
this.status = code; this.status = code;
} }
} }
...@@ -132,11 +132,11 @@ public class ResultCode { ...@@ -132,11 +132,11 @@ public class ResultCode {
// 账户已禁用 // 账户已禁用
public static int ACCOUNTINFO_ISDEL = Integer.valueOf(SystemProperty.getResultConfig("ACCOUNTINFO_ISDEL")); public static int ACCOUNTINFO_ISDEL = Integer.valueOf(SystemProperty.getResultConfig("ACCOUNTINFO_ISDEL"));
// 监控设备不存在 // // 监控设备不存在
public static int DEVICE_NOTEXIST_CODE = Integer.valueOf(SystemProperty.getResultConfig("DEVICE_NOTEXIST_CODE")); // public static int DEVICE_NOTEXIST_CODE = Integer.valueOf(SystemProperty.getResultConfig("DEVICE_NOTEXIST_CODE"));
// 设备access_token获取失败 // // 设备access_token获取失败
public static int DEVICE_TOKEN_NOTEXIST_CODE = Integer // public static int DEVICE_TOKEN_NOTEXIST_CODE = Integer
.valueOf(SystemProperty.getResultConfig("DEVICE_TOKEN_NOTEXIST_CODE")); // .valueOf(SystemProperty.getResultConfig("DEVICE_TOKEN_NOTEXIST_CODE"));
// 操作频繁提示 // 操作频繁提示
public static int API_MAX_CODE = Integer.valueOf(SystemProperty.getResultConfig("API_MAX_CODE")); public static int API_MAX_CODE = Integer.valueOf(SystemProperty.getResultConfig("API_MAX_CODE"));
......
...@@ -154,10 +154,10 @@ NICKNAME_NULL_CODE=9006 ...@@ -154,10 +154,10 @@ NICKNAME_NULL_CODE=9006
ACCOUNTINFO_ISDEL=9007 ACCOUNTINFO_ISDEL=9007
9007=账户已禁用 9007=账户已禁用
DEVICE_NOTEXIST_CODE=1005 #DEVICE_NOTEXIST_CODE=1005
1005=监控设备不存在 #1005=监控设备不存在
DEVICE_TOKEN_NOTEXIST_CODE=1006 #DEVICE_TOKEN_NOTEXIST_CODE=1006
1005=设备access_token获取失败 #1005=设备access_token获取失败
REPEAT_SUB_CODE=1008 REPEAT_SUB_CODE=1008
......
...@@ -240,6 +240,7 @@ public class AppPermissionService { ...@@ -240,6 +240,7 @@ public class AppPermissionService {
userLogin.setImUserid(imUserId); userLogin.setImUserid(imUserId);
userLogin.setUsername(username); userLogin.setUsername(username);
appUserLoginBiz.updateSelectiveById(userLogin); appUserLoginBiz.updateSelectiveById(userLogin);
log.info(username+"----userLogin updateSelectiveById---username====="+username+"----imPassword===="+imPassword);
} }
data.put("imToken",access_token); data.put("imToken",access_token);
data.put("imUserId",imUserId); data.put("imUserId",imUserId);
......
...@@ -22,6 +22,6 @@ public interface CofigMapper extends Mapper<Cofig> { ...@@ -22,6 +22,6 @@ public interface CofigMapper extends Mapper<Cofig> {
* @param cofig * @param cofig
* @return * @return
*/ */
@Update("update config set `title`=#{title},`value`=#{value}`,`type`=#{type},`upd_time`=#{updTime} where `id`=#{id}") @Update("update config `cf` set cf.title=#{title},cf.value=#{value},cf.type=#{type},cf.upd_time=#{updTime} where cf.id=#{id}")
int updateConfig(Cofig cofig); int updateConfig(Cofig cofig);
} }
...@@ -22,3 +22,4 @@ spring: ...@@ -22,3 +22,4 @@ spring:
nacos: nacos:
config: config:
server-addr: 10.5.52.2:8848 server-addr: 10.5.52.2:8848
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<module>xx-common-platform</module> <module>xx-common-platform</module>
<module>xx-common-platform-web</module> <module>xx-common-platform-web</module>
<module>xx-common-platform-component</module> <module>xx-common-platform-component</module>
<module>xx-common-demo</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
...@@ -11,17 +11,44 @@ ...@@ -11,17 +11,44 @@
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
<artifactId>xx-common-platform-component</artifactId> <artifactId>xx-common-platform-component</artifactId>
<properties>
<swagger.version>2.9.2</swagger.version>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId> <artifactId>spring-cloud-starter-openfeign</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-configuration-processor -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>com.github.wxiaoqi</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>ace-common</artifactId>
<version>4.0.1</version> <version>2.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -2,6 +2,7 @@ package com.xxfc.platform.common.config; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.common.config;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import feign.RequestTemplate; import feign.RequestTemplate;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
...@@ -17,8 +18,6 @@ import java.util.Enumeration; ...@@ -17,8 +18,6 @@ import java.util.Enumeration;
* @description 设置请求头部信息,防止微服务之间调用请求头部信息丢失 * @description 设置请求头部信息,防止微服务之间调用请求头部信息丢失
* @data 2019/6/25 16:22 * @data 2019/6/25 16:22
*/ */
@Configuration
@Component
public class HeaderConfig implements RequestInterceptor { public class HeaderConfig implements RequestInterceptor {
@Override @Override
......
package com.xxfc.platform.common.config; package com.xxfc.platform.common.config;
import io.swagger.annotations.Api;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
* @description TODO * @description 通用swagger设置
* @data 2019/6/26 10:28 * @data 2019/6/26 10:28
*/ */
@Profile(value = {"dev","test"})
@ConditionalOnClass(value = EnableSwagger2.class)
@ConditionalOnProperty(prefix = "xxfc",name = "swagger",havingValue = "true")
@EnableSwagger2
@Setter
public class SwaggerConfig { public class SwaggerConfig {
@Value("${xxfc.swagger.title:xxfc api swagger document}")
private String title;
@Value("${xxfc.swagger.description:前后端联调xxfc api 文档}")
private String description;
@Value("${xxfc.swagger.version:1.0.0}")
private String version;
@Value("${jwt.tokenHeader:Authorization}")
private String header;
@Bean
public Docket docket(){
ParameterBuilder ticketPar = new ParameterBuilder();
List<Parameter> parameters = new ArrayList<Parameter>();
ticketPar.name(header).description("user Authorization")
.modelRef(new ModelRef("string")).parameterType("header")
//header中的ticket参数非必填,传空也可以
.required(false).build();
//根据每个方法名也知道当前方法在设置什么参数
parameters.add(ticketPar.build());
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
.paths(PathSelectors.any())
.build()
.globalOperationParameters(parameters);
}
private ApiInfo apiInfo(){
return new ApiInfoBuilder()
.title(title)
.description(description)
.version(version)
.build();
}
} }
...@@ -5,8 +5,10 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign; ...@@ -5,8 +5,10 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.msg.BaseResponse; import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.xxfc.platform.im.model.User; import com.xxfc.platform.im.model.User;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
...@@ -23,6 +25,7 @@ import java.util.HashMap; ...@@ -23,6 +25,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Component @Component
@Slf4j
public class UserBiz { public class UserBiz {
@Autowired @Autowired
...@@ -31,6 +34,9 @@ public class UserBiz { ...@@ -31,6 +34,9 @@ public class UserBiz {
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
@Value("${im.url}")
String imUrl;
/** /**
* 注册 * 注册
* @param map * @param map
...@@ -48,8 +54,7 @@ public class UserBiz { ...@@ -48,8 +54,7 @@ public class UserBiz {
if(map.get("nickname") != null && !("").equals(map.get("nickname"))){ if(map.get("nickname") != null && !("").equals(map.get("nickname"))){
str += "nickname="+map.get("nickname").toString(); str += "nickname="+map.get("nickname").toString();
} }
String result = this.doPost("http://10.5.52.3:6688/xxfcim/user/register",str) ; String result = this.doPost(imUrl + "/xxfcim/user/register",str) ;
JSONObject json = JSONObject.parseObject(result); JSONObject json = JSONObject.parseObject(result);
//如果已经注册过,查询出手机号对应用户信息执行登录返回 //如果已经注册过,查询出手机号对应用户信息执行登录返回
if(0 == json.getInteger("resultCode")){ if(0 == json.getInteger("resultCode")){
...@@ -72,6 +77,7 @@ public class UserBiz { ...@@ -72,6 +77,7 @@ public class UserBiz {
baseResponse.setStatus(200); baseResponse.setStatus(200);
baseResponse.setMessage(result); baseResponse.setMessage(result);
log.info("用户注册:result = {}, telephone = {}, password = {}, nickname = {}", result, map.get("telephone"), map.get("password"), map.get("nickname"));
return baseResponse; return baseResponse;
} }
...@@ -93,8 +99,9 @@ public class UserBiz { ...@@ -93,8 +99,9 @@ public class UserBiz {
str += "password="+map.get("password").toString(); str += "password="+map.get("password").toString();
} }
str += "&areaCode=86"; str += "&areaCode=86";
String result = this.doPost("http://10.5.52.3:6688/xxfcim/user/login",str) ; String result = this.doPost(imUrl + "/xxfcim/user/login",str) ;
JSONObject json = JSONObject.parseObject(result); JSONObject json = JSONObject.parseObject(result);
log.info("用户登录:result = {}, telephone = {}, password = {}, userId = {}", result, map.get("telephone"), map.get("password"), map.get("userId"));
json.put("password",map.get("password").toString()); json.put("password",map.get("password").toString());
return json.toJSONString(); return json.toJSONString();
} }
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
and is_del = #{isDel} and is_del = #{isDel}
</if> </if>
</where> </where>
order by time DESC order by praise_count, comment_count DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
package com.xxfc.platform.order.entity;
import lombok.Data;
import javax.persistence.*;
@Table(name = "order_user_license")
@Data
public class OrderUserLicense {
@Id
private Integer id;
/**
* 驾驶人
*/
@Column(name = "license_name")
private String licenseName;
/**
* 驾驶人手机号
*/
@Column(name = "license_phone")
private String licensePhone;
/**
* 驾驶人身份证号
*/
@Column(name = "license_id_card")
private String licenseIdCard;
/**
* 驾驶证照
*/
@Column(name = "license_img")
private String licenseImg;
}
\ No newline at end of file
package com.xxfc.platform.order.entity; package com.xxfc.platform.order.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.RequiredArgsConstructor;
import javax.persistence.*; import javax.persistence.*;
@Table(name = "order_vehicle_crosstown") @Table(name = "order_vehicle_crosstown")
@Data @Data
@RequiredArgsConstructor
public class OrderVehicaleCrosstown { public class OrderVehicaleCrosstown {
/** /**
* 主键id * 主键id
...@@ -28,23 +25,6 @@ public class OrderVehicaleCrosstown { ...@@ -28,23 +25,6 @@ public class OrderVehicaleCrosstown {
@Column(name = "order_no") @Column(name = "order_no")
private String orderNo; private String orderNo;
/**
* 驾驶人
*/
@Column(name = "license_name")
private String licenseName;
/**
* 驾驶人手机号
*/
@Column(name = "license_phone")
private String licensePhone;
/**
* 驾驶证照
*/
@Column(name = "license_img")
private String licenseImg;
/** /**
* 公里数(公里) * 公里数(公里)
...@@ -122,11 +102,6 @@ public class OrderVehicaleCrosstown { ...@@ -122,11 +102,6 @@ public class OrderVehicaleCrosstown {
*/ */
private String dedDetail; private String dedDetail;
/**
* 驾驶人身份证号
*/
private String licenseIdCard;
/** /**
* 1、交车, 2、还车 * 1、交车, 2、还车
*/ */
...@@ -141,4 +116,9 @@ public class OrderVehicaleCrosstown { ...@@ -141,4 +116,9 @@ public class OrderVehicaleCrosstown {
* 剩余押金 * 剩余押金
*/ */
private Integer restDeposit; private Integer restDeposit;
/**
* 驾驶人Id
*/
private String userLicenseId;
} }
\ No newline at end of file
...@@ -15,14 +15,19 @@ public class OrderPageVO extends BaseOrder { ...@@ -15,14 +15,19 @@ public class OrderPageVO extends BaseOrder {
public static final String NO = "no="; public static final String NO = "no=";
OrderRentVehicleDetail orderRentVehicleDetail; OrderRentVehicleDetail orderRentVehicleDetail;
OrderTourDetail orderTourDetail; OrderTourDetail orderTourDetail;
List<VehicleUserLicense> vehicleUserLicenses; List<VehicleUserLicense> vehicleUserLicenses;
private String username; private String username;
private String vehicalNumberPlat; private String vehicalNumberPlat;
private String qrcodeStr; private String qrcodeStr;
private OrderVehicleCrosstownDto orderVehicleCrosstownDto;
public void setQrcodeStr(String prefix) { public void setQrcodeStr(String prefix) {
this.qrcodeStr = prefix+ "?"+ TYPE+ getType()+ "&"+ NO+ getNo(); this.qrcodeStr = prefix+ "?"+ TYPE+ getType()+ "&"+ NO+ getNo();
} }
......
package com.xxfc.platform.order.pojo.order;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown;
import lombok.Data;
@Data
public class OrderVehicleCrosstownDto extends OrderVehicaleCrosstown {
String userLicenses;
/**
* 驾驶人
*/
private String licenseName;
/**
* 驾驶人手机号
*/
private String licensePhone;
/**
* 驾驶证照
*/
private String licenseImg;
/**
* 驾驶人身份证号
*/
private String licenseIdCard;
}
...@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.admin.dto.UserMemberDTO; ...@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum; import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
...@@ -13,9 +14,11 @@ import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum; ...@@ -13,9 +14,11 @@ import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.BaseOrderMapper; import com.xxfc.platform.order.mapper.BaseOrderMapper;
import com.xxfc.platform.order.pojo.order.OrderPageVO; import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import com.xxfc.platform.tour.feign.TourFeign; import com.xxfc.platform.tour.feign.TourFeign;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.vo.OrderRefundVo; import com.xxfc.platform.universal.vo.OrderRefundVo;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense; import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -52,6 +55,12 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -52,6 +55,12 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
@Autowired @Autowired
OrderRentVehicleBiz orderRentVehicleBiz; OrderRentVehicleBiz orderRentVehicleBiz;
@Autowired
OrderVehicalCrosstownBiz orderVehicalCrosstownBiz;
@Autowired
OrderUserLicenseBiz orderUserLicenseBiz;
@Autowired @Autowired
OrderRefundBiz orderRefundBiz; OrderRefundBiz orderRefundBiz;
...@@ -100,27 +109,56 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -100,27 +109,56 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
* @param no * @param no
* @return * @return
*/ */
public OrderPageVO getOrderDetail(String no) { public ObjectRestResponse getOrderDetail(String no) {
OrderPageVO orderPageVo = mapper.getOrderDetail(no); OrderPageVO orderPageVo = mapper.getOrderDetail(no);
String myDriverIds = orderPageVo.getOrderRentVehicleDetail().getMyDriverIds(); if(orderPageVo == null) {
return ObjectRestResponse.createDefaultFail();
}
if(orderPageVo.getStatus() >= 5) {//出行中 已交车
OrderVehicleCrosstownDto orderVehicleCrosstownDto = new OrderVehicleCrosstownDto();
orderVehicleCrosstownDto.setOrderId(orderPageVo.getId());
orderVehicleCrosstownDto.setOrderNo(orderPageVo.getNo());
List<OrderVehicaleCrosstown> orderVehicaleCrosstowns = orderVehicalCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto);
if(orderVehicaleCrosstowns != null && orderVehicaleCrosstowns.size() > 0) {
List<OrderUserLicense> orderUserLicenses = orderUserLicenseBiz.selectByIds(orderVehicaleCrosstowns.get(0).getUserLicenseId()).getData();
if(orderUserLicenses != null && orderUserLicenses.size() > 0) {
orderVehicleCrosstownDto.setLicenseIdCard(orderUserLicenses.get(0).getLicenseIdCard());
orderVehicleCrosstownDto.setLicenseImg(orderUserLicenses.get(0).getLicenseImg());
orderVehicleCrosstownDto.setLicenseName(orderUserLicenses.get(0).getLicenseName());
orderVehicleCrosstownDto.setLicensePhone(orderUserLicenses.get(0).getLicensePhone());
}
}
orderPageVo.setOrderVehicleCrosstownDto(orderVehicleCrosstownDto);
} else { //未交车
List<VehicleUserLicense> vehicleUserLicenses = Lists.newArrayList(); List<VehicleUserLicense> vehicleUserLicenses = Lists.newArrayList();
String myDriverIds = orderPageVo.getOrderRentVehicleDetail().getMyDriverIds();
if(StringUtils.isNotBlank(myDriverIds)) { if(StringUtils.isNotBlank(myDriverIds)) {
if(myDriverIds.contains(",")) { if(myDriverIds.contains(",")) {
String[] ids = myDriverIds.split(","); String[] ids = myDriverIds.split(",");
try{ try{
for(String id : ids) { //目前暂定一个驾驶人,后期需要更改再此更改
vehicleUserLicenses.add(vehicleFeign.one(Integer.parseInt(id)).getData()); RestResponse<VehicleUserLicense> restResponse = vehicleFeign.getOne(Integer.parseInt(ids[0]));
log.info(restResponse.getMessage());
if(restResponse.getData() != null) {
vehicleUserLicenses.add(restResponse.getData());
} }
}catch (Exception e) { }catch (Exception e) {
e.printStackTrace();
} }
} else { } else {
try { try {
vehicleUserLicenses.add(vehicleFeign.one(Integer.parseInt(myDriverIds)).getData()); vehicleUserLicenses.add(vehicleFeign.one(Integer.parseInt(myDriverIds)).getData());
}catch (Exception e){} }catch (Exception e){
e.printStackTrace();
}
} }
} }
orderPageVo.setVehicleUserLicenses(vehicleUserLicenses); orderPageVo.setVehicleUserLicenses(vehicleUserLicenses);
return orderPageVo; }
return ObjectRestResponse.succ(orderPageVo);
} }
/** /**
......
...@@ -61,6 +61,7 @@ public class OrderTourVerificationBiz{ ...@@ -61,6 +61,7 @@ public class OrderTourVerificationBiz{
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "订单不是已支付状态"); return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "订单不是已支付状态");
} }
Integer orderId=baseOrder.getId(); Integer orderId=baseOrder.getId();
Integer version=baseOrder.getVersion();
OrderTourDetail tourDetail=new OrderTourDetail(); OrderTourDetail tourDetail=new OrderTourDetail();
tourDetail.setOrderId(orderId); tourDetail.setOrderId(orderId);
tourDetail=tourDetailBiz.selectOne(tourDetail); tourDetail=tourDetailBiz.selectOne(tourDetail);
...@@ -81,6 +82,7 @@ public class OrderTourVerificationBiz{ ...@@ -81,6 +82,7 @@ public class OrderTourVerificationBiz{
baseOrder=new BaseOrder(); baseOrder=new BaseOrder();
baseOrder.setId(orderId); baseOrder.setId(orderId);
baseOrder.setStatus(OrderStatusEnum.ORDER_FINISH.getCode()); baseOrder.setStatus(OrderStatusEnum.ORDER_FINISH.getCode());
baseOrder.setVersion(version);
baseOrderBiz.updateSelectiveById(baseOrder); baseOrderBiz.updateSelectiveById(baseOrder);
tourDetail.setVerificationUser(userDTO.getId()); tourDetail.setVerificationUser(userDTO.getId());
tourDetail.setVerificationName(userDTO.getName()); tourDetail.setVerificationName(userDTO.getName());
......
package com.xxfc.platform.order.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.google.common.collect.Lists;
import com.xxfc.platform.order.entity.OrderUserLicense;
import com.xxfc.platform.order.mapper.OrderUserLicenseMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Slf4j
public class OrderUserLicenseBiz extends BaseBiz<OrderUserLicenseMapper, OrderUserLicense> {
/**
* 添加驾驶人信息
* @param orderUserLicense
* @return
*/
public ObjectRestResponse<OrderUserLicense> add(OrderUserLicense orderUserLicense) {
if(orderUserLicense == null) {
return ObjectRestResponse.paramIsEmpty();
}
OrderUserLicense oldValue = mapper.selectByLicenseIdCard(orderUserLicense.getLicenseIdCard());
if(oldValue == null) {
mapper.insertSelective(orderUserLicense);
return ObjectRestResponse.succ(mapper.selectByLicenseIdCard(orderUserLicense.getLicenseIdCard()));
}
BeanUtil.copyProperties(orderUserLicense, oldValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
mapper.updateByPrimaryKeySelective(oldValue);
return ObjectRestResponse.succ(mapper.selectByLicenseIdCard(oldValue.getLicenseIdCard()));
}
/**
* 根据id获取信息
* @param ids
* @return
*/
public ObjectRestResponse<List<OrderUserLicense>> selectByIds(String ids) {
if(StringUtils.isBlank(ids)) {
return ObjectRestResponse.paramIsEmpty();
}
List<OrderUserLicense> orderUserLicenses = Lists.newArrayList();
if(ids.contains(",")) {
String[] licenseIds = ids.split(",");
for(String license : licenseIds) {
OrderUserLicense orderUserLicense = selectById(Integer.parseInt(license));
if(orderUserLicense != null)
orderUserLicenses.add(orderUserLicense);
}
} else {
OrderUserLicense orderUserLicense = selectById(Integer.parseInt(ids));
if(orderUserLicense != null)
orderUserLicenses.add(orderUserLicense);
}
return ObjectRestResponse.succ(orderUserLicenses);
}
public ObjectRestResponse<OrderUserLicense> selectByUserIdCard(String licenseIdCard) {
if(StringUtils.isBlank(licenseIdCard)) {
return ObjectRestResponse.paramIsEmpty();
}
OrderUserLicense orderUserLicense = mapper.selectByLicenseIdCard(licenseIdCard);
return ObjectRestResponse.succ(orderUserLicense);
}
}
...@@ -4,6 +4,7 @@ import com.ace.cache.annotation.Cache; ...@@ -4,6 +4,7 @@ import com.ace.cache.annotation.Cache;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown; import com.xxfc.platform.order.entity.OrderVehicaleCrosstown;
import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper; import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
...@@ -15,7 +16,7 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -15,7 +16,7 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return selectById(id); return selectById(id);
} }
public List<OrderVehicaleCrosstown> selectByOrderId(OrderVehicaleCrosstown orderVehicaleCrosstown) { public List<OrderVehicaleCrosstown> selectByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
return mapper.selectByOrderId(orderVehicaleCrosstown); return mapper.selectByOrderId(orderVehicleCrosstownDto);
} }
} }
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderUserLicense;
import tk.mybatis.mapper.common.Mapper;
public interface OrderUserLicenseMapper extends Mapper<OrderUserLicense> {
OrderUserLicense selectByLicenseIdCard(String licenseIdCard);
}
\ No newline at end of file
package com.xxfc.platform.order.mapper; package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown; import com.xxfc.platform.order.entity.OrderVehicaleCrosstown;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
public interface OrderVehicaleCrosstownMapper extends Mapper<OrderVehicaleCrosstown> { public interface OrderVehicaleCrosstownMapper extends Mapper<OrderVehicaleCrosstown> {
List<OrderVehicaleCrosstown> selectByOrderId(OrderVehicaleCrosstown orderVehicaleCrosstown); List<OrderVehicaleCrosstown> selectByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto);
} }
\ No newline at end of file
...@@ -70,6 +70,9 @@ public class BaseOrderController extends CommonBaseController { ...@@ -70,6 +70,9 @@ public class BaseOrderController extends CommonBaseController {
@Autowired @Autowired
OrderMemberDetailBiz orderMemberDetailBiz; OrderMemberDetailBiz orderMemberDetailBiz;
@Value("${gateway.insideHost}")
String insideHost;
@Value("${gateway.host}") @Value("${gateway.host}")
String host; String host;
...@@ -188,7 +191,7 @@ public class BaseOrderController extends CommonBaseController { ...@@ -188,7 +191,7 @@ public class BaseOrderController extends CommonBaseController {
if(StringUtils.isBlank(orderNo)) { if(StringUtils.isBlank(orderNo)) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
return ObjectRestResponse.succ(baseOrderBiz.getOrderDetail(orderNo)); return baseOrderBiz.getOrderDetail(orderNo);
} }
...@@ -256,7 +259,7 @@ public class BaseOrderController extends CommonBaseController { ...@@ -256,7 +259,7 @@ public class BaseOrderController extends CommonBaseController {
orderPayVo.setBody(baseOrder.getName()); orderPayVo.setBody(baseOrder.getName());
orderPayVo.setBuyerIp(StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request))); orderPayVo.setBuyerIp(StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request)));
orderPayVo.setChannel(PayChannelEnum.ORDER_CRT.getCode()); orderPayVo.setChannel(PayChannelEnum.ORDER_CRT.getCode());
orderPayVo.setNotifyUrl(host + order + notifyUrl + "?orderNo=" + baseOrder.getNo()); orderPayVo.setNotifyUrl(insideHost + order + notifyUrl + "?orderNo=" + baseOrder.getNo());
orderPayVo.setSubject(baseOrder.getName()); orderPayVo.setSubject(baseOrder.getName());
orderPayVo.setUserId(baseOrder.getUserId()); orderPayVo.setUserId(baseOrder.getUserId());
ObjectRestResponse response = BeanUtil.toBean(thirdFeign.wx(orderPayVo), ObjectRestResponse.class); ObjectRestResponse response = BeanUtil.toBean(thirdFeign.wx(orderPayVo), ObjectRestResponse.class);
......
package com.xxfc.platform.order.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.biz.OrderUserLicenseBiz;
import com.xxfc.platform.order.entity.OrderUserLicense;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/orderUserLicense")
@Api(value = "订单驾驶员信息")
public class OrderUserLicenseController {
@Autowired
OrderUserLicenseBiz orderUserLicenseBiz;
@PostMapping(value = "/add")
@ApiOperation(value = "添加订单驾驶员信息")
public ObjectRestResponse add(OrderUserLicense orderUserLicense) {
return orderUserLicenseBiz.add(orderUserLicense);
}
@GetMapping(value = "/getUserLicenseById")
@ApiOperation(value = "根据id获取驾驶人信息")
public ObjectRestResponse getUserLicenseById(String userLicenseIds) {
return orderUserLicenseBiz.selectByIds(userLicenseIds);
}
@GetMapping(value = "/selectByUserIdCard")
@ApiOperation(value = "根据身份证号获取驾驶人信息")
public ObjectRestResponse selectByUserIdCard(String licenseIdCard) {
return orderUserLicenseBiz.selectByUserIdCard(licenseIdCard);
}
}
...@@ -2,13 +2,21 @@ package com.xxfc.platform.order.rest; ...@@ -2,13 +2,21 @@ package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.biz.BaseOrderBiz;
import com.xxfc.platform.order.biz.OrderUserLicenseBiz;
import com.xxfc.platform.order.biz.OrderVehicalCrosstownBiz; import com.xxfc.platform.order.biz.OrderVehicalCrosstownBiz;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderUserLicense;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown; import com.xxfc.platform.order.entity.OrderVehicaleCrosstown;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
...@@ -22,27 +30,51 @@ public class OrderVehicleCrosstownController { ...@@ -22,27 +30,51 @@ public class OrderVehicleCrosstownController {
@Autowired @Autowired
OrderVehicalCrosstownBiz orderVehicalCrosstownBiz; OrderVehicalCrosstownBiz orderVehicalCrosstownBiz;
@Autowired
OrderUserLicenseBiz orderUserLicenseBiz;
@Autowired
BaseOrderBiz baseOrderBiz;
@PostMapping(value = "/add") @PostMapping(value = "/add")
@ApiOperation(value = "添加交还车记录") @ApiOperation(value = "添加交还车记录")
public ObjectRestResponse<?> add(OrderVehicaleCrosstown orderVehicaleCrosstown) { @Transactional
log.info("添加的参数:orderVehicaleCrosstown = {}", orderVehicaleCrosstown); public ObjectRestResponse<OrderVehicleCrosstownDto> add(@RequestBody OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
if (orderVehicaleCrosstown == null) { log.info("添加的参数:orderVehicaleCrosstown = {}", orderVehicleCrosstownDto);
if (orderVehicleCrosstownDto == null || orderVehicleCrosstownDto.getOrderId() == null ) {
return ObjectRestResponse.createFailedResult(500, "参数为空!"); return ObjectRestResponse.createFailedResult(500, "参数为空!");
} }
if (orderVehicaleCrosstown.getId() != null) { BaseOrder baseOrder = baseOrderBiz.selectById(orderVehicleCrosstownDto.getOrderId());
OrderVehicaleCrosstown oldValue = orderVehicalCrosstownBiz.get(orderVehicaleCrosstown.getId()); if(baseOrder == null) {
if (oldValue != null) { return ObjectRestResponse.createFailedResult(500,"订单不存在!");
BeanUtil.copyProperties(orderVehicaleCrosstown, oldValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
orderVehicalCrosstownBiz.updateSelectiveById(oldValue);
return ObjectRestResponse.succ();
} }
orderVehicalCrosstownBiz.insertSelective(orderVehicaleCrosstown); List<OrderVehicaleCrosstown> oldValue = orderVehicalCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto);
return ObjectRestResponse.succ(); if (oldValue .size() == 1) {
} else { //已有直接返回
orderVehicalCrosstownBiz.insertSelective(orderVehicaleCrosstown); //交车完成 设置订单状态为出行中
return ObjectRestResponse.succ(); if(baseOrder.getStatus() == 4) {
baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder);
} }
OrderVehicleCrosstownDto vehicleCrosstownDto = new OrderVehicleCrosstownDto();
BeanUtil.copyProperties(oldValue.get(0), vehicleCrosstownDto, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
List<OrderUserLicense> orderUserLicenses = orderUserLicenseBiz.selectByIds(oldValue.get(0).getUserLicenseId()).getData();
if(orderUserLicenses != null && orderUserLicenses.size() > 0) {
orderVehicleCrosstownDto.setLicenseIdCard(orderUserLicenses.get(0).getLicenseIdCard());
orderVehicleCrosstownDto.setLicenseImg(orderUserLicenses.get(0).getLicenseImg());
orderVehicleCrosstownDto.setLicenseName(orderUserLicenses.get(0).getLicenseName());
orderVehicleCrosstownDto.setLicensePhone(orderUserLicenses.get(0).getLicensePhone());
}
return ObjectRestResponse.succ(vehicleCrosstownDto);
} else if(oldValue .size() <= 0) {
getOrderLicense(orderVehicleCrosstownDto);
orderVehicalCrosstownBiz.insertSelective(orderVehicleCrosstownDto);
//交车完成 设置订单状态为出行中
baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder);
return ObjectRestResponse.succ(orderVehicleCrosstownDto);
}
return ObjectRestResponse.createDefaultFail();
} }
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
...@@ -53,11 +85,24 @@ public class OrderVehicleCrosstownController { ...@@ -53,11 +85,24 @@ public class OrderVehicleCrosstownController {
@GetMapping(value = "/getByOrderId") @GetMapping(value = "/getByOrderId")
@ApiOperation(value = "根据订单Id获取所有记录信息") @ApiOperation(value = "根据订单Id获取所有记录信息")
public ObjectRestResponse<List<OrderVehicaleCrosstown>> getByOrderId(OrderVehicaleCrosstown orderVehicaleCrosstown) { public ObjectRestResponse<List<OrderVehicaleCrosstown>> getByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
if (orderVehicaleCrosstown == null) { if (orderVehicleCrosstownDto == null) {
return ObjectRestResponse.createFailedResult(500, "参数orderId为空"); return ObjectRestResponse.createFailedResult(500, "参数orderId为空");
} }
return ObjectRestResponse.succ(orderVehicalCrosstownBiz.selectByOrderId(orderVehicaleCrosstown)); return ObjectRestResponse.succ(orderVehicalCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto));
}
public void getOrderLicense(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
OrderUserLicense orderUserLicense = new OrderUserLicense();
orderUserLicense.setLicenseIdCard(orderVehicleCrosstownDto.getLicenseIdCard());
orderUserLicense.setLicenseImg(orderVehicleCrosstownDto.getLicenseImg());
orderUserLicense.setLicenseName(orderVehicleCrosstownDto.getLicenseName());
orderUserLicense.setLicensePhone(orderVehicleCrosstownDto.getLicensePhone());
if(orderUserLicense != null) {
Integer id = orderUserLicenseBiz.add(orderUserLicense).getData().getId();
orderVehicleCrosstownDto.setUserLicenseId(id + "");
}
} }
} }
...@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil; ...@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum; import com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.constant.CommonConstants;
import com.github.wxiaoqi.security.common.context.BaseContextHandler; import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
...@@ -93,7 +94,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -93,7 +94,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//发送定时取消订单(30分钟) //发送定时取消订单(30分钟)
//rabbitProduct.sendDelayMessage(bo.getOrder(), 1000L * 60 * 30); //rabbitProduct.sendDelayMessage(bo.getOrder(), 1000L * 60 * 30);
rabbitProduct.sendDelayMessage(bo.getOrder(), 100L * 6 * 3); rabbitProduct.sendDelayMessage(bo.getOrder(), 1000L * 60 * 5);
} }
@Override @Override
...@@ -251,6 +252,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -251,6 +252,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
rentVehicleBookDTO.setModelId(detail.getModelId()); rentVehicleBookDTO.setModelId(detail.getModelId());
rentVehicleBookDTO.setUserName(BaseContextHandler.getName()); rentVehicleBookDTO.setUserName(BaseContextHandler.getName());
ObjectRestResponse<VehicleBookRecord> orr = vehicleFeign.rentApplyVehicle(rentVehicleBookDTO); ObjectRestResponse<VehicleBookRecord> orr = vehicleFeign.rentApplyVehicle(rentVehicleBookDTO);
if(! CommonConstants.SYS_JSON_TRUE.equals(orr.getStatus())) {
throw new BaseException(orr.getMessage(), orr.getStatus());
}
detail.setVehicleId(orr.getData().getVehicleId()); detail.setVehicleId(orr.getData().getVehicleId());
detail.setBookRecordId(orr.getData().getId()); detail.setBookRecordId(orr.getData().getId());
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</plugin> </plugin>
<jdbcConnection driverClass="com.mysql.jdbc.Driver" <jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://10.5.52.3:3306/xxfc_order?useUnicode=true&amp;characterEncoding=UTF8" connectionURL="jdbc:mysql://10.5.52.3:3306/xxfc_third_platform?useUnicode=true&amp;characterEncoding=UTF8"
userId="root" userId="root"
password="sslcloud123*()"> password="sslcloud123*()">
</jdbcConnection> </jdbcConnection>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<!-- </table>--> <!-- </table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>--> <!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>--> <!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<table tableName="order_vehicle_crosstown" domainObjectName="OrderVehicaleCrosstown"></table> <table tableName="dictionary" domainObjectName="Dictionary"></table>
<!-- <table tableName="vehicle_upkeep_log" domainObjectName="VehicleUpkeepLog"></table>--> <!-- <table tableName="vehicle_upkeep_log" domainObjectName="VehicleUpkeepLog"></table>-->
</context> </context>
</generatorConfiguration> </generatorConfiguration>
\ No newline at end of file
...@@ -138,8 +138,8 @@ ...@@ -138,8 +138,8 @@
</select> </select>
<select id="getOrderDetail" parameterType="java.lang.String" resultMap="orderPageMap"> <select id="getOrderDetail" parameterType="java.lang.String" resultMap="orderPageMap">
select b.* select *
from base_order b from base_order
where no = #{no} where no = #{no}
</select> </select>
......
<?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.OrderUserLicenseMapper" >
<resultMap id="BaseResultMap" type="com.xxfc.platform.order.entity.OrderUserLicense" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="license_name" property="licenseName" jdbcType="VARCHAR" />
<result column="license_phone" property="licensePhone" jdbcType="VARCHAR" />
<result column="license_id_card" property="licenseIdCard" jdbcType="VARCHAR" />
<result column="license_img" property="licenseImg" jdbcType="VARCHAR" />
<result column="crt_time" property="crtTime" jdbcType="BIGINT" />
<result column="upd_time" property="updTime" jdbcType="BIGINT" />
</resultMap>
<select id="selectByLicenseIdCard" resultType="com.xxfc.platform.order.entity.OrderUserLicense" parameterType="java.lang.String">
select * from order_user_license
where license_id_card = #{licenseIdCard}
</select>
</mapper>
\ No newline at end of file
...@@ -8,9 +8,6 @@ ...@@ -8,9 +8,6 @@
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id" />
<result column="order_id" jdbcType="INTEGER" property="orderId" /> <result column="order_id" jdbcType="INTEGER" property="orderId" />
<result column="order_no" jdbcType="VARCHAR" property="orderNo" /> <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
<result column="license_name" jdbcType="VARCHAR" property="licenseName" />
<result column="license_phone" jdbcType="VARCHAR" property="licensePhone" />
<result column="license_img" jdbcType="VARCHAR" property="licenseImg" />
<result column="mileage" jdbcType="INTEGER" property="mileage" /> <result column="mileage" jdbcType="INTEGER" property="mileage" />
<result column="mileage_img" jdbcType="VARCHAR" property="mileageImg" /> <result column="mileage_img" jdbcType="VARCHAR" property="mileageImg" />
<result column="status" jdbcType="BIT" property="status" /> <result column="status" jdbcType="BIT" property="status" />
...@@ -23,15 +20,15 @@ ...@@ -23,15 +20,15 @@
<result column="crt_time" jdbcType="BIGINT" property="crtTime" /> <result column="crt_time" jdbcType="BIGINT" property="crtTime" />
<result column="upd_time" jdbcType="BIGINT" property="updTime" /> <result column="upd_time" jdbcType="BIGINT" property="updTime" />
<result column="vehicle_key" jdbcType="LONGVARCHAR" property="vehicleKey"/> <result column="vehicle_key" jdbcType="LONGVARCHAR" property="vehicleKey"/>
<result column="license_id_card" jdbcType="VARCHAR" property="licenseIdCard"/>
<result column="deduction" jdbcType="BIT" property="deduction" /> <result column="deduction" jdbcType="BIT" property="deduction" />
<result column="ded_detail" jdbcType="LONGVARCHAR" property="dedDetail" /> <result column="ded_detail" jdbcType="LONGVARCHAR" property="dedDetail" />
<result column="type" jdbcType="INTEGER" property="type"/> <result column="type" jdbcType="INTEGER" property="type"/>
<result column="deduction_cost" jdbcType="INTEGER" property="deductionCost"/> <result column="deduction_cost" jdbcType="INTEGER" property="deductionCost"/>
<result column="rest_deposit" jdbcType="INTEGER" property="restDeposit"/> <result column="rest_deposit" jdbcType="INTEGER" property="restDeposit"/>
<result column="user_license_id" jdbcType="VARCHAR" property="userLicenseId"/>
</resultMap> </resultMap>
<select id="selectByOrderId" parameterType="com.xxfc.platform.order.entity.OrderVehicaleCrosstown" resultMap="BaseResultMap"> <select id="selectByOrderId" parameterType="com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto" resultMap="BaseResultMap">
select * select *
from order_vehicle_crosstown from order_vehicle_crosstown
<where> <where>
......
...@@ -119,11 +119,15 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> { ...@@ -119,11 +119,15 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
* @return * @return
*/ */
public TourTagAndBannerDTO findTourTagById(Integer tagId){ public TourTagAndBannerDTO findTourTagById(Integer tagId){
TourTagAndBannerDTO tourTagAndBannerDTO = new TourTagAndBannerDTO();
//根据旅游标签id查询出标签信息 //根据旅游标签id查询出标签信息
TourTag tourTag = mapper.findById(tagId); TourTag tourTag = mapper.findById(tagId);
if (log.isDebugEnabled()){ if (log.isDebugEnabled()){
log.debug("根据标签id=[{}]查询出标签信息:[{}]",tagId,tourTag); log.debug("根据标签id=[{}]查询出标签信息:[{}]",tagId,tourTag);
} }
if (tourTag==null){
return tourTagAndBannerDTO;
}
TourTagDTO tourTagDTO = new TourTagDTO(); TourTagDTO tourTagDTO = new TourTagDTO();
BeanUtils.copyProperties(tourTag,tourTagDTO); BeanUtils.copyProperties(tourTag,tourTagDTO);
//根据旅游标签id查询出标签对应的轮播图信息 //根据旅游标签id查询出标签对应的轮播图信息
...@@ -131,7 +135,7 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> { ...@@ -131,7 +135,7 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
if (log.isDebugEnabled()){ if (log.isDebugEnabled()){
log.debug("根据标签id=[{}],查询出轮播图信息:[{}]",tagId,tourTagBannerDTOS); log.debug("根据标签id=[{}],查询出轮播图信息:[{}]",tagId,tourTagBannerDTOS);
} }
TourTagAndBannerDTO tourTagAndBannerDTO = new TourTagAndBannerDTO();
//组装数据 //组装数据
tourTagAndBannerDTO.setTourTagDTO(tourTagDTO); tourTagAndBannerDTO.setTourTagDTO(tourTagDTO);
tourTagAndBannerDTO.setTourTagBannerDTOS(tourTagBannerDTOS); tourTagAndBannerDTO.setTourTagBannerDTOS(tourTagBannerDTOS);
......
package com.xxfc.platform.tour.config; package com.xxfc.platform.tour.config;
import feign.Logger;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
...@@ -10,4 +11,8 @@ public class RestConfiguration { ...@@ -10,4 +11,8 @@ public class RestConfiguration {
public RestTemplate restTemplate() { public RestTemplate restTemplate() {
return new RestTemplate(); return new RestTemplate();
} }
@Bean
public Logger.Level feignLevel(){
return Logger.Level.HEADERS;
}
} }
...@@ -17,6 +17,17 @@ spring: ...@@ -17,6 +17,17 @@ spring:
nacos: nacos:
config: config:
file-extension: yaml file-extension: yaml
debug: true
feign:
compression:
response:
enabled: true
request:
enabled: true
logging:
level:
com.github.wxiaoqi: debug
com.xxfc: debug
--- ---
spring: spring:
profiles: dev profiles: dev
......
package com.xxfc.platform.universal.entity;
import lombok.Data;
import javax.persistence.*;
import java.util.Set;
@Data
@Table(name = "data_dictionary")
public class Dictionary {
@Id
private Integer id;
/**
* 类型
*/
private String type;
/**
* 编码
*/
private String code;
/**
* 父类Id
*/
private Integer pid;
private String name;
private String detail;
@Transient
private Set<Dictionary> childrens;
}
\ No newline at end of file
...@@ -10,6 +10,7 @@ import javax.persistence.Column; ...@@ -10,6 +10,7 @@ import javax.persistence.Column;
import javax.persistence.Id; import javax.persistence.Id;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Objects;
@Data @Data
public class LicensePlateType implements Serializable { public class LicensePlateType implements Serializable {
...@@ -55,4 +56,18 @@ public class LicensePlateType implements Serializable { ...@@ -55,4 +56,18 @@ public class LicensePlateType implements Serializable {
public LicensePlateType() { public LicensePlateType() {
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LicensePlateType that = (LicensePlateType) o;
return code.equals(that.code) &&
type.equals(that.type);
}
@Override
public int hashCode() {
return Objects.hash(code, type);
}
} }
package com.xxfc.platform.universal.vo;
import com.xxfc.platform.universal.entity.Dictionary;
import lombok.Data;
import java.util.Set;
@Data
public class DictionaryVo extends Dictionary {
Set<Dictionary> childrens;
}
...@@ -72,6 +72,10 @@ ...@@ -72,6 +72,10 @@
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.xxfc.platform.universal.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.google.common.collect.Lists;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.mapper.DictionaryMapper;
import com.xxfc.platform.universal.vo.DictionaryVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Service
@Slf4j
public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
public ObjectRestResponse add(Dictionary dictionary) {
if(dictionary == null)
return ObjectRestResponse.paramIsEmpty();
List<Dictionary> dictionaryVos = mapper.selectByCodeAndType(dictionary);
if(dictionaryVos.size() == 1) {//已有数据 直接更新
BeanUtil.copyProperties(dictionary, dictionaryVos.get(0), CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
mapper.updateByPrimaryKeySelective(dictionaryVos.get(0));
return ObjectRestResponse.succ();
}
if(dictionary.getPid() != null) {//有父类 判断是否存在
Dictionary parent = mapper.selectByPrimaryKey(dictionary.getPid());
if(parent == null) {
log.info("pid所属数据不存在, dictionary = {}", dictionary);
return ObjectRestResponse.createFailedResult(500, "pid所属数据不存在");
}
} else { //没有父类设置pid为0
dictionary.setPid(0);
}
mapper.insertSelective(dictionary);
return ObjectRestResponse.succ();
}
public ObjectRestResponse get(Dictionary dictionary) {
if(dictionary == null) {
return ObjectRestResponse.paramIsEmpty();
}
List<Dictionary> dictionaryList = mapper.selectByCodeAndType(dictionary);
for(Dictionary parent : dictionaryList) {
Set<Dictionary> dictionaryVoList = buildTree(parent.getId());
parent.setChildrens(dictionaryVoList);
}
return ObjectRestResponse.succ(dictionaryList);
}
public ObjectRestResponse deleteByEntity(Dictionary dictionary) {
if(dictionary == null) {
return ObjectRestResponse.paramIsEmpty();
}
//删除所有子元素
Set<Dictionary> childrens = mapper.selectByPid(dictionary.getId());
if(childrens.size() > 0) {
childrens.forEach((a) -> mapper.deleteByPrimaryKey(a));
}
mapper.deleteByPrimaryKey(dictionary);
return ObjectRestResponse.succ();
}
public ObjectRestResponse update(Dictionary dictionary) {
if(StringUtils.isEmpty(dictionary)) {
return ObjectRestResponse.paramIsEmpty();
}
Dictionary oldValue = mapper.selectByPrimaryKey(dictionary.getId());
BeanUtil.copyProperties(dictionary, oldValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
mapper.updateByPrimaryKeySelective(oldValue);
return ObjectRestResponse.succ();
}
public ObjectRestResponse getParent(String type) {
if(StringUtils.isEmpty(type)) {
return ObjectRestResponse.paramIsEmpty();
}
Dictionary dictionary = new Dictionary();
dictionary.setType(type);
dictionary.setPid(0);
List<Dictionary> dictionaryList = mapper.selectByCodeAndType(dictionary);
for(Dictionary parent : dictionaryList) {
Set<Dictionary> dictionaryVoList = buildTree(parent.getId());
parent.setChildrens(dictionaryVoList);
}
return ObjectRestResponse.succ(dictionaryList);
}
public DictionaryVo buidTree(Dictionary dictionary) {
DictionaryVo dictionaryVo = new DictionaryVo();
if(dictionary.getPid() == 0) {
BeanUtil.copyProperties(dictionary, dictionaryVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
Set<Dictionary> childrens = mapper.selectByPid(dictionary.getId());
dictionaryVo.setChildrens(childrens);
for(Dictionary children : childrens) {
buidTree(children);
}
}
return dictionaryVo;
}
public Set<Dictionary> buildTree(int parentId) {
Set<Dictionary> childrens = mapper.selectByPid(parentId);
Set<Dictionary> dictionaryVoList = new HashSet<>();
for (Dictionary dictionary : childrens) {
int dictionaryId = dictionary.getId();
int pid = dictionary.getPid();
if (parentId == pid) {
Set<Dictionary> menuLists = buildTree(dictionaryId);
dictionary.setChildrens(menuLists);
dictionaryVoList.add(dictionary);
}
}
return dictionaryVoList;
}
}
package com.xxfc.platform.universal.biz; package com.xxfc.platform.universal.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.universal.entity.LicensePlateType; import com.xxfc.platform.universal.entity.LicensePlateType;
import com.xxfc.platform.universal.entity.SearchableCity;
import com.xxfc.platform.universal.mapper.LicensePlateTypeMapper; import com.xxfc.platform.universal.mapper.LicensePlateTypeMapper;
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.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.ArrayList; import java.sql.SQLDataException;
import java.sql.SQLException;
import java.util.List;
@Service @Service
public class LicensePlateTypeBiz extends BaseBiz<LicensePlateTypeMapper, LicensePlateType> { public class LicensePlateTypeBiz extends BaseBiz<LicensePlateTypeMapper, LicensePlateType> {
/**
* 获取车牌类型和和编码
* @param licensePlateTypes
*/
@Transactional @Transactional
public void insertLicensePlateType(ArrayList<LicensePlateType> licensePlateTypes) { public void insertLicensePlateType(List<LicensePlateType> licensePlateTypes) {
mapper.insertLicensePlateType(licensePlateTypes); mapper.insertLicensePlateType(licensePlateTypes);
} }
/**
* 修改数据库数据
* @param licensePlateTypes
* @throws SQLException
*/
@Transactional
public void updateLicensePlateType(List<LicensePlateType> licensePlateTypes) throws SQLException {
// List<LicensePlateType> saveLicensePlateTypes = mapper.selectAll();
// HashSet<LicensePlateType> judgeSet = new HashSet<>();
// judgeSet.addAll(saveLicensePlateTypes);
// for (LicensePlateType licensePlateType : licensePlateTypes) {
//
// if (judgeSet.add(licensePlateType)) {
//
// mapper.updateByExample()
// }
// }
for (LicensePlateType licensePlateType : licensePlateTypes) {
Example exa = Example.builder(LicensePlateType.class)
.where(
WeekendSqls.<LicensePlateType>custom()
.andEqualTo(LicensePlateType::getCode,licensePlateType.getCode())
).build();
int flag = mapper.updateByExample(licensePlateType,exa);
if (flag==0) {
insertSelective(licensePlateType);
}
if (flag>1) {
throw new SQLException("修改错误,同时修改多条数据");
}
}
}
} }
...@@ -50,7 +50,14 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -50,7 +50,14 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
Integer amount=orderPayVo.getAmount(); Integer amount=orderPayVo.getAmount();
log.error("---下单---order_no====="+order_no+"--支付订单号--trade_no===="+trade_no+"--金额---amount===="+amount); log.error("---下单---order_no====="+order_no+"--支付订单号--trade_no===="+trade_no+"--金额---amount===="+amount);
//报名费回调路径 //报名费回调路径
String jsParam = WXPay.apppay(1+"",orderPayVo.getBody(),"https://"+ SystemConfig.weixinHost+"/api/universal/pay/app/unauth/notify" ,trade_no,orderPayVo.getBuyerIp(),0);
//临时处理
amount = amount/100000;
if(amount <= 0) {
amount = 1;
}
String jsParam = WXPay.apppay(amount+"",orderPayVo.getBody(),"https://"+ SystemConfig.weixinHost+"/api/universal/pay/app/unauth/notify" ,trade_no,orderPayVo.getBuyerIp(),0);
log.info("报名费回调路径jsParam:"+jsParam); log.info("报名费回调路径jsParam:"+jsParam);
if(!StringUtils.isBlank(jsParam)) if(!StringUtils.isBlank(jsParam))
{ {
......
package com.xxfc.platform.universal.controller;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.universal.biz.DictionaryBiz;
import com.xxfc.platform.universal.entity.Dictionary;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = "dictionary")
@Api(value = "数据字典")
public class DictionaryController {
@Autowired
DictionaryBiz dictionaryBiz;
@PostMapping(value = "/add")
@ApiOperation(value = "添加数据")
public ObjectRestResponse<?> add(@RequestBody Dictionary dictionary) {
return dictionaryBiz.add(dictionary);
}
@GetMapping(value = "/get")
@ApiOperation(value = "获取数据")
public ObjectRestResponse<?> get(Dictionary dictionary) {
return dictionaryBiz.get(dictionary);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除数据")
public ObjectRestResponse<?> delete(Dictionary dictionary) {
return dictionaryBiz.deleteByEntity(dictionary);
}
@PostMapping(value = "/update")
@ApiOperation(value = "修改数据")
public ObjectRestResponse<?> update(@RequestBody Dictionary dictionary) {
return dictionaryBiz.update(dictionary);
}
@GetMapping(value = "/getParents")
@ApiOperation(value = "获取所有的父类元素 pid=0")
public ObjectRestResponse getParent(String type) {
return dictionaryBiz.getParent(type);
}
}
package com.xxfc.platform.universal.mapper;
import com.xxfc.platform.universal.entity.Dictionary;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Set;
public interface DictionaryMapper extends Mapper<Dictionary> {
List<Dictionary> selectByCodeAndType(Dictionary dictionary);
Set<Dictionary> selectByPid(Integer pid);
}
\ No newline at end of file
...@@ -4,8 +4,9 @@ import com.xxfc.platform.universal.entity.LicensePlateType; ...@@ -4,8 +4,9 @@ import com.xxfc.platform.universal.entity.LicensePlateType;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.ArrayList;
import java.util.List;
public interface LicensePlateTypeMapper extends Mapper<LicensePlateType> { public interface LicensePlateTypeMapper extends Mapper<LicensePlateType> {
void insertLicensePlateType(@Param("licensePlateTypes") ArrayList<LicensePlateType> licensePlateTypes); void insertLicensePlateType(@Param("licensePlateTypes") List<LicensePlateType> licensePlateTypes);
} }
...@@ -3,7 +3,6 @@ package com.xxfc.platform.universal.service; ...@@ -3,7 +3,6 @@ package com.xxfc.platform.universal.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.universal.biz.LicensePlateTypeBiz; import com.xxfc.platform.universal.biz.LicensePlateTypeBiz;
import com.xxfc.platform.universal.biz.SearchableCityBiz;
import com.xxfc.platform.universal.entity.LicensePlateType; import com.xxfc.platform.universal.entity.LicensePlateType;
import com.xxfc.platform.universal.utils.CertifHttpUtils; import com.xxfc.platform.universal.utils.CertifHttpUtils;
import com.xxfc.platform.universal.vo.TrafficViolations; import com.xxfc.platform.universal.vo.TrafficViolations;
...@@ -15,8 +14,10 @@ import org.apache.http.util.EntityUtils; ...@@ -15,8 +14,10 @@ import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.task.TaskExecutor; import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.sql.SQLException;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -31,11 +32,16 @@ public class TrafficViolationsService { ...@@ -31,11 +32,16 @@ public class TrafficViolationsService {
@Autowired @Autowired
private LicensePlateTypeBiz licensePlateTypeBiz; private LicensePlateTypeBiz licensePlateTypeBiz;
@Autowired
private TaskExecutor taskExecutor;
@Value("${ALIYUN.CODE}") @Value("${ALIYUN.CODE}")
private String CODE; private String CODE;
@Value("${RETURN.TYPE}") @Value("${RETURN.TYPE}")
private String TYPE; private String TYPE;
/**
* 下列参数,根据使用不同的公司的接口进行修改
*/
private static final String CITY_HOST = "https://weizhang.market.alicloudapi.com"; private static final String CITY_HOST = "https://weizhang.market.alicloudapi.com";
private static final String CITY_PATH = "/wz/province"; private static final String CITY_PATH = "/wz/province";
private static final String CITY_METHOD = "GET"; private static final String CITY_METHOD = "GET";
...@@ -60,7 +66,6 @@ public class TrafficViolationsService { ...@@ -60,7 +66,6 @@ public class TrafficViolationsService {
* @return * @return
* @throws Exception * @throws Exception
*/ */
// @Scheduled(cron = "0 0 0 * * ?")
public String getCity() throws Exception { public String getCity() throws Exception {
Map<String, String> headers = new HashMap< Map<String, String> headers = new HashMap<
String, String>(); String, String>();
...@@ -98,8 +103,9 @@ public class TrafficViolationsService { ...@@ -98,8 +103,9 @@ public class TrafficViolationsService {
/** /**
* 放入bean中 * 放入bean中
* @throws Exception * @throws Exception
* @return
*/ */
public void saveLicensePlateType() throws Exception { public ArrayList<LicensePlateType> saveLicensePlateType() throws Exception {
String result = searchaLicensePlateType(); String result = searchaLicensePlateType();
if (StringUtils.isBlank(result)) { if (StringUtils.isBlank(result)) {
throw new BaseException("错误! 查询不到车辆类型"); throw new BaseException("错误! 查询不到车辆类型");
...@@ -114,12 +120,15 @@ public class TrafficViolationsService { ...@@ -114,12 +120,15 @@ public class TrafficViolationsService {
for (Map.Entry<String, String> licensePlateTypeEntry : licensePlateTypeMap.entrySet()) { for (Map.Entry<String, String> licensePlateTypeEntry : licensePlateTypeMap.entrySet()) {
licensePlateTypes.add(new LicensePlateType(licensePlateTypeEntry.getKey(),licensePlateTypeEntry.getValue())); licensePlateTypes.add(new LicensePlateType(licensePlateTypeEntry.getKey(),licensePlateTypeEntry.getValue()));
} }
licensePlateTypeBiz.insertLicensePlateType(licensePlateTypes);
return licensePlateTypes;
} }
/** /**
* Unicode转汉字字符串 * Unicode转汉字字符串(根据接口返回编码的类型使用)
* @param str * @param str
* @return * @return
*/ */
...@@ -144,7 +153,7 @@ public class TrafficViolationsService { ...@@ -144,7 +153,7 @@ public class TrafficViolationsService {
/** /**
* 调用接口获取车辆车和代码 * 调用接口获取车辆车和代码
* @return * @return
* @throws Exception * @throws Exception
*/ */
...@@ -163,11 +172,41 @@ public class TrafficViolationsService { ...@@ -163,11 +172,41 @@ public class TrafficViolationsService {
return unicodeToString(EntityUtils.toString(entity)); return unicodeToString(EntityUtils.toString(entity));
} }
public ArrayList<LicensePlateType> getLicensePlateType() { /**
* 查询对应的车牌和车牌代码
* @return
* @throws Exception
*/
public List<LicensePlateType> getLicensePlateType() throws Exception {
List<LicensePlateType> licensePlateTypes = licensePlateTypeBiz.selectListAll(); List<LicensePlateType> licensePlateTypes = licensePlateTypeBiz.selectListAll();
if (CollectionUtils.isEmpty(licensePlateTypes)) { if (CollectionUtils.isEmpty(licensePlateTypes)) {
licensePlateTypes = saveLicensePlateType();
List<LicensePlateType> finalLicensePlateTypes = licensePlateTypes;
taskExecutor.execute(new Runnable() {
@Override
public void run() {
insertLicensePlateType(finalLicensePlateTypes);
}
});
} }
return null; return licensePlateTypes;
}
/**
* 定时修改车牌类型
* @throws SQLException
*/
@Scheduled(cron = "0 0 0 0/7 * ?")
private void updateLicensePlateType() throws SQLException {
List<LicensePlateType> licensePlateTypes = licensePlateTypeBiz.selectListAll();
licensePlateTypeBiz.updateLicensePlateType(licensePlateTypes);
}
private void insertLicensePlateType(List<LicensePlateType> finalLicensePlateTypes){
licensePlateTypeBiz.insertLicensePlateType(finalLicensePlateTypes);
} }
} }
<?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.universal.mapper.DictionaryMapper" >
<resultMap id="BaseResultMap" type="com.xxfc.platform.universal.entity.Dictionary" >
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER" />
<result column="type" property="type" jdbcType="VARCHAR" />
<result column="code" property="code" jdbcType="VARCHAR" />
<result column="pid" property="pid" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="detail" property="detail" jdbcType="VARCHAR" />
</resultMap>
<select id="selectByCodeAndType" parameterType="com.xxfc.platform.universal.entity.Dictionary" resultType="com.xxfc.platform.universal.entity.Dictionary">
select * from data_dictionary
<where>
<if test="type != null">
and type = #{type}
</if>
<if test="code != null">
and code = #{code}
</if>
<if test="pid != null">
and pid = #{pid}
</if>
</where>
</select>
<select id = "selectByPid" parameterType="java.lang.Integer" resultType="com.xxfc.platform.universal.entity.Dictionary">
select * from data_dictionary
where pid = #{pid}
</select>
</mapper>
\ No newline at end of file
...@@ -19,5 +19,4 @@ public enum VehicleScoreType { ...@@ -19,5 +19,4 @@ public enum VehicleScoreType {
* 检验感受 * 检验感受
*/ */
EXPERIENCE; EXPERIENCE;
} }
...@@ -47,17 +47,17 @@ public class VehicleUserLicense implements Serializable { ...@@ -47,17 +47,17 @@ public class VehicleUserLicense implements Serializable {
//驾驶证 //驾驶证
@Column(name = "license") @Column(name = "license")
@ApiModelProperty(value = "驾驶证") @ApiModelProperty(value = "驾驶证号码")
private String license; private String license;
//正面图片 //正面图片
@Column(name = "img") @Column(name = "img")
@ApiModelProperty(value = "正面图片") @ApiModelProperty(value = "驾驶证正面图片")
private String img; private String img;
//反面图片 //反面图片
@Column(name = "fimg") @Column(name = "fimg")
@ApiModelProperty(value = "反面图片") @ApiModelProperty(value = "驾驶证反面图片")
private String fimg; private String fimg;
//创建时间 //创建时间
......
...@@ -53,4 +53,8 @@ public interface VehicleFeign { ...@@ -53,4 +53,8 @@ public interface VehicleFeign {
@RequestMapping(value = "/user/license/one", method = RequestMethod.GET) @RequestMapping(value = "/user/license/one", method = RequestMethod.GET)
public RestResponse<VehicleUserLicense> one(@RequestParam(value="id",defaultValue="0")Integer id) throws Exception; public RestResponse<VehicleUserLicense> one(@RequestParam(value="id",defaultValue="0")Integer id) throws Exception;
@RequestMapping(value = "/user/license/company/getOne", method = RequestMethod.GET)
public RestResponse<VehicleUserLicense> getOne(
@RequestParam(value="id",defaultValue="0")Integer id) throws Exception ;
} }
...@@ -135,9 +135,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -135,9 +135,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
} }
@Cache(key = "vehical") // @Cache(key = "vehical")
public Vehicle get(String id){ public Vehicle get(String id){
return mapper.selectByPrimaryKey(id); Vehicle vehicle = mapper.selectByPrimaryKey(id);
return vehicle;
} }
/** /**
......
...@@ -5,7 +5,7 @@ import com.xxfc.platform.vehicle.common.RestResponse; ...@@ -5,7 +5,7 @@ import com.xxfc.platform.vehicle.common.RestResponse;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice //@RestControllerAdvice
public class BaseExceptionHandler { public class BaseExceptionHandler {
@ExceptionHandler(BaseException.class) @ExceptionHandler(BaseException.class)
......
...@@ -401,7 +401,9 @@ public class VehicleController extends BaseController<VehicleBiz> { ...@@ -401,7 +401,9 @@ public class VehicleController extends BaseController<VehicleBiz> {
//查询可车辆信息 //查询可车辆信息
PageDataVO<Vehicle> pageDataVO = vehicleBiz.searchUsableVehicle(dto); PageDataVO<Vehicle> pageDataVO = vehicleBiz.searchUsableVehicle(dto);
if (pageDataVO.getData().size() <= 0) { if (pageDataVO.getData().size() <= 0) {
throw new BaseException(ResultCode.NOTEXIST_CODE); throw new BaseException(ResultCode.NOTEXIST_CODE, new HashMap<String, Object>(){{
put("可用车辆", "不存在");
}});
} }
bookVehicleVo.setVehicleId(pageDataVO.getData().get(0).getId()); bookVehicleVo.setVehicleId(pageDataVO.getData().get(0).getId());
......
...@@ -59,7 +59,11 @@ public class VehicleLicenseController extends VehicleBaseController<VehicleLicen ...@@ -59,7 +59,11 @@ public class VehicleLicenseController extends VehicleBaseController<VehicleLicen
} }
return RestResponse.suc(baseBiz.getOneById(id)); return RestResponse.suc(baseBiz.getOneById(id));
} }
@RequestMapping(value = "/license/company/getOne", method = RequestMethod.GET)
public RestResponse<VehicleUserLicense> getOne(
@RequestParam(value="id",defaultValue="0")Integer id) throws Exception {
return RestResponse.suc(baseBiz.getOneById(id));
}
@ApiOperation("多个驾驶员查询") @ApiOperation("多个驾驶员查询")
@RequestMapping(value = "/license/multi", method = RequestMethod.GET) @RequestMapping(value = "/license/multi", method = RequestMethod.GET)
public ObjectRestResponse<List<VehicleUserLicense>> multi(QueryMultiDTO dto) throws Exception { public ObjectRestResponse<List<VehicleUserLicense>> multi(QueryMultiDTO dto) throws Exception {
......
...@@ -333,7 +333,8 @@ ...@@ -333,7 +333,8 @@
</if> </if>
<include refid="searchUsableSql"/> <include refid="searchUsableSql"/>
and vm.id is not null
and bc.id is not null
GROUP BY model_id, company_id GROUP BY model_id, company_id
<if test="lon != null and lat != null">, distance</if> <if test="lon != null and lat != null">, distance</if>
......
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