Commit 45f6a3b5 authored by libin's avatar libin

banner

parents d3769c23 76db2a7d
......@@ -13,7 +13,7 @@ import tk.mybatis.spring.annotation.MapperScan;
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(defaultConfiguration = HeaderConfig.class)
@EnableFeignClients
@MapperScan("com.github.wxiaoqi.security.auth.mapper")
//@EnableAutoConfiguration
public class AuthBootstrap {
......
......@@ -6,6 +6,7 @@ package com.github.wxiaoqi.security.common.constant;
public class CommonConstants {
public static final Integer SYS_TRUE = 1;
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_BTN = "button";
// 用户token异常
......
......@@ -54,7 +54,7 @@ public class BaseException extends RuntimeException {
}
public BaseException(int code, Map<String, Object> map) {
super(ResultCode.getMsg(code));
super(ResultCode.getMsg(code) + (map == null? "" : map.toString()));
this.status = code;
}
}
......@@ -132,11 +132,11 @@ public class ResultCode {
// 账户已禁用
public static int ACCOUNTINFO_ISDEL = Integer.valueOf(SystemProperty.getResultConfig("ACCOUNTINFO_ISDEL"));
// 监控设备不存在
public static int DEVICE_NOTEXIST_CODE = Integer.valueOf(SystemProperty.getResultConfig("DEVICE_NOTEXIST_CODE"));
// 设备access_token获取失败
public static int DEVICE_TOKEN_NOTEXIST_CODE = Integer
.valueOf(SystemProperty.getResultConfig("DEVICE_TOKEN_NOTEXIST_CODE"));
// // 监控设备不存在
// public static int DEVICE_NOTEXIST_CODE = Integer.valueOf(SystemProperty.getResultConfig("DEVICE_NOTEXIST_CODE"));
// // 设备access_token获取失败
// public static int DEVICE_TOKEN_NOTEXIST_CODE = Integer
// .valueOf(SystemProperty.getResultConfig("DEVICE_TOKEN_NOTEXIST_CODE"));
// 操作频繁提示
public static int API_MAX_CODE = Integer.valueOf(SystemProperty.getResultConfig("API_MAX_CODE"));
......
......@@ -154,10 +154,10 @@ NICKNAME_NULL_CODE=9006
ACCOUNTINFO_ISDEL=9007
9007=账户已禁用
DEVICE_NOTEXIST_CODE=1005
1005=监控设备不存在
DEVICE_TOKEN_NOTEXIST_CODE=1006
1005=设备access_token获取失败
#DEVICE_NOTEXIST_CODE=1005
#1005=监控设备不存在
#DEVICE_TOKEN_NOTEXIST_CODE=1006
#1005=设备access_token获取失败
REPEAT_SUB_CODE=1008
......
......@@ -240,6 +240,7 @@ public class AppPermissionService {
userLogin.setImUserid(imUserId);
userLogin.setUsername(username);
appUserLoginBiz.updateSelectiveById(userLogin);
log.info(username+"----userLogin updateSelectiveById---username====="+username+"----imPassword===="+imPassword);
}
data.put("imToken",access_token);
data.put("imUserId",imUserId);
......
......@@ -22,6 +22,6 @@ public interface CofigMapper extends Mapper<Cofig> {
* @param cofig
* @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);
}
......@@ -21,4 +21,5 @@ spring:
cloud:
nacos:
config:
server-addr: 10.5.52.2:8848
\ No newline at end of file
server-addr: 10.5.52.2:8848
......@@ -16,6 +16,7 @@
<module>xx-common-platform</module>
<module>xx-common-platform-web</module>
<module>xx-common-platform-component</module>
<module>xx-common-demo</module>
</modules>
</project>
\ No newline at end of file
......@@ -11,17 +11,44 @@
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-common-platform-component</artifactId>
<properties>
<swagger.version>2.9.2</swagger.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<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>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<groupId>com.github.wxiaoqi</groupId>
<artifactId>ace-common</artifactId>
<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>
</dependency>
</dependencies>
......
......@@ -2,6 +2,7 @@ package com.xxfc.platform.common.config;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
......@@ -17,8 +18,6 @@ import java.util.Enumeration;
* @description 设置请求头部信息,防止微服务之间调用请求头部信息丢失
* @data 2019/6/25 16:22
*/
@Configuration
@Component
public class HeaderConfig implements RequestInterceptor {
@Override
......
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
* @version 1.0
* @description TODO
* @description 通用swagger设置
* @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 {
@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;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.xxfc.platform.im.model.User;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
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.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
......@@ -23,6 +25,7 @@ import java.util.HashMap;
import java.util.Map;
@Component
@Slf4j
public class UserBiz {
@Autowired
......@@ -31,6 +34,9 @@ public class UserBiz {
@Autowired
UserFeign userFeign;
@Value("${im.url}")
String imUrl;
/**
* 注册
* @param map
......@@ -48,8 +54,7 @@ public class UserBiz {
if(map.get("nickname") != null && !("").equals(map.get("nickname"))){
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);
//如果已经注册过,查询出手机号对应用户信息执行登录返回
if(0 == json.getInteger("resultCode")){
......@@ -72,6 +77,7 @@ public class UserBiz {
baseResponse.setStatus(200);
baseResponse.setMessage(result);
log.info("用户注册:result = {}, telephone = {}, password = {}, nickname = {}", result, map.get("telephone"), map.get("password"), map.get("nickname"));
return baseResponse;
}
......@@ -93,8 +99,9 @@ public class UserBiz {
str += "password="+map.get("password").toString();
}
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);
log.info("用户登录:result = {}, telephone = {}, password = {}, userId = {}", result, map.get("telephone"), map.get("password"), map.get("userId"));
json.put("password",map.get("password").toString());
return json.toJSONString();
}
......
......@@ -42,7 +42,7 @@
and is_del = #{isDel}
</if>
</where>
order by time DESC
order by praise_count, comment_count DESC
</select>
</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;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import javax.persistence.*;
@Table(name = "order_vehicle_crosstown")
@Data
@RequiredArgsConstructor
public class OrderVehicaleCrosstown {
/**
* 主键id
......@@ -28,23 +25,6 @@ public class OrderVehicaleCrosstown {
@Column(name = "order_no")
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 {
*/
private String dedDetail;
/**
* 驾驶人身份证号
*/
private String licenseIdCard;
/**
* 1、交车, 2、还车
*/
......@@ -141,4 +116,9 @@ public class OrderVehicaleCrosstown {
* 剩余押金
*/
private Integer restDeposit;
/**
* 驾驶人Id
*/
private String userLicenseId;
}
\ No newline at end of file
......@@ -15,14 +15,19 @@ public class OrderPageVO extends BaseOrder {
public static final String NO = "no=";
OrderRentVehicleDetail orderRentVehicleDetail;
OrderTourDetail orderTourDetail;
List<VehicleUserLicense> vehicleUserLicenses;
private String username;
private String vehicalNumberPlat;
private String qrcodeStr;
private OrderVehicleCrosstownDto orderVehicleCrosstownDto;
public void setQrcodeStr(String prefix) {
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;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
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.google.common.collect.Lists;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
......@@ -13,9 +14,11 @@ import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum;
import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.BaseOrderMapper;
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.universal.feign.ThirdFeign;
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.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j;
......@@ -52,6 +55,12 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
@Autowired
OrderRentVehicleBiz orderRentVehicleBiz;
@Autowired
OrderVehicalCrosstownBiz orderVehicalCrosstownBiz;
@Autowired
OrderUserLicenseBiz orderUserLicenseBiz;
@Autowired
OrderRefundBiz orderRefundBiz;
......@@ -100,27 +109,56 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
* @param no
* @return
*/
public OrderPageVO getOrderDetail(String no) {
public ObjectRestResponse getOrderDetail(String no) {
OrderPageVO orderPageVo = mapper.getOrderDetail(no);
String myDriverIds = orderPageVo.getOrderRentVehicleDetail().getMyDriverIds();
List<VehicleUserLicense> vehicleUserLicenses = Lists.newArrayList();
if(StringUtils.isNotBlank(myDriverIds)) {
if(myDriverIds.contains(",")) {
String[] ids = myDriverIds.split(",");
try{
for(String id : ids) {
vehicleUserLicenses.add(vehicleFeign.one(Integer.parseInt(id)).getData());
}
}catch (Exception e) {
}
} else {
try {
vehicleUserLicenses.add(vehicleFeign.one(Integer.parseInt(myDriverIds)).getData());
}catch (Exception e){}
}
if(orderPageVo == null) {
return ObjectRestResponse.createDefaultFail();
}
orderPageVo.setVehicleUserLicenses(vehicleUserLicenses);
return orderPageVo;
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();
String myDriverIds = orderPageVo.getOrderRentVehicleDetail().getMyDriverIds();
if(StringUtils.isNotBlank(myDriverIds)) {
if(myDriverIds.contains(",")) {
String[] ids = myDriverIds.split(",");
try{
//目前暂定一个驾驶人,后期需要更改再此更改
RestResponse<VehicleUserLicense> restResponse = vehicleFeign.getOne(Integer.parseInt(ids[0]));
log.info(restResponse.getMessage());
if(restResponse.getData() != null) {
vehicleUserLicenses.add(restResponse.getData());
}
}catch (Exception e) {
e.printStackTrace();
}
} else {
try {
vehicleUserLicenses.add(vehicleFeign.one(Integer.parseInt(myDriverIds)).getData());
}catch (Exception e){
e.printStackTrace();
}
}
}
orderPageVo.setVehicleUserLicenses(vehicleUserLicenses);
}
return ObjectRestResponse.succ(orderPageVo);
}
/**
......
......@@ -61,6 +61,7 @@ public class OrderTourVerificationBiz{
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "订单不是已支付状态");
}
Integer orderId=baseOrder.getId();
Integer version=baseOrder.getVersion();
OrderTourDetail tourDetail=new OrderTourDetail();
tourDetail.setOrderId(orderId);
tourDetail=tourDetailBiz.selectOne(tourDetail);
......@@ -81,6 +82,7 @@ public class OrderTourVerificationBiz{
baseOrder=new BaseOrder();
baseOrder.setId(orderId);
baseOrder.setStatus(OrderStatusEnum.ORDER_FINISH.getCode());
baseOrder.setVersion(version);
baseOrderBiz.updateSelectiveById(baseOrder);
tourDetail.setVerificationUser(userDTO.getId());
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;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown;
import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -15,7 +16,7 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return selectById(id);
}
public List<OrderVehicaleCrosstown> selectByOrderId(OrderVehicaleCrosstown orderVehicaleCrosstown) {
return mapper.selectByOrderId(orderVehicaleCrosstown);
public List<OrderVehicaleCrosstown> selectByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
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;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
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 {
@Autowired
OrderMemberDetailBiz orderMemberDetailBiz;
@Value("${gateway.insideHost}")
String insideHost;
@Value("${gateway.host}")
String host;
......@@ -188,7 +191,7 @@ public class BaseOrderController extends CommonBaseController {
if(StringUtils.isBlank(orderNo)) {
return ObjectRestResponse.paramIsEmpty();
}
return ObjectRestResponse.succ(baseOrderBiz.getOrderDetail(orderNo));
return baseOrderBiz.getOrderDetail(orderNo);
}
......@@ -256,7 +259,7 @@ public class BaseOrderController extends CommonBaseController {
orderPayVo.setBody(baseOrder.getName());
orderPayVo.setBuyerIp(StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request)));
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.setUserId(baseOrder.getUserId());
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;
import cn.hutool.core.bean.BeanUtil;
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.xxfc.platform.order.biz.BaseOrderBiz;
import com.xxfc.platform.order.biz.OrderUserLicenseBiz;
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.pojo.order.OrderVehicleCrosstownDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
......@@ -22,27 +30,51 @@ public class OrderVehicleCrosstownController {
@Autowired
OrderVehicalCrosstownBiz orderVehicalCrosstownBiz;
@Autowired
OrderUserLicenseBiz orderUserLicenseBiz;
@Autowired
BaseOrderBiz baseOrderBiz;
@PostMapping(value = "/add")
@ApiOperation(value = "添加交还车记录")
public ObjectRestResponse<?> add(OrderVehicaleCrosstown orderVehicaleCrosstown) {
log.info("添加的参数:orderVehicaleCrosstown = {}", orderVehicaleCrosstown);
if (orderVehicaleCrosstown == null) {
return ObjectRestResponse.createFailedResult(500, "参数为空!");
}
if (orderVehicaleCrosstown.getId() != null) {
OrderVehicaleCrosstown oldValue = orderVehicalCrosstownBiz.get(orderVehicaleCrosstown.getId());
if (oldValue != null) {
BeanUtil.copyProperties(orderVehicaleCrosstown, oldValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
orderVehicalCrosstownBiz.updateSelectiveById(oldValue);
return ObjectRestResponse.succ();
@Transactional
public ObjectRestResponse<OrderVehicleCrosstownDto> add(@RequestBody OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
log.info("添加的参数:orderVehicaleCrosstown = {}", orderVehicleCrosstownDto);
if (orderVehicleCrosstownDto == null || orderVehicleCrosstownDto.getOrderId() == null ) {
return ObjectRestResponse.createFailedResult(500, "参数为空!");
}
orderVehicalCrosstownBiz.insertSelective(orderVehicaleCrosstown);
return ObjectRestResponse.succ();
} else {
orderVehicalCrosstownBiz.insertSelective(orderVehicaleCrosstown);
return ObjectRestResponse.succ();
}
BaseOrder baseOrder = baseOrderBiz.selectById(orderVehicleCrosstownDto.getOrderId());
if(baseOrder == null) {
return ObjectRestResponse.createFailedResult(500,"订单不存在!");
}
List<OrderVehicaleCrosstown> oldValue = orderVehicalCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto);
if (oldValue .size() == 1) {
//已有直接返回
//交车完成 设置订单状态为出行中
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}")
......@@ -53,11 +85,24 @@ public class OrderVehicleCrosstownController {
@GetMapping(value = "/getByOrderId")
@ApiOperation(value = "根据订单Id获取所有记录信息")
public ObjectRestResponse<List<OrderVehicaleCrosstown>> getByOrderId(OrderVehicaleCrosstown orderVehicaleCrosstown) {
if (orderVehicaleCrosstown == null) {
public ObjectRestResponse<List<OrderVehicaleCrosstown>> getByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
if (orderVehicleCrosstownDto == null) {
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;
import com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
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.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
......@@ -93,7 +94,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//发送定时取消订单(30分钟)
//rabbitProduct.sendDelayMessage(bo.getOrder(), 1000L * 60 * 30);
rabbitProduct.sendDelayMessage(bo.getOrder(), 100L * 6 * 3);
rabbitProduct.sendDelayMessage(bo.getOrder(), 1000L * 60 * 5);
}
@Override
......@@ -251,6 +252,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
rentVehicleBookDTO.setModelId(detail.getModelId());
rentVehicleBookDTO.setUserName(BaseContextHandler.getName());
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.setBookRecordId(orr.getData().getId());
}
......
......@@ -15,7 +15,7 @@
</plugin>
<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"
password="sslcloud123*()">
</jdbcConnection>
......@@ -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="order_vehicle_crosstown" domainObjectName="OrderVehicaleCrosstown"></table>
<table tableName="dictionary" domainObjectName="Dictionary"></table>
<!-- <table tableName="vehicle_upkeep_log" domainObjectName="VehicleUpkeepLog"></table>-->
</context>
</generatorConfiguration>
\ No newline at end of file
......@@ -138,8 +138,8 @@
</select>
<select id="getOrderDetail" parameterType="java.lang.String" resultMap="orderPageMap">
select b.*
from base_order b
select *
from base_order
where no = #{no}
</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 @@
<id column="id" jdbcType="INTEGER" property="id" />
<result column="order_id" jdbcType="INTEGER" property="orderId" />
<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_img" jdbcType="VARCHAR" property="mileageImg" />
<result column="status" jdbcType="BIT" property="status" />
......@@ -23,15 +20,15 @@
<result column="crt_time" jdbcType="BIGINT" property="crtTime" />
<result column="upd_time" jdbcType="BIGINT" property="updTime" />
<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="ded_detail" jdbcType="LONGVARCHAR" property="dedDetail" />
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="deduction_cost" jdbcType="INTEGER" property="deductionCost"/>
<result column="rest_deposit" jdbcType="INTEGER" property="restDeposit"/>
<result column="user_license_id" jdbcType="VARCHAR" property="userLicenseId"/>
</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 *
from order_vehicle_crosstown
<where>
......
......@@ -119,11 +119,15 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
* @return
*/
public TourTagAndBannerDTO findTourTagById(Integer tagId){
TourTagAndBannerDTO tourTagAndBannerDTO = new TourTagAndBannerDTO();
//根据旅游标签id查询出标签信息
TourTag tourTag = mapper.findById(tagId);
if (log.isDebugEnabled()){
log.debug("根据标签id=[{}]查询出标签信息:[{}]",tagId,tourTag);
}
if (tourTag==null){
return tourTagAndBannerDTO;
}
TourTagDTO tourTagDTO = new TourTagDTO();
BeanUtils.copyProperties(tourTag,tourTagDTO);
//根据旅游标签id查询出标签对应的轮播图信息
......@@ -131,7 +135,7 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
if (log.isDebugEnabled()){
log.debug("根据标签id=[{}],查询出轮播图信息:[{}]",tagId,tourTagBannerDTOS);
}
TourTagAndBannerDTO tourTagAndBannerDTO = new TourTagAndBannerDTO();
//组装数据
tourTagAndBannerDTO.setTourTagDTO(tourTagDTO);
tourTagAndBannerDTO.setTourTagBannerDTOS(tourTagBannerDTOS);
......
package com.xxfc.platform.tour.config;
import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
......@@ -10,4 +11,8 @@ public class RestConfiguration {
public RestTemplate restTemplate() {
return new RestTemplate();
}
@Bean
public Logger.Level feignLevel(){
return Logger.Level.HEADERS;
}
}
......@@ -17,6 +17,17 @@ spring:
nacos:
config:
file-extension: yaml
debug: true
feign:
compression:
response:
enabled: true
request:
enabled: true
logging:
level:
com.github.wxiaoqi: debug
com.xxfc: debug
---
spring:
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;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
@Data
public class LicensePlateType implements Serializable {
......@@ -55,4 +56,18 @@ public class LicensePlateType implements Serializable {
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 @@
<version>2.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
</dependency>
</dependencies>
<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;
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.SearchableCity;
import com.xxfc.platform.universal.mapper.LicensePlateTypeMapper;
import org.springframework.stereotype.Service;
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
public class LicensePlateTypeBiz extends BaseBiz<LicensePlateTypeMapper, LicensePlateType> {
/**
* 获取车牌类型和和编码
* @param licensePlateTypes
*/
@Transactional
public void insertLicensePlateType(ArrayList<LicensePlateType> licensePlateTypes) {
public void insertLicensePlateType(List<LicensePlateType> 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> {
Integer amount=orderPayVo.getAmount();
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);
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;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.ArrayList;
import java.util.List;
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;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.exception.BaseException;
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.utils.CertifHttpUtils;
import com.xxfc.platform.universal.vo.TrafficViolations;
......@@ -15,8 +14,10 @@ import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.sql.SQLException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -31,11 +32,16 @@ public class TrafficViolationsService {
@Autowired
private LicensePlateTypeBiz licensePlateTypeBiz;
@Autowired
private TaskExecutor taskExecutor;
@Value("${ALIYUN.CODE}")
private String CODE;
@Value("${RETURN.TYPE}")
private String TYPE;
/**
* 下列参数,根据使用不同的公司的接口进行修改
*/
private static final String CITY_HOST = "https://weizhang.market.alicloudapi.com";
private static final String CITY_PATH = "/wz/province";
private static final String CITY_METHOD = "GET";
......@@ -60,7 +66,6 @@ public class TrafficViolationsService {
* @return
* @throws Exception
*/
// @Scheduled(cron = "0 0 0 * * ?")
public String getCity() throws Exception {
Map<String, String> headers = new HashMap<
String, String>();
......@@ -98,8 +103,9 @@ public class TrafficViolationsService {
/**
* 放入bean中
* @throws Exception
* @return
*/
public void saveLicensePlateType() throws Exception {
public ArrayList<LicensePlateType> saveLicensePlateType() throws Exception {
String result = searchaLicensePlateType();
if (StringUtils.isBlank(result)) {
throw new BaseException("错误! 查询不到车辆类型");
......@@ -114,12 +120,15 @@ public class TrafficViolationsService {
for (Map.Entry<String, String> licensePlateTypeEntry : licensePlateTypeMap.entrySet()) {
licensePlateTypes.add(new LicensePlateType(licensePlateTypeEntry.getKey(),licensePlateTypeEntry.getValue()));
}
licensePlateTypeBiz.insertLicensePlateType(licensePlateTypes);
return licensePlateTypes;
}
/**
* Unicode转汉字字符串
* Unicode转汉字字符串(根据接口返回编码的类型使用)
* @param str
* @return
*/
......@@ -144,7 +153,7 @@ public class TrafficViolationsService {
/**
* 调用接口获取车辆车和代码
* 调用接口获取车辆车和代码
* @return
* @throws Exception
*/
......@@ -163,11 +172,41 @@ public class TrafficViolationsService {
return unicodeToString(EntityUtils.toString(entity));
}
public ArrayList<LicensePlateType> getLicensePlateType() {
/**
* 查询对应的车牌和车牌代码
* @return
* @throws Exception
*/
public List<LicensePlateType> getLicensePlateType() throws Exception {
List<LicensePlateType> licensePlateTypes = licensePlateTypeBiz.selectListAll();
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 {
* 检验感受
*/
EXPERIENCE;
}
......@@ -47,17 +47,17 @@ public class VehicleUserLicense implements Serializable {
//驾驶证
@Column(name = "license")
@ApiModelProperty(value = "驾驶证")
private String license;
@ApiModelProperty(value = "驾驶证号码")
private String license;
//正面图片
@Column(name = "img")
@ApiModelProperty(value = "正面图片")
@ApiModelProperty(value = "驾驶证正面图片")
private String img;
//反面图片
@Column(name = "fimg")
@ApiModelProperty(value = "反面图片")
@ApiModelProperty(value = "驾驶证反面图片")
private String fimg;
//创建时间
......
......@@ -53,4 +53,8 @@ public interface VehicleFeign {
@RequestMapping(value = "/user/license/one", method = RequestMethod.GET)
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> {
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
}
@Cache(key = "vehical")
// @Cache(key = "vehical")
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;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
//@RestControllerAdvice
public class BaseExceptionHandler {
@ExceptionHandler(BaseException.class)
......
......@@ -401,7 +401,9 @@ public class VehicleController extends BaseController<VehicleBiz> {
//查询可车辆信息
PageDataVO<Vehicle> pageDataVO = vehicleBiz.searchUsableVehicle(dto);
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());
......
......@@ -59,7 +59,11 @@ public class VehicleLicenseController extends VehicleBaseController<VehicleLicen
}
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("多个驾驶员查询")
@RequestMapping(value = "/license/multi", method = RequestMethod.GET)
public ObjectRestResponse<List<VehicleUserLicense>> multi(QueryMultiDTO dto) throws Exception {
......
......@@ -333,7 +333,8 @@
</if>
<include refid="searchUsableSql"/>
and vm.id is not null
and bc.id is not null
GROUP BY model_id, company_id
<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