Commit b482ec71 authored by libin's avatar libin

companybase

parents cd73ee4f a8cada48
......@@ -16,7 +16,7 @@ spring:
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848
server-addr: 127.0.0.1:8848,10.1.37.166:8848
#共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
---
......
......@@ -46,6 +46,7 @@
<module>xx-campsite</module>
<module>xx-activity</module>
<module>xx-user-behavior-collect</module>
<module>xx-uccn</module>
</modules>
<packaging>pom</packaging>
<developers>
......
package com.xxfc.platform.campsite.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -20,5 +21,6 @@ public interface CampsiteFeign {
@GetMapping(value = "/campsiteShop/app/shopList")
public List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit",defaultValue = "4") Integer limit);
@GetMapping(value = "/campsiteShop/app/unauth/findRandomVehicle")
public ObjectRestResponse findRandomVehicle(@RequestParam(value = "number")Integer number);
}
......@@ -2,6 +2,8 @@ package com.xxfc.platform.campsite.biz;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.RandomUtil;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.campsite.dto.*;
......@@ -330,6 +332,28 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
.toEpochMilli();
}
/**
* 获取指定数量的随机旅游路线
* @return
*/
public ObjectRestResponse findRandomVehicle(Integer number) {
number = number == null ? 2 : number;
List<GoodDataVO> list = mapper.findAll();
Set<GoodDataVO> resultList = new HashSet<>();
if(CollectionUtils.isNotEmpty(list)) {
if(number == list.size()) {
return ObjectRestResponse.succ(list);
}
Set<Integer> set = new HashSet<>();
RandomUtil.randomSet(list.size(), number, set);
for(Integer i : set) {
resultList.add(list.get(i));
}
}
return ObjectRestResponse.succ(resultList);
}
private long transformEndTime(Long endTime) {
return LocalDateTime.ofInstant(new Date(endTime).toInstant(), ZoneOffset.ofHours(+8))
......
......@@ -39,6 +39,8 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
*/
List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size);
List<GoodDataVO> findAll();
/**
* 根据店铺id查询
*
......@@ -80,5 +82,7 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
* @param name
* @return
*/
int checkNameExist(@Param("id") Integer id, @Param("name") String name);
int checkNameExist(@Param("id") Integer id,@Param("name") String name);
}
......@@ -60,6 +60,11 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
return getBaseBiz().getAllByHome(page,limit);
}
@ApiOperation("随机获取营地")
@GetMapping(value = "/app/unauth/findRandomVehicle")
public ObjectRestResponse findRandomVehicle(Integer number) {
return baseBiz.findRandomVehicle(number);
}
@PostMapping(value = "/app/unauth/webchat_official/campsites")
public ObjectRestResponse<PageDataVO<CampsiteShopPageVo>> findCampsitesForPublicNumber(@RequestBody CampsiteShopFindDTO campsiteShopFindDTO){
......
......@@ -63,6 +63,13 @@
limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
</select>
<select id="findAll" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude
FROM `campsite_shop` cs
where cs.sale_state=1 and cs.is_del=0
order by cs.hot desc
</select>
<!--根据id查询详情-->
<select id="findCampsiteShopDetailById" resultType="com.xxfc.platform.campsite.dto.CampsiteShopDetailDTO">
select `name` as `name`,`province_name` as `provinceName`,`city_name` as `cityName`,`address` as `address`,`service_phone` as `phone`,`logo` as `logo`,`poster_background` as `posterBackground` ,
......
......@@ -13,7 +13,7 @@ spring:
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848, 10.1.37.166:8848
server-addr: 127.0.0.1:8848
#共用配置,+ mongodb日志配置
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
......
......@@ -104,4 +104,7 @@ public interface TourFeign {
@GetMapping("/spe/departure_date")
Date selectDepartureDataBySpeId(@RequestParam(value = "speIds") Integer speIds);
@GetMapping(value = "/tourGood/app/unauth/findRandomVehicle")
public ObjectRestResponse findRandomVehicle(@RequestParam(value = "number")Integer number);
}
......@@ -329,7 +329,7 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
* @return
*/
public ObjectRestResponse findRandomVehicle(Integer number) {
number = number == null ? 3 : number;
number = number == null ? 2 : number;
Map<String, Object> param = new HashMap<>();
List<TourGood> list = mapper.getCoordinateList(param);
Set<TourGood> resultList = new HashSet<>();
......
......@@ -100,7 +100,7 @@
LEFT JOIN tour_good_site s on v.site_id=s.id
LEFT JOIN tour_good_spe_price p ON v.spe_id=p.id
WHERE
v.is_del = 0 and v.good_id=#{goodId} and DATEDIFF(p.start_time,NOW())>0
v.is_del = 0 and v.good_id=#{goodId} <!--and DATEDIFF(p.start_time,NOW())>0-->
<if test="siteId!=null and siteId!='' ">
and v.site_id=#{siteId}
</if>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ace-security</artifactId>
<groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>com.xxfc.platform</groupId>
<modules>
<module>xx-uccn-api</module>
<module>xx-uccn-server</module>
</modules>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<artifactId>xx-uccn</artifactId>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-uccn-api</artifactId>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform-web</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-uccn-server</artifactId>
<dependencies>
<!-- 自己项目 -->
<dependency>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-uccn-api</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<configurationFile>
${basedir}/src/main/resources/builder/generatorConfig.xml
</configurationFile>
<overwrite>true</overwrite>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>${mapper.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.xxfc.platform.uccn;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import tk.mybatis.spring.annotation.MapperScan;
/**
*
* @author Administrator
*/
@SpringBootApplication(scanBasePackages ={
"com.xxfc.platform",
"com.github.wxiaoqi"
})
@EnableDiscoveryClient
@EnableFeignClients(value = {"com.xxfc.platform","com.github.wxiaoqi.security"})
@MapperScan(basePackages = "com.xxfc.platform.uccn.mapper")
public class UccnApplication {
public static void main(String[] args) {
SpringApplication.run(UccnApplication.class,args);
}
}
package com.xxfc.platform.uccn.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
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;
/**
* @Description : swagger配置配置
* @Author : Mars
* @Date : 2017年9月6日
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
/**
* Every Docket bean is picked up by the swagger-mvc framework - allowing for multiple
* swagger groups i.e. same code base multiple swagger resource listings.
*/
@Bean
public Docket customDocket() {
ParameterBuilder ticketPar = new ParameterBuilder();
List<Parameter> pars = new ArrayList<Parameter>();
ticketPar.name("Authorization").description("user Authorization")
.modelRef(new ModelRef("string")).parameterType("header")
//header中的ticket参数非必填,传空也可以
.required(false).build();
//根据每个方法名也知道当前方法在设置什么参数
pars.add(ticketPar.build());
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.xxfc.platform.activity.rest"))
.build()
.globalOperationParameters(pars)
.apiInfo(apiInfo());
}
ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("api swagger document")
.description("前后端联调swagger api 文档")
.version("2.1.5.5")
.build();
}
}
\ No newline at end of file
package com.xxfc.platform.uccn.config;
import com.github.wxiaoqi.security.common.handler.GlobalExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/12 15:27
*/
@Configuration("campsiteWebConfig")
@Primary
public class WebConfiguration implements WebMvcConfigurer {
@Bean
GlobalExceptionHandler getGlobalExceptionHandler() {
return new GlobalExceptionHandler();
}
}
spring:
application:
name: xx-uccn
profiles:
active: dev
cloud:
nacos:
config:
file-extension: yaml
---
spring:
profiles: dev
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848
#共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
---
spring:
profiles: pro
cloud:
nacos:
config:
server-addr: 10.5.52.2:8848
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 -->
<property name="LOG_HOME" value="${system.log.path:-logs}"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <!--1. 输出到控制台-->
<filter class="com.github.wxiaoqi.security.common.filter.NacosLogFilter"></filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
</appender>
<appender name="SYSTEM_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"><!-- 按照每天生成日志文件 -->
<filter class="com.github.wxiaoqi.security.common.filter.DenyFilter"></filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${LOG_HOME}/sys.%d{yyyy-MM-dd}.log</FileNamePattern><!--日志文件输出的文件名 -->
<MaxHistory>30</MaxHistory><!--日志文件保留天数 -->
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern><!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
<appender name="WEB_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"><!-- 按照每天生成日志文件 -->
<filter class="com.github.wxiaoqi.security.common.filter.AcceptFilter"></filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${LOG_HOME}/log.%d{yyyy-MM-dd}.log</FileNamePattern><!--日志文件输出的文件名 -->
<MaxHistory>30</MaxHistory><!--日志文件保留天数 -->
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern><!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="SYSTEM_FILE" />
<appender-ref ref="WEB_FILE" />
</root>
</configuration>
\ No newline at end of file
......@@ -69,3 +69,5 @@ public class DictionaryController {
return ObjectRestResponse.succ();
}
}
......@@ -39,6 +39,9 @@ public interface VehicleFeign {
@PostMapping("/active/small/arrival")
public RestResponse arrivalBySmall(@RequestBody VehicleArrivalVo arrivalVo);
@GetMapping(value = "/vehicleModel/app/unauth/findRandomVehicle")
public ObjectRestResponse findRandomVehicle(@RequestParam(value="number")Integer number);
//修改评分
@RequestMapping(value = "/vehicleModel/app/addScore", method = RequestMethod.GET)
public RestResponse addScore(@RequestParam(value="id")Integer id, @RequestParam(value="score")Integer score);
......
......@@ -70,19 +70,24 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
endPredictableHour |= 1 << (curentHour);
}
}
DateTime startDay = DateTime.parse(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), DATE_TIME_FORMATTER);
DateTime endDay = DateTime.parse(DateTime.parse(bookEndDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), DATE_TIME_FORMATTER);
if(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER).equals(DateTime.parse(bookEndDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER))) {//同一天预定
//如果开始时间是0点开始
if(startPredictableHour == 0 || endPredictableHour == 0) {
predictableHours.put(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), startPredictableHour | endPredictableHour);
} else {
predictableHours.put(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), startPredictableHour & endPredictableHour);
}
} else {
} else { //非同一天开始
if(startPredictableHour == 0) { //如果是0点就直接预订全天
startPredictableHour = 16777215;
}
predictableHours.put(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), startPredictableHour);
predictableHours.put(DateTime.parse(bookEndDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), endPredictableHour);
}
DateTime startDay = DateTime.parse(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), DATE_TIME_FORMATTER);
DateTime endDay = DateTime.parse(DateTime.parse(bookEndDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), DATE_TIME_FORMATTER);
if(endDay.getDayOfMonth() - startDay.getDayOfMonth() >1){ //
if(endDay.getDayOfMonth() - startDay.getDayOfMonth() > 1){ //
for (DateTime curDate = startDay.plusDays(1); curDate.compareTo(endDay) < 0; curDate = curDate.plusDays(1)) {
String curDateStr = curDate.toString(DATE_TIME_FORMATTER);
//全天预定
......
......@@ -78,7 +78,7 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> {
* @return
*/
public ObjectRestResponse findRandomVehicle(Integer number) {
number = number == null ? 3 : number;
number = number == null ? 2 : number;
VehicleModelQueryCondition vmqc = new VehicleModelQueryCondition();
List<VehicleModelVo> list = mapper.findVehicleModelPage(vmqc);
Set<VehicleModelVo> resultList = new HashSet<>();
......
......@@ -23,7 +23,7 @@ spring:
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848
server-addr: 127.0.0.1:8848,10.1.37.166:8848
#共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
......
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