kchh
parent
e4f537a87d
commit
3fe8f3209a
|
@ -0,0 +1,18 @@
|
|||
#FROM openjdk:8
|
||||
#LABEL name="rtosac" version="1.0.0" author="wsnet" maintainer="wsnet@wsmis.com"
|
||||
#COPY target/com.haitongauto.rtosac.jar rtosac-image.jar
|
||||
#CMD ["java","-jar","rtosac-image.jar"]
|
||||
|
||||
FROM openjdk:8
|
||||
#adoptopenjdk/openjdk8:ubi
|
||||
LABEL name="docker" version="1.0.0" author="wsnet" maintainer="wsnet@wsmis.com"
|
||||
COPY target/com.haitongauto.rtosac.jar rtosac-image.jar
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
RUN echo 'Asia/Shanghai' >/etc/timezone
|
||||
EXPOSE 8083
|
||||
|
||||
ENV PROFILES_OPTS=""
|
||||
ENV JAVA_OPTS=""
|
||||
|
||||
ENTRYPOINT [ "sh", "-c","java $PROFILES_OPTS $JAVA_OPTS -jar rtosac-image.jar" ]
|
|
@ -0,0 +1,4 @@
|
|||
FROM openjdk:8
|
||||
LABEL name="rtosac" version="1.0.0" author="wsnet" maintainer="wsnet@wsmis.com"
|
||||
COPY target/com.haitongauto.rtosac.jar rtosac-image.jar
|
||||
CMD ["java","-jar","rtosac-image.jar"]
|
|
@ -0,0 +1,241 @@
|
|||
<?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>rtos-wh</artifactId>
|
||||
<groupId>org.example</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wx-applet</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.14.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.14.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframwork.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 配置 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.6.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 分页插件 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<version>5.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bestvike</groupId>
|
||||
<artifactId>linq</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>models</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>utils</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>mapper</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>interfaces</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!--哪吒组件1-->
|
||||
<dependency>
|
||||
<groupId>com.nuzar</groupId>
|
||||
<artifactId>rtops-openapi-client</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!--哪吒组件2-->
|
||||
<dependency>
|
||||
<groupId>com.nuzar</groupId>
|
||||
<artifactId>nuzar-security</artifactId>
|
||||
<version>2.6.14.10-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!--哪吒组件依赖-1-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-web</artifactId>
|
||||
<version>5.6.9</version>
|
||||
</dependency>
|
||||
<!--哪吒组件依赖-2-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-config</artifactId>
|
||||
<version>5.6.9</version>
|
||||
</dependency>
|
||||
<!--哪吒组件依赖-3-->
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-oauth2-resource-server -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
|
||||
<version>2.6.14</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-oauth2-client -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-oauth2-client</artifactId>
|
||||
<version>2.6.14</version>
|
||||
</dependency>
|
||||
<!--哪吒组件依赖-4-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-oauth2-resource-server</artifactId>
|
||||
<version>5.6.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-oauth2-client</artifactId>
|
||||
<version>5.6.9</version>
|
||||
</dependency>
|
||||
<!--哪吒组件依赖-5-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
<version>5.6.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
<!-- <version>3.0.6</version>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
<!-- <version>4.0.3</version>-->
|
||||
</dependency>
|
||||
|
||||
<!--swagger组件-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>top.jfunc.json</groupId>
|
||||
<artifactId>Json-Gson</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.tess4j</groupId>
|
||||
<artifactId>tess4j</artifactId>
|
||||
<version>5.6.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>com.haitongauto.rtosac</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.2.2.RELEASE</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
|
||||
<configuration>
|
||||
<!--添加该配置,上面的yaml的智能补全将禁止编译打包到目标项目-->
|
||||
<excludes>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,17 @@
|
|||
package com.haitongauto.rtosac;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
@MapperScan("com.haitongauto.mapper")
|
||||
@EnableFeignClients(basePackages = {"com.haitongauto.interfaces"})
|
||||
@SpringBootApplication(scanBasePackages = {"com.haitongauto.interfaces","com.haitongauto.rtosac"})
|
||||
public class ApplicationApplet {
|
||||
/**
|
||||
* 启动微信小程序服务入口
|
||||
* @param args args
|
||||
*/
|
||||
public static void main(String[] args){
|
||||
SpringApplication.run(ApplicationApplet.class,args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.haitongauto.rtosac;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 拦截器的属性配置
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass(WebMvcConfigurer.class)
|
||||
public class InterceptorConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@PostConstruct
|
||||
public void EnumObjectMapper() {
|
||||
// 解决enum不匹配问题 默认值为false
|
||||
objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限验证过滤器
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public PermInterceptor permInterceptor() {
|
||||
return new PermInterceptor();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ConditionalOnBean(PermInterceptor.class)
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 拦截器
|
||||
InterceptorRegistration registration = registry.addInterceptor(permInterceptor());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package com.haitongauto.rtosac;
|
||||
|
||||
import com.haitongauto.interfaces.UsersApi;
|
||||
import com.haitongauto.models.ido.login.UserInfoRes;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 权限过滤器
|
||||
*/
|
||||
public class PermInterceptor implements HandlerInterceptor {
|
||||
public static final String[] SWAGGER_EXCLUDE_PATHS = {"/doc.html", "/swagger-resources/**", "/webjars/**", "/v2/**", "/favicon.ico", "/swagger-ui.htmL/**", "/health/ping"};
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
String uri = request.getRequestURI();
|
||||
AntPathMatcher antPathMatcher = new AntPathMatcher();
|
||||
for (String p : SWAGGER_EXCLUDE_PATHS) {
|
||||
if (antPathMatcher.match(p, uri)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//判断是否登录
|
||||
String userId = "";
|
||||
String username = "";
|
||||
try {
|
||||
BeanFactory factory = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext());
|
||||
//老系统同步新系统 没有token(直接放过)
|
||||
if (StringUtils.equalsAny(request.getRequestURI()
|
||||
, "/appointment/execTruckOrderNsFin"
|
||||
)) {
|
||||
return true;
|
||||
}
|
||||
UsersApi openApi = factory.getBean(UsersApi.class);
|
||||
UserInfoRes info = openApi.getUserInfo().getData();
|
||||
userId = info.getId();
|
||||
username = info.getName();
|
||||
String me = "mini-app,app,pad,web";
|
||||
String mt = info.getMediaType();
|
||||
if (me.contains(mt) && StringUtils.equalsAny(request.getRequestURI()
|
||||
, "/appointment/plateTruckScan"
|
||||
, "/appointment/cancelAppointmentUnPlan"
|
||||
, "/message/realMessage"
|
||||
, "/message/punchClockOverByPrint"
|
||||
, "/news/sendTruckThroughGateInfo"
|
||||
, "/news/sendTruckThroughGateInfoUnconventionality"
|
||||
)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StringUtils.equalsIgnoreCase(info.getMediaType(), "mini-app")) {
|
||||
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
||||
// 可以设置响应体
|
||||
response.getWriter().write("Access Forbidden");
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
// response.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
||||
// // 可以设置响应体
|
||||
// response.getWriter().write("Access Forbidden");
|
||||
// return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
||||
// UserContext.clear();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断是否有权限
|
||||
* 1.从请求头中获取token
|
||||
*
|
||||
* 2.通过token从redis中获取当前登录对象(object)
|
||||
*
|
||||
* 3.通过对象查询数据库是否存在当前对象
|
||||
*
|
||||
* 4.获取登录对象的登录名 判断是否是(admin或者总经理)这两个账号拥有最高权限
|
||||
*
|
||||
* 5.判断是否被授权,(获取临时授权时设置的开始时间,结束时间,当前时间),
|
||||
*
|
||||
* 获取这个三个时间的时间戳,判断当前时间是否在开始时间和结束时间之间
|
||||
*
|
||||
* 如果开始时间和结束时间为空的话表示当前登录对象未被临时授权,会执行后面的 4,5,6,
|
||||
*
|
||||
* 如果有时间,但是当前时间不在这个时间段也会执行 4,5,6
|
||||
*
|
||||
* 如果有时间,并且当前时间在这个时间段之中,就会直接返回true
|
||||
*
|
||||
* 6.从请求头中获取当前接口的地址,
|
||||
*
|
||||
* 7.通过当前登录对象的id查询权限
|
||||
*
|
||||
* 8.判断当前登录对象的权限中是否包含当前接口的地址,如果包含,允许当前登录对象访问,如果不包含,则不允许当前登录人访问
|
||||
* ————————————————
|
||||
* 版权声明:本文为CSDN博主「原你是阳光(#`O′)」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
|
||||
* 原文链接:https://blog.csdn.net/weixin_58696998/article/details/124663181
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.haitongauto.rtosac;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
//@Configuration
|
||||
//@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
// @Bean
|
||||
// public Docket api() {
|
||||
// return new Docket(DocumentationType.SWAGGER_2)
|
||||
// .enable(true)//是否启动swagger
|
||||
// .select()
|
||||
// .apis(RequestHandlerSelectors.basePackage("com.haitongauto.rtosac.api"))
|
||||
// //.paths(PathSelectors.any())
|
||||
// .build();
|
||||
// }
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,19 @@
|
|||
package com.haitongauto.rtosac.api;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/health")
|
||||
public class HeathCheckController {
|
||||
/**
|
||||
* 健康检查(服务心跳)
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/ping")
|
||||
public String ping() {
|
||||
return "pong";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,376 @@
|
|||
package com.haitongauto.rtosac.api;
|
||||
|
||||
import com.haitongauto.interfaces.OrderApi;
|
||||
import com.haitongauto.interfaces.UsersApi;
|
||||
import com.haitongauto.models.dto.AnnouncementsDto;
|
||||
import com.haitongauto.models.ido.CommonRes;
|
||||
import com.haitongauto.models.ido.PortAreasIdo;
|
||||
import com.haitongauto.models.ido.login.UserInfoRes;
|
||||
import com.haitongauto.models.pojo.Announcement;
|
||||
import com.haitongauto.models.pojo.Truck;
|
||||
import com.haitongauto.models.pojo.Users;
|
||||
import com.haitongauto.models.sysuser.OldSysTruck;
|
||||
import com.haitongauto.models.sysuser.OldSysUT;
|
||||
import com.haitongauto.models.sysuser.OldSysUTDto;
|
||||
import com.haitongauto.models.sysuser.OldSysUser;
|
||||
import com.haitongauto.rtosac.service.Response;
|
||||
import com.haitongauto.models.dto.DataForMessage;
|
||||
import com.haitongauto.models.dto.Pages;
|
||||
import com.haitongauto.rtosac.service.HomeService;
|
||||
import com.haitongauto.rtosac.service.UsersService;
|
||||
import com.haitongauto.utils.IpHelper;
|
||||
import com.haitongauto.utils.StringHelper;
|
||||
import com.haitongauto.utils.minio.MinioUtils;
|
||||
import io.minio.errors.InvalidEndpointException;
|
||||
import io.minio.errors.InvalidPortException;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/home")
|
||||
public class HomeController {
|
||||
/**
|
||||
* 头部信息
|
||||
*/
|
||||
@Autowired
|
||||
HttpServletRequest servletRequest;
|
||||
@Autowired
|
||||
HomeService homeService;
|
||||
@Autowired
|
||||
Response response;
|
||||
@Autowired
|
||||
UsersService usersService;
|
||||
@Resource
|
||||
private UsersApi usersApi;
|
||||
@Resource
|
||||
private OrderApi orderApi;
|
||||
|
||||
|
||||
/**
|
||||
* 提供给哪吒调用的接口,用于老系统用户和板车信息同步到新系统
|
||||
* "wx_openid":"bbaaaaaaaaaaaaaa",
|
||||
* "tel_number":"15102735688",
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/userInfoSync")
|
||||
public String userInfoSync(@RequestBody OldSysUTDto oldSysUTDto) {
|
||||
com.haitongauto.models.res.Response<String> myResponse = new com.haitongauto.models.res.Response();
|
||||
if (oldSysUTDto == null) {
|
||||
myResponse.setCode(-200);
|
||||
myResponse.setMsg("传参不能为空");
|
||||
return myResponse.toJSONString();
|
||||
}
|
||||
String wx_openid = oldSysUTDto.getWx_openid();
|
||||
String tel_number = oldSysUTDto.getTel_number();
|
||||
if (wx_openid == null || wx_openid.isEmpty()) {
|
||||
myResponse.setCode(-200);
|
||||
myResponse.setMsg("微信openid不能为空");
|
||||
return myResponse.toJSONString();
|
||||
}
|
||||
if (tel_number == null || tel_number.isEmpty()) {
|
||||
myResponse.setCode(-200);
|
||||
myResponse.setMsg("手机号不能为空");
|
||||
return myResponse.toJSONString();
|
||||
}
|
||||
try {
|
||||
myResponse.setCode(200);
|
||||
Users users = homeService.userInfoSync(wx_openid, tel_number);
|
||||
if (users == null) {
|
||||
myResponse.setCode(-200);
|
||||
myResponse.setMsg("数据库不存在该用户记录");
|
||||
return myResponse.toJSONString();
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
myResponse.setCode(500);
|
||||
myResponse.setMsg(ex.getMessage());
|
||||
return myResponse.toJSONString();
|
||||
}
|
||||
return myResponse.toJSONString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户登录:提交用户信息(users信息要保持完整:open_id、session_key、access_token,及用户),登陆RTOS系统:需要RTOS系统排除拦截
|
||||
*
|
||||
* @param users 用户信息
|
||||
* @return 返回
|
||||
*/
|
||||
@PostMapping("/onLogin")
|
||||
public String onLogin(@RequestBody Users users) {
|
||||
//请求哪吒接口获得用户信息
|
||||
CommonRes<UserInfoRes> userInfoResCommonRes = usersApi.getUserInfo();
|
||||
UserInfoRes userInfoRes = userInfoResCommonRes.getData();
|
||||
String msg = "";
|
||||
//检查本地数据库是否有该用户
|
||||
Users my_users = null;
|
||||
if (userInfoRes != null && userInfoRes.getId() != null && !userInfoRes.getId().isEmpty()) {
|
||||
users.setId(userInfoRes.getId());
|
||||
users.setWx_openid(userInfoRes.getOpenId());
|
||||
my_users = homeService.getUsersForId(userInfoRes.getId());
|
||||
}
|
||||
if (my_users != null) {
|
||||
users.setId(my_users.getId());
|
||||
if (users.getUsers_name() == null || users.getUsers_name().isEmpty()) {
|
||||
users.setUsers_name(my_users.getUsers_name());
|
||||
}
|
||||
if (users.getId_code() == null || users.getId_code().isEmpty()) {
|
||||
users.setId_code(my_users.getId_code());
|
||||
}
|
||||
if (users.getTel_number() == null || users.getTel_number().isEmpty()) {
|
||||
users.setTel_number(my_users.getTel_number());
|
||||
}
|
||||
}
|
||||
String users_id = (my_users != null) ? my_users.getId() : null;
|
||||
//更新到入本地数据库(保存用户的openid和rtos的token)
|
||||
if (users_id != null && !users_id.isEmpty()) {
|
||||
Integer x = usersService.update(users);
|
||||
} else {
|
||||
String id = usersService.insert(users);
|
||||
users.setId(id);
|
||||
}
|
||||
|
||||
Truck myTruck = null;
|
||||
myTruck = usersService.getTruckByWxOpenID(users.getWx_openid());
|
||||
if (myTruck != null && my_users != null) {
|
||||
users.setId(users.getId());
|
||||
users.setUsers_name(my_users.getUsers_name());
|
||||
}
|
||||
|
||||
assert userInfoRes != null;
|
||||
my_users = homeService.getUsersForId(userInfoRes.getId());
|
||||
|
||||
//1-先获取用户登录IP
|
||||
String ip = IpHelper.getIpAddr(servletRequest);
|
||||
//2-登录日志写如数据库
|
||||
homeService.loginLogAdd(users.getWx_openid(), ip);
|
||||
//判断请求是否成功
|
||||
Boolean bl = true;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("users", my_users);
|
||||
data.put("truck", myTruck);
|
||||
//返回
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前端提交车辆信息
|
||||
*
|
||||
* @param truck 车辆信息
|
||||
* @return 返回
|
||||
*/
|
||||
@PostMapping("/truckBanding")
|
||||
public String truckBanding(@RequestBody Truck truck) {
|
||||
CommonRes<UserInfoRes> userInfoResCommonRes;
|
||||
String userId;
|
||||
String msg = "";
|
||||
if (truck == null || truck.getTruck_number().isEmpty()) {
|
||||
msg = "用户车辆信息不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
try {
|
||||
//请求哪吒接口获得用户信息
|
||||
userInfoResCommonRes = usersApi.getUserInfo();
|
||||
UserInfoRes userInfoRes = userInfoResCommonRes.getData();
|
||||
userId = userInfoRes.getId();
|
||||
truck.setUsers_id(userId);
|
||||
} catch (Exception ex) {
|
||||
msg = "从rtos后台,获得用户信息异常," + ex.getMessage();
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
|
||||
String truck_id = truck.getId();
|
||||
Truck myTruck = null;
|
||||
String openid = "";
|
||||
if (truck.getWx_openid() != null && !truck.getWx_openid().isEmpty()) {
|
||||
openid = truck.getWx_openid();
|
||||
myTruck = usersService.getTruckByWxOpenID(openid);
|
||||
if (myTruck != null) {
|
||||
truck.setUsers_id(myTruck.getUsers_id());
|
||||
truck.setId(myTruck.getId());
|
||||
if (openid != null && !openid.isEmpty()) {
|
||||
truck.setWx_openid(openid);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//请求哪吒接口获得用户信息
|
||||
UserInfoRes userInfoRes = userInfoResCommonRes.getData();
|
||||
openid = userInfoRes.getOpenId();
|
||||
truck.setWx_openid(openid);
|
||||
truck.setUsers_id(userInfoRes.getId());
|
||||
}
|
||||
if (myTruck != null) {
|
||||
truck_id = myTruck.getId();
|
||||
}
|
||||
//更新到数据库
|
||||
if (truck_id != null && !truck_id.isEmpty()) {
|
||||
Integer x = homeService.updateTruck(truck);
|
||||
truck_id = truck.getId();
|
||||
} else {
|
||||
truck_id = homeService.insertTruck(truck);
|
||||
truck.setId(truck_id);
|
||||
}
|
||||
Boolean bl = truck_id != null && !truck_id.isEmpty();
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("truck", truck);
|
||||
//返回
|
||||
return response.getResponseData(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页读取每页10条公告数据
|
||||
*
|
||||
* @return 返回分页公告数据
|
||||
*/
|
||||
@RequestMapping("/getAnnouncementsList")
|
||||
public String getAnnouncementsList(Pages pages, Integer sort, String keyWords) {
|
||||
//解析分页参数
|
||||
Integer pageNum = (pages != null && pages.getPageNum() != null && pages.getPageNum() > 0) ? pages.getPageNum() : 1;
|
||||
Integer pageSize = (pages != null) && pages.getPageSize() != null && pages.getPageSize() > 0 ? pages.getPageSize() : 10;
|
||||
//调用Service分页方法,获取分页数据对象PageInfo
|
||||
PageInfo<Announcement> pagesInfo = homeService.getAnnouncementsList(pageNum, pageSize, sort, keyWords);
|
||||
//读取分页结果
|
||||
int pageCount = 0; //总页数
|
||||
long recordTotal = 0; //记录总数
|
||||
List<Announcement> myList = null; //当前页的列表数据
|
||||
List<AnnouncementsDto> myListres = null; //当前页的列表数据
|
||||
if (pagesInfo != null) {
|
||||
pageCount = pagesInfo.getPages(); //总页数
|
||||
recordTotal = pagesInfo.getTotal(); //记录总数
|
||||
myList = pagesInfo.getList(); //当前页的列表数据
|
||||
}
|
||||
if (myList != null && myList.size() > 0) {
|
||||
myListres = new ArrayList<>();
|
||||
for (Announcement announcement : myList) {
|
||||
if (announcement != null) {
|
||||
AnnouncementsDto announcementsDto = new AnnouncementsDto();
|
||||
announcementsDto.setId(announcement.getId());
|
||||
announcementsDto.setTitle(announcement.getTitle());
|
||||
announcementsDto.setSort(announcement.getSort());
|
||||
if (announcement.getSort() != null) {
|
||||
switch (announcement.getSort()) {
|
||||
case 1:
|
||||
announcementsDto.setSort_name("小程序");
|
||||
break;
|
||||
case 2:
|
||||
announcementsDto.setSort_name("客服平台");
|
||||
break;
|
||||
}
|
||||
}
|
||||
announcementsDto.setAbstracts(announcement.getAbstracts());
|
||||
String content = announcement.getAnnouncement();
|
||||
if (content != null && !content.isEmpty()) {
|
||||
String decodedHtml = StringEscapeUtils.unescapeHtml4(content);
|
||||
announcementsDto.setAnnouncement(decodedHtml);
|
||||
announcementsDto.setAnnouncement_text(StringHelper.getTxtByHtml(decodedHtml));
|
||||
}
|
||||
announcementsDto.setAuthor(announcement.getAuthor());
|
||||
announcementsDto.setReading_volume(announcement.getReading_volume());
|
||||
if (announcement.getCreate_time() != null) {
|
||||
announcementsDto.setCreate_time(announcement.getCreate_time());
|
||||
}
|
||||
if (announcement.getUpdate_time() != null) {
|
||||
announcementsDto.setUpdate_time(announcement.getUpdate_time());
|
||||
}
|
||||
announcementsDto.setIs_del(announcement.getIs_del());
|
||||
myListres.add(announcementsDto);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//定义返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("pageNum", pageNum);
|
||||
data.put("pageCount", pageCount);
|
||||
data.put("recordTotal", recordTotal);
|
||||
data.put("dataJson", myListres);
|
||||
Boolean bl = myListres != null;
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据公告id获得公告
|
||||
*
|
||||
* @param announcement_id 公告id
|
||||
* @return 返回公告信息
|
||||
*/
|
||||
@RequestMapping("/getAnnouncementById")
|
||||
public String getAnnouncementById(@RequestParam("announcement_id") String announcement_id) {
|
||||
String msg = "";
|
||||
if (announcement_id == null || announcement_id.isEmpty()) {
|
||||
msg = "公告id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
//调用Service分页方法,获取分页数据对象PageInfo
|
||||
Announcement announcement = homeService.getAnnouncementById(announcement_id);
|
||||
AnnouncementsDto announcementsDto = new AnnouncementsDto();
|
||||
if (announcement != null) {
|
||||
announcementsDto.setId(announcement.getId());
|
||||
announcementsDto.setTitle(announcement.getTitle());
|
||||
announcementsDto.setSort(announcement.getSort());
|
||||
if (announcement.getSort() != null) {
|
||||
switch (announcement.getSort()) {
|
||||
case 1:
|
||||
announcementsDto.setSort_name("小程序");
|
||||
break;
|
||||
case 2:
|
||||
announcementsDto.setSort_name("客服平台");
|
||||
break;
|
||||
}
|
||||
}
|
||||
announcementsDto.setAbstracts(announcement.getAbstracts());
|
||||
String content = announcement.getAnnouncement();
|
||||
if (content != null && !content.isEmpty()) {
|
||||
String decodedHtml = StringEscapeUtils.unescapeHtml4(content);
|
||||
announcementsDto.setAnnouncement(decodedHtml);
|
||||
announcementsDto.setAnnouncement_text(StringHelper.getTxtByHtml(decodedHtml));
|
||||
}
|
||||
announcementsDto.setAuthor(announcement.getAuthor());
|
||||
announcementsDto.setReading_volume(announcement.getReading_volume());
|
||||
if (announcement.getCreate_time() != null) {
|
||||
announcementsDto.setCreate_time(announcement.getCreate_time());
|
||||
}
|
||||
if (announcement.getUpdate_time() != null) {
|
||||
announcementsDto.setUpdate_time(announcement.getUpdate_time());
|
||||
}
|
||||
announcementsDto.setIs_del(announcement.getIs_del());
|
||||
}
|
||||
Boolean bl = announcement != null;
|
||||
//定义返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("announcementInfo", announcementsDto);
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
package com.haitongauto.rtosac.api;
|
||||
|
||||
import com.bestvike.linq.Linq;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.haitongauto.models.dto.Pages;
|
||||
import com.haitongauto.models.pojo.Appointment;
|
||||
import com.haitongauto.models.pojo.Message;
|
||||
import com.haitongauto.rtosac.service.AppointmentService;
|
||||
import com.haitongauto.rtosac.service.MessageService;
|
||||
import com.haitongauto.rtosac.service.Response;
|
||||
import com.haitongauto.rtosac.service.impl.AppointmentServiceImpl;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/message")
|
||||
public class MessageController {
|
||||
@Autowired
|
||||
MessageService messageService;
|
||||
|
||||
@Autowired
|
||||
AppointmentService appointmentService;
|
||||
|
||||
@Autowired
|
||||
Response response;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(AppointmentServiceImpl.class);
|
||||
|
||||
/**
|
||||
* 哪吒打印的时候向小程序发送消息(哪吒请求接口)
|
||||
*
|
||||
* @param message 消息实体
|
||||
* @return 返回结果
|
||||
*/
|
||||
@PostMapping("/realMessage")
|
||||
public String realMessage(@RequestBody Message message) {
|
||||
//判断请求是否成功
|
||||
Boolean bl = messageService.receiveMessage(message);
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
return response.getResponseData(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序前端打开界面,获得未消息列表,
|
||||
*
|
||||
* @param open_id 板车号
|
||||
* @return 返回结果
|
||||
*/
|
||||
@GetMapping("/getUnReadMessageListByOpenId")
|
||||
public String getUnReadMessageListByOpenId(@RequestParam("open_id") String open_id,
|
||||
@RequestParam("pageNum") Integer pageNum,
|
||||
@RequestParam("pageSize") Integer pageSize) {
|
||||
pageNum = (pageNum != null) ? pageNum : 1;
|
||||
pageSize = (pageSize != null) ? pageSize : 10;
|
||||
//判断请求是否成功
|
||||
PageInfo<Message> pagesInfo = messageService.getUnReadMessageListByWxOpenid(open_id, pageNum, pageSize);
|
||||
//读取分页结果
|
||||
Integer pageCount = pagesInfo.getPages();//总页数
|
||||
long recordTotal = pagesInfo.getTotal();//记录总数
|
||||
List<Message> myList = new ArrayList<>();//当前页的列表数据
|
||||
Pages pages = new Pages();
|
||||
int noReadSize = 0;
|
||||
if (pageNum <= pageCount) {
|
||||
myList = pagesInfo.getList();//当前页的列表数据
|
||||
if (myList != null && myList.size() > 0) {
|
||||
noReadSize = Linq.of(myList).where(p -> p.getIs_read().equals(0)).count();
|
||||
}
|
||||
|
||||
pages.setUnReadSize(noReadSize);
|
||||
}
|
||||
//分页数据添加到pages
|
||||
pages.setPageNum(pageNum);
|
||||
pages.setPageSize(pageSize);
|
||||
pages.setPageCount(pageCount);
|
||||
pages.setRecordTotal(recordTotal);
|
||||
//判断请求是否成功
|
||||
Boolean bl = myList != null;
|
||||
//创建返回数据data
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("pages", pages);
|
||||
data.put("messageList", myList);
|
||||
//添加到返回对象
|
||||
//返回
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序前端打开界面,获得所有消息列表,
|
||||
*
|
||||
* @param open_id 板车号
|
||||
* @return 返回结果
|
||||
*/
|
||||
@GetMapping("/getMessageListByOpenId")
|
||||
public String getMessageListByOpenId(@RequestParam("open_id") String open_id,
|
||||
@RequestParam("pageNum") Integer pageNum,
|
||||
@RequestParam("pageSize") Integer pageSize) {
|
||||
pageNum = (pageNum != null) ? pageNum : 1;
|
||||
pageSize = (pageSize != null) ? pageSize : 10;
|
||||
//判断请求是否成功
|
||||
PageInfo<Message> pagesInfo = messageService.getMessageListByWxOpenid(open_id, pageNum, pageSize);
|
||||
//读取分页结果
|
||||
Integer pageCount = pagesInfo.getPages();//总页数
|
||||
long recordTotal = pagesInfo.getTotal();//记录总数
|
||||
List<Message> myList = new ArrayList<>();//当前页的列表数据
|
||||
Pages pages = new Pages();
|
||||
int noReadSize = 0;
|
||||
if (pageNum <= pageCount) {
|
||||
myList = pagesInfo.getList();//当前页的列表数据
|
||||
if (myList != null && myList.size() > 0) {
|
||||
//noReadSize = Linq.of(myList).where(p -> Objects.equals(p.getIs_read(), 0)).count();
|
||||
//Message message = Linq.of(myList).firstOrDefault();
|
||||
//未读数据查所有未读的站内消息数量
|
||||
noReadSize = messageService.sumUnread(open_id);
|
||||
}
|
||||
pages.setUnReadSize(noReadSize);
|
||||
}
|
||||
//分页数据添加到pages
|
||||
pages.setPageNum(pageNum);
|
||||
pages.setPageSize(pageSize);
|
||||
pages.setPageCount(pageCount);
|
||||
pages.setRecordTotal(recordTotal);
|
||||
//判断请求是否成功
|
||||
Boolean bl = myList != null;
|
||||
//创建返回数据data
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("pages", pages);
|
||||
data.put("messageList", myList);
|
||||
//添加到返回对象
|
||||
//返回
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序前端点看信息后,修改信息状态为已看,
|
||||
*
|
||||
* @param id id
|
||||
* @return 返回结果
|
||||
*/
|
||||
@PostMapping("/setHavingLookMessageState")
|
||||
public String setHavingLookMessageState(@RequestParam("id") String id) {
|
||||
String msg = "";
|
||||
if (id == null || id.isEmpty()) {
|
||||
msg = "Id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
Message message = new Message();
|
||||
message.setId(id);
|
||||
message.setIs_read(1);
|
||||
int res = messageService.update(message);
|
||||
//判断请求是否成功
|
||||
Boolean bl = res > 0;
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
return response.getResponseData(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过打印小票环节完成完工打卡
|
||||
*
|
||||
* @param appointmentId 预约id
|
||||
*/
|
||||
@GetMapping("/punchClockOverByPrint")
|
||||
public String punchClockOverByPrint(@RequestParam("appointmentId") String appointmentId) {
|
||||
String msg;
|
||||
if (appointmentId == null || appointmentId.isEmpty()) {
|
||||
msg = "预约id不能为空!";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
data.put("message", msg);
|
||||
logger.info("通过打印小票环节完成完工打卡:" + msg);
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
Appointment myappointment = appointmentService.getAppointmentById(appointmentId);
|
||||
if (myappointment == null) {
|
||||
msg = "预约id" + appointmentId + "的预约,不存在!";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
data.put("message", msg);
|
||||
logger.info("通过打印小票环节完成完工打卡:" + msg);
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
//完工打卡不受预约是否取消制约,依然可以完工打卡,故注释此处判断 (2024-7-16 王文文 提出)
|
||||
//Integer appointment_state = myappointment.getAppointment_state();
|
||||
//if (appointment_state != null && appointment_state.equals(4)) {
|
||||
// msg = "预约id" + appointmentId + "的预约,已被取消,不能完工打卡!";
|
||||
// //判断请求是否成功
|
||||
// Boolean bl = false;
|
||||
// //创建返回数据
|
||||
// Map<String, Object> data = new HashMap<>();
|
||||
// data.put("result", bl);
|
||||
// data.put("message", msg);
|
||||
// logger.info("通过打印小票环节完成完工打卡:" + msg);
|
||||
// return response.getResponseData(bl, data, msg);
|
||||
//}
|
||||
Appointment appointment = messageService.punchClockOverByPrint(appointmentId);
|
||||
logger.info("通过打印小票环节完成完工打卡:预约id" + appointmentId + "的预约完成打卡成功");
|
||||
//判断请求是否成功
|
||||
Boolean bl = true;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
return response.getResponseData(bl, data);
|
||||
}
|
||||
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,358 @@
|
|||
package com.haitongauto.rtosac.api;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.haitongauto.mapper.base.PunchClockMapper;
|
||||
import com.haitongauto.models.pojo.*;
|
||||
import com.haitongauto.rtosac.service.*;
|
||||
import com.haitongauto.models.dto.DataForMessage;
|
||||
import com.haitongauto.utils.DateTimeHelper;
|
||||
import com.haitongauto.utils.FormatDateTime;
|
||||
import com.haitongauto.utils.QueueNumberHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 指令消息
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/news")
|
||||
public class NewsController {
|
||||
@Autowired
|
||||
NewsService newsService;
|
||||
@Autowired
|
||||
HomeService homePageService;
|
||||
@Autowired
|
||||
Response response;
|
||||
@Autowired
|
||||
AppointmentService appointmentService;
|
||||
@Autowired
|
||||
PunchClockService punchClockService;
|
||||
@Autowired
|
||||
HomeService homeService;
|
||||
|
||||
|
||||
/**
|
||||
* RTOS向小程序提交车辆过闸信息(正常过闸)
|
||||
*
|
||||
* @param pass_type:车辆过闸类型,1-进闸,2-出闸
|
||||
* @param truck_number:板车号
|
||||
* @param gate_canal:道口号
|
||||
* @return 返回提交结果
|
||||
*/
|
||||
@RequestMapping("/sendTruckThroughGateInfo")
|
||||
public String sendTruckThroughGateInfo(@RequestParam("pass_type") Integer pass_type,
|
||||
@RequestParam("truck_number") String truck_number,
|
||||
@RequestParam("gate_canal") String gate_canal) {
|
||||
String msg = "";
|
||||
if (pass_type == null || pass_type.equals(0)) {
|
||||
msg = "车辆过闸类型,不能为空,1-进闸,2-出闸";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
String message = msg;
|
||||
data.put("message", message);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (truck_number == null) {
|
||||
msg = "板车号不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
String message = msg;
|
||||
data.put("message", message);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
Appointment appointment = null;
|
||||
if (pass_type.equals(1)) {
|
||||
appointment = appointmentService.getAppointmentByTruckNo(truck_number);
|
||||
} else if (pass_type.equals(2)) {
|
||||
appointment = appointmentService.getAppointmentByTruckNoForOutGate(truck_number);
|
||||
}
|
||||
|
||||
if (appointment == null) {
|
||||
msg = "板车号" + truck_number + "当前不存在有效预约";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
String message = msg;
|
||||
data.put("message", message);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
Date date = new Date();
|
||||
//进闸口
|
||||
if (pass_type.equals(1)) {
|
||||
appointment.setIs_conventionality_in(0);//正常自动过闸口
|
||||
appointment.setGate_canal_in(gate_canal);
|
||||
//签到打卡时间
|
||||
if (appointment.getCheck_in_time() == null || appointment.getCheck_in_time().isEmpty()) {
|
||||
appointment.setCheck_in_time(FormatDateTime.dateTimeToStr(date));
|
||||
}
|
||||
//进闸口时间
|
||||
appointment.setGate_canal_in_time(FormatDateTime.dateTimeToStr(date));
|
||||
} else if (pass_type.equals(2)) {//出闸口
|
||||
appointment.setGate_canal_out(gate_canal);
|
||||
//完工打卡时间
|
||||
if (appointment.getCheck_over_time() == null || appointment.getCheck_over_time().isEmpty()) {
|
||||
appointment.setCheck_over_time(FormatDateTime.dateTimeToStr(date));
|
||||
}
|
||||
//出闸口时间
|
||||
appointment.setGate_canal_out_time(FormatDateTime.dateTimeToStr(date));
|
||||
}
|
||||
//定义该车牌用户的当前预约打卡状态
|
||||
Integer appointment_state = (pass_type.equals(1)) ? 3 : 7; //3-进港,7-离港
|
||||
Integer punch_clock_type = (pass_type.equals(1)) ? 2 : 5; //2-已进港,5-已离港
|
||||
//更新预约状态
|
||||
|
||||
appointment.setAppointment_state(appointment_state);
|
||||
appointment.setUpdate_time(FormatDateTime.dateTimeToStr(new Date()));
|
||||
Integer x = appointmentService.updateAppointment(appointment);
|
||||
//更新打卡状态
|
||||
if (x > 0) {
|
||||
String appointment_id = appointment.getId();
|
||||
PunchClock punchClock = punchClockService.getPunchClockForAppintementId(appointment_id);
|
||||
if (punchClock != null) {
|
||||
punchClock.setPunch_clock_type(punch_clock_type);
|
||||
//进闸口
|
||||
if (pass_type == 1) {
|
||||
//如果未打签到卡,则打签到卡;
|
||||
String start_time = punchClock.getStart_time();
|
||||
if (start_time == null || start_time.isEmpty()) {
|
||||
punchClock.setStart_time(FormatDateTime.dateTimeToStr(date));
|
||||
}
|
||||
//生成新的排队编号
|
||||
//排队号需求变更,格式"2308210001"
|
||||
String queue_number = punchClock.getQueue_number();
|
||||
if (queue_number == null || queue_number.isEmpty()) {
|
||||
//获取当前日期最后一个排队编号
|
||||
String last_queue_number = punchClockService.getLastQueueNumber(date, appointment.getPort_area_id());
|
||||
queue_number = QueueNumberHelper.getNewQueueNumber(last_queue_number);
|
||||
punchClock.setQueue_number(queue_number);
|
||||
}
|
||||
//签到打卡地点
|
||||
String punch_address = punchClock.getPunch_address();
|
||||
if (punch_address == null || punch_address.isEmpty()) {
|
||||
PortArea portArea = punchClockService.getPortAreaForId(appointment.getPort_area_id());
|
||||
if (portArea != null) {
|
||||
punchClock.setPunch_address(portArea.getPort_area_address());
|
||||
}
|
||||
}
|
||||
} else {//出闸口
|
||||
//完工打卡时间
|
||||
String over_time = punchClock.getOver_time();
|
||||
if (over_time == null || over_time.isEmpty()) {
|
||||
punchClock.setOver_time(FormatDateTime.dateTimeToStr(date));
|
||||
}
|
||||
//完工打卡地点
|
||||
String over_address = punchClock.getOver_address();
|
||||
if (over_address == null || over_address.isEmpty()) {
|
||||
PortArea portArea = punchClockService.getPortAreaForId(appointment.getPort_area_id());
|
||||
if (portArea != null) {
|
||||
punchClock.setOver_address(portArea.getPort_area_address());
|
||||
}
|
||||
}
|
||||
}
|
||||
punchClock.setUpdate_time(FormatDateTime.dateTimeToStr(new Date()));
|
||||
int myx = punchClockService.updatePunchClock(punchClock);
|
||||
}
|
||||
}
|
||||
if (pass_type.equals(1)) {
|
||||
msg = "板车" + truck_number + "进闸成功";
|
||||
}
|
||||
if (pass_type.equals(1)) {
|
||||
msg = "板车" + truck_number + "出闸成功";
|
||||
}
|
||||
//判断请求是否成功
|
||||
Boolean bl = true;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
String message = (bl) ? "request success" : "request fail";
|
||||
data.put("message", message);
|
||||
if (bl) {
|
||||
data.put("code", "200");
|
||||
}
|
||||
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* RTOS向小程序提交车辆过闸信息(人工过闸)
|
||||
*
|
||||
* @param pass_type:车辆过闸类型,1-进闸,2-出闸
|
||||
* @param truck_number:板车号
|
||||
* @param gate_canal:道口号
|
||||
* @return 返回提交结果
|
||||
*/
|
||||
@RequestMapping("/sendTruckThroughGateInfoUnconventionality")
|
||||
public String sendTruckThroughGateInfoUnconventionality(@RequestParam("pass_type") Integer pass_type,
|
||||
@RequestParam("truck_number") String truck_number,
|
||||
@RequestParam("gate_canal") String gate_canal) {
|
||||
String msg = "";
|
||||
if (pass_type == null || pass_type.equals(0)) {
|
||||
msg = "车辆过闸类型,不能为空,1-进闸,2-出闸";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
String message = msg;
|
||||
data.put("message", message);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (truck_number == null) {
|
||||
msg = "板车号不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
String message = msg;
|
||||
data.put("message", message);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
Appointment appointment = null;
|
||||
if (pass_type.equals(1)) {
|
||||
appointment = appointmentService.getAppointmentByTruckNo(truck_number);
|
||||
} else if (pass_type.equals(2)) {
|
||||
appointment = appointmentService.getAppointmentByTruckNoForOutGate(truck_number);
|
||||
}
|
||||
if (appointment == null) {
|
||||
msg = "板车号" + truck_number + "当前不存在有效预约";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
String message = msg;
|
||||
data.put("message", message);
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
|
||||
Date date = new Date();
|
||||
//进闸口
|
||||
if (pass_type.equals(1)) {
|
||||
appointment.setIs_conventionality_in(1);//非正常的过闸口
|
||||
appointment.setGate_canal_in(gate_canal);
|
||||
//签到打卡时间
|
||||
if (appointment.getCheck_in_time() == null || appointment.getCheck_in_time().isEmpty()) {
|
||||
appointment.setCheck_in_time(FormatDateTime.dateTimeToStr(date));
|
||||
}
|
||||
//进闸口时间
|
||||
appointment.setGate_canal_in_time(FormatDateTime.dateTimeToStr(date));
|
||||
} else if (pass_type.equals(2)) {//出闸口
|
||||
appointment.setGate_canal_out(gate_canal);
|
||||
//完工打卡时间
|
||||
if (appointment.getCheck_over_time() == null || appointment.getCheck_over_time().isEmpty()) {
|
||||
appointment.setCheck_over_time(FormatDateTime.dateTimeToStr(date));
|
||||
}
|
||||
//出闸口时间
|
||||
appointment.setGate_canal_out_time(FormatDateTime.dateTimeToStr(date));
|
||||
}
|
||||
|
||||
//定义该车牌用户的当前预约打卡状态
|
||||
Integer appointment_state = (pass_type.equals(1)) ? 3 : 7; //3-进港,7-离港
|
||||
Integer punch_clock_type = (pass_type.equals(1)) ? 2 : 5; //2-已进港,5-已离港
|
||||
//更新预约状态
|
||||
|
||||
appointment.setAppointment_state(appointment_state);
|
||||
appointment.setUpdate_time(FormatDateTime.dateTimeToStr(new Date()));
|
||||
Integer x = appointmentService.updateAppointment(appointment);
|
||||
//更新打卡状态
|
||||
if (x > 0) {
|
||||
String appointment_id = appointment.getId();
|
||||
PunchClock punchClock = punchClockService.getPunchClockForAppintementId(appointment_id);
|
||||
if (punchClock != null) {
|
||||
punchClock.setPunch_clock_type(punch_clock_type);
|
||||
//进闸口
|
||||
if (pass_type == 1) {
|
||||
//如果未打签到卡,则打签到卡;
|
||||
String start_time = punchClock.getStart_time();
|
||||
if (start_time == null || start_time.isEmpty()) {
|
||||
punchClock.setStart_time(FormatDateTime.dateTimeToStr(date));
|
||||
}
|
||||
//生成新的排队编号
|
||||
//排队号需求变更,格式"2308210001"
|
||||
String queue_number = punchClock.getQueue_number();
|
||||
if (queue_number == null || queue_number.isEmpty()) {
|
||||
//获取当前日期最后一个排队编号
|
||||
String last_queue_number = punchClockService.getLastQueueNumber(date, appointment.getPort_area_id());
|
||||
queue_number = QueueNumberHelper.getNewQueueNumber(last_queue_number);
|
||||
punchClock.setQueue_number(queue_number);
|
||||
}
|
||||
//签到打卡地点
|
||||
String punch_address = punchClock.getPunch_address();
|
||||
if (punch_address == null || punch_address.isEmpty()) {
|
||||
PortArea portArea = punchClockService.getPortAreaForId(appointment.getPort_area_id());
|
||||
if (portArea != null) {
|
||||
punchClock.setPunch_address(portArea.getPort_area_address());
|
||||
}
|
||||
}
|
||||
} else {//出闸口
|
||||
//完工打卡时间
|
||||
String over_time = punchClock.getOver_time();
|
||||
if (over_time == null || over_time.isEmpty()) {
|
||||
punchClock.setOver_time(FormatDateTime.dateTimeToStr(date));
|
||||
}
|
||||
//完工打卡地点
|
||||
String over_address = punchClock.getOver_address();
|
||||
if (over_address == null || over_address.isEmpty()) {
|
||||
PortArea portArea = punchClockService.getPortAreaForId(appointment.getPort_area_id());
|
||||
if (portArea != null) {
|
||||
punchClock.setOver_address(portArea.getPort_area_address());
|
||||
}
|
||||
}
|
||||
}
|
||||
punchClock.setUpdate_time(FormatDateTime.dateTimeToStr(new Date()));
|
||||
int myx = punchClockService.updatePunchClock(punchClock);
|
||||
}
|
||||
}
|
||||
|
||||
if (pass_type.equals(1)) {
|
||||
msg = "板车" + truck_number + "进闸成功";
|
||||
} else if (pass_type.equals(2)) {
|
||||
msg = "板车" + truck_number + "出闸成功";
|
||||
}
|
||||
//判断请求是否成功
|
||||
Boolean bl = true;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("result", bl);
|
||||
String message = (bl) ? "request success" : "request fail";
|
||||
data.put("message", message);
|
||||
if (bl) {
|
||||
data.put("code", "200");
|
||||
}
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,667 @@
|
|||
package com.haitongauto.rtosac.api;
|
||||
|
||||
import com.bestvike.linq.Linq;
|
||||
import com.haitongauto.interfaces.UsersApi;
|
||||
import com.haitongauto.models.dto.CurrentDayPunchClockDto;
|
||||
import com.haitongauto.models.ido.CommonRes;
|
||||
import com.haitongauto.models.ido.login.UserInfoRes;
|
||||
import com.haitongauto.models.pojo.*;
|
||||
import com.haitongauto.rtosac.service.*;
|
||||
import com.haitongauto.utils.DateTimeHelper;
|
||||
import com.haitongauto.utils.FormatDateTime;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 打卡操作
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/punchclock")
|
||||
public class PunchClockController {
|
||||
@Autowired
|
||||
AppointmentService appointmentService;
|
||||
@Autowired
|
||||
PunchClockService punchClockService;
|
||||
@Autowired
|
||||
VehicleService vehicleService;
|
||||
@Autowired
|
||||
MineService mineService;
|
||||
|
||||
@Resource
|
||||
private UsersApi usersApi;
|
||||
|
||||
@Autowired
|
||||
Response response;
|
||||
|
||||
/**
|
||||
* 检查是否有未完成预约
|
||||
*
|
||||
* //@param users_id 用户id
|
||||
* @return 返回完成预约
|
||||
*/
|
||||
@RequestMapping("/getIincompleteAppointment")
|
||||
public String getIincompleteAppointment() {
|
||||
CommonRes<UserInfoRes> userInfoResCommonRes;
|
||||
String userId;
|
||||
String msg = "";
|
||||
try {
|
||||
//请求哪吒接口获得用户信息
|
||||
userInfoResCommonRes = usersApi.getUserInfo();
|
||||
UserInfoRes userInfoRes = userInfoResCommonRes.getData();
|
||||
userId = userInfoRes.getId();
|
||||
} catch (Exception ex) {
|
||||
msg = "从rtos后台,获得用户信息异常," + ex.getMessage();
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (userId == null || userId.isEmpty()) {
|
||||
msg = "用户Id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
//获取未完成预约
|
||||
Appointment appointment = punchClockService.getIincompleteAppointment(userId);
|
||||
String appointment_id = (appointment != null) ? appointment.getId() : null;
|
||||
//获取该预约的打卡信息
|
||||
PunchClock mypunchClock = (appointment_id != null) ? punchClockService.getPunchClockForAppintementId(appointment_id) : null;
|
||||
|
||||
//读取打卡的时间和地址信息
|
||||
Integer appointment_type = (appointment != null) ? appointment.getAppointment_type() : null;
|
||||
String punch_start_time = (mypunchClock != null) ? mypunchClock.getStart_time() : "";
|
||||
String punch_over_time = (mypunchClock != null) ? mypunchClock.getOver_time() : "";
|
||||
String punch_start_address = (mypunchClock != null) ? mypunchClock.getPunch_address() : "";
|
||||
String punch_over_address = (mypunchClock != null) ? mypunchClock.getOver_address() : "";
|
||||
|
||||
//读取进港港区Id
|
||||
String port_area_id = (appointment != null) ? appointment.getPort_area_id() : null;
|
||||
//进港港区信息
|
||||
PortArea portArea = punchClockService.getPortAreaForId(port_area_id);
|
||||
//进港港区中心坐标
|
||||
String poi = (portArea != null) ? portArea.getArea_center_poi() : "";
|
||||
//打卡范围
|
||||
Integer punch_range = (portArea != null && portArea.getPunch_range() != null) ? portArea.getPunch_range() : 0;
|
||||
//判断请求是否成功
|
||||
Boolean bl = true;
|
||||
//创建返回数据对象
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("appointment_type", appointment_type);
|
||||
data.put("poi", poi);
|
||||
data.put("punch_range", punch_range);
|
||||
data.put("punch_start_time", punch_start_time);
|
||||
data.put("punch_over_time", punch_over_time);
|
||||
data.put("punch_start_address", punch_start_address);
|
||||
data.put("punch_over_address", punch_over_address);
|
||||
data.put("appointment", appointment);
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到打卡提交
|
||||
*
|
||||
* //@param users_id 用户id
|
||||
* @param appointment_id 预约id
|
||||
* @param port_area_id 港区id
|
||||
* @param punch_poi 坐标
|
||||
* @return 返回提交结果
|
||||
*/
|
||||
@RequestMapping("/postPunchClockStart")
|
||||
public String postPunchClockStart(@RequestParam("appointment_id") String appointment_id,
|
||||
@RequestParam("port_area_id") String port_area_id,
|
||||
@RequestParam("punch_poi") String punch_poi,
|
||||
@RequestParam("punch_address") String punch_address) {
|
||||
CommonRes<UserInfoRes> userInfoResCommonRes;
|
||||
String userId;
|
||||
String msg = "";
|
||||
try {
|
||||
//请求哪吒接口获得用户信息
|
||||
userInfoResCommonRes = usersApi.getUserInfo();
|
||||
UserInfoRes userInfoRes = userInfoResCommonRes.getData();
|
||||
userId = userInfoRes.getId();
|
||||
} catch (Exception ex) {
|
||||
msg = "从rtos后台,获得用户信息异常," + ex.getMessage();
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (userId == null || userId.isEmpty()) {
|
||||
msg = "用户Id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (appointment_id == null || appointment_id.isEmpty()) {
|
||||
msg = "预约Id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (port_area_id == null || port_area_id.isEmpty()) {
|
||||
msg = "港区Id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (punch_poi == null || punch_poi.isEmpty()) {
|
||||
msg = "坐标不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (punch_address == null || punch_address.isEmpty()) {
|
||||
msg = "打卡地点不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
|
||||
//写入打卡数据
|
||||
PunchClock punchClock = punchClockService.postPunchClockStart(userId, appointment_id, port_area_id, punch_poi, punch_address);
|
||||
String punch_clock_id = "";
|
||||
String queue_number = "";
|
||||
String punch_date_time = "";
|
||||
if (punchClock == null) {
|
||||
msg = "不在该预约信息";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
|
||||
} else {
|
||||
punch_clock_id = punchClock.getId();
|
||||
queue_number = punchClock.getQueue_number();
|
||||
//获取签到打卡的日期时间(年月日小时分钟秒)
|
||||
//转换为两位数格式字符串
|
||||
String punch_date = punchClock.getStart_time().split(" ")[0];
|
||||
String punch_time = punchClock.getStart_time().split(" ")[1];
|
||||
punch_date_time = punch_date + " " + punch_time;
|
||||
}
|
||||
|
||||
Appointment appointment = appointmentService.getAppointmentById(appointment_id);
|
||||
Integer x = null;
|
||||
if (queue_number != null && !queue_number.isEmpty() && appointment != null) {
|
||||
//获取当前排队前面还剩多少位
|
||||
x = punchClockService.getNumberBefore(appointment.getApproach_date(), appointment.getPort_area_id(), queue_number);
|
||||
}
|
||||
|
||||
//判断请求是否成功
|
||||
Boolean bl = punch_clock_id != null && !punch_clock_id.isEmpty();
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("punch_clock_id", punch_clock_id);
|
||||
data.put("NumberBeforeCount", x);
|
||||
data.put("queue_number", queue_number);
|
||||
data.put("punch_time", punch_date_time);
|
||||
data.put("punch_address", punch_address);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成打卡提交
|
||||
*
|
||||
* @param appointment_id 预约id
|
||||
* @param punch_clock_id 打卡id
|
||||
* @return 返回完成打卡提交执行结果
|
||||
*/
|
||||
@RequestMapping("/postPunchClockOver")
|
||||
public String postPunchClockOver(@RequestParam("appointment_id") String appointment_id,
|
||||
@RequestParam("punch_clock_id") String punch_clock_id,
|
||||
@RequestParam("punch_address") String punch_address) {
|
||||
//打卡信息更新到数据库
|
||||
String msg = "";
|
||||
if (appointment_id == null || appointment_id.isEmpty()) {
|
||||
msg = "预约id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
// if (punch_clock_id == null || punch_clock_id.isEmpty()) {
|
||||
// msg = "预约打卡记录id不能为空";
|
||||
// //判断请求是否成功
|
||||
// Boolean bl = false;
|
||||
// //创建返回数据
|
||||
// Map<String, Object> data = new HashMap<>();
|
||||
// //封装数据
|
||||
// return response.getResponseData(bl, data, msg);
|
||||
// }
|
||||
if (punch_address == null || punch_address.isEmpty()) {
|
||||
msg = "打卡地点不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
Appointment myAppointment = appointmentService.getAppointmentById(appointment_id);
|
||||
PunchClock myPunchClock = punchClockService.getPunchClockForAppintementId(appointment_id);
|
||||
if (myAppointment == null) {
|
||||
msg = "不存预约Id为" + appointment_id + "的预约信息";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (myPunchClock == null) {
|
||||
msg = "不存预约Id为" + appointment_id + "的打卡记录信息";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
|
||||
PunchClock punchClock = punchClockService.postPunchClockOver(appointment_id, punch_clock_id, punch_address);
|
||||
//获取签到打卡的日期时间(年月日小时分钟秒)
|
||||
String punch_date = "";
|
||||
String punch_time = "";
|
||||
String punch_date_time = "";
|
||||
if (punchClock != null) {
|
||||
String[] strArray = punchClock.getOver_time().split(" ");
|
||||
//转换为两位数格式字符串
|
||||
punch_date = strArray[0];
|
||||
punch_time = strArray[1];
|
||||
punch_date_time = punch_date + " " + punch_time;
|
||||
}
|
||||
//注意:此处还需追加完成打卡后生成指令,并提交到哪吒接口
|
||||
|
||||
//判断请求是否成功
|
||||
Boolean bl = true;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("punch_time", punch_date_time);
|
||||
data.put("punch_address", punch_address);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据预约Id获取打卡记录状态
|
||||
* @param appointment_id 预约id
|
||||
* @return 返回打卡记录
|
||||
*/
|
||||
@RequestMapping("getPunchState")
|
||||
public String getPunchState(@RequestParam("appointment_id") String appointment_id) {
|
||||
String msg = "";
|
||||
if (appointment_id == null || appointment_id.isEmpty()) {
|
||||
msg = "预约Id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
//获取指定预约的打卡记录
|
||||
PunchClock punchClock = punchClockService.getPunchClockForAppintementId(appointment_id);
|
||||
if (punchClock == null) {
|
||||
msg = "不存在预约Id为" + appointment_id + "的打卡记录";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
//读取该预约的打卡状态
|
||||
Integer punch_clock_type = punchClock.getPunch_clock_type();
|
||||
//判断请求是否成功
|
||||
Boolean bl = punch_clock_type != null && punch_clock_type > 0;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("appointment_id", appointment_id);
|
||||
data.put("punch_clock_type", punch_clock_type);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的打卡记录(查询指定日期,默认当天)
|
||||
*
|
||||
* @param my_date 指定日期
|
||||
* //@param users_id 司机id
|
||||
* @return 返回我的打卡记录
|
||||
*/
|
||||
@RequestMapping("/getPunchClockForDate")
|
||||
public String getPunchClockForDate(@RequestParam("my_date") String my_date) {
|
||||
CommonRes<UserInfoRes> userInfoResCommonRes;
|
||||
String userId;
|
||||
String msg = "";
|
||||
try {
|
||||
//请求哪吒接口获得用户信息
|
||||
userInfoResCommonRes = usersApi.getUserInfo();
|
||||
UserInfoRes userInfoRes = userInfoResCommonRes.getData();
|
||||
userId = userInfoRes.getId();
|
||||
} catch (Exception ex) {
|
||||
msg = "从rtos后台,获得用户信息异常," + ex.getMessage();
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
|
||||
if (my_date == null || my_date.isEmpty()) {
|
||||
msg = "指定日期不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (userId == null || userId.isEmpty()) {
|
||||
msg = "用户Id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
LocalDate myDate = DateTimeHelper.DateStrToLocalDate(my_date);
|
||||
List<PunchClock> mylist = punchClockService.getPunchClockForDate(my_date, userId);
|
||||
CurrentDayPunchClockDto currentDayPunchClockDto = new CurrentDayPunchClockDto();
|
||||
//总工时
|
||||
long totalWorkingSeconds = 0;//秒
|
||||
//long totalWorkingHours = 0;//小时
|
||||
double totalWorkingHours = 0;//小时
|
||||
//打卡次数
|
||||
int totalPunchClockCount = 0;
|
||||
if (mylist != null && mylist.size() > 0) {
|
||||
for (PunchClock punchClock : mylist) {
|
||||
String start_time = punchClock.getStart_time();
|
||||
String over_time = punchClock.getOver_time();
|
||||
//统计次数
|
||||
//if (start_time != null && !start_time.isEmpty()) {
|
||||
// totalPunchClockCount = totalPunchClockCount + 1;
|
||||
//}
|
||||
//if (over_time != null && !over_time.isEmpty()) {
|
||||
// totalPunchClockCount = totalPunchClockCount + 1;
|
||||
//}
|
||||
|
||||
//签到打卡统计,累加次数
|
||||
if (start_time != null && !start_time.isEmpty() ) {
|
||||
totalPunchClockCount = totalPunchClockCount + 1;
|
||||
}
|
||||
//完工打卡打卡统计,累加次数
|
||||
if (over_time != null && !over_time.isEmpty() ) {
|
||||
totalPunchClockCount = totalPunchClockCount + 1;
|
||||
}
|
||||
|
||||
//计算签到打卡时间与完成打卡时间的时间差(单位秒数)
|
||||
long timechaSeconds = FormatDateTime.getTimeCha(start_time, over_time);
|
||||
//统计工时
|
||||
if (timechaSeconds > 0) {
|
||||
//累加打卡的工时
|
||||
totalWorkingSeconds = totalWorkingSeconds + timechaSeconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
//将总秒数转化为总小时数据
|
||||
if (totalWorkingSeconds > 0) {
|
||||
//totalWorkingHours = TimeUnit.MILLISECONDS.toHours(totalWorkingSeconds);
|
||||
totalWorkingHours = (double) totalWorkingSeconds / 3600;
|
||||
//小时数据保留四位小数
|
||||
totalWorkingHours = Math.round(totalWorkingHours * 10000) / 10000.0;
|
||||
}
|
||||
currentDayPunchClockDto.setPunchClockList(mylist);
|
||||
currentDayPunchClockDto.setTotalPunchClockCount(totalPunchClockCount);
|
||||
currentDayPunchClockDto.setTotalWorkingHours(totalWorkingHours);
|
||||
//判断请求是否成功
|
||||
Boolean bl = true;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("CurrentDayPunchClock", currentDayPunchClockDto);
|
||||
//封装数据
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 我的打卡记录(查询指定司机某年某月的打卡记录)
|
||||
*
|
||||
* @param year 年
|
||||
* @param month 月
|
||||
* //@param users_id 司机id
|
||||
* @return 返回我的打卡记录
|
||||
*/
|
||||
@RequestMapping("/getPunchClockForYM")
|
||||
public String getPunchClockForYM(@RequestParam("year") Integer year,
|
||||
@RequestParam("month") Integer month) {
|
||||
CommonRes<UserInfoRes> userInfoResCommonRes;
|
||||
String userId;
|
||||
String msg = "";
|
||||
try {
|
||||
//请求哪吒接口获得用户信息
|
||||
userInfoResCommonRes = usersApi.getUserInfo();
|
||||
UserInfoRes userInfoRes = userInfoResCommonRes.getData();
|
||||
userId = userInfoRes.getId();
|
||||
} catch (Exception ex) {
|
||||
msg = "从rtos后台,获得用户信息异常," + ex.getMessage();
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (userId == null || userId.isEmpty()) {
|
||||
msg = "用户Id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
List<PunchClock> mylist = punchClockService.getPunchClockForYM(year, month, userId);
|
||||
List<Appointment> myappointmentList = mineService.getMyAppointmentList(userId);
|
||||
//找到对应的预约进港时间 (王琛需要)
|
||||
//未完成的预约进港日期
|
||||
List<String> approachDateList_ww = new ArrayList<>();
|
||||
//已完成的预约进港日期
|
||||
List<String> approachDateList_yw = new ArrayList<>();
|
||||
//查出未完成的预约进港日期
|
||||
List<PunchClock> mylist1 = null;
|
||||
if (mylist != null && mylist.size() > 0) {
|
||||
//查询当月未完工打卡的记录()
|
||||
//mylist1 = Linq.of(mylist).where(p -> p.getPunch_clock_type() < 4).toList();
|
||||
mylist1 = Linq.of(mylist).where(p -> p.getPunch_clock_type().compareTo(4) < 0).toList();
|
||||
List<String> appointmentIdList1;
|
||||
if (mylist1 != null && mylist1.size() > 0) {
|
||||
appointmentIdList1 = Linq.of(mylist1).select(PunchClock::getAppointment_id).toList();
|
||||
if (appointmentIdList1 != null && appointmentIdList1.size() > 0) {
|
||||
if (myappointmentList != null && myappointmentList.size() > 0) {
|
||||
//未完成的
|
||||
List<Appointment> myappointmentList1 = Linq.of(myappointmentList).where(o -> appointmentIdList1.contains(o.getId())).toList();
|
||||
if (myappointmentList1 != null && myappointmentList1.size() > 0) {
|
||||
approachDateList_ww = Linq.of(myappointmentList1).select(Appointment::getApproach_date).distinct().toList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//查出已完成的预约进港日期
|
||||
List<PunchClock> mylist2 = null;
|
||||
if (mylist != null && mylist.size() > 0) {
|
||||
//查询当月未完工打卡的记录(不关心预约是否取消)
|
||||
//mylist2 = Linq.of(mylist).where(p -> p.getPunch_clock_type() >= 4).toList();
|
||||
mylist2 = Linq.of(mylist).where(p -> !(p.getPunch_clock_type().compareTo(4) < 0)).toList();
|
||||
List<String> appointmentIdList2;
|
||||
if (mylist2 != null && mylist2.size() > 0) {
|
||||
appointmentIdList2 = Linq.of(mylist2).select(PunchClock::getAppointment_id).toList();
|
||||
if (appointmentIdList2 != null && appointmentIdList2.size() > 0) {
|
||||
if (myappointmentList != null && myappointmentList.size() > 0) {
|
||||
//已完成的
|
||||
List<Appointment> myappointmentList2 = Linq.of(myappointmentList).where(o -> appointmentIdList2.contains(o.getId())).toList();
|
||||
if (myappointmentList2 != null && myappointmentList2.size() > 0) {
|
||||
approachDateList_yw = Linq.of(myappointmentList2).select(Appointment::getApproach_date).distinct().toList();
|
||||
List<String> finalApproachDateList_ww = approachDateList_ww;
|
||||
approachDateList_yw = Linq.of(approachDateList_yw).where(o -> !finalApproachDateList_ww.contains(o)).toList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//获得打卡记录的预约信息
|
||||
//判断请求是否成功
|
||||
Boolean bl = true;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("approachDateList_ww", approachDateList_ww);
|
||||
data.put("approachDateList_yw", approachDateList_yw);
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取港区中心点坐标
|
||||
*
|
||||
* @param port_area_id 港区id
|
||||
* @return 返回港区中心坐标
|
||||
*/
|
||||
@RequestMapping("/getPortAreaPoi")
|
||||
public String getPortAreaPoi(@RequestParam("port_area_id") String port_area_id) {
|
||||
String msg = "";
|
||||
if (port_area_id == null || port_area_id.isEmpty()) {
|
||||
msg = "港区Id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
String poi = punchClockService.getPortAreaPoi(port_area_id);
|
||||
//判断请求是否成功
|
||||
Boolean bl = poi != null && !poi.isEmpty();
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("poi", poi);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取排队编号
|
||||
*
|
||||
* @param appointment_id : 预约编号
|
||||
* @return 返回排队编号
|
||||
*/
|
||||
@RequestMapping("/getQueueNumber")
|
||||
public String getQueueNumber(@RequestParam("appointment_id") String appointment_id) {
|
||||
String msg = "";
|
||||
if (appointment_id == null || appointment_id.isEmpty()) {
|
||||
msg = "预约Id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
String queue_number = punchClockService.getQueueNumber(appointment_id);
|
||||
Appointment appointment = appointmentService.getAppointmentById(appointment_id);
|
||||
|
||||
Integer x = null;
|
||||
if (queue_number != null && !queue_number.isEmpty() && appointment != null) {
|
||||
x = punchClockService.getNumberBefore(appointment.getApproach_date(), appointment.getPort_area_id(), queue_number);
|
||||
}
|
||||
|
||||
//判断请求是否成功
|
||||
Boolean bl = true;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("NumberBeforeCount", x);
|
||||
data.put("queue_number", queue_number);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户排队时前面还剩余多少位
|
||||
*
|
||||
* @param approach_date:预约日期
|
||||
* @param port_area_id:进港港区
|
||||
* @param queue_number:排队编号
|
||||
* @return 返回结果
|
||||
*/
|
||||
@RequestMapping("/getNumberBefore")
|
||||
public String getNumberBefore(@RequestParam("approach_date") String approach_date, @RequestParam("port_area_id") String port_area_id, @RequestParam("queue_number") String queue_number) {
|
||||
Integer x = punchClockService.getNumberBefore(approach_date, port_area_id, queue_number);
|
||||
//判断请求是否成功
|
||||
Boolean bl = x != null;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("NumberBeforeCount", x);
|
||||
data.put("queue_number", queue_number);
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,370 @@
|
|||
package com.haitongauto.rtosac.api;
|
||||
|
||||
import com.haitongauto.interfaces.OrderApi;
|
||||
import com.haitongauto.interfaces.UsersApi;
|
||||
import com.haitongauto.models.ido.CheckRes;
|
||||
import com.haitongauto.models.ido.CommonRes;
|
||||
import com.haitongauto.models.ido.departure.DepartureDetailIdo;
|
||||
import com.haitongauto.models.ido.departure.DepartureDetailIdo_DTO;
|
||||
import com.haitongauto.models.ido.departure.DepartureVehicleIdo;
|
||||
import com.haitongauto.models.ido.departure.DepartureVehicleIdo_DTO;
|
||||
import com.haitongauto.models.ido.receiving.ReceivingDetailIdo;
|
||||
import com.haitongauto.models.ido.receiving.ReceivingDetailIdo_DTO;
|
||||
import com.haitongauto.models.ido.receiving.ReceivingVehicleIdo;
|
||||
import com.haitongauto.models.ido.receiving.ReceivingVehicleIdo_DTO;
|
||||
import com.haitongauto.models.pojo.Appointment;
|
||||
import com.haitongauto.models.pojo.PunchClock;
|
||||
import com.haitongauto.rtosac.service.AppointmentService;
|
||||
import com.haitongauto.rtosac.service.PunchClockService;
|
||||
import com.haitongauto.rtosac.service.Response;
|
||||
import com.haitongauto.rtosac.service.VehicleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/vehicle")
|
||||
public class VehicleController {
|
||||
@Autowired
|
||||
VehicleService vehicleService;
|
||||
@Autowired
|
||||
Response response;
|
||||
@Autowired
|
||||
AppointmentService appointmentService;
|
||||
@Autowired
|
||||
PunchClockService punchClockService;
|
||||
@Resource
|
||||
OrderApi orderApi;
|
||||
@Resource
|
||||
private UsersApi usersApi;
|
||||
|
||||
/**
|
||||
* 获取收车凭证的分页数据(从Rtos请求数据)
|
||||
* <p>
|
||||
* //@param users_id 当前页码
|
||||
*
|
||||
* @return 返回收车凭证的分页数据
|
||||
*/
|
||||
@GetMapping("/getVehicleReceivingList")
|
||||
public String getVehicleReceivingList(@RequestParam("printTicketTime") String printTicketTime,
|
||||
@RequestParam("query") String query,
|
||||
@RequestParam("pageNum") Integer pageNum,
|
||||
@RequestParam("pageSize") Integer pageSize) {
|
||||
//解析分页参数
|
||||
pageNum = (pageNum != null && pageNum > 0) ? pageNum : 1;
|
||||
pageSize = (pageSize != null && pageSize > 0) ? pageSize : 10;
|
||||
List<ReceivingVehicleIdo> myList = null;
|
||||
|
||||
//通过RTOS接口读取收车凭证分页数据
|
||||
ReceivingVehicleIdo_DTO receivingVehicleIdo_dto = vehicleService.getVehicleReceivingList(printTicketTime, query, pageNum, pageSize); //当前页的列表数据
|
||||
String status = receivingVehicleIdo_dto.getStatus();
|
||||
//用户权限过期
|
||||
if ("401".equals(status)) {
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getRtosResponseData(bl, data, "401");
|
||||
}
|
||||
|
||||
if ("200".equals(status)) {
|
||||
myList = receivingVehicleIdo_dto.getReceivingVehicleIdoList();
|
||||
}
|
||||
//判断请求是否成功
|
||||
Boolean bl = "200".equals(status);
|
||||
//创建返回数据对象
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("pageNum", pageNum);
|
||||
if (myList != null && myList.size() > 0) {
|
||||
//data.put("pageSize", pageSize);
|
||||
data.put("pageSize", myList.size());
|
||||
data.put("ReceivingVehicleIdoList", myList);
|
||||
} else {
|
||||
data.put("pageSize", 0);
|
||||
data.put("ReceivingVehicleIdoList", null);
|
||||
}
|
||||
//封装数据
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收车凭证详细信息(从Rtos请求数据)
|
||||
*
|
||||
* @param vehicle_receiving_id:收车id
|
||||
* @return 返回收车凭证详细信息
|
||||
*/
|
||||
@GetMapping("/getVehicleReceivingInfo")
|
||||
public String getVehicleReceivingInfo(@RequestParam("vehicle_receiving_id") String vehicle_receiving_id) {
|
||||
String msg = "";
|
||||
if (vehicle_receiving_id == null || vehicle_receiving_id.isEmpty()) {
|
||||
msg = "收车凭证id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
//外部接口获取凭证数据
|
||||
ReceivingDetailIdo receivingDetailIdo = null;
|
||||
ReceivingDetailIdo_DTO receivingDetailIdo_dto = vehicleService.getVehicleReceivingInfo(vehicle_receiving_id);
|
||||
String status = receivingDetailIdo_dto.getStatus();
|
||||
//用户权限过期
|
||||
if ("401".equals(status)) {
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getRtosResponseData(bl, data, "401");
|
||||
}
|
||||
if ("200".equals(status)) {
|
||||
receivingDetailIdo = receivingDetailIdo_dto.getReceivingDetailIdo();
|
||||
}
|
||||
//判断请求是否成功
|
||||
Boolean bl = "200".equals(status);
|
||||
|
||||
//创建返回数据data
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("receivingDetailIdo", receivingDetailIdo);
|
||||
//添加到返回对象
|
||||
//返回
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成收车核对
|
||||
*
|
||||
* @param vehicle_receiving_id:收车id
|
||||
* @param ttiId:预约id
|
||||
* @return 返回收车核对结果
|
||||
*/
|
||||
@GetMapping("/vehicleReceivingOver")
|
||||
public String vehicleReceivingOver(@RequestParam("vehicle_receiving_id") String vehicle_receiving_id,
|
||||
@RequestParam("ttiId") String ttiId) {
|
||||
String msg = null;
|
||||
if (vehicle_receiving_id == null || vehicle_receiving_id.isEmpty()) {
|
||||
msg = "收车凭证id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (ttiId == null || ttiId.isEmpty()) {
|
||||
msg = "预约id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
//向哪吒提交完成收车核对请求
|
||||
//boolean res = vehicleService.vehicleReceivingOver(vehicle_receiving_id);
|
||||
CommonRes<CheckRes> res = orderApi.checkReceivingVehicle(vehicle_receiving_id);
|
||||
//判断请求是否成功
|
||||
CheckRes myData = null;
|
||||
//判断请求是否成功
|
||||
boolean bl = false;
|
||||
if (res != null) {
|
||||
myData = res.getData();
|
||||
bl = myData.isResult();
|
||||
msg = myData.getErrorMsg();
|
||||
}
|
||||
|
||||
//如果核对成功,则修改预约/打卡状态
|
||||
if (bl) {
|
||||
Appointment myAppointment = appointmentService.getAppointmentById(ttiId);
|
||||
if (myAppointment == null) {
|
||||
msg = "当前收车凭证id为 " + vehicle_receiving_id + ", 预约id为" + ttiId + ",但未找到对应的预约信息,无法进行完工打卡";
|
||||
//判断请求是否成功
|
||||
bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
|
||||
PunchClock myPunchClock = punchClockService.getPunchClockForAppintementId(ttiId);
|
||||
if (myPunchClock != null && myPunchClock.getId() != null && !myPunchClock.getId().isEmpty()) {
|
||||
PunchClock punchClock = punchClockService.postPunchClockOver(ttiId, myPunchClock.getId(), myPunchClock.getOver_address());
|
||||
}
|
||||
}
|
||||
|
||||
//创建返回数据对象
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提车凭证分页列表数据(从Rtos请求数据)
|
||||
*
|
||||
* //@param users_id 当前页码
|
||||
* @return 分页数据
|
||||
*/
|
||||
@GetMapping("/getVehicleDepartureInfoList")
|
||||
public String getVehicleDepartureInfoList(@RequestParam("printTicketTime") String printTicketTime,
|
||||
@RequestParam("query") String query,
|
||||
@RequestParam("pageNum") Integer pageNum,
|
||||
@RequestParam("pageSize") Integer pageSize) {
|
||||
String msg = "";
|
||||
//解析分页参数
|
||||
pageNum = (pageNum != null && pageNum > 0) ? pageNum : 1;
|
||||
pageSize = (pageSize != null && pageSize > 0) ? pageSize : 10;
|
||||
System.out.print("当前页码:" + pageNum + ",数据条数:" + pageSize);
|
||||
//通过RTOS接口读取提车凭证分页数据
|
||||
List<DepartureVehicleIdo> myList = null;
|
||||
//通过RTOS接口读取收车凭证分页数据
|
||||
DepartureVehicleIdo_DTO departureVehicleIdo_dto = vehicleService.getVehicleDepartureInfoList(printTicketTime, query, pageNum, pageSize); //当前页的列表数据
|
||||
String status = departureVehicleIdo_dto.getStatus();
|
||||
//用户权限过期
|
||||
if ("401".equals(status)) {
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getRtosResponseData(bl, data, "401");
|
||||
}
|
||||
if ("200".equals(status)) {
|
||||
myList = departureVehicleIdo_dto.getDepartureVehicleIdoList();
|
||||
}
|
||||
//判断请求是否成功
|
||||
Boolean bl = "200".equals(status);
|
||||
//创建返回数据对象
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("pageNum", pageNum);
|
||||
if (myList != null && myList.size() > 0) {
|
||||
data.put("pageSize", myList.size());
|
||||
data.put("departureVehicleIdoList", myList);
|
||||
} else {
|
||||
data.put("pageSize", 0);
|
||||
data.put("departureVehicleIdoList", null);
|
||||
}
|
||||
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提车凭证详细信息(从Rtos请求数据)
|
||||
*
|
||||
* @param vehicle_departure_id 提车凭证详id
|
||||
* @return 返回提车凭证详细信息
|
||||
*/
|
||||
@GetMapping("/getVehicleDepartureInfo")
|
||||
public String getVehicleDepartureInfo(@RequestParam("vehicle_departure_id") String vehicle_departure_id) {
|
||||
String msg = "";
|
||||
if (vehicle_departure_id == null || vehicle_departure_id.isEmpty()) {
|
||||
msg = "提车凭证id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
DepartureDetailIdo departureDetailIdo = null;
|
||||
//获取指定发车信息
|
||||
DepartureDetailIdo_DTO departureDetailIdo_dto = vehicleService.getVehicleDepartureInfo(vehicle_departure_id);
|
||||
//判断请求是否成功
|
||||
String status = departureDetailIdo_dto.getStatus();
|
||||
//用户权限过期
|
||||
if ("401".equals(status)) {
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getRtosResponseData(bl, data, "401");
|
||||
}
|
||||
if ("200".equals(status)) {
|
||||
departureDetailIdo = departureDetailIdo_dto.getDepartureDetailIdo();
|
||||
}
|
||||
//判断请求是否成功
|
||||
Boolean bl = "200".equals(status);
|
||||
//创建返回数据data
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("departureDetailIdo", departureDetailIdo);
|
||||
//添加到返回对象
|
||||
//返回
|
||||
return response.getResponseDataJavaJson(bl, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成提车核对
|
||||
*
|
||||
* @param vehicle_departure_id 提车凭证id
|
||||
* @param ttiId:预约id
|
||||
* @return 返回完成提车核对结果
|
||||
*/
|
||||
@GetMapping("/VehicleDepartureOver")
|
||||
public String VehicleDepartureOver(@RequestParam("vehicle_departure_id") String vehicle_departure_id, @RequestParam("ttiId") String ttiId) {
|
||||
String msg = "";
|
||||
if (vehicle_departure_id == null || vehicle_departure_id.isEmpty()) {
|
||||
msg = "提车凭证id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
if (ttiId == null || ttiId.isEmpty()) {
|
||||
msg = "预约id不能为空";
|
||||
//判断请求是否成功
|
||||
Boolean bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
//向哪吒提交完成提车核对请求
|
||||
CommonRes<CheckRes> res = orderApi.checkDepartureVehicle(vehicle_departure_id);
|
||||
CheckRes myData = null;
|
||||
//判断请求是否成功
|
||||
boolean bl = false;
|
||||
if (res != null) {
|
||||
myData = res.getData();
|
||||
bl = myData.isResult();
|
||||
msg = myData.getErrorMsg();
|
||||
}
|
||||
|
||||
//如果核对成功,则修改预约/打卡状态
|
||||
if (bl) {
|
||||
Appointment myAppointment = appointmentService.getAppointmentById(ttiId);
|
||||
if (myAppointment == null) {
|
||||
msg = "当前发车凭证id为 " + vehicle_departure_id + ", 预约id为" + ttiId + ",但未找到对应的预约信息,无法进行完工打卡";
|
||||
//判断请求是否成功
|
||||
bl = false;
|
||||
//创建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
PunchClock myPunchClock = punchClockService.getPunchClockForAppintementId(ttiId);
|
||||
if (myPunchClock != null && myPunchClock.getId() != null && !myPunchClock.getId().isEmpty()) {
|
||||
PunchClock punchClock = punchClockService.postPunchClockOver(ttiId, myPunchClock.getId(), myPunchClock.getOver_address());
|
||||
}
|
||||
}
|
||||
//创建返回数据对象
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
//封装数据
|
||||
//返回
|
||||
return response.getResponseData(bl, data, msg);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.haitongauto.rtosac.config;
|
||||
import com.google.gson.Gson;
|
||||
import net.sourceforge.tess4j.util.LoadLibs;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.Reader;
|
||||
|
||||
public class ConfigHelper {
|
||||
public static ForwardConfig getForwardConfig() {
|
||||
ForwardConfig forwardConfig = null;
|
||||
Gson gson = new Gson();
|
||||
File js = LoadLibs.extractTessResources("forward.json");
|
||||
try {
|
||||
Reader reader = new FileReader(js);
|
||||
// 将 JSON 文件内容解析为对象
|
||||
forwardConfig = gson.fromJson(reader, ForwardConfig.class);
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return forwardConfig;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.haitongauto.rtosac.config;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ForwardConfig {
|
||||
private String url;
|
||||
|
||||
private Boolean isOpen;
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.haitongauto.rtosac.fangdou;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Debounce {
|
||||
private final DebounceInterface debounceInterface;
|
||||
private final long delay;
|
||||
private ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();//对高并发有比较好的支持
|
||||
private ScheduledFuture<?> future;
|
||||
|
||||
public Debounce(DebounceInterface debounceInterface, long delay) {
|
||||
this.debounceInterface = debounceInterface;
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
public void debounce() {
|
||||
if (future != null && !future.isDone()) {
|
||||
future.cancel(false);
|
||||
}
|
||||
|
||||
future = executor.schedule(() -> debounceInterface.execute(), delay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
executor.shutdown();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.haitongauto.rtosac.fangdou;
|
||||
|
||||
public interface DebounceInterface {
|
||||
void execute();
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
package com.haitongauto.rtosac.service;
|
||||
|
||||
import com.haitongauto.models.dto.AppointmentDto;
|
||||
import com.haitongauto.models.forward.ForwardRes;
|
||||
import com.haitongauto.models.pojo.*;
|
||||
import com.haitongauto.models.valid.cus.ValidCusVin;
|
||||
import com.haitongauto.models.valid.naz.CargoInfoNaz;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AppointmentService {
|
||||
ForwardRes invokeForwardApi(Appointment appointment, List<AppointmentDetail> appointmentDetailList);
|
||||
|
||||
|
||||
void updateUserAndTruckByAppointment(Appointment appointment);
|
||||
|
||||
/**
|
||||
* 发起预约,根据用户Id获取用户板车注册信息
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @return 返回用户板车注册信息
|
||||
*/
|
||||
Truck getPalletTruck(String users_id);
|
||||
|
||||
/**
|
||||
* 提交预约信息
|
||||
*
|
||||
* @param appointment 预约数据实体
|
||||
* @return 返回提交结果
|
||||
*/
|
||||
Integer postAppointment(Appointment appointment);
|
||||
|
||||
/**
|
||||
* 提交预约信息
|
||||
*
|
||||
* @param appointment 预约数据实体
|
||||
* @return 返回提交结果
|
||||
*/
|
||||
Integer postAppointmentDetailList(Appointment appointment, List<AppointmentDetail> appointmentDetailList);
|
||||
|
||||
/**
|
||||
* 查询指定用户是否存在已预约但未完成预约信息
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @return 返回查询结果
|
||||
*/
|
||||
Appointment getActiveAppointment(String users_id);
|
||||
|
||||
/**
|
||||
* 查询指定板车是否存在已预约但未完成预约信息
|
||||
* @param truck_number 板车号
|
||||
* @return 返回查询结果
|
||||
*/
|
||||
Appointment getActiveAppointmentNew(String truck_number);
|
||||
|
||||
Appointment getActiveAppointmentByTruckNumber(String truck_number);
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
*
|
||||
* @param appointment_id 预约id
|
||||
* @return 返回执行取消预约的结果
|
||||
*/
|
||||
Integer cancelAppointment(String appointment_id);
|
||||
|
||||
/**
|
||||
* 根据车牌号获取该用户的当前预约
|
||||
*
|
||||
* @param truck_number 车牌号
|
||||
* @return 返回当前预约
|
||||
*/
|
||||
Appointment getAppointmentByTruckNo(String truck_number);
|
||||
|
||||
/**
|
||||
* 根据车牌号获取该用户的当前预约(出闸口专用)
|
||||
*
|
||||
* @param truck_number 车牌号
|
||||
* @return 返回当前预约
|
||||
*/
|
||||
Appointment getAppointmentByTruckNoForOutGate(String truck_number);
|
||||
|
||||
|
||||
/**
|
||||
* 通过更新一条预约信息,实现预约记录的进出港状态更新
|
||||
*
|
||||
* @param appointment 预约数据实体
|
||||
* @return 返回更新执行结果
|
||||
*/
|
||||
Integer updateAppointment(Appointment appointment);
|
||||
|
||||
Integer updateAppointmentDetailList(Appointment appointment, List<AppointmentDetail> appointmentDetailList);
|
||||
|
||||
/**
|
||||
* 查询指定用户和指定车辆是否存在已预约但未完成预约信息
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @param truck_number 车牌号
|
||||
* @return 返回查询结果
|
||||
*/
|
||||
Appointment getActiveAppointmentByUserAndTruck(String users_id, String truck_number);
|
||||
|
||||
/**
|
||||
* 根据id获得预约信息
|
||||
*
|
||||
* @param id 预约id
|
||||
* @return 返回预约信息
|
||||
*/
|
||||
Appointment getAppointmentById(String id);
|
||||
|
||||
List<AppointmentDetail> getAppointmentDetailListByAppointmentId(String appointment_id);
|
||||
|
||||
AppointmentDto getAppointmentDtoById(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户当天在外高桥港区未离港的预约
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @param port_area_id 港区id
|
||||
* @param approach_date 进港日期
|
||||
* @return 返回预约信息
|
||||
*/
|
||||
Appointment getAppointmentByUserIdAndPortAreaIdAndApproachDate(String users_id, String port_area_id, String approach_date);
|
||||
|
||||
Integer updateAppointmentPlateScanTime(String appointment_id);
|
||||
|
||||
List<String> getAppointmentDetailListByGoodVinList(List<String> vinlist);
|
||||
|
||||
//根据 Vin列表查询匹配的商品车明细,并筛选出不属于已取消和异常的预约的
|
||||
List<AppointmentDetail> getAppointmentDetailListByVinList(List<String> vinlist, String appointmentId);
|
||||
|
||||
Integer deleteAppointmentDetailByAppointmentId(String appointment_id);
|
||||
|
||||
/**
|
||||
* 激活验证,返回商品企业信息
|
||||
*
|
||||
* @param vinList vin
|
||||
* @return 激活验证,返回商品企业信息
|
||||
*/
|
||||
List<ValidCusVin> validCusVin(List<String> vinList);
|
||||
|
||||
List<CargoInfoNaz> cargoInfoNaz(List<ValidCusVin> validCusVinList,String truckNum);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.haitongauto.rtosac.service;
|
||||
|
||||
import com.haitongauto.models.forward.AppointOverState;
|
||||
import com.haitongauto.models.forward.ForwardRes;
|
||||
import com.haitongauto.models.forward.UserTruck;
|
||||
import com.haitongauto.models.pojo.Appointment;
|
||||
import com.haitongauto.models.pojo.AppointmentDetail;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public interface ForwardService {
|
||||
/***
|
||||
* 预约信息异步转发到老系统
|
||||
* @param
|
||||
* @return 返回进港
|
||||
*/
|
||||
public CompletableFuture<ForwardRes> invokeApiAsyncForward(Appointment appointment, List<AppointmentDetail> appointmentDetailList);
|
||||
|
||||
|
||||
/***
|
||||
* 预约信息完成,将完成状态同步到老系统(整车物流)
|
||||
* @param
|
||||
* @return 返回进港
|
||||
*/
|
||||
public CompletableFuture<ForwardRes> appointmentOverApiAsync(AppointOverState appointOverState);
|
||||
|
||||
|
||||
Integer execUserTruck(List<UserTruck> userTrucks);
|
||||
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
package com.haitongauto.rtosac.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.haitongauto.models.dto.DataForMessage;
|
||||
import com.haitongauto.models.ido.login.PostLoginRes;
|
||||
import com.haitongauto.models.pojo.Users;
|
||||
import com.haitongauto.models.pojo.Truck;
|
||||
import com.haitongauto.models.pojo.Announcement;
|
||||
import com.haitongauto.models.sysuser.OldSysTruck;
|
||||
import com.haitongauto.models.sysuser.OldSysUser;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
public interface HomeService {
|
||||
|
||||
void userInfoSync1(OldSysUser applet_users, OldSysTruck applet_truck);
|
||||
|
||||
|
||||
Users userInfoSync(String wx_openid, String tel_number);
|
||||
|
||||
Users getUsersForId(String id);
|
||||
|
||||
/**
|
||||
* 根据用户的小程序 openid 获取用户在数据库里的数据
|
||||
*
|
||||
* @param wx_openid 微信openid
|
||||
* @return 返回用户信息
|
||||
*/
|
||||
Users getUsersForOpenId(String wx_openid);
|
||||
|
||||
String insertTruck(Truck truck);
|
||||
|
||||
Integer updateTruck(Truck truck);
|
||||
|
||||
/**
|
||||
* 用户/车辆注册
|
||||
*
|
||||
* @param users 用户
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
PostLoginRes postLogin(Users users);
|
||||
|
||||
/**
|
||||
* 写入登录日志
|
||||
*
|
||||
* @param wx_openid wx_openid
|
||||
* @param ip ip地址
|
||||
*/
|
||||
void loginLogAdd(String wx_openid, String ip);
|
||||
|
||||
/**
|
||||
* 分页读取每页10条公告数据
|
||||
*
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 数据条数
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
PageInfo<Announcement> getAnnouncementsList(Integer pageNum, Integer pageSize, Integer sort, String keyWords);
|
||||
|
||||
/**
|
||||
* 根据公告id获得公告
|
||||
*
|
||||
* @param announcement_id 公告id
|
||||
* @return 返回公告信息
|
||||
*/
|
||||
Announcement getAnnouncementById(String announcement_id);
|
||||
|
||||
/**
|
||||
* 读取系统服务路径
|
||||
*
|
||||
* @return 返回系统服务路径
|
||||
*/
|
||||
String getServiceBaseUrl();
|
||||
|
||||
/**
|
||||
* 读取图片访问路径
|
||||
*
|
||||
* @return 返回图片路径
|
||||
*/
|
||||
String getImgAccessUrl();
|
||||
|
||||
/**
|
||||
* 根据配置编号获取配置值
|
||||
*
|
||||
* @param config_code 配置编号
|
||||
* @return 返回配置值
|
||||
*/
|
||||
String getServiceConfigForCode(String config_code);
|
||||
|
||||
/**
|
||||
* 获取外部接口数据
|
||||
*
|
||||
* @param request_type : 请求类型参数,取值于Requester表
|
||||
* @param myParamMap :实时传值,其键值对与 Requester表param字段的键值对对应
|
||||
* @return 返回外部接口数据
|
||||
*/
|
||||
String getExternalInterfaceData(Integer request_type, Map<String, Object> myParamMap);
|
||||
|
||||
/**
|
||||
* 发送订阅消息
|
||||
*
|
||||
* @param dataForMessage:订阅消息发送数据类的实例
|
||||
* @return 发送失败的错误信息
|
||||
*/
|
||||
String sendMessage(DataForMessage dataForMessage);
|
||||
|
||||
/**
|
||||
* 返回文件后缀
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 返回文件后缀
|
||||
*/
|
||||
String getImagePath(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 保存图片
|
||||
*
|
||||
* @param mfile 文件
|
||||
* @param file 文件
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
boolean saveImage(MultipartFile mfile, File file);
|
||||
|
||||
/**
|
||||
* 新文件名
|
||||
*
|
||||
* @param suffix suffix
|
||||
* @return 返回文件名
|
||||
*/
|
||||
String getNewFileName(String suffix);
|
||||
|
||||
/**
|
||||
* 返回图片保存地址
|
||||
*
|
||||
* @param name 文件名
|
||||
* @return 返回图片保存地址
|
||||
*/
|
||||
String getNewImagePath(String name);
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.haitongauto.rtosac.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.haitongauto.models.pojo.Appointment;
|
||||
import com.haitongauto.models.pojo.Message;
|
||||
|
||||
public interface MessageService {
|
||||
|
||||
String insert(Message message);
|
||||
|
||||
int update(Message message);
|
||||
|
||||
/**
|
||||
* 哪吒打印的时候向小程序发送消息(哪吒请求接口)
|
||||
*
|
||||
* @param message 消息实体
|
||||
* @return 返回结果
|
||||
*/
|
||||
boolean receiveMessage(Message message);
|
||||
|
||||
/**
|
||||
* 根据板车号获得该板车最新消息
|
||||
* @param type 收车/发车
|
||||
* @return 返回消息
|
||||
*/
|
||||
Message getLastMessageByTypeAndBizId(Integer type, String biz_id);
|
||||
|
||||
PageInfo<Message> getUnReadMessageListByWxOpenid(String wxOpenid, Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 微信小程序前端打开界面,获得所有消息列表
|
||||
*
|
||||
* @param wxOpenid 微信openId
|
||||
* @return 返回结果
|
||||
*/
|
||||
PageInfo<Message> getMessageListByWxOpenid(String wxOpenid, Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 微信小程序前端打开界面,获得所有未读消息数量
|
||||
*
|
||||
* @param wxOpenid 微信openId
|
||||
* @return 返回结果
|
||||
*/
|
||||
Integer sumUnread(String wxOpenid);
|
||||
|
||||
|
||||
Appointment punchClockOverByPrint(String appointmentId);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
package com.haitongauto.rtosac.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.haitongauto.models.pojo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MineService {
|
||||
|
||||
/**
|
||||
* 个人资料修改
|
||||
*
|
||||
* @param users 用户(司机)
|
||||
* @return 返回修改结果
|
||||
*/
|
||||
Integer postMyUsers(Users users);
|
||||
|
||||
|
||||
/**
|
||||
* 获取我的板车信息
|
||||
*
|
||||
* @param truckId 板车id
|
||||
* @return 返回我的板车信息
|
||||
*/
|
||||
Truck getTruck(String truckId);
|
||||
|
||||
/**
|
||||
* 获取我的板车信息
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @return 返回我的板车信息
|
||||
*/
|
||||
List<Truck> getMyPalletTruck(String users_id);
|
||||
|
||||
/**
|
||||
* 修改或添加我的板车信息
|
||||
*
|
||||
* @param palletTruck 板车数据实体
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
Integer postMyPalletTruck(Truck palletTruck);
|
||||
|
||||
/**
|
||||
* 删除我的板车信息
|
||||
*
|
||||
* @param palletTruck_id 板车id
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
Integer delMyPalletTruck(String palletTruck_id);
|
||||
|
||||
Integer deleteTruckByUsersId(String users_id);
|
||||
|
||||
/**
|
||||
* 我的车辆黑名单信息 truck_management
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @return 返回我的车辆黑名单信息
|
||||
*/
|
||||
List<TruckManagement> getMyTruckManagement(String users_id);
|
||||
|
||||
/**
|
||||
* 提交反馈意见
|
||||
*
|
||||
* @param feedback 反馈意见数据实体
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
Integer postFeedback(Feedback feedback);
|
||||
|
||||
/**
|
||||
* 我的预约信息列表
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @return 返回我的预约信息列表
|
||||
*/
|
||||
List<Appointment> getMyAppointmentList(String users_id);
|
||||
|
||||
|
||||
/**
|
||||
* 根据预约ids
|
||||
*
|
||||
* @param ids 预约ids
|
||||
* @return 返回预约列表
|
||||
*/
|
||||
|
||||
public List<Appointment> getAppointmentByIds(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 我的预约信息模糊查询分页列表
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @param keywords 查询关键字
|
||||
* @param approach_date 进场日期
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 数据条数
|
||||
* @return 返回我的预约信息模糊查询分页列表
|
||||
*/
|
||||
PageInfo<Appointment> getMyAppointmentListForPage(String users_id, String keywords, String approach_date, Integer pageNum, Integer pageSize);
|
||||
|
||||
PageInfo<Appointment> getMyAppointmentListForPageNew(String users_id, String keywords, String approach_date, Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 我的预约信息按日期查询分页列表
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @param approach_date 预约进场日期
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 数据条数
|
||||
* @return 返回我的预约信息按日期查询分页列表
|
||||
*/
|
||||
PageInfo<Appointment> getMyAppointmentListByDateForPage(String users_id, String approach_date, Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 新手攻略
|
||||
*
|
||||
* @return 返回新手攻略
|
||||
*/
|
||||
List<NoviceIntroduction> getNoviceIntroduction();
|
||||
|
||||
/**
|
||||
* 获取我的当前预约
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @return 返回获取我的当前预约
|
||||
*/
|
||||
Appointment getMyAppointment(String users_id);
|
||||
|
||||
/**
|
||||
* 根据Id获取用户信息
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @return 返回用户信息
|
||||
*/
|
||||
Users getUsersById(String users_id);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.haitongauto.rtosac.service;
|
||||
import com.haitongauto.models.pojo.EntryInstruct;
|
||||
import com.haitongauto.models.pojo.Requester;
|
||||
import java.util.List;
|
||||
|
||||
public interface NewsService {
|
||||
|
||||
/**
|
||||
* 获取发送给指定用户的(最近10条)指令信息
|
||||
* @param users_id 用户id
|
||||
* @return 返回定用户的(最近10条)指令信息
|
||||
*/
|
||||
List<EntryInstruct> getEntryInstructionsForUsers(String users_id);
|
||||
|
||||
Requester getRequesterForType(Integer requestType);
|
||||
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package com.haitongauto.rtosac.service;
|
||||
|
||||
import com.haitongauto.models.pojo.Appointment;
|
||||
import com.haitongauto.models.pojo.PortArea;
|
||||
import com.haitongauto.models.pojo.PunchClock;
|
||||
|
||||
import javax.xml.crypto.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface PunchClockService {
|
||||
/**
|
||||
* 检查是否有预约(查询是否存在有预约待签到)的预约数据
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @return 返回预约信息
|
||||
*/
|
||||
Appointment getIincompleteAppointment(String users_id);
|
||||
|
||||
/**
|
||||
* 签到打卡提交
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @param appointment_id 预约id
|
||||
* @param port_area_id 港区id
|
||||
* @param punch_poi 坐标
|
||||
* @return 返回提交结果
|
||||
*/
|
||||
PunchClock postPunchClockStart(String users_id, String appointment_id, String port_area_id, String punch_poi, String punch_address);
|
||||
|
||||
/**
|
||||
* 完成打卡提交
|
||||
*
|
||||
* @param appointment_id 预约id
|
||||
* @param punch_clock_id 打卡id
|
||||
* @param over_address 打卡地址
|
||||
* @return 返回完成打卡提交执行结果
|
||||
*/
|
||||
PunchClock postPunchClockOver(String appointment_id, String punch_clock_id, String over_address);
|
||||
|
||||
/**
|
||||
* 根据预约Id获取获取打卡记录
|
||||
*
|
||||
* @param appointment_id 预约id
|
||||
* @return 返回打卡记录
|
||||
*/
|
||||
PunchClock getPunchClockForAppintementId(String appointment_id);
|
||||
|
||||
/**
|
||||
* 查询指定司机某一天(指定日期)的打卡记录
|
||||
*
|
||||
* @param date 指定日期
|
||||
* @param users_id 用户id
|
||||
* @return 返回打卡记录列表
|
||||
*/
|
||||
List<PunchClock> getPunchClockForDate(String date, String users_id);
|
||||
|
||||
/**
|
||||
* 查询指定司机某年某月的打卡记录
|
||||
*
|
||||
* @param year 年
|
||||
* @param month 月
|
||||
* @param users_id 用户id
|
||||
* @return 返回打卡记录列表
|
||||
*/
|
||||
List<PunchClock> getPunchClockForYM(Integer year, Integer month, String users_id);
|
||||
|
||||
/**
|
||||
* 获取港区
|
||||
*
|
||||
* @param port_area_id 港区id
|
||||
* @return 返回港区信息
|
||||
*/
|
||||
PortArea getPortAreaForId(String port_area_id);
|
||||
|
||||
/**
|
||||
* 获取港区中心点坐标
|
||||
*
|
||||
* @param port_area_id 港区id
|
||||
* @return 返回港区中心点坐标
|
||||
*/
|
||||
String getPortAreaPoi(String port_area_id);
|
||||
|
||||
/**
|
||||
* 获取签到打卡排队序号
|
||||
*
|
||||
* @param appointment_id 预约id
|
||||
* @return 返回签到打卡排队序号
|
||||
*/
|
||||
String getQueueNumber(String appointment_id);
|
||||
|
||||
/**
|
||||
* 获取当前排队前面还剩多少车辆未进港
|
||||
*
|
||||
* @param approach_date 进场日期
|
||||
* @param port_area_id 港区id
|
||||
* @param queue_number 排队号
|
||||
* @return 返回查询结果
|
||||
*/
|
||||
Integer getNumberBefore(String approach_date, String port_area_id, String queue_number);
|
||||
|
||||
Integer updatePunchClock(PunchClock punchClock);
|
||||
|
||||
|
||||
String getLastQueueNumber(Date date, String port_area_id);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.haitongauto.rtosac.service;
|
||||
|
||||
public interface Response {
|
||||
/**
|
||||
* 封装为返回Json对象
|
||||
*
|
||||
* @param bl:请求是否成功
|
||||
* @param data:返回数据
|
||||
* @return 返回Json对象
|
||||
*/
|
||||
String getResponseData(Boolean bl, Object data);
|
||||
|
||||
/**
|
||||
* 封装为返回Json对象
|
||||
*
|
||||
* @param bl 请求是否成功
|
||||
* @param data 返回数据
|
||||
* @param msg 消息
|
||||
* @return 返回Json对象
|
||||
*/
|
||||
String getResponseData(Boolean bl, Object data, String msg);
|
||||
|
||||
/**
|
||||
* 封装为返回Json对象(带null)
|
||||
* @param bl:请求是否成功
|
||||
* @param data:返回数据
|
||||
* @return 返回Json对象
|
||||
*/
|
||||
String getResponseDataJavaJson(Boolean bl,Object data);
|
||||
|
||||
|
||||
/**
|
||||
* 封装为返回Json对象(带null)
|
||||
* @param bl:请求是否成功
|
||||
* @param data:返回数据
|
||||
* @return 返回Json对象
|
||||
*/
|
||||
String getRtosResponseData(Boolean bl,Object data,String errorCode);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.haitongauto.rtosac.service;
|
||||
import com.haitongauto.models.pojo.Truck;
|
||||
import com.haitongauto.models.pojo.Users;
|
||||
|
||||
public interface UsersService {
|
||||
String insert(Users users);
|
||||
|
||||
Integer update(Users users);
|
||||
|
||||
Truck getTruckByWxOpenID(String wx_openid);
|
||||
|
||||
Truck getTruckByUserId(String userId);
|
||||
|
||||
Users getUsersByUserId(String userId);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.haitongauto.rtosac.service;
|
||||
import com.haitongauto.models.ido.departure.DepartureDetailIdo_DTO;
|
||||
import com.haitongauto.models.ido.departure.DepartureVehicleIdo_DTO;
|
||||
import com.haitongauto.models.ido.receiving.ReceivingDetailIdo_DTO;
|
||||
import com.haitongauto.models.ido.receiving.ReceivingVehicleIdo_DTO;
|
||||
public interface VehicleService {
|
||||
/**
|
||||
* 获取收车凭证的分页数据
|
||||
*
|
||||
* @param current 当前页码
|
||||
* @param size 数据条数(非必填)
|
||||
* @return 返回收车凭证的分页数据
|
||||
*/
|
||||
ReceivingVehicleIdo_DTO getVehicleReceivingList(String printTicketTime, String query, Integer current, Integer size);
|
||||
//ReceivingVehicleIdo_DTO getVehicleReceivingList(String access_token, Integer current, Integer size);
|
||||
|
||||
/**
|
||||
* 获取指定id的待核对收车凭证信息
|
||||
* access_token 访问令牌(根据该用户access_token权限获得该用户的收车凭证)用户登录后前端会保存access_token
|
||||
*
|
||||
* @param id 收车凭证id
|
||||
* @return 返回收车凭证信息
|
||||
*/
|
||||
ReceivingDetailIdo_DTO getVehicleReceivingInfo(String id);
|
||||
|
||||
/**
|
||||
* 完成收车核对
|
||||
*
|
||||
* @param id 收车凭证id
|
||||
* @return 返回核对结果
|
||||
*/
|
||||
boolean vehicleReceivingOver(String id);
|
||||
|
||||
/**
|
||||
* 获取提车凭证的分页数据
|
||||
*
|
||||
* @param current 当前页码
|
||||
* @param size 数据条数(非必填)
|
||||
* @return 返回提车凭证的分页数据
|
||||
*/
|
||||
DepartureVehicleIdo_DTO getVehicleDepartureInfoList(String printTicketTime, String query, Integer current, Integer size);
|
||||
|
||||
/**
|
||||
* 获取指定id的待核对提车信息
|
||||
*
|
||||
* @param id 待提车id
|
||||
* @return 返回指定id的待核对提车信息
|
||||
*/
|
||||
DepartureDetailIdo_DTO getVehicleDepartureInfo(String id);
|
||||
|
||||
/**
|
||||
* 完成发车核对
|
||||
*
|
||||
* @param id 提车凭证id
|
||||
* @return 返回提车凭证id的提车信息
|
||||
*/
|
||||
boolean VehicleDepartureOver(String id);
|
||||
|
||||
}
|
|
@ -0,0 +1,816 @@
|
|||
package com.haitongauto.rtosac.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bestvike.linq.Linq;
|
||||
import com.haitongauto.interfaces.*;
|
||||
import com.haitongauto.mapper.base.*;
|
||||
import com.haitongauto.mapper.client.PunchClockExtendMapper;
|
||||
import com.haitongauto.mapper.client.TruckExtendMapper;
|
||||
import com.haitongauto.models.dto.AppointmentDto;
|
||||
import com.haitongauto.models.dto.DicDto;
|
||||
import com.haitongauto.models.dto.EnterPortTypeDtol;
|
||||
import com.haitongauto.models.forward.AppointForward;
|
||||
import com.haitongauto.models.forward.ForwardRes;
|
||||
import com.haitongauto.models.forward.VinDetail;
|
||||
import com.haitongauto.models.pojo.*;
|
||||
import com.haitongauto.models.valid.cus.ValidCusVin;
|
||||
import com.haitongauto.models.valid.cus.ValidRequest;
|
||||
import com.haitongauto.models.valid.naz.CargoInfo;
|
||||
import com.haitongauto.models.valid.naz.CargoInfoNaz;
|
||||
import com.haitongauto.models.valid.naz.EnterpriseInfo;
|
||||
import com.haitongauto.models.valid.naz.Good;
|
||||
import com.haitongauto.rtosac.api.AppointmentController;
|
||||
import com.haitongauto.rtosac.service.AppointmentService;
|
||||
import com.haitongauto.mapper.client.AppointmentExtendMapper;
|
||||
import com.haitongauto.rtosac.service.MessageService;
|
||||
import com.haitongauto.utils.FormatDateTime;
|
||||
import com.haitongauto.utils.HttpClientHelper;
|
||||
import com.haitongauto.utils.QueueNumberHelper;
|
||||
import com.haitongauto.utils.http.OkHttpUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AppointmentServiceImpl implements AppointmentService {
|
||||
/**
|
||||
* 读取nacos接口路径(正常物流,预约信息同步老系统的接口地址)
|
||||
*/
|
||||
@Value("${rtos.syncold.url}")
|
||||
private String myUrl;
|
||||
|
||||
@Autowired
|
||||
PunchClockExtendMapper punchClockExtendMapper;
|
||||
@Autowired
|
||||
PunchClockMapper punchClockMapper;
|
||||
@Autowired
|
||||
TruckMapper truckMapper;
|
||||
@Autowired
|
||||
PortAreasMapper portAreasMapper;
|
||||
@Autowired
|
||||
AppointmentMapper appointmentMapper;
|
||||
@Autowired
|
||||
AppointmentDetailMapper appointmentDetailMapper;
|
||||
@Autowired
|
||||
AppointmentExtendMapper appointmentExtendMapper;
|
||||
@Autowired
|
||||
TruckExtendMapper truckExtendMapper;
|
||||
@Autowired
|
||||
PortAreaInterface portAreaInterface;
|
||||
@Autowired
|
||||
DicInterface dicInterface;
|
||||
@Autowired
|
||||
EnterPortTypeInterface enterPortTypeInterface;
|
||||
@Autowired
|
||||
UsersMapper usersMapper;
|
||||
|
||||
@Resource
|
||||
CusOrderApi cusOrderApi;
|
||||
|
||||
@Resource
|
||||
OrderApi orderApi;
|
||||
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(AppointmentServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public ForwardRes invokeForwardApi(Appointment appointment, List<AppointmentDetail> appointmentDetailList) {
|
||||
if (appointment == null) {
|
||||
return null;
|
||||
}
|
||||
AppointForward appointForward = new AppointForward();
|
||||
//appointForward.setId(appointment.getId());//预约id
|
||||
appointForward.setTruckNo(appointment.getTruck_number());//板车号
|
||||
appointForward.setPhone(appointment.getTel_number());//手机号码
|
||||
appointForward.setGodNum(appointment.getGoods_quantity());//货物数量
|
||||
appointForward.setOrderTm(appointment.getApproach_date());//预约时间
|
||||
Users users = usersMapper.getById(appointment.getUsers_id());
|
||||
if (users != null) {
|
||||
appointForward.setOpenId(users.getWx_openid());//openid
|
||||
}
|
||||
PortArea portArea = portAreasMapper.getById(appointment.getPort_area_id());
|
||||
if (portArea != null) {
|
||||
appointForward.setWhafType(portArea.getPort_area_name());//港区
|
||||
}
|
||||
String goods_type = appointment.getGoods_type();
|
||||
//货物类型
|
||||
if (goods_type != null && !goods_type.isEmpty()) {
|
||||
switch (goods_type) {
|
||||
case "C": {
|
||||
appointForward.setGodType("商品车");
|
||||
break;
|
||||
}
|
||||
case "L": {
|
||||
appointForward.setGodType("大件");
|
||||
break;
|
||||
}
|
||||
case "M": {
|
||||
appointForward.setGodType("工程机械");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//进港类型
|
||||
String enter_type = appointment.getEnter_type();
|
||||
if (enter_type != null && !enter_type.isEmpty()) {
|
||||
switch (enter_type) {
|
||||
case "WE": {
|
||||
appointForward.setOrderType("外贸出口");
|
||||
break;
|
||||
}
|
||||
case "WI": {
|
||||
appointForward.setOrderType("外贸进口");
|
||||
break;
|
||||
}
|
||||
case "NE": {
|
||||
appointForward.setOrderType("内贸出口");
|
||||
break;
|
||||
}
|
||||
case "NI": {
|
||||
appointForward.setOrderType("内贸进口");
|
||||
break;
|
||||
}
|
||||
case "BC": {
|
||||
appointForward.setOrderType("奔驰分拨");
|
||||
break;
|
||||
}
|
||||
case "LP": {
|
||||
appointForward.setOrderType("提离港区");
|
||||
break;
|
||||
}
|
||||
case "BM": {
|
||||
appointForward.setOrderType("宝马分拨");
|
||||
break;
|
||||
}
|
||||
case "JL": {
|
||||
appointForward.setOrderType("捷豹路虎分拨");
|
||||
break;
|
||||
}
|
||||
case "AC": {
|
||||
appointForward.setOrderType("安盛场地");
|
||||
break;
|
||||
}
|
||||
case "FT": {
|
||||
appointForward.setOrderType("丰田分拨");
|
||||
break;
|
||||
}
|
||||
case "AD": {
|
||||
appointForward.setOrderType("奥迪分拨");
|
||||
break;
|
||||
}
|
||||
case "OTHER": {
|
||||
appointForward.setOrderType("其他品牌分拨");
|
||||
break;
|
||||
}
|
||||
case "MV": {
|
||||
appointForward.setOrderType("移库短驳");
|
||||
break;
|
||||
}
|
||||
case "PD": {
|
||||
appointForward.setOrderType("整车分拨");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<VinDetail> vinDetails = null;
|
||||
if (appointmentDetailList != null && appointmentDetailList.size() > 0) {
|
||||
vinDetails = new ArrayList<>();
|
||||
for (AppointmentDetail appointmentDetail : appointmentDetailList) {
|
||||
VinDetail vinDetail = new VinDetail();
|
||||
vinDetail.setVin(appointmentDetail.getVin());//车架号
|
||||
String shipName = appointmentDetail.getShip_name();
|
||||
if (shipName != null && !shipName.isEmpty()) {
|
||||
String myShipName = shipName.split("/")[0];
|
||||
vinDetail.setVlsNm(myShipName);//船名
|
||||
}
|
||||
String brandName = appointmentDetail.getBrand_name();
|
||||
if (brandName != null && !brandName.isEmpty()) {
|
||||
String myBrandName = brandName.split("/")[0];
|
||||
vinDetail.setBrdNm(myBrandName);//品牌
|
||||
}
|
||||
String destinationPort = appointmentDetail.getDestination_port();
|
||||
if (destinationPort != null && !destinationPort.isEmpty()) {
|
||||
String myDestinationPort = destinationPort.split("/")[0];
|
||||
vinDetail.setPotNm(myDestinationPort);//港口
|
||||
}
|
||||
vinDetails.add(vinDetail);
|
||||
}
|
||||
}
|
||||
appointForward.setDataList(vinDetails);
|
||||
|
||||
//调用哪吒接口,将预约数据转发到,老系统,待补充
|
||||
//String myUrl = "http://192.168.161.81:8090/rtopswebapi/api/NsOrder/execTruckOrder";
|
||||
ForwardRes forwardRes = null;
|
||||
//ForwardConfig config= ConfigHelper.getForwardConfig();
|
||||
//if (config != null) {
|
||||
// myUrl = config.getUrl() + "execTruckOrder";
|
||||
//}
|
||||
try {
|
||||
logger.info("预约信息转发:" + JSON.toJSONString(appointForward));
|
||||
String post = OkHttpUtils.post(myUrl, OkHttpUtils.buildJsonRequestBody(JSON.toJSONString(appointForward)), null);
|
||||
JSONObject rst = JSONObject.parseObject(post);
|
||||
logger.info("预约信息转发回复:" + JSONObject.toJSONString(rst));
|
||||
|
||||
//解析成实体
|
||||
if (post != null && post.contains("success")) {
|
||||
forwardRes = JSONObject.parseObject(post, ForwardRes.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("预约信息转发回复:" + JSON.toJSONString(e.getMessage()));
|
||||
}
|
||||
return forwardRes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserAndTruckByAppointment(Appointment appointment) {
|
||||
if (appointment == null) {
|
||||
return;
|
||||
}
|
||||
String users_id = appointment.getUsers_id();
|
||||
if (users_id == null || users_id.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Users myUsers = usersMapper.getById(users_id);
|
||||
if (myUsers != null) {
|
||||
myUsers.setTel_number(appointment.getTel_number());
|
||||
myUsers.setId_code(appointment.getId_code());
|
||||
usersMapper.update(myUsers);
|
||||
}
|
||||
|
||||
Truck myTruck = truckMapper.getTruckByUsersId(users_id);
|
||||
if (myTruck != null) {
|
||||
myTruck.setUsers_id(users_id);
|
||||
myTruck.setTel_number(appointment.getTel_number());
|
||||
myTruck.setTruck_number(appointment.getTruck_number());
|
||||
myTruck.setVehicle_frame_weight(appointment.getVehicle_frame_weight());
|
||||
myTruck.setVehicle_weight(appointment.getVehicle_weight());
|
||||
myTruck.setHead_frame_number(appointment.getTruck_vin());
|
||||
myTruck.setDriving_license(appointment.getDriving_license());
|
||||
if (myUsers != null) {
|
||||
myTruck.setWx_openid(myUsers.getWx_openid());
|
||||
}
|
||||
truckMapper.update(myTruck);
|
||||
} else {
|
||||
myTruck = new Truck();
|
||||
myTruck.setId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
||||
myTruck.setUsers_id(users_id);
|
||||
myTruck.setTel_number(appointment.getTel_number());
|
||||
myTruck.setTruck_number(appointment.getTruck_number());
|
||||
myTruck.setVehicle_frame_weight(appointment.getVehicle_frame_weight());
|
||||
myTruck.setVehicle_weight(appointment.getVehicle_weight());
|
||||
myTruck.setHead_frame_number(appointment.getTruck_vin());
|
||||
myTruck.setDriving_license(appointment.getDriving_license());
|
||||
if (myUsers != null) {
|
||||
myTruck.setWx_openid(myUsers.getWx_openid());
|
||||
}
|
||||
truckMapper.insert(myTruck);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (发起预约时)获取用户注册的板车信息
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @return 返回用户注册的板车信息
|
||||
*/
|
||||
@Override
|
||||
public Truck getPalletTruck(String users_id) {
|
||||
//获取该用户的板车信息
|
||||
return truckMapper.getTruckByUsersId(users_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交预约信息
|
||||
*
|
||||
* @param appointment 预约数据实体
|
||||
* @return 返回提交结果
|
||||
*/
|
||||
@Override
|
||||
public Integer postAppointment(Appointment appointment) {
|
||||
Integer res = 0;
|
||||
String id = appointment.getId();
|
||||
if (id == null || id.isEmpty()) {
|
||||
//插入
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
|
||||
appointment.setId(uuid);
|
||||
//数据补全
|
||||
String myDate = FormatDateTime.dateTimeToStr(new Date());
|
||||
appointment.setAppointment_state(1);
|
||||
appointment.setCreate_time(myDate);
|
||||
appointment.setUpdate_time(myDate);
|
||||
appointment.setIs_del(0);
|
||||
//写入
|
||||
String myId = appointmentMapper.insert(appointment);
|
||||
res = (myId != null && myId.length() > 0) ? 1 : null;
|
||||
//插入打卡记录
|
||||
if (res != null) {
|
||||
PunchClock punchClock = new PunchClock();
|
||||
punchClock.setId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
||||
punchClock.setPunch_clock_type(0);
|
||||
punchClock.setPort_area_id(appointment.getPort_area_id());
|
||||
punchClock.setAppointment_id(appointment.getId());
|
||||
punchClock.setBiz_type(appointment.getBiz_type());
|
||||
punchClock.setUsers_id(appointment.getUsers_id());
|
||||
punchClock.setCreate_time(myDate);
|
||||
punchClock.setUpdate_time(myDate);
|
||||
punchClock.setIs_del(0);
|
||||
String punchClockId = punchClockMapper.insert(punchClock);
|
||||
}
|
||||
|
||||
} else {
|
||||
//修改
|
||||
res = appointmentMapper.update(appointment);
|
||||
if (res != null) {
|
||||
PunchClock myPunchClock = punchClockMapper.getPunchClockByAppointmentId(appointment.getId());
|
||||
if (myPunchClock != null) {
|
||||
myPunchClock.setPort_area_id(appointment.getPort_area_id());
|
||||
myPunchClock.setAppointment_id(appointment.getId());
|
||||
myPunchClock.setBiz_type(appointment.getBiz_type());
|
||||
myPunchClock.setUsers_id(appointment.getUsers_id());
|
||||
myPunchClock.setIs_del(0);
|
||||
Integer x = punchClockMapper.update(myPunchClock);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//返回
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约明细提交
|
||||
*
|
||||
* @param appointment 预约数据实体
|
||||
* @param appointmentDetailList 明细列表
|
||||
* @return 返回执行影响条数
|
||||
*/
|
||||
@Override
|
||||
public Integer postAppointmentDetailList(Appointment appointment, List<AppointmentDetail> appointmentDetailList) {
|
||||
int res = 0;
|
||||
if (appointment == null || appointmentDetailList == null || appointmentDetailList.size() == 0) {
|
||||
return res;
|
||||
}
|
||||
List<AppointmentDetail> myAppointmentDetailList = appointmentDetailMapper.getAppointmentDetailListByAppointmentId(appointment.getId());
|
||||
for (AppointmentDetail appointmentDetail : appointmentDetailList) {
|
||||
AppointmentDetail myAppointmentDetail = null;
|
||||
if (myAppointmentDetailList != null && myAppointmentDetailList.size() > 0) {
|
||||
myAppointmentDetail = Linq.of(myAppointmentDetailList).firstOrDefault(p -> p.getVin().equals(appointmentDetail.getVin()));
|
||||
}
|
||||
//新增
|
||||
if (myAppointmentDetail == null) {
|
||||
appointmentDetail.setAppointment_id(appointment.getId());
|
||||
appointmentDetail.setId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
||||
appointmentDetail.setIs_del(0);
|
||||
String r = appointmentDetailMapper.insert(appointmentDetail);
|
||||
if (r != null && !r.isEmpty()) {
|
||||
res = res + 1;
|
||||
}
|
||||
} else {
|
||||
//修改
|
||||
appointmentDetail.setIs_del(0);
|
||||
int x = appointmentDetailMapper.update(appointmentDetail);
|
||||
res = res + x;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定用户是否存在已预约但未完成预约信息
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @return 返回查询结果
|
||||
*/
|
||||
@Override
|
||||
public Appointment getActiveAppointment(String users_id) {
|
||||
return appointmentExtendMapper.getActiveAppointment(users_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Appointment getActiveAppointmentNew(String truck_number) {
|
||||
return appointmentExtendMapper.getActiveAppointmentNew(truck_number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Appointment getActiveAppointmentByTruckNumber(String truck_number) {
|
||||
return appointmentExtendMapper.getActiveAppointmentByTruckNumber(truck_number);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
*
|
||||
* @param appointment_id 预约id
|
||||
* @return 返回执行取消预约的结果
|
||||
*/
|
||||
@Override
|
||||
public Integer cancelAppointment(String appointment_id) {
|
||||
String cancel_time = FormatDateTime.dateTimeToStr(new Date());
|
||||
int x = 0;
|
||||
//取消预约
|
||||
x = appointmentExtendMapper.cancelAppointment(cancel_time, appointment_id);
|
||||
//取消对应的预约明细
|
||||
//int count = appointmentExtendMapper.cancelAppointmentDetails(appointment_id);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车牌号获取该用户的当前预约
|
||||
*
|
||||
* @param truck_number 车牌号
|
||||
* @return 返回当前预约
|
||||
*/
|
||||
@Override
|
||||
public Appointment getAppointmentByTruckNo(String truck_number) {
|
||||
Appointment appointment = null;
|
||||
List<Appointment> appointmentList = appointmentMapper.getListByTruckName(truck_number);
|
||||
if (appointmentList != null && appointmentList.size() > 0) {
|
||||
appointment = Linq.of(appointmentList).firstOrDefault();
|
||||
}
|
||||
return appointment;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车牌号获取该用户的当前预约(出闸口专用)
|
||||
*
|
||||
* @param truck_number 车牌号
|
||||
* @return 返回当前预约
|
||||
*/
|
||||
@Override
|
||||
public Appointment getAppointmentByTruckNoForOutGate(String truck_number) {
|
||||
return appointmentMapper.getAppointmentByTruckNoForOutGate(truck_number);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过更新一条预约信息,实现预约记录的进出港状态更新
|
||||
*
|
||||
* @param appointment 预约数据实体
|
||||
* @return 返回更新执行结果
|
||||
*/
|
||||
@Override
|
||||
public Integer updateAppointment(Appointment appointment) {
|
||||
return appointmentMapper.update(appointment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约明细提交
|
||||
*
|
||||
* @param appointment 预约数据实体
|
||||
* @param appointmentDetailList 明细列表
|
||||
* @return 返回执行影响条数
|
||||
*/
|
||||
@Override
|
||||
public Integer updateAppointmentDetailList(Appointment appointment, List<AppointmentDetail> appointmentDetailList) {
|
||||
int res = 0;
|
||||
if (appointment == null || appointmentDetailList == null || appointmentDetailList.size() == 0) {
|
||||
return res;
|
||||
}
|
||||
String appointmentId = appointment.getId();
|
||||
if (appointmentId == null || appointmentId.isEmpty()) {
|
||||
return res;
|
||||
}
|
||||
//删除修改前的预约明细
|
||||
int result = appointmentDetailMapper.deleteAppointmentDetailByAppointmentId(appointmentId);
|
||||
for (AppointmentDetail appointmentDetail : appointmentDetailList) {
|
||||
//新增
|
||||
if (appointmentDetail != null) {
|
||||
appointmentDetail.setAppointment_id(appointment.getId());
|
||||
String id_Detail = appointmentDetail.getId();
|
||||
if (id_Detail == null || id_Detail.isEmpty()) {
|
||||
//前端可能新增了一条车vin,
|
||||
appointmentDetail.setId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
||||
}
|
||||
appointmentDetail.setIs_del(0);
|
||||
String r = appointmentDetailMapper.insert(appointmentDetail);
|
||||
if (r != null && !r.isEmpty()) {
|
||||
res = res + 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定用户和指定车辆是否存在已预约但未完成预约信息
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @param truck_number 车牌号
|
||||
* @return 返回查询结果
|
||||
*/
|
||||
@Override
|
||||
public Appointment getActiveAppointmentByUserAndTruck(String users_id, String truck_number) {
|
||||
return appointmentExtendMapper.getActiveAppointmentByUserAndTruck(users_id, truck_number);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获得预约信息
|
||||
*
|
||||
* @param id 预约id
|
||||
* @return 返回预约信息
|
||||
*/
|
||||
@Override
|
||||
public Appointment getAppointmentById(String id) {
|
||||
return appointmentMapper.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppointmentDetail> getAppointmentDetailListByAppointmentId(String appointment_id) {
|
||||
return appointmentDetailMapper.getAppointmentDetailListByAppointmentId(appointment_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppointmentDto getAppointmentDtoById(String id) {
|
||||
Appointment appointment = appointmentMapper.getById(id);
|
||||
if (appointment == null) {
|
||||
return null;
|
||||
}
|
||||
AppointmentDto appointmentDto = new AppointmentDto();
|
||||
//港区
|
||||
String port_area_id = appointment.getPort_area_id();
|
||||
List<PortArea> portAreaList = portAreaInterface.getPortArea();
|
||||
PortArea portArea = null;
|
||||
if (portAreaList != null) {
|
||||
portArea = Linq.of(portAreaList).firstOrDefault(p -> p.getId().equals(port_area_id));
|
||||
}
|
||||
//运输方式
|
||||
String transport_type = appointment.getTransport_type();
|
||||
List<DicDto> transportTypelist = dicInterface.getDicList("TRANSPORT_TYPE");
|
||||
DicDto transportType = null;
|
||||
if (transportTypelist != null) {
|
||||
transportType = Linq.of(transportTypelist).firstOrDefault(p -> p.getId().equals(transport_type));
|
||||
}
|
||||
//进港类型
|
||||
String enter_type = appointment.getEnter_type();
|
||||
List<EnterPortTypeDtol> enterTypelist = enterPortTypeInterface.getEnterPortTypeList();
|
||||
EnterPortTypeDtol enterType = null;
|
||||
if (enterTypelist != null) {
|
||||
enterType = Linq.of(enterTypelist).firstOrDefault(p -> p.getId().equals(enter_type));
|
||||
}
|
||||
//货物类型
|
||||
String goods_type = appointment.getGoods_type();
|
||||
List<DicDto> goodsTypelist = dicInterface.getDicList("APP_CARGO_TYPE");
|
||||
DicDto goodsType = null;
|
||||
if (goodsTypelist != null) {
|
||||
goodsType = Linq.of(goodsTypelist).firstOrDefault(p -> p.getId().equals(goods_type));
|
||||
}
|
||||
|
||||
appointmentDto.setId(appointment.getId());
|
||||
appointmentDto.setBiz_type(appointment.getBiz_type());
|
||||
appointmentDto.setUsers_id(appointment.getUsers_id());
|
||||
appointmentDto.setTruck_number(appointment.getTruck_number());
|
||||
appointmentDto.setId_code(appointment.getId_code());
|
||||
appointmentDto.setTel_number(appointment.getTel_number());
|
||||
appointmentDto.setTruck_vin(appointment.getTruck_vin());
|
||||
appointmentDto.setVehicle_weight(appointment.getVehicle_weight());
|
||||
appointmentDto.setVehicle_frame_weight(appointment.getVehicle_frame_weight());
|
||||
appointmentDto.setDriving_license(appointment.getDriving_license());
|
||||
appointmentDto.setApproach_date(appointment.getApproach_date());
|
||||
appointmentDto.setGoods_quantity(appointment.getGoods_quantity());
|
||||
appointmentDto.setAppointment_state(appointment.getAppointment_state());
|
||||
appointmentDto.setCancel_time(appointment.getCancel_time());
|
||||
appointmentDto.setCreate_time(appointment.getCreate_time());
|
||||
appointmentDto.setUpdate_time(appointment.getUpdate_time());
|
||||
appointmentDto.setIs_del(appointment.getIs_del());
|
||||
appointmentDto.setPort_area_id(appointment.getPort_area_id());
|
||||
appointmentDto.setAppointment_type(appointment.getAppointment_type());
|
||||
if (appointmentDto.getAppointment_state().equals(1)) {
|
||||
appointmentDto.setAppointment_type_name("普通码头预约");
|
||||
}
|
||||
if (appointmentDto.getAppointment_state().equals(2)) {
|
||||
appointmentDto.setAppointment_type_name("特保区预约");
|
||||
}
|
||||
if (portArea != null) {
|
||||
appointmentDto.setPort_area_name(portArea.getPort_area_name());
|
||||
}
|
||||
appointmentDto.setEnter_type(appointment.getEnter_type());
|
||||
if (enterType != null) {
|
||||
appointmentDto.setEnter_type_name(enterType.getText());
|
||||
}
|
||||
appointmentDto.setGoods_type(appointment.getGoods_type());
|
||||
if (goodsType != null) {
|
||||
appointmentDto.setGoods_type_name(goodsType.getText());
|
||||
}
|
||||
appointmentDto.setTransport_type(appointment.getTransport_type());
|
||||
if (transportType != null) {
|
||||
appointmentDto.setTransport_type_name(transportType.getText());
|
||||
}
|
||||
|
||||
return appointmentDto;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户当天在外高桥港区未离港的预约
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @param port_area_id 港区id
|
||||
* @param approach_date 进港日期
|
||||
* @return 返回预约信息
|
||||
*/
|
||||
@Override
|
||||
public Appointment getAppointmentByUserIdAndPortAreaIdAndApproachDate(String users_id, String port_area_id, String approach_date) {
|
||||
return appointmentMapper.getAppointmentByUserIdAndPortAreaIdAndApproachDate(users_id, port_area_id, approach_date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改预约板车扫描时间及预约状态(预约状态进入收车状态,就不能取消,但可以修改)
|
||||
*
|
||||
* @param appointment_id 预约id
|
||||
* @return 返回结果
|
||||
*/
|
||||
@Override
|
||||
public Integer updateAppointmentPlateScanTime(String appointment_id) {
|
||||
//板车扫描时间: 如果未进港,改成已进港,同时记录进港时间
|
||||
Appointment appointment = appointmentMapper.getById(appointment_id);
|
||||
if (appointment == null) {
|
||||
return 0;
|
||||
}
|
||||
Date now = new Date();
|
||||
//签到时间
|
||||
if (appointment.getCheck_in_time() == null || appointment.getCheck_in_time().isEmpty()) {
|
||||
appointment.setCheck_in_time(FormatDateTime.dateTimeToStr(now));
|
||||
}
|
||||
//进闸口时间
|
||||
if (appointment.getGate_canal_in_time() == null || appointment.getGate_canal_in_time().isEmpty()) {
|
||||
appointment.setGate_canal_in_time(FormatDateTime.dateTimeToStr(now));
|
||||
}
|
||||
//收车扫描,状态可以改为作业中(5)
|
||||
if (appointment.getAppointment_state() < 5) {
|
||||
appointment.setAppointment_state(5);
|
||||
}
|
||||
//收车扫描时间
|
||||
appointment.setPlate_scan_time(FormatDateTime.dateTimeToStr(now));
|
||||
|
||||
int res = appointmentMapper.update(appointment);
|
||||
//完善签到打卡(),将打卡表状态修改为,作业中状态
|
||||
if (res > 0) {
|
||||
PunchClock punchClock = punchClockMapper.getPunchClockByAppointmentId(appointment_id);
|
||||
if (punchClock != null) {
|
||||
String start_time = punchClock.getStart_time();
|
||||
String queue_number = punchClock.getQueue_number();
|
||||
String punch_address = punchClock.getPunch_address();
|
||||
Integer punch_clock_type = punchClock.getPunch_clock_type();
|
||||
if (start_time == null || start_time.isEmpty()) {
|
||||
start_time = FormatDateTime.dateTimeToStr(now);
|
||||
punchClock.setStart_time(start_time);
|
||||
}
|
||||
if (queue_number == null || queue_number.isEmpty()) {
|
||||
String last_queue_number = punchClockExtendMapper.getLastQueueNumber(now, appointment.getPort_area_id());
|
||||
//生成新的排队编号
|
||||
//排队号需求变更,格式"2308210001"
|
||||
queue_number = QueueNumberHelper.getNewQueueNumber(last_queue_number);
|
||||
punchClock.setQueue_number(queue_number);
|
||||
}
|
||||
if (punch_address == null || punch_address.isEmpty()) {
|
||||
PortArea portArea = portAreasMapper.getById(appointment.getPort_area_id());
|
||||
if (portArea != null) {
|
||||
punchClock.setPunch_address(portArea.getPort_area_address());
|
||||
}
|
||||
}
|
||||
//扫码收车,可以设置打卡状态为操作中(3)
|
||||
punchClock.setPunch_clock_type(3);
|
||||
punchClock.setUpdate_time(FormatDateTime.dateTimeToStr(now));
|
||||
int x = punchClockMapper.update(punchClock);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAppointmentDetailListByGoodVinList(List<String> vinlist) {
|
||||
return appointmentDetailMapper.getAppointmentDetailListByGoodVinList(vinlist);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 Vin列表查询匹配的商品车明细,并筛选出不属于已取消和异常的预约的
|
||||
*
|
||||
* @param vinlist vinlist
|
||||
* @return vinlist
|
||||
*/
|
||||
@Override
|
||||
public List<AppointmentDetail> getAppointmentDetailListByVinList(List<String> vinlist, String appointmentId) {
|
||||
//获取与vinList匹配的商品车明细
|
||||
List<AppointmentDetail> detailList = appointmentDetailMapper.getAppointmentDetailListByVinList(vinlist);
|
||||
//获得所有有效预约id集合
|
||||
List<String> mylist = appointmentMapper.getIdListNoInEnNew();
|
||||
List<AppointmentDetail> resdetailList = null;
|
||||
if (detailList != null && detailList.size() > 0) {
|
||||
//排除掉当前预约自身的明细
|
||||
if (appointmentId != null && !appointmentId.isEmpty()) {
|
||||
detailList = Linq.of(detailList).where(p -> !appointmentId.equals(p.getAppointment_id())).toList();
|
||||
}
|
||||
if (mylist != null && mylist.size() > 0) {
|
||||
resdetailList = Linq.of(detailList).where(p -> mylist.contains(p.getAppointment_id())).toList();
|
||||
}
|
||||
}
|
||||
return resdetailList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteAppointmentDetailByAppointmentId(String appointment_id) {
|
||||
return appointmentDetailMapper.deleteAppointmentDetailByAppointmentId(appointment_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 激活验证,返回商品企业信息
|
||||
*
|
||||
* @param vinList vin
|
||||
* @return 激活验证,返回商品企业信息
|
||||
*/
|
||||
@Override
|
||||
public List<ValidCusVin> validCusVin(List<String> vinList) {
|
||||
if (vinList == null || vinList.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
List<ValidCusVin> list = null;
|
||||
try {
|
||||
ValidRequest validRequest = new ValidRequest();
|
||||
validRequest.setVins(vinList);
|
||||
com.haitongauto.models.res.Response<List<ValidCusVin>> myResponse = cusOrderApi.getCheckVinISValid(validRequest);
|
||||
list = myResponse.getData();
|
||||
logger.info("激活验证回复:" + JSON.toJSONString(list));
|
||||
} catch (Exception e) {
|
||||
logger.info(e.getMessage());
|
||||
logger.info("激活验证回复:" + JSON.toJSONString(e.getMessage()));
|
||||
throw new RuntimeException("激活验证回复:" + e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得需要传送哪吒的智云参数
|
||||
*
|
||||
* @param validCusVinList
|
||||
* @return 返回结果
|
||||
*/
|
||||
@Override
|
||||
public List<CargoInfoNaz> cargoInfoNaz(List<ValidCusVin> validCusVinList, String truckNum) {
|
||||
List<CargoInfoNaz> list = null;
|
||||
if (validCusVinList == null || validCusVinList.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
if (truckNum == null || truckNum.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Truck truck = truckMapper.getPalletTruckByTruckNo(truckNum);
|
||||
//获得所有记录的企业编号,按企业编号分组
|
||||
List<String> companyCodeList = Linq.of(validCusVinList).select(p -> p.getCompanyCode()).distinct().toList();
|
||||
if (companyCodeList != null && companyCodeList.size() > 0) {
|
||||
list = new ArrayList<>();
|
||||
for (String companyCode : companyCodeList) {
|
||||
EnterpriseInfo enterpriseInfo = new EnterpriseInfo();
|
||||
CargoInfo cargoInfo = new CargoInfo();
|
||||
if (truck != null) {
|
||||
cargoInfo.setVehicleNo(truckNum);
|
||||
cargoInfo.setVehicleFrameWt(truck.getVehicle_frame_weight().toString());
|
||||
cargoInfo.setVehicleWt(truck.getVehicle_weight().toString());
|
||||
}
|
||||
List<Good> goodList = new ArrayList<>();
|
||||
List<ValidCusVin> validCusVinList_comp = Linq.of(validCusVinList).where(p -> p.getCompanyCode().equals(companyCode)).toList();
|
||||
if (validCusVinList_comp != null && validCusVinList_comp.size() > 0) {
|
||||
ValidCusVin validCusVin_first = Linq.of(validCusVinList_comp).firstOrDefault();
|
||||
enterpriseInfo.setNumber(validCusVin_first.getCompanyCode());
|
||||
enterpriseInfo.setCode(validCusVin_first.getCompanySocialCode());
|
||||
enterpriseInfo.setName(validCusVin_first.getCompanyName());
|
||||
enterpriseInfo.setCountry(validCusVin_first.getCountry());
|
||||
enterpriseInfo.setCity(validCusVin_first.getCity());
|
||||
for (ValidCusVin vin : validCusVinList_comp) {
|
||||
Good good = new Good();
|
||||
good.setGdsMtno(vin.getCargoItemNo());
|
||||
good.setGdecd(vin.getCargoCode());
|
||||
good.setGdsNm(vin.getCargoName());
|
||||
good.setGdsSpcfModelDesc(vin.getSpec());
|
||||
good.setDclCurrcd(vin.getCurrency());
|
||||
good.setDclTotalAmt(vin.getTotalPrice());
|
||||
good.setNetWt(vin.getNetWeight());
|
||||
good.setDclUnitcd(vin.getUnitMeasure());
|
||||
good.setUnit1(vin.getUnitLegal());//该字段后一个字母是 数字1还是字母l;
|
||||
good.setNatcd(vin.getOriginArea());
|
||||
good.setVin(vin.getVin());
|
||||
goodList.add(good);
|
||||
}
|
||||
}
|
||||
CargoInfoNaz cargoInfoNaz = new CargoInfoNaz();
|
||||
cargoInfoNaz.setCargoInfo(cargoInfo);
|
||||
cargoInfoNaz.setEnterpriseInfo(enterpriseInfo);
|
||||
cargoInfoNaz.setGoodsInfo(goodList);
|
||||
cargoInfoNaz.setPushType("oneByOne");//王正琰 写死
|
||||
list.add(cargoInfoNaz);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,287 @@
|
|||
package com.haitongauto.rtosac.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.haitongauto.mapper.base.PortAreasMapper;
|
||||
import com.haitongauto.mapper.base.TruckMapper;
|
||||
import com.haitongauto.mapper.base.UsersMapper;
|
||||
import com.haitongauto.models.forward.*;
|
||||
import com.haitongauto.models.pojo.*;
|
||||
|
||||
import com.haitongauto.rtosac.service.ForwardService;
|
||||
import com.haitongauto.utils.HttpClientHelper;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Service
|
||||
@EnableAsync
|
||||
public class ForwardServiceImpl implements ForwardService {
|
||||
private static final Logger logger = LogManager.getLogger(ForwardServiceImpl.class);
|
||||
@Autowired
|
||||
UsersMapper usersMapper;
|
||||
@Autowired
|
||||
PortAreasMapper portAreasMapper;
|
||||
|
||||
@Autowired
|
||||
TruckMapper truckMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 预约信息完成,将完成状态同步到老系统(整车物流)
|
||||
*
|
||||
* @param appointOverState 预约完成转态
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
public CompletableFuture<ForwardRes> appointmentOverApiAsync(AppointOverState appointOverState) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
return appointmentOverApi(appointOverState);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约信息完成,将完成状态同步到老系统(整车物流)
|
||||
*
|
||||
* @param appointOverState 预约完成转态
|
||||
* @return
|
||||
*/
|
||||
private ForwardRes appointmentOverApi(AppointOverState appointOverState) throws IOException, CloneNotSupportedException {
|
||||
if (appointOverState == null) {
|
||||
return null;
|
||||
}
|
||||
String myUrl = "http://192.168.161.81:8090/rtopswebapi/api/NsOrder/execTruckOrderOsFin";
|
||||
//调用哪吒接口,将预约完成转态,同步老系统
|
||||
//ForwardConfig config = ConfigHelper.getForwardConfig();
|
||||
//if (config != null) {
|
||||
// myUrl = config.getUrl() + "execTruckOrderOsFin";
|
||||
//}
|
||||
ForwardRes forwardRes = null;
|
||||
logger.info("预约完成状态,同步老系统:"+JSON.toJSONString(appointOverState));
|
||||
String res = HttpClientHelper.forwardSendNew(appointOverState, myUrl);
|
||||
|
||||
|
||||
if (res != null && res.contains("success")) {
|
||||
forwardRes = JSONObject.parseObject(res, ForwardRes.class);
|
||||
}
|
||||
logger.info("预约完成状态,同步老系统,返回:"+res);
|
||||
return forwardRes;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 预约信息异步转发到老系统
|
||||
* @param
|
||||
* @return 返回进港
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
public CompletableFuture<ForwardRes> invokeApiAsyncForward(Appointment appointment, List<AppointmentDetail> appointmentDetailList) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
return invokeForwardApi(appointment, appointmentDetailList);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/***
|
||||
* 预约信息异步转发到老系统
|
||||
* @param
|
||||
* @return 返回进港
|
||||
*/
|
||||
private ForwardRes invokeForwardApi(Appointment appointment, List<AppointmentDetail> appointmentDetailList) throws IOException, CloneNotSupportedException {
|
||||
if (appointment == null) {
|
||||
return null;
|
||||
}
|
||||
AppointForward appointForward = new AppointForward();
|
||||
//appointForward.setId(appointment.getId());//预约id
|
||||
appointForward.setTruckNo(appointment.getTruck_number());//板车号
|
||||
appointForward.setPhone(appointment.getTel_number());//手机号码
|
||||
appointForward.setGodNum(appointment.getGoods_quantity());//货物数量
|
||||
appointForward.setOrderTm(appointment.getApproach_date());//预约时间
|
||||
Users users = usersMapper.getById(appointment.getUsers_id());
|
||||
if (users != null) {
|
||||
appointForward.setOpenId(users.getWx_openid());//openid
|
||||
}
|
||||
PortArea portArea = portAreasMapper.getById(appointment.getPort_area_id());
|
||||
if (portArea != null) {
|
||||
appointForward.setWhafType(portArea.getPort_area_name());//港区
|
||||
}
|
||||
String goods_type = appointment.getGoods_type();
|
||||
//货物类型
|
||||
if (goods_type != null && !goods_type.isEmpty()) {
|
||||
switch (goods_type) {
|
||||
case "C": {
|
||||
appointForward.setGodType("商品车");
|
||||
break;
|
||||
}
|
||||
case "L": {
|
||||
appointForward.setGodType("大件");
|
||||
break;
|
||||
}
|
||||
case "M": {
|
||||
appointForward.setGodType("工程机械");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//进港类型
|
||||
String enter_type = appointment.getEnter_type();
|
||||
if (enter_type != null && !enter_type.isEmpty()) {
|
||||
switch (enter_type) {
|
||||
case "WE": {
|
||||
appointForward.setOrderType("外贸出口");
|
||||
break;
|
||||
}
|
||||
case "WI": {
|
||||
appointForward.setOrderType("外贸进口");
|
||||
break;
|
||||
}
|
||||
case "NE": {
|
||||
appointForward.setOrderType("内贸出口");
|
||||
break;
|
||||
}
|
||||
case "NI": {
|
||||
appointForward.setOrderType("内贸进口");
|
||||
break;
|
||||
}
|
||||
case "BC": {
|
||||
appointForward.setOrderType("奔驰分拨");
|
||||
break;
|
||||
}
|
||||
case "LP": {
|
||||
appointForward.setOrderType("提离港区");
|
||||
break;
|
||||
}
|
||||
case "BM": {
|
||||
appointForward.setOrderType("宝马分拨");
|
||||
break;
|
||||
}
|
||||
case "JL": {
|
||||
appointForward.setOrderType("捷豹路虎分拨");
|
||||
break;
|
||||
}
|
||||
case "AC": {
|
||||
appointForward.setOrderType("安盛场地");
|
||||
break;
|
||||
}
|
||||
case "FT": {
|
||||
appointForward.setOrderType("丰田分拨");
|
||||
break;
|
||||
}
|
||||
case "AD": {
|
||||
appointForward.setOrderType("奥迪分拨");
|
||||
break;
|
||||
}
|
||||
case "OTHER": {
|
||||
appointForward.setOrderType("其他品牌分拨");
|
||||
break;
|
||||
}
|
||||
case "MV": {
|
||||
appointForward.setOrderType("移库短驳");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<VinDetail> vinDetails = null;
|
||||
if (appointmentDetailList != null && appointmentDetailList.size() > 0) {
|
||||
vinDetails = new ArrayList<>();
|
||||
for (AppointmentDetail appointmentDetail : appointmentDetailList) {
|
||||
VinDetail vinDetail = new VinDetail();
|
||||
vinDetail.setVin(appointmentDetail.getVin());//车架号
|
||||
String shipName = appointmentDetail.getShip_name();
|
||||
if (shipName != null && !shipName.isEmpty()) {
|
||||
String myShipName = shipName.split("/")[0];
|
||||
vinDetail.setVlsNm(myShipName);//船名
|
||||
}
|
||||
String brandName = appointmentDetail.getBrand_name();
|
||||
if (brandName != null && !brandName.isEmpty()) {
|
||||
String myBrandName = brandName.split("/")[0];
|
||||
vinDetail.setBrdNm(myBrandName);//品牌
|
||||
}
|
||||
String destinationPort = appointmentDetail.getDestination_port();
|
||||
if (destinationPort != null && !destinationPort.isEmpty()) {
|
||||
String myDestinationPort = destinationPort.split("/")[0];
|
||||
vinDetail.setPotNm(myDestinationPort);//港口
|
||||
}
|
||||
vinDetails.add(vinDetail);
|
||||
}
|
||||
}
|
||||
appointForward.setDataList(vinDetails);
|
||||
|
||||
//调用哪吒接口,将预约数据转发到,老系统,待补充
|
||||
String myUrl = "http://192.168.161.81:8090/rtopswebapi/api/NsOrder/execTruckOrder";
|
||||
ForwardRes forwardRes = null;
|
||||
//ForwardConfig config= ConfigHelper.getForwardConfig();
|
||||
//if (config != null) {
|
||||
// myUrl = config.getUrl() + "execTruckOrder";
|
||||
//}
|
||||
logger.info("预约信息转发:"+JSON.toJSONString(appointForward));
|
||||
String res = HttpClientHelper.forwardSendNew(appointForward, myUrl);
|
||||
|
||||
|
||||
if (res != null && res.contains("success")) {
|
||||
forwardRes = JSONObject.parseObject(res, ForwardRes.class);
|
||||
}
|
||||
logger.info("预约信息转发回复:"+res);
|
||||
return forwardRes;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer execUserTruck(List<UserTruck> userTrucks) {
|
||||
Integer res = 0;
|
||||
if (userTrucks != null && userTrucks.size() > 0) {
|
||||
for (UserTruck item : userTrucks) {
|
||||
//用户
|
||||
Users users = new Users();
|
||||
users.setUsers_name(item.getUsers_name());
|
||||
users.setId(item.getUsers_id());
|
||||
users.setWx_openid(item.getWx_openid());
|
||||
users.setTel_number(item.getTel_number());
|
||||
users.setId_code(item.getId_code());
|
||||
String wx_openid = item.getWx_openid();
|
||||
Users myUsers = null;
|
||||
if (wx_openid != null && !wx_openid.isEmpty()) {
|
||||
myUsers = usersMapper.getByWxOpenid(wx_openid);
|
||||
}
|
||||
|
||||
if (myUsers != null) {
|
||||
users.setId(myUsers.getId());
|
||||
usersMapper.update(users);
|
||||
res = res + 1;
|
||||
|
||||
} else {
|
||||
usersMapper.insert(users);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Users users = new Users();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,540 @@
|
|||
package com.haitongauto.rtosac.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bestvike.linq.Linq;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.haitongauto.interfaces.OrderApi;
|
||||
import com.haitongauto.interfaces.UserInterface;
|
||||
import com.haitongauto.mapper.base.*;
|
||||
import com.haitongauto.models.ido.CommonRes;
|
||||
import com.haitongauto.models.ido.login.UserLoginOrRegisterRequest;
|
||||
import com.haitongauto.models.ido.login.PostLoginRes;
|
||||
import com.haitongauto.models.ido.login.UserLoginOrRegisterResponse;
|
||||
import com.haitongauto.models.pojo.*;
|
||||
import com.haitongauto.models.pojo.Announcement;
|
||||
import com.haitongauto.models.sysuser.OldSysTruck;
|
||||
import com.haitongauto.models.sysuser.OldSysUser;
|
||||
import com.haitongauto.rtosac.service.HomeService;
|
||||
import com.haitongauto.models.dto.DataForMessage;
|
||||
import com.haitongauto.utils.FormatDateTime;
|
||||
import com.haitongauto.utils.HttpRequest;
|
||||
import com.haitongauto.mapper.client.OtherExtendMapper;
|
||||
import com.haitongauto.utils.HttpTemplate;
|
||||
import com.haitongauto.utils.StringHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class HomeServiceImpl implements HomeService {
|
||||
|
||||
@Autowired
|
||||
AnnouncementMapper announcementsMapper;
|
||||
@Autowired
|
||||
UsersMapper usersMapper;
|
||||
@Autowired
|
||||
TruckMapper truckMapper;
|
||||
@Autowired
|
||||
ServiceConfigMapper serviceConfigMapper;
|
||||
@Autowired
|
||||
RequesterMapper requesterMapper;
|
||||
@Autowired
|
||||
OtherExtendMapper otherExtendMapper;
|
||||
@Autowired
|
||||
LoginLogMapper loginLogMapper;
|
||||
@Autowired
|
||||
UserInterface userInterface;
|
||||
private String users_id;
|
||||
@Resource
|
||||
OrderApi orderApi;
|
||||
|
||||
@Override
|
||||
public void userInfoSync1(OldSysUser applet_users, OldSysTruck applet_truck) {
|
||||
Users users = new Users();
|
||||
users.setId(applet_users.getId());
|
||||
users.setUsers_name(applet_users.getUsers_name());
|
||||
users.setTel_number(applet_users.getTel_number());
|
||||
users.setWx_openid(applet_users.getWx_openid());
|
||||
users.setUsers_state(1);
|
||||
users.setIs_del(0);
|
||||
Users myUsers = usersMapper.getByWxOpenid(users.getWx_openid());
|
||||
if (myUsers == null) {
|
||||
usersMapper.insert(users);
|
||||
} else {
|
||||
users.setId(myUsers.getId());
|
||||
usersMapper.update(users);
|
||||
}
|
||||
|
||||
Truck truck = new Truck();
|
||||
truck.setId(applet_truck.getId());
|
||||
truck.setUsers_id(applet_truck.getUsers_id());
|
||||
truck.setTruck_number(applet_truck.getTruck_number());
|
||||
truck.setTel_number(applet_truck.getTel_number());
|
||||
truck.setWx_openid(applet_truck.getWx_openid());
|
||||
truck.setTruck_state(1);
|
||||
truck.setIs_del(0);
|
||||
Truck myTruck = truckMapper.getTruckByOpenId(applet_truck.getWx_openid());
|
||||
if (myTruck == null) {
|
||||
truckMapper.insert(truck);
|
||||
} else {
|
||||
truck.setId(myTruck.getId());
|
||||
truckMapper.update(truck);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Users userInfoSync(String wx_openid, String tel_number) {
|
||||
Users users = new Users();
|
||||
Users myUsers = usersMapper.getByWxOpenid(wx_openid);
|
||||
if (myUsers != null) {
|
||||
users.setId(myUsers.getId());
|
||||
users.setWx_openid(wx_openid);
|
||||
users.setTel_number(tel_number);
|
||||
users.setUsers_state(0);
|
||||
users.setIs_del(0);
|
||||
|
||||
myUsers.setWx_openid(wx_openid);
|
||||
myUsers.setTel_number(tel_number);
|
||||
|
||||
usersMapper.update(users);
|
||||
|
||||
Truck truck = new Truck();
|
||||
Truck myTruck = truckMapper.getTruckByOpenId(wx_openid);
|
||||
if (myTruck != null) {
|
||||
truck.setId(myTruck.getId());
|
||||
truck.setWx_openid(wx_openid);
|
||||
truck.setTel_number(tel_number);
|
||||
truck.setTruck_state(1);
|
||||
truck.setIs_del(0);
|
||||
truckMapper.update(truck);
|
||||
}
|
||||
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return myUsers;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询用户
|
||||
*
|
||||
* @param id 用户id
|
||||
* @return 返回用户
|
||||
*/
|
||||
@Override
|
||||
public Users getUsersForId(String id) {
|
||||
return (Users) usersMapper.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户的小程序 openid 获取用户在数据库里的数据
|
||||
*
|
||||
* @param wx_openid 微信openid
|
||||
* @return 返回用户信息
|
||||
*/
|
||||
@Override
|
||||
public Users getUsersForOpenId(String wx_openid) {
|
||||
return otherExtendMapper.getUsersForOpenId(wx_openid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
*
|
||||
* @param users 用户
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
@Override
|
||||
public PostLoginRes postLogin(Users users) {
|
||||
//初始变量
|
||||
String users_id = users.getId();
|
||||
String truck_id = "";
|
||||
String access_token_rtos = "";
|
||||
PostLoginRes postLoginRes = new PostLoginRes();
|
||||
//将用户信息提交给哪吒 哪吒入参
|
||||
String appId = "";
|
||||
appId = getServiceConfigForCode("400");
|
||||
String mobile = users.getTel_number();
|
||||
String openId = users.getWx_openid();
|
||||
String unionId = users.getWx_unionid();
|
||||
|
||||
//请求哪吒注册登录
|
||||
if (true) {
|
||||
UserLoginOrRegisterRequest request = new UserLoginOrRegisterRequest();
|
||||
request.setAppId(appId);
|
||||
request.setMobile(mobile);
|
||||
request.setOpenId(openId);
|
||||
request.setUnionId(unionId);
|
||||
request.setMediaType("小程序");
|
||||
//用户信息提交外部接口(哪吒) 返回参数缺少userId,需要补充
|
||||
//本地测试注释,正式环境需要解开
|
||||
CommonRes<UserLoginOrRegisterResponse> myResponse = orderApi.login(request);
|
||||
if (myResponse != null) {
|
||||
UserLoginOrRegisterResponse response = myResponse.getData();
|
||||
if (response != null) {
|
||||
access_token_rtos = response.getAccess_token();
|
||||
System.out.print("Rtos登录注册接口Token:" + access_token_rtos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String date = FormatDateTime.dateTimeToStr(new Date());
|
||||
//添加用户司机信息
|
||||
if (!Objects.equals(users.getWx_openid(), "")) {
|
||||
Users myusers = this.getUsersForOpenId(openId);
|
||||
if (myusers != null) {
|
||||
users.setId(myusers.getId());
|
||||
users.setIs_del(0);
|
||||
users.setAccess_token(myusers.getAccess_token());
|
||||
}
|
||||
String users_name = users.getUsers_name();
|
||||
users.setWx_nick(users_name);
|
||||
users.setCreate_time(date);
|
||||
users.setUpdate_time(date);
|
||||
users.setUsers_state(0);
|
||||
users.setAccess_token_rtos(access_token_rtos);
|
||||
users.setIs_del(0);
|
||||
|
||||
if (users.getId() == null || users.getId().isEmpty()) {
|
||||
users.setId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
||||
//更新到数据库,返回当前id
|
||||
users_id = usersMapper.insert(users);
|
||||
} else {
|
||||
Integer x = usersMapper.update(users);
|
||||
}
|
||||
}
|
||||
postLoginRes.setUsers_id(users_id);
|
||||
postLoginRes.setTruck_id(truck_id);
|
||||
postLoginRes.setAccess_token_rtos(access_token_rtos);
|
||||
|
||||
return postLoginRes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
*
|
||||
* @param truck 板车
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
@Override
|
||||
public String insertTruck(Truck truck) {
|
||||
String id = truck.getId();
|
||||
if (id == null || id.isEmpty()) {
|
||||
id = UUID.randomUUID().toString().replace("-", "").toLowerCase();
|
||||
truck.setId(id);
|
||||
id = truckMapper.insert(truck);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
*
|
||||
* @param truck 板车
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
@Override
|
||||
public Integer updateTruck(Truck truck) {
|
||||
Integer x = truckMapper.update(truck);
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入登录日志
|
||||
*
|
||||
* @param wx_openid wx_openid
|
||||
* @param ip ip地址
|
||||
*/
|
||||
@Override
|
||||
public void loginLogAdd(String wx_openid, String ip) {
|
||||
//获取IP所在的城市,异步调用外部接口
|
||||
String url = "http://ip.360.cn/IPQuery/ipquery?ip=" + ip;
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int i = 0;
|
||||
String res = HttpTemplate.doGet(url);
|
||||
while (res.isEmpty()) {
|
||||
res = HttpTemplate.doGet(url);
|
||||
i++;
|
||||
if (i > 20 && res.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Map maps = (Map) JSON.parse(res);
|
||||
String area = maps.get("data").toString().split("\t")[0];
|
||||
//控制台打印
|
||||
System.out.println(maps.get("data").toString().split("\t")[0]);
|
||||
//数据封装到LoginLog
|
||||
String date = FormatDateTime.dateTimeToStr(new Date());
|
||||
LoginLog loginLog = new LoginLog();
|
||||
loginLog.setWx_openid(wx_openid);
|
||||
loginLog.setIp(ip);
|
||||
loginLog.setArea(area);
|
||||
loginLog.setLogin_time(date);
|
||||
loginLog.setCreate_time(date);
|
||||
loginLog.setUpdate_time(date);
|
||||
loginLog.setIs_del(0);
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
|
||||
loginLog.setId(uuid);
|
||||
//写入数据库
|
||||
loginLogMapper.insert(loginLog);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页读取每页10条公告数据
|
||||
*
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 数据条数
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<Announcement> getAnnouncementsList(Integer pageNum, Integer pageSize, Integer sort, String keyWords) {
|
||||
//初始化PageHelper
|
||||
PageHelper.startPage(pageNum, pageSize, true, false, false);
|
||||
//立即查询
|
||||
List<Announcement> mylist = announcementsMapper.getListBySort(sort, keyWords);
|
||||
if (mylist != null && mylist.size() > 0) {
|
||||
for (Announcement item : mylist) {
|
||||
String announcement = item.getAnnouncement();
|
||||
String announcement_text = "";
|
||||
if (announcement != null && !announcement.isEmpty()) {
|
||||
announcement_text = StringHelper.getTxtByHtml(announcement);
|
||||
}
|
||||
item.setAnnouncement_text(announcement_text);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//获取分页数据
|
||||
|
||||
assert mylist != null;
|
||||
return new PageInfo<Announcement>(mylist);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据公告id获得公告
|
||||
*
|
||||
* @param announcement_id 公告id
|
||||
* @return 返回公告信息
|
||||
*/
|
||||
@Override
|
||||
public Announcement getAnnouncementById(String announcement_id) {
|
||||
Announcement announcement = null;
|
||||
announcement = announcementsMapper.getById(announcement_id);
|
||||
String announcementStr = null;
|
||||
if (announcement != null) {
|
||||
announcementStr = announcement.getAnnouncement();
|
||||
}
|
||||
String announcement_text = "";
|
||||
if (announcementStr != null && !announcementStr.isEmpty()) {
|
||||
announcement_text = StringHelper.getTxtByHtml(announcementStr);
|
||||
announcement.setAnnouncement_text(announcement_text);
|
||||
}
|
||||
return announcement;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取系统服务路径
|
||||
*
|
||||
* @return 返回系统服务路径
|
||||
*/
|
||||
@Override
|
||||
public String getServiceBaseUrl() {
|
||||
List<ServiceConfig> mylist = serviceConfigMapper.getList();
|
||||
String servicePath = "";
|
||||
if (mylist != null && mylist.size() > 0) {
|
||||
servicePath = mylist.stream().filter(a -> a.getConfig_code().equals("100")).findFirst().get().getConfig_content();
|
||||
}
|
||||
|
||||
return servicePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取图片访问路径
|
||||
*
|
||||
* @return 返回图片路径
|
||||
*/
|
||||
@Override
|
||||
public String getImgAccessUrl() {
|
||||
List<ServiceConfig> mylist = serviceConfigMapper.getList();
|
||||
String imgServicePath = "";
|
||||
if (mylist != null && mylist.size() > 0) {
|
||||
ServiceConfig serviceConfig = Linq.of(mylist).firstOrDefault(p -> p.getConfig_code().equals("300"));
|
||||
if (serviceConfig != null) {
|
||||
imgServicePath = serviceConfig.getConfig_content();
|
||||
}
|
||||
}
|
||||
return imgServicePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据配置编号获取配置值
|
||||
*
|
||||
* @param config_code 配置编号
|
||||
* @return 返回配置值
|
||||
*/
|
||||
@Override
|
||||
public String getServiceConfigForCode(String config_code) {
|
||||
return otherExtendMapper.getServiceConfigForCode(config_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取外部接口数据
|
||||
*
|
||||
* @param request_type : 请求类型参数,取值于Requester表
|
||||
* @param myParamMap :实时传值,其键值对与 Requester表param字段的键值对对应
|
||||
* @return 返回外部接口数据
|
||||
*/
|
||||
@Override
|
||||
public String getExternalInterfaceData(Integer request_type, Map<String, Object> myParamMap) {
|
||||
//根据请求类型获取一条请求配置数据
|
||||
Requester requester = otherExtendMapper.getRequesterForType(request_type);
|
||||
//解析请求配置
|
||||
String url = requester.getUrl();
|
||||
StringBuilder param = new StringBuilder();
|
||||
Map<String, Object> paramMap = JSONObject.parseObject(requester.getParam_map());
|
||||
if (requester.getParam_map() != null && !requester.getParam_map().isEmpty()) {
|
||||
for (Map.Entry<String, Object> item : paramMap.entrySet()) {
|
||||
String key = item.getKey();
|
||||
Object value;
|
||||
//遍历配置参数
|
||||
if (item.getValue().equals("")) {
|
||||
value = myParamMap.get(key); //当key的value为空字符串时,key参数取值myParamMap传值中的key对应的值
|
||||
} else {
|
||||
value = item.getValue(); //当key与value不相等时,key参数取值value
|
||||
}
|
||||
param.append((param.toString().equals("")) ? key + "=" + value : "&" + key + "=" + value);
|
||||
}
|
||||
}
|
||||
|
||||
//发送请求
|
||||
String dataJson = "";
|
||||
try {
|
||||
dataJson = HttpRequest.sendGet(url, param.toString());
|
||||
} catch (Exception e) {
|
||||
System.out.println("请求异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return dataJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送订阅消息
|
||||
*
|
||||
* @param dataForMessage:订阅消息发送数据类的实例
|
||||
* @return 发送失败的错误信息
|
||||
*/
|
||||
@Override
|
||||
public String sendMessage(DataForMessage dataForMessage) {
|
||||
/*
|
||||
//解析订阅消息发送数据类的实例
|
||||
String access_token = dataForMessage.getAccess_token(); //接口调用凭证,该参数为 URL 参数,非 Body 参数。使用access_token或者authorizer_access_token
|
||||
String template_id = dataForMessage.getTemplate_id(); //所需下发的订阅模板id
|
||||
String page = dataForMessage.getPage(); //点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转
|
||||
String touser = dataForMessage.getTouser(); //接收者(用户)的 openid
|
||||
String data = dataForMessage.getData(); //模板内容,格式形如 { "key1": { "value": any }, "key2": { "value": any } }的object
|
||||
String miniprogram_state = dataForMessage.getMiniprogram_state(); //跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版
|
||||
*/
|
||||
//请求参数
|
||||
String access_token = dataForMessage.getAccess_token();
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + access_token;
|
||||
String param = JSON.toJSONString(dataForMessage);
|
||||
|
||||
//发送请求(参考微信官方:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/mp-message-management/subscribe-message/sendMessage.html)
|
||||
String dataJson = "";
|
||||
try {
|
||||
dataJson = HttpRequest.sendPost(url, param);
|
||||
} catch (Exception e) {
|
||||
System.out.println("请求异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return dataJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回文件后缀
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 返回文件后缀
|
||||
*/
|
||||
@Override
|
||||
public String getImagePath(MultipartFile file) {
|
||||
String fileName = (file != null) ? file.getOriginalFilename() : "";//获取原文件名
|
||||
int index;
|
||||
if ((!Objects.equals(fileName, ""))) {
|
||||
assert fileName != null;
|
||||
index = fileName.indexOf(".");
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
return fileName.substring(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存图片
|
||||
*
|
||||
* @param mfile 文件
|
||||
* @param file 文件
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
@Override
|
||||
public boolean saveImage(MultipartFile mfile, File file) {
|
||||
//查看文件是否存在,不存在则创建
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
try {
|
||||
//使用此方法保存必须要绝对路径且文件夹必须已存在,否则报错
|
||||
mfile.transferTo(file);
|
||||
return true;
|
||||
} catch (IllegalStateException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新文件名
|
||||
*
|
||||
* @param suffix suffix
|
||||
* @return 返回文件名
|
||||
*/
|
||||
@Override
|
||||
public String getNewFileName(String suffix) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||
String date = sdf.format(new Date());
|
||||
return date + UUID.randomUUID() + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回图片保存地址
|
||||
*
|
||||
* @param name 文件名
|
||||
* @return 返回图片保存地址
|
||||
*/
|
||||
@Override
|
||||
public String getNewImagePath(String name) {
|
||||
List<ServiceConfig> mylist = serviceConfigMapper.getList();
|
||||
String imgPath = "";
|
||||
if (mylist != null && mylist.size() > 0) {
|
||||
imgPath = mylist.stream().filter(a -> a.getConfig_code().equals("200")).findFirst().get().getConfig_content();
|
||||
}
|
||||
return imgPath + "/" + name;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
package com.haitongauto.rtosac.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.haitongauto.mapper.base.*;
|
||||
import com.haitongauto.models.pojo.*;
|
||||
import com.haitongauto.rtosac.service.MessageService;
|
||||
import com.haitongauto.rtosac.service.UsersService;
|
||||
import com.haitongauto.utils.FormatDateTime;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
public class MessageServiceImpl implements MessageService {
|
||||
@Autowired
|
||||
MessageMapper messageMapper;
|
||||
@Autowired
|
||||
UsersMapper usersMapper;
|
||||
@Autowired
|
||||
PortAreasMapper portAreasMapper;
|
||||
@Autowired
|
||||
TruckMapper truckMapper;
|
||||
@Autowired
|
||||
AppointmentMapper appointmentMapper;
|
||||
@Autowired
|
||||
PunchClockMapper punchClockMapper;
|
||||
|
||||
@Override
|
||||
public String insert(Message message) {
|
||||
return messageMapper.insert(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(Message message) {
|
||||
return messageMapper.update(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message 消息实体
|
||||
* @return 返回结果
|
||||
*/
|
||||
@Override
|
||||
public boolean receiveMessage(Message message) {
|
||||
boolean b = false;
|
||||
if (message == null) {
|
||||
return b;
|
||||
}
|
||||
Message myMessage = null;
|
||||
Integer type = message.getType();
|
||||
String biz_id = message.getBiz_id();
|
||||
myMessage = messageMapper.getLastMessageByTypeAndBizId(type, biz_id);
|
||||
if (myMessage == null) {
|
||||
message.setId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
||||
String id = messageMapper.insert(message);
|
||||
if (id != null && !id.isEmpty()) {
|
||||
b = true;
|
||||
}
|
||||
} else {
|
||||
message.setId(myMessage.getId());
|
||||
int id = messageMapper.update(message);
|
||||
if (id > 0) {
|
||||
b = true;
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得车辆最新消息
|
||||
*
|
||||
* @param type 收车/发车
|
||||
* @param biz_id biz_id
|
||||
* @return 返回消息
|
||||
*/
|
||||
@Override
|
||||
public Message getLastMessageByTypeAndBizId(Integer type, String biz_id) {
|
||||
return messageMapper.getLastMessageByTypeAndBizId(type, biz_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得未读消息 包含 车牌号和身份证号(自开)
|
||||
*
|
||||
* @param wxOpenid 微信openid
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 数据条数
|
||||
* @return 返回结果
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<Message> getUnReadMessageListByWxOpenid(String wxOpenid, Integer pageNum, Integer pageSize) {
|
||||
List<Message> messageList = null;
|
||||
Truck truck = truckMapper.getTruckByOpenId(wxOpenid);
|
||||
Users users = usersMapper.getByWxOpenid(wxOpenid);
|
||||
List<String> truckNums = new ArrayList<>();
|
||||
String truck_number = null;
|
||||
String id_code = null;
|
||||
if (truck != null) {
|
||||
truck_number = truck.getTruck_number();
|
||||
if (truck_number != null && !truck_number.isEmpty()) {
|
||||
truckNums.add(truck_number);
|
||||
}
|
||||
}
|
||||
if (users != null) {
|
||||
id_code = users.getId_code();
|
||||
if (id_code != null && !id_code.isEmpty()) {
|
||||
truckNums.add(id_code);
|
||||
}
|
||||
}
|
||||
if (truckNums != null && truckNums.size() > 0) {
|
||||
PageHelper.startPage(pageNum, pageSize, true, false, false);
|
||||
messageList = messageMapper.getUnReadMessageListByTruckNumber(truckNums);
|
||||
}
|
||||
if (messageList == null) {
|
||||
messageList = new ArrayList<>();
|
||||
}
|
||||
return new PageInfo<>(messageList);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得站内消息 包含 车牌号和身份证号(自开)
|
||||
* @param wxOpenid 微信openid
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 数据条数
|
||||
* @return 返回结果
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<Message> getMessageListByWxOpenid(String wxOpenid, Integer pageNum, Integer pageSize) {
|
||||
List<Message> messageList = null;
|
||||
Truck truck = truckMapper.getTruckByOpenId(wxOpenid);
|
||||
Users users = usersMapper.getByWxOpenid(wxOpenid);
|
||||
List<String> truckNums = new ArrayList<>();
|
||||
String truck_number = null;
|
||||
String id_code = null;
|
||||
if (truck != null) {
|
||||
truck_number = truck.getTruck_number();
|
||||
if (truck_number != null && !truck_number.isEmpty()) {
|
||||
truckNums.add(truck_number);
|
||||
}
|
||||
}
|
||||
if (users != null) {
|
||||
id_code = users.getId_code();
|
||||
if (id_code != null && !id_code.isEmpty()) {
|
||||
truckNums.add(id_code);
|
||||
}
|
||||
}
|
||||
if (truckNums != null && truckNums.size() > 0) {
|
||||
PageHelper.startPage(pageNum, pageSize, true, false, false);
|
||||
messageList = messageMapper.getMessageListByTruckNumber(truckNums);
|
||||
}
|
||||
if (messageList == null) {
|
||||
messageList = new ArrayList<>();
|
||||
}
|
||||
return new PageInfo<>(messageList);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序前端打开界面,获得所有未读消息数量 包含车牌号和身份证号(自开)
|
||||
*
|
||||
* @param wxOpenid 微信openId
|
||||
* @return 返回结果
|
||||
*/
|
||||
@Override
|
||||
public Integer sumUnread(String wxOpenid) {
|
||||
Truck truck = truckMapper.getTruckByOpenId(wxOpenid);
|
||||
Users users = usersMapper.getByWxOpenid(wxOpenid);
|
||||
List<String> truckNums = new ArrayList<>();
|
||||
String truck_number = null;
|
||||
String id_code = null;
|
||||
if (truck != null) {
|
||||
truck_number = truck.getTruck_number();
|
||||
if (truck_number != null && !truck_number.isEmpty()) {
|
||||
truckNums.add(truck_number);
|
||||
}
|
||||
}
|
||||
if (users != null) {
|
||||
id_code = users.getId_code();
|
||||
if (id_code != null && !id_code.isEmpty()) {
|
||||
truckNums.add(id_code);
|
||||
}
|
||||
}
|
||||
Integer result = 0;
|
||||
if (truckNums != null && truckNums.size() > 0) {
|
||||
result = messageMapper.sumUnread(truckNums);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过打印小票环节完成完工打卡
|
||||
*
|
||||
* @param appointmentId 预约id
|
||||
*/
|
||||
@Override
|
||||
public Appointment punchClockOverByPrint(String appointmentId) {
|
||||
if (appointmentId == null || appointmentId.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
//获取当前日期时间
|
||||
Date datetime = new Date();
|
||||
Integer res = 0;
|
||||
//更新预约状态
|
||||
Appointment appointment = appointmentMapper.getById(appointmentId);
|
||||
if (appointment != null) {
|
||||
//appointment.setAppointment_state(6);
|
||||
//完成打印小票就直接设置成(离港状态)郑璐、张小雅
|
||||
appointment.setAppointment_state(7);
|
||||
appointment.setCheck_over_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
appointment.setGate_canal_out_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
appointment.setUpdate_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
res = appointmentMapper.update(appointment);
|
||||
}
|
||||
//更新打卡状态为完成状态
|
||||
PunchClock punchClock = punchClockMapper.getPunchClockByAppointmentId(appointmentId);
|
||||
if (punchClock != null) {
|
||||
punchClock.setOver_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
String portAreaId = punchClock.getPort_area_id();
|
||||
PortArea portArea = null;
|
||||
if (portAreaId != null && !portAreaId.isEmpty()) {
|
||||
portArea = portAreasMapper.getById(punchClock.getPort_area_id());
|
||||
}
|
||||
if (portArea != null) {
|
||||
punchClock.setOver_address(portArea.getPort_area_address());
|
||||
}
|
||||
punchClock.setPunch_clock_type(4);
|
||||
punchClock.setUpdate_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
punchClockMapper.update(punchClock);
|
||||
}
|
||||
return appointment;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,354 @@
|
|||
package com.haitongauto.rtosac.service.impl;
|
||||
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.haitongauto.interfaces.UsersApi;
|
||||
import com.haitongauto.mapper.base.*;
|
||||
import com.haitongauto.models.ido.CommonRes;
|
||||
import com.haitongauto.models.ido.login.UserInfoRes;
|
||||
import com.haitongauto.models.pojo.*;
|
||||
import com.haitongauto.rtosac.service.MineService;
|
||||
import com.haitongauto.mapper.client.OtherExtendMapper;
|
||||
import com.haitongauto.mapper.client.TruckExtendMapper;
|
||||
import com.haitongauto.mapper.client.AppointmentExtendMapper;
|
||||
import com.haitongauto.utils.FormatDateTime;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class MineServiceImpl implements MineService {
|
||||
@Autowired
|
||||
UsersMapper usersMapper;
|
||||
@Autowired
|
||||
TruckMapper truckMapper;
|
||||
@Autowired
|
||||
FeedbackMapper feedbackMapper;
|
||||
@Autowired
|
||||
AppointmentMapper appointmentMapper;
|
||||
@Autowired
|
||||
NoviceIntroductionMapper noviceIntroductionMapper;
|
||||
@Autowired
|
||||
AppointmentDetailMapper appointmentDetailMapper;
|
||||
@Autowired
|
||||
OtherExtendMapper otherExtendMapper;
|
||||
@Autowired
|
||||
TruckExtendMapper truckExtendMapper;
|
||||
@Autowired
|
||||
AppointmentExtendMapper appointmentExtendMapper;
|
||||
@Resource
|
||||
private UsersApi usersApi;
|
||||
|
||||
/**
|
||||
* 个人资料修改
|
||||
*
|
||||
* @param users 用户(司机)
|
||||
* @return 返回修改结果
|
||||
*/
|
||||
@Override
|
||||
public Integer postMyUsers(Users users) {
|
||||
String users_id = users.getId();
|
||||
Integer x = (users_id != null && users_id.length() > 0) ? usersMapper.update(users) : null;
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的板车信息
|
||||
*
|
||||
* @param truckId 板车id
|
||||
* @return 返回我的板车信息
|
||||
*/
|
||||
@Override
|
||||
public Truck getTruck(String truckId) {
|
||||
return truckMapper.getById(truckId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的板车信息
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @return 返回我的板车信息
|
||||
*/
|
||||
@Override
|
||||
public List<Truck> getMyPalletTruck(String users_id) {
|
||||
//访问哪吒接口,先获取并更新我的车辆可能被列入黑名单的信息
|
||||
List<TruckManagement> myTruckManagementList = truckExtendMapper.getMyTruckManagement(users_id);
|
||||
if (myTruckManagementList != null && myTruckManagementList.size() > 0) {
|
||||
for (TruckManagement item : myTruckManagementList) {
|
||||
String truck_number = item.getTruck_number();
|
||||
Truck myPalletTruck = truckExtendMapper.getPalletTruckForNumber(truck_number);
|
||||
if (myPalletTruck.getTruck_state() != 4) {
|
||||
myPalletTruck.setTruck_state(4);
|
||||
truckMapper.update(myPalletTruck);
|
||||
}
|
||||
}
|
||||
}
|
||||
//再获取我的车辆信息(含最新更新的被列入黑名单信息)
|
||||
return truckExtendMapper.getPalletTruckForUsers(users_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改或添加我的板车信息
|
||||
*
|
||||
* @param palletTruck 板车数据实体
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
@Override
|
||||
public Integer postMyPalletTruck(Truck palletTruck) {
|
||||
if (palletTruck == null) {
|
||||
return 0;
|
||||
}
|
||||
//判断板车id是否存在
|
||||
String id = palletTruck.getId();
|
||||
//检查是否设置为默认车辆
|
||||
// Integer truck_state = palletTruck.getTruck_state();
|
||||
//如果truck_state=1
|
||||
// if (Objects.equals(truck_state, 1)) {
|
||||
// String users_id = palletTruck.getUsers_id();
|
||||
// //重置其他所有车辆的状态为0,除非被列为黑名单(truck_state=4)
|
||||
// if (users_id != null && !users_id.isEmpty()) {
|
||||
// int x = truckExtendMapper.setTruckSateToGeneral(users_id);
|
||||
// }
|
||||
// }
|
||||
//将数据更新信息定义为返回值
|
||||
Integer x = 0;
|
||||
if (id != null && id.length() > 0) {
|
||||
//修改
|
||||
//palletTruck.setCreate_time(myPalletTruck.getCreate_time());
|
||||
palletTruck.setUpdate_time(FormatDateTime.dateToStr(new Date()));
|
||||
palletTruck.setIs_del(0);
|
||||
//允许null值覆盖
|
||||
x = truckMapper.updateEX(palletTruck);
|
||||
|
||||
} else {
|
||||
String user_id = palletTruck.getUsers_id();
|
||||
Truck myPalletTruck = (Truck) truckMapper.getTruckByUsersId(user_id);
|
||||
if (myPalletTruck != null) {
|
||||
palletTruck.setId(myPalletTruck.getId());
|
||||
palletTruck.setCreate_time(FormatDateTime.dateToStr(new Date()));
|
||||
palletTruck.setUpdate_time(FormatDateTime.dateToStr(new Date()));
|
||||
palletTruck.setTruck_state(1);
|
||||
palletTruck.setIs_del(0);
|
||||
x = truckMapper.updateEX(palletTruck);
|
||||
} else {
|
||||
//添加
|
||||
palletTruck.setId(UUID.randomUUID().toString().replace("-", "").toLowerCase(Locale.ROOT));
|
||||
palletTruck.setCreate_time(FormatDateTime.dateToStr(new Date()));
|
||||
palletTruck.setUpdate_time(FormatDateTime.dateToStr(new Date()));
|
||||
palletTruck.setTruck_state(1);
|
||||
palletTruck.setIs_del(0);
|
||||
truckMapper.insert(palletTruck);
|
||||
x = 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除我的板车信息
|
||||
*
|
||||
* @param palletTruck_id 板车id
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
@Override
|
||||
public Integer delMyPalletTruck(String palletTruck_id) {
|
||||
//return truckMapper.logicDel(palletTruck_id);
|
||||
//王琛建议硬删除
|
||||
return truckMapper.delete(palletTruck_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户所有板车信息
|
||||
*
|
||||
* @param users_id 板车id
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
@Override
|
||||
public Integer deleteTruckByUsersId(String users_id) {
|
||||
//return truckMapper.logicDel(users_id);
|
||||
//王琛建议硬删除
|
||||
return truckMapper.deleteTruckByUsersId(users_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的车辆黑名单信息 truck_management
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @return 返回我的车辆黑名单信息
|
||||
*/
|
||||
@Override
|
||||
public List<TruckManagement> getMyTruckManagement(String users_id) {
|
||||
return truckExtendMapper.getMyTruckManagement(users_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交反馈意见
|
||||
*
|
||||
* @param feedback 反馈意见数据实体
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
@Override
|
||||
public Integer postFeedback(Feedback feedback) {
|
||||
//数据补全
|
||||
Date date = new Date();
|
||||
feedback.setId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
||||
feedback.setCreate_time(FormatDateTime.dateToStr(date));
|
||||
feedback.setUpdate_time(FormatDateTime.dateToStr(date));
|
||||
feedback.setIs_del(0);
|
||||
//写入到数据库
|
||||
String id = feedbackMapper.insert(feedback);
|
||||
return (id != null && id.length() > 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的预约信息列表
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @return 返回我的预约信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<Appointment> getMyAppointmentList(String users_id) {
|
||||
return appointmentExtendMapper.getMyAppointmentList(users_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据预约ids
|
||||
*
|
||||
* @param ids 预约ids
|
||||
* @return 返回预约列表
|
||||
*/
|
||||
@Override
|
||||
public List<Appointment> getAppointmentByIds(List<String> ids) {
|
||||
return appointmentMapper.getAppointmentByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的预约信息模糊查询分页列表
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @param keywords 查询关键字
|
||||
* @param approach_date 进场日期
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 数据条数
|
||||
* @return 返回我的预约信息模糊查询分页列表
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<Appointment> getMyAppointmentListForPage(String users_id, String keywords, String approach_date, Integer pageNum, Integer pageSize) {
|
||||
|
||||
//初始化PageHelper
|
||||
pageNum = (pageNum != null) ? pageNum : 1; //当前页码
|
||||
pageSize = (pageSize != null) ? pageSize : 10; //每页记录条数
|
||||
List<Appointment> mylist = new ArrayList<>();
|
||||
//根据预约日期查询
|
||||
if (approach_date != null && approach_date.length() == 10) {
|
||||
LocalDate myApproach_date = LocalDate.parse(approach_date);
|
||||
//初始化PageHelper
|
||||
PageHelper.startPage(pageNum, pageSize, true, false, false);
|
||||
mylist = appointmentExtendMapper.getMyAppointmentListForDate(users_id, myApproach_date);
|
||||
}
|
||||
//根据关键字查询
|
||||
if (keywords != null && keywords.length() > 0) {
|
||||
// keywords 船名或航次的关键字
|
||||
//获取关键字匹配的 appointment_id 值的列表
|
||||
List<String> id_list = appointmentExtendMapper.getAppointmentDetailListForKeyWords(keywords);
|
||||
//去重
|
||||
Set<String> my_id_list = new HashSet<>(id_list);
|
||||
id_list = new ArrayList<>(my_id_list);
|
||||
|
||||
//初始化PageHelper
|
||||
PageHelper.startPage(pageNum, pageSize, true, false, false);
|
||||
//根据idList查询我的预约记录
|
||||
mylist = appointmentExtendMapper.getMyAppointmentListForIdList(users_id, id_list);
|
||||
}
|
||||
//无条件参数时,查询全部
|
||||
if ((keywords == null || keywords.length() == 0) && (approach_date == null || approach_date.length() == 0)) {
|
||||
//初始化PageHelper
|
||||
PageHelper.startPage(pageNum, pageSize, true, false, false);
|
||||
mylist = appointmentExtendMapper.getMyAppointmentList(users_id);
|
||||
}
|
||||
//获取分页数据
|
||||
return new PageInfo<Appointment>(mylist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<Appointment> getMyAppointmentListForPageNew(String users_id, String keywords, String approach_date, Integer pageNum, Integer pageSize) {
|
||||
//初始化PageHelper
|
||||
pageNum = (pageNum != null) ? pageNum : 1; //当前页码
|
||||
pageSize = (pageSize != null) ? pageSize : 10;
|
||||
List<Appointment> mylist = new ArrayList<>();
|
||||
PageHelper.startPage(pageNum, pageSize, true, false, false);
|
||||
mylist = appointmentExtendMapper.getAppointmentListForCondition(users_id, keywords, approach_date);
|
||||
return new PageInfo<Appointment>(mylist);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的预约信息按日期查询分页列表
|
||||
*
|
||||
* @param users_id 司机id
|
||||
* @param approach_date 预约进场日期
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 数据条数
|
||||
* @return 返回我的预约信息按日期查询分页列表
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<Appointment> getMyAppointmentListByDateForPage(String users_id, String approach_date, Integer pageNum, Integer pageSize) {
|
||||
//初始化PageHelper
|
||||
pageNum = (pageNum != null) ? pageNum : 1; //当前页码
|
||||
pageSize = (pageSize != null) ? pageSize : 10; //每页记录条数
|
||||
List<Appointment> mylist = new ArrayList<>();
|
||||
//根据预约日期查询
|
||||
if (approach_date != null && approach_date.length() == 10) {
|
||||
LocalDate myApproach_date = LocalDate.parse(approach_date);
|
||||
//初始化PageHelper
|
||||
PageHelper.startPage(pageNum, pageSize, true, false, false);
|
||||
mylist = appointmentExtendMapper.getMyAppointmentListForDate(users_id, myApproach_date);
|
||||
}
|
||||
//无条件参数时,查询全部
|
||||
if ((approach_date == null || approach_date.length() == 0)) {
|
||||
//初始化PageHelper
|
||||
PageHelper.startPage(pageNum, pageSize, true, false, false);
|
||||
mylist = appointmentExtendMapper.getMyAppointmentList(users_id);
|
||||
}
|
||||
//获取分页数据
|
||||
return new PageInfo<Appointment>(mylist);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新手攻略
|
||||
*
|
||||
* @return 返回新手攻略
|
||||
*/
|
||||
@Override
|
||||
public List<NoviceIntroduction> getNoviceIntroduction() {
|
||||
return noviceIntroductionMapper.getList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的当前预约
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @return 返回获取我的当前预约
|
||||
*/
|
||||
@Override
|
||||
public Appointment getMyAppointment(String users_id) {
|
||||
return appointmentExtendMapper.getMyAppointment(users_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据Id获取用户信息
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @return 返回用户信息
|
||||
*/
|
||||
@Override
|
||||
public Users getUsersById(String users_id) {
|
||||
return usersMapper.getById(users_id);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.haitongauto.rtosac.service.impl;
|
||||
import com.haitongauto.mapper.base.RequesterMapper;
|
||||
import com.haitongauto.models.pojo.EntryInstruct;
|
||||
import com.haitongauto.models.pojo.Requester;
|
||||
import com.haitongauto.rtosac.service.NewsService;
|
||||
import com.haitongauto.mapper.client.OtherExtendMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class NewsServiceImpl implements NewsService {
|
||||
@Autowired
|
||||
OtherExtendMapper otherExtendMapper;
|
||||
|
||||
@Autowired
|
||||
RequesterMapper requesterMapper;
|
||||
|
||||
/**
|
||||
* 获取发送给指定用户的(最近10条)指令信息
|
||||
* @param users_id 用户id
|
||||
* @return 返回定用户的(最近10条)指令信息
|
||||
*/
|
||||
@Override
|
||||
public List<EntryInstruct> getEntryInstructionsForUsers(@Param("users_id") String users_id){
|
||||
return otherExtendMapper.getEntryInstructionsForUsers(users_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Requester getRequesterForType(Integer requestType) {
|
||||
return requesterMapper.getRequesterForType(requestType);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,294 @@
|
|||
package com.haitongauto.rtosac.service.impl;
|
||||
|
||||
import com.bestvike.linq.Linq;
|
||||
import com.haitongauto.interfaces.PortAreaInterface;
|
||||
import com.haitongauto.mapper.base.AppointmentMapper;
|
||||
import com.haitongauto.mapper.base.PunchClockMapper;
|
||||
import com.haitongauto.mapper.base.PortAreasMapper;
|
||||
import com.haitongauto.models.pojo.Appointment;
|
||||
import com.haitongauto.models.pojo.PortArea;
|
||||
import com.haitongauto.models.pojo.PunchClock;
|
||||
import com.haitongauto.rtosac.service.PunchClockService;
|
||||
import com.haitongauto.mapper.client.AppointmentExtendMapper;
|
||||
import com.haitongauto.mapper.client.PunchClockExtendMapper;
|
||||
import com.haitongauto.utils.DateTimeHelper;
|
||||
import com.haitongauto.utils.FormatDateTime;
|
||||
import com.haitongauto.utils.QueueNumberHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PunchClockServiceImpl implements PunchClockService {
|
||||
@Autowired
|
||||
PortAreaInterface portAreaInterface;
|
||||
@Autowired
|
||||
AppointmentMapper appointmentMapper;
|
||||
@Autowired
|
||||
PunchClockMapper punchClockMapper;
|
||||
@Autowired
|
||||
PortAreasMapper portAreasMapper;
|
||||
@Autowired
|
||||
AppointmentExtendMapper appointmentExtendMapper;
|
||||
@Autowired
|
||||
PunchClockExtendMapper punchClockExtendMapper;
|
||||
|
||||
/**
|
||||
* 检查是否有预约(查询是否存在有预约待签到)的预约数据
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @return 返回预约信息
|
||||
*/
|
||||
@Override
|
||||
public Appointment getIincompleteAppointment(String users_id) {
|
||||
return appointmentExtendMapper.getActiveAppointment(users_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到打卡提交
|
||||
*
|
||||
* @param users_id 用户id
|
||||
* @param appointment_id 预约id
|
||||
* @param port_area_id 港区id
|
||||
* @param punch_poi 坐标
|
||||
* @return 返回提交结果
|
||||
*/
|
||||
@Override
|
||||
public PunchClock postPunchClockStart(String users_id, String appointment_id, String port_area_id, String punch_poi, String punch_address) {
|
||||
//获取当前日期时间
|
||||
Date datetime = new Date();
|
||||
//更新预约状态
|
||||
Appointment appointment = appointmentMapper.getById(appointment_id);
|
||||
if (appointment == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (appointment.getAppointment_state().equals(2)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//普通预约签到
|
||||
if (appointment.getAppointment_type() != null) {
|
||||
if (appointment.getAppointment_type().equals(1)) {
|
||||
appointment.setAppointment_state(2);
|
||||
appointment.setCheck_in_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
appointment.setUpdate_time(FormatDateTime.dateToStr(datetime));
|
||||
}
|
||||
//特保区预约签到
|
||||
if (appointment.getAppointment_type().equals(2)) {
|
||||
appointment.setAppointment_state(2);
|
||||
appointment.setCheck_in_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
appointment.setUpdate_time(FormatDateTime.dateToStr(datetime));
|
||||
}
|
||||
} else {
|
||||
appointment.setAppointment_state(2);
|
||||
appointment.setCheck_in_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
appointment.setUpdate_time(FormatDateTime.dateToStr(datetime));
|
||||
}
|
||||
|
||||
Integer x = appointmentMapper.update(appointment);
|
||||
PunchClock myPunchClock = null;
|
||||
myPunchClock = punchClockMapper.getPunchClockByAppointmentId(appointment.getId());
|
||||
if (x > 0) {
|
||||
//更改打卡记录
|
||||
if (myPunchClock != null) {
|
||||
//获取当前日期
|
||||
Date date = new Date();
|
||||
//获取当前日期最后一个排队编号
|
||||
String last_queue_number = punchClockExtendMapper.getLastQueueNumber(date, appointment.getPort_area_id());
|
||||
//生成新的排队编号
|
||||
//排队号需求变更,格式"2308210001"
|
||||
String queue_number = QueueNumberHelper.getNewQueueNumber(last_queue_number);
|
||||
//添加打卡信息
|
||||
myPunchClock.setUsers_id(users_id); //'用户id'
|
||||
myPunchClock.setAppointment_id(appointment_id); //'预约Id'
|
||||
myPunchClock.setQueue_number(queue_number); //排队编号(1000-9999)
|
||||
myPunchClock.setStart_time(FormatDateTime.dateTimeToStr(datetime)); //'签到打卡日期时间'
|
||||
myPunchClock.setPort_area_id(port_area_id); //'打卡港区'
|
||||
myPunchClock.setPunch_address(punch_address);
|
||||
myPunchClock.setPunch_clock_type(1); //'打卡类别(0-预约未签到,1-签到,2-已进港,3-操作中,4-已完成,5-已离港)'
|
||||
myPunchClock.setPunch_clock_poi(punch_poi); //'打卡位置(位置坐标)'
|
||||
myPunchClock.setUpdate_time(FormatDateTime.dateTimeToStr(datetime)); //'更新时间'
|
||||
myPunchClock.setIs_del(0); //'是否软删除'
|
||||
//更新到数据库
|
||||
Integer res = punchClockMapper.update(myPunchClock);
|
||||
}
|
||||
}
|
||||
return myPunchClock;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成打卡提交
|
||||
*
|
||||
* @param appointment_id 预约id
|
||||
* @param punch_clock_id 打卡id
|
||||
* @param over_address 打卡地址
|
||||
* @return 返回完成打卡提交执行结果
|
||||
*/
|
||||
@Override
|
||||
public PunchClock postPunchClockOver(String appointment_id, String punch_clock_id, String over_address) {
|
||||
//获取当前日期时间
|
||||
Date datetime = new Date();
|
||||
//更新预约状态
|
||||
Appointment appointment = appointmentMapper.getById(appointment_id);
|
||||
if (appointment != null) {
|
||||
appointment.setAppointment_state(6);
|
||||
appointment.setCheck_over_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
appointment.setGate_canal_out_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
appointment.setUpdate_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
Integer x = appointmentMapper.update(appointment);
|
||||
}
|
||||
//更新打卡状态为完成状态
|
||||
//PunchClock punchClock = punchClockMapper.getById(punch_clock_id);
|
||||
PunchClock punchClock = punchClockMapper.getPunchClockByAppointmentId(appointment_id);
|
||||
if (punchClock != null) {
|
||||
punchClock.setOver_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
punchClock.setOver_address(over_address);
|
||||
punchClock.setPunch_clock_type(4);
|
||||
punchClock.setUpdate_time(FormatDateTime.dateTimeToStr(datetime));
|
||||
punchClockMapper.update(punchClock);
|
||||
}
|
||||
return punchClock;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据预约Id获取获取打卡记录
|
||||
*
|
||||
* @param appointment_id 预约id
|
||||
* @return 返回打卡记录
|
||||
*/
|
||||
@Override
|
||||
public PunchClock getPunchClockForAppintementId(String appointment_id) {
|
||||
return punchClockExtendMapper.getPunchClockForAppintementId(appointment_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定司机某一天(指定日期)的打卡记录
|
||||
*
|
||||
* @param date 指定日期
|
||||
* @param users_id 用户id
|
||||
* @return 返回打卡记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<PunchClock> getPunchClockForDate(String date, String users_id) {
|
||||
return punchClockExtendMapper.getPunchClockForDate(date, users_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定司机某年某月的打卡记录
|
||||
*
|
||||
* @param year 年
|
||||
* @param month 月
|
||||
* @param users_id 用户id
|
||||
* @return 返回打卡记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<PunchClock> getPunchClockForYM(Integer year, Integer month, String users_id) {
|
||||
//获取该用户的所有打卡记录
|
||||
if (users_id == null || users_id.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<PunchClock> mylist = punchClockExtendMapper.getPunchClockForYM(users_id, year, month);
|
||||
return mylist;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<PunchClock> getPunchClockForYM(Integer year, Integer month, String users_id) {
|
||||
// //获取该用户的所有打卡记录
|
||||
// List<PunchClock> mylist = punchClockExtendMapper.getPunchClockForYM(users_id);
|
||||
// if (users_id == null || users_id.isEmpty()) {
|
||||
// return null;
|
||||
// }
|
||||
// //String time="2023-05-06 10:11:12";
|
||||
// //LocalDateTime date= DateTimeHelper.DateTimeStrToLocalDateTime(time.replace(" ","T"));
|
||||
// //int year1=date.getYear();
|
||||
// //int month1th=date.getMonthValue();
|
||||
//
|
||||
// //年份、月份过滤
|
||||
// //mylist = mylist.stream().filter(a -> LocalDateTime.parse(a.getStart_time()).getYear() == year && LocalDateTime.parse(a.getStart_time()).getMonthValue() == month).collect(Collectors.toList());
|
||||
// if (year != null && year != 0 && month != null && month != 0) {
|
||||
// //mylist = Linq.of(mylist).where(p -> p.getStart_time().contains(year.toString())).toList();
|
||||
// mylist = Linq.of(mylist).where(p -> p.getStart_time() != null && DateTimeHelper.DateTimeStrToLocalDateTime(p.getStart_time()).getYear() == year).toList();
|
||||
// mylist = Linq.of(mylist).where(p -> p.getStart_time() != null && DateTimeHelper.DateTimeStrToLocalDateTime(p.getStart_time()).getMonthValue() == month).toList();
|
||||
// }
|
||||
// return mylist;
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 获取港区
|
||||
*
|
||||
* @param port_area_id 港区id
|
||||
* @return 返回港区信息
|
||||
*/
|
||||
@Override
|
||||
public PortArea getPortAreaForId(String port_area_id) {
|
||||
return portAreasMapper.getById(port_area_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取港区中心点坐标
|
||||
*
|
||||
* @param port_area_id 港区id
|
||||
* @return 返回港区中心点坐标
|
||||
*/
|
||||
@Override
|
||||
public String getPortAreaPoi(String port_area_id) {
|
||||
PortArea portAreas = (PortArea) portAreasMapper.getById(port_area_id);
|
||||
//从哪吒接口拿,哪吒接口缺少字段 港区中心点坐标Area_center_poi
|
||||
if (portAreas == null) {
|
||||
//哪吒接口
|
||||
List<PortArea> portAreaList = portAreaInterface.getPortArea();
|
||||
if (portAreaList != null) {
|
||||
portAreas = Linq.of(portAreaList).firstOrDefault(p -> p.getId().equals(port_area_id));
|
||||
}
|
||||
}
|
||||
String area_center_poi = "";
|
||||
if (portAreas != null) {
|
||||
area_center_poi = portAreas.getArea_center_poi();
|
||||
}
|
||||
return area_center_poi;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签到打卡排队序号
|
||||
*
|
||||
* @param appointment_id 预约id
|
||||
* @return 返回签到打卡排队序号
|
||||
*/
|
||||
@Override
|
||||
public String getQueueNumber(String appointment_id) {
|
||||
//根据预约id和签到日期即可获得签到排队顺序号
|
||||
return punchClockExtendMapper.getQueueNumberForIdDate(appointment_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前排队前面还剩多少车辆未进港
|
||||
*
|
||||
* @param approach_date 进场日期
|
||||
* @param port_area_id 港区id
|
||||
* @param queue_number 排队号
|
||||
* @return 返回查询结果
|
||||
*/
|
||||
@Override
|
||||
public Integer getNumberBefore(String approach_date, String port_area_id, String queue_number) {
|
||||
return punchClockExtendMapper.getNumberBeforeMe(approach_date, port_area_id, queue_number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updatePunchClock(PunchClock punchClock) {
|
||||
return punchClockMapper.update(punchClock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLastQueueNumber(Date data, String port_area_id) {
|
||||
return punchClockExtendMapper.getLastQueueNumber(data, port_area_id);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package com.haitongauto.rtosac.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.haitongauto.rtosac.service.Response;
|
||||
import com.haitongauto.models.dto.Responser;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ResponseImpl implements Response {
|
||||
|
||||
/**
|
||||
* 封装为返回Json对象
|
||||
*
|
||||
* @param bl:请求是否成功
|
||||
* @param data:返回数据
|
||||
* @return 返回Json对象
|
||||
*/
|
||||
@Override
|
||||
public String getResponseData(Boolean bl, Object data) {
|
||||
//创建返回数据
|
||||
Integer code = (bl) ? 200 : 404;
|
||||
String message = (bl) ? "request success" : "request fail";
|
||||
//添加到返回对象
|
||||
Responser responser = new Responser();
|
||||
responser.setCode(code);
|
||||
responser.setMessage(message);
|
||||
responser.setData(data);
|
||||
//解析为Json字符串
|
||||
//返回
|
||||
return JSON.toJSONString(responser);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 封装为返回Json对象
|
||||
*
|
||||
* @param bl:请求是否成功
|
||||
* @param data:返回数据
|
||||
* @return 返回Json对象
|
||||
*/
|
||||
@Override
|
||||
public String getResponseData(Boolean bl, Object data, String msg) {
|
||||
//创建返回数据
|
||||
Integer code = (bl) ? 200 : 404;
|
||||
String message;
|
||||
if (msg != null && !msg.isEmpty()) {
|
||||
message = msg;
|
||||
} else {
|
||||
message = (bl) ? "request success" : "request fail";
|
||||
}
|
||||
//添加到返回对象
|
||||
Responser responser = new Responser();
|
||||
responser.setCode(code);
|
||||
responser.setMessage(message);
|
||||
responser.setData(data);
|
||||
//解析为Json字符串
|
||||
//返回
|
||||
return JSON.toJSONString(responser);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 封装为返回Json对象(带null)
|
||||
* @param bl:请求是否成功
|
||||
* @param data:返回数据
|
||||
* @return 返回Json对象
|
||||
*/
|
||||
@Override
|
||||
public String getResponseDataJavaJson(Boolean bl,Object data){
|
||||
//创建返回数据
|
||||
Integer code = (bl) ? 200 : 404;
|
||||
String message = (bl) ? "request success" : "request fail";
|
||||
//添加到返回对象
|
||||
Responser responser = new Responser();
|
||||
responser.setCode(code);
|
||||
responser.setMessage(message);
|
||||
responser.setData(data);
|
||||
//解析为Json字符串
|
||||
// 将对象转换为 JSON 字符串
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
//String json = objectMapper.writeValueAsString(data);
|
||||
String json = null;
|
||||
try {
|
||||
json = objectMapper.writeValueAsString(responser);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//返回
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRtosResponseData(Boolean bl, Object data, String errorCode) {
|
||||
//创建返回数据
|
||||
Integer code = (bl) ? 200 : 404;
|
||||
String message="";
|
||||
if (errorCode != null && !errorCode.isEmpty()) {
|
||||
code = Integer.parseInt(errorCode);
|
||||
}
|
||||
if (code.equals(401)){
|
||||
message="用户权限过期,请重新登录";
|
||||
}
|
||||
else {
|
||||
message = (bl) ? "request success" : "request fail";
|
||||
}
|
||||
//添加到返回对象
|
||||
Responser responser = new Responser();
|
||||
responser.setCode(code);
|
||||
responser.setMessage(message);
|
||||
responser.setData(data);
|
||||
//解析为Json字符串
|
||||
//返回
|
||||
return JSON.toJSONString(responser);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.haitongauto.rtosac.service.impl;
|
||||
import com.haitongauto.mapper.base.TruckMapper;
|
||||
import com.haitongauto.mapper.base.UsersMapper;
|
||||
import com.haitongauto.models.pojo.Truck;
|
||||
import com.haitongauto.models.pojo.Users;
|
||||
import com.haitongauto.rtosac.service.UsersService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class UsersServiceImpl implements UsersService {
|
||||
@Autowired
|
||||
UsersMapper usersMapper;
|
||||
@Autowired
|
||||
TruckMapper truckMapper;
|
||||
|
||||
@Override
|
||||
public String insert(Users users) {
|
||||
return usersMapper.insert(users);
|
||||
}
|
||||
@Override
|
||||
public Integer update(Users users) {
|
||||
return usersMapper.update(users);
|
||||
}
|
||||
@Override
|
||||
public Truck getTruckByWxOpenID(String wx_openid) {
|
||||
return truckMapper.getTruckByOpenId(wx_openid);
|
||||
}
|
||||
@Override
|
||||
public Truck getTruckByUserId(String userId) {
|
||||
return truckMapper.getTruckByUsersId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Users getUsersByUserId(String userId) {
|
||||
return usersMapper.getById(userId);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.haitongauto.rtosac.service.impl;
|
||||
import com.haitongauto.models.ido.departure.DepartureDetailIdo_DTO;
|
||||
import com.haitongauto.models.ido.departure.DepartureVehicleIdo_DTO;
|
||||
import com.haitongauto.models.ido.receiving.ReceivingDetailIdo_DTO;
|
||||
import com.haitongauto.models.ido.receiving.ReceivingVehicleIdo_DTO;
|
||||
import com.haitongauto.rtosac.service.VehicleService;
|
||||
import com.haitongauto.interfaces.ReceivingVehicleInterface;
|
||||
import com.haitongauto.interfaces.DepartureVehicleInterface;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class VehicleServiceImpl implements VehicleService {
|
||||
@Autowired
|
||||
ReceivingVehicleInterface receivingVehicleInterface;
|
||||
@Autowired
|
||||
DepartureVehicleInterface departureVehicleInterface;
|
||||
|
||||
/**
|
||||
* 获取收车凭证的分页数据
|
||||
*
|
||||
* @param current 当前页码
|
||||
* @param size 数据条数(非必填)
|
||||
* @return 返回收车凭证的分页数据
|
||||
*/
|
||||
@Override
|
||||
public ReceivingVehicleIdo_DTO getVehicleReceivingList(String printTicketTime, String query, Integer current, Integer size) {
|
||||
//通过外部接口获取收车分页数据
|
||||
return receivingVehicleInterface.getReceivingVehicleList(printTicketTime, query, current, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定id的待核对收车凭证信息
|
||||
*
|
||||
* @param id 收车凭证id
|
||||
* @return 返回收车凭证信息
|
||||
*/
|
||||
@Override
|
||||
public ReceivingDetailIdo_DTO getVehicleReceivingInfo(String id) {
|
||||
return receivingVehicleInterface.getReceivingDetailForId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成收车核对
|
||||
*
|
||||
* @param id 收车凭证id
|
||||
* @return 返回核对结果
|
||||
*/
|
||||
@Override
|
||||
public boolean vehicleReceivingOver(String id) {
|
||||
//状态更新到数据库
|
||||
return receivingVehicleInterface.checkReceivingVehicle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取提车凭证的分页数据
|
||||
*
|
||||
* @param current 当前页码
|
||||
* @param size 数据条数(非必填)
|
||||
* @return 返回提车凭证的分页数据
|
||||
*/
|
||||
@Override
|
||||
public DepartureVehicleIdo_DTO getVehicleDepartureInfoList(String printTicketTime, String query, Integer current, Integer size) {
|
||||
return departureVehicleInterface.getDepartureVehicleList(printTicketTime, query, current, size);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取指定id的提车明细
|
||||
*
|
||||
* @param id 指定明细id
|
||||
* @return 返回提车明细
|
||||
*/
|
||||
@Override
|
||||
public DepartureDetailIdo_DTO getVehicleDepartureInfo(String id) {
|
||||
//提醒:此处不应该使用提车信息类,而应该使用提车明细类
|
||||
return departureVehicleInterface.getDepartureDetailForId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成提车核对
|
||||
*
|
||||
* @param id 记录id
|
||||
* @return 返回核对执行结果
|
||||
*/
|
||||
@Override
|
||||
public boolean VehicleDepartureOver(String id) {
|
||||
//获取发车数据
|
||||
return departureVehicleInterface.checkDepartureVehicle(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
|
||||
# 微信小程序服务配置
|
||||
# postgresql数据源配置
|
||||
#spring:
|
||||
# redis:
|
||||
# database: 0
|
||||
# host: 192.168.61.130
|
||||
# port: 6379
|
||||
# connect-timeout: 1
|
||||
# password: Nuzar123456_
|
||||
# security:
|
||||
# oauth2:
|
||||
# resourceserver:
|
||||
# opaquetoken:
|
||||
# client-secret: bossnine
|
||||
# client-id: trusted-bbw-tally
|
||||
# introspection-uri: ${auth-server}/saas/token/info
|
||||
# profiles:
|
||||
# active: pre
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/rtos_wx_applet?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: wsnet_906 #Fineidc@2023 #wsnet_906
|
||||
|
||||
# # 丰网服务器环境:IP:61.184.202.72; port:5432; db:rtos_applet_v2; user: postgres password: Fineidc@2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://61.184.202.72:5432/rtos_applet_v2?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: Fineidc@2023 #Fineidc@2023 #wsnet_906
|
||||
|
||||
# 海通测试环境:IP:192.168.61.114; port:5432; db:rtos_wh; user: rtops_wh password: wh#2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://192.168.61.114:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: rtops_wh
|
||||
# password: wh#2023
|
||||
|
||||
|
||||
# 开发库本地(公司):IP:192.168.0.16; port:5432; db:rtops_wh; user: rtos_wh password: wh#2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://192.168.0.16:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: rtops_wh
|
||||
# password: wh#2023
|
||||
|
||||
# 开发库本地:IP:localhost; port:5432; db:rtos_wh; user: postgres password: wsnet906
|
||||
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: wsnet906
|
||||
|
||||
# # 华为云测试环境:IP:116.205.142.169; port:5432; db:rtos_wh; user: rtops_wh password: wh#2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://116.205.142.169:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: rtops_wh
|
||||
# password: wh#2023
|
||||
|
||||
# mybatis配置
|
||||
#mybatis:
|
||||
# mapper-locations: classpath:mappers/*/*.xml
|
||||
#
|
||||
## pagehelper 分页插件
|
||||
#pagehelper:
|
||||
# helperDialect: postgresql
|
||||
# reasonable: true
|
||||
# supportMethodsArguments: true
|
||||
# rowBoundsWithCount: true
|
||||
# params: count=countSql
|
||||
#
|
||||
#logging:
|
||||
# level:
|
||||
# root: info
|
||||
# com:
|
||||
# nuzar: DEBUG
|
||||
#nuzar:
|
||||
# cloud:
|
||||
# jasypt:
|
||||
# password: RTOS_HTGJ
|
||||
# security:
|
||||
# #mode: none
|
||||
# mode: classic
|
||||
# saas:
|
||||
# enabled: true
|
||||
# #enabled: false
|
||||
#
|
||||
#
|
||||
#mybatis-plus:
|
||||
# type-enums-package: com.nuzar.rtos.common.enumeration
|
||||
#
|
||||
#
|
||||
## auth-server: http://127.0.0.1:20880 # 认证服务器地址
|
||||
#auth-server: https://rtops4.haitongauto.com/auth
|
||||
##auth-server: http://10.166.1.27:32500/auth/ # 认证服务器地址
|
|
@ -0,0 +1,22 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// _ooOoo_ //
|
||||
// o8888888o //
|
||||
// 88" . "88 //
|
||||
// (| ^_^ |) //
|
||||
// O\ = /O //
|
||||
// ____/`---'\____ //
|
||||
// .' \\| |// `. //
|
||||
// / \\||| : |||// \ //
|
||||
// / _||||| -:- |||||- \ //
|
||||
// | | \\\ - /// | | //
|
||||
// | \_| ''\---/'' | | //
|
||||
// \ .-\__ `-` ___/-. / //
|
||||
// ___`. .' /--.--\ `. . ___ //
|
||||
// ."" '< `.___\_<|>_/___.' >'"". //
|
||||
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
||||
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
||||
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
||||
// `=---=' //
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
||||
// 佛祖保佑 永不宕机 永无BUG //
|
||||
////////////////////////////////////////////////////////////////////
|
|
@ -0,0 +1,19 @@
|
|||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- encoders are assigned the type
|
||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="chapters.configuration" level="INFO"/>
|
||||
|
||||
<!-- Strictly speaking, the level attribute is not necessary since -->
|
||||
<!-- the level of the root level is set to DEBUG by default. -->
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
|
@ -0,0 +1,61 @@
|
|||
# 微信小程序服务配置
|
||||
server:
|
||||
port: 8891
|
||||
|
||||
# postgresql数据源配置
|
||||
spring:
|
||||
# profiles:
|
||||
# active: pre
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/rtos_wx_applet?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: wsnet_906 #Fineidc@2023 #wsnet_906
|
||||
|
||||
# # 丰网服务器环境:IP:61.184.202.72; port:5432; db:rtos_applet_v2; user: postgres password: Fineidc@2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://61.184.202.72:5432/rtos_applet_v2?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: Fineidc@2023 #Fineidc@2023 #wsnet_906
|
||||
|
||||
# 海通测试环境:IP:192.168.61.114; port:5432; db:rtos_wh; user: rtops_wh password: wh#2023
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://192.168.61.114:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
username: rtops_wh
|
||||
password: wh#2023
|
||||
|
||||
|
||||
# 开发库本地(公司):IP:192.168.0.16; port:5432; db:rtops_wh; user: rtos_wh password: wh#2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://192.168.0.16:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: rtops_wh
|
||||
# password: wh#2023
|
||||
|
||||
# 开发库本地:IP:localhost; port:5432; db:rtos_wh; user: postgres password: wsnet906
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: wsnet906
|
||||
|
||||
# # 华为云测试环境:IP:116.205.142.169; port:5432; db:rtos_wh; user: rtops_wh password: wh#2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://116.205.142.169:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: rtops_wh
|
||||
# password: wh#2023
|
||||
|
||||
# mybatis配置
|
||||
mybatis:
|
||||
mapper-locations: classpath:mappers/*/*.xml
|
||||
|
||||
# pagehelper 分页插件
|
||||
pagehelper:
|
||||
helperDialect: postgresql
|
||||
reasonable: true
|
||||
supportMethodsArguments: true
|
||||
rowBoundsWithCount: true
|
||||
# params: count=countSql
|
|
@ -0,0 +1,8 @@
|
|||
# 微信小程序服务配置
|
||||
server:
|
||||
port: 8891
|
||||
|
||||
# postgresql数据源配置
|
||||
spring:
|
||||
profiles:
|
||||
active: pre
|
|
@ -0,0 +1,25 @@
|
|||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 192.168.61.130:8848
|
||||
discovery:
|
||||
enabled: true
|
||||
server-addr: 192.168.61.130:8848
|
||||
namespace: 4f38d093-5ff8-46f0-974f-08453b0980f4
|
||||
file-extension: yaml
|
||||
config:
|
||||
enabled: true
|
||||
server-addr: 192.168.61.130:8848
|
||||
namespace: 4f38d093-5ff8-46f0-974f-08453b0980f4
|
||||
file-extension: yaml
|
||||
group: DEFAULT_GROUP
|
||||
prefix: ${spring.application.name}
|
||||
shared-configs:
|
||||
- data-id: rtops-pre.yaml
|
||||
username: nacos
|
||||
password: Nuzar123456_#QWE
|
||||
#nuzar:
|
||||
# cloud:
|
||||
# security:
|
||||
# permit-all: /swagger-resources/**,/webjars/**,/swagger-ui.html/*,/swagger-ui.html,/v2/**,/appointment/execTruckOrderNsFin
|
||||
# - data-id: rtops-st.yaml
|
|
@ -0,0 +1,27 @@
|
|||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: nacos1:8848,nacos2:8848,nacos3:8848
|
||||
discovery:
|
||||
enabled: true
|
||||
server-addr: nacos1:8848,nacos2:8848,nacos3:8848
|
||||
namespace: 80f92d8d-5c3e-41bd-a0c0-cb5c63652340
|
||||
file-extension: yaml
|
||||
config:
|
||||
enabled: true
|
||||
server-addr: nacos1:8848,nacos2:8848,nacos3:8848
|
||||
namespace: 80f92d8d-5c3e-41bd-a0c0-cb5c63652340
|
||||
file-extension: yaml
|
||||
group: DEFAULT_GROUP
|
||||
prefix: ${spring.application.name}
|
||||
shared-configs:
|
||||
- data-id: rtops-prod.yaml
|
||||
username: nacos
|
||||
password: Nuzar123456_@HTGJ1
|
||||
#nuzar:
|
||||
# cloud:
|
||||
# security:
|
||||
# permit-all: /swagger-resources/**,/webjars/**,/swagger-ui.html/*,/swagger-ui.html,/v2/**,/appointment/execTruckOrderNsFin
|
||||
|
||||
|
||||
# - data-id: rtops-st.yaml
|
|
@ -0,0 +1,70 @@
|
|||
# 微信小程序服务配置
|
||||
server:
|
||||
port: 8891
|
||||
shutdown: graceful
|
||||
|
||||
|
||||
# postgresql数据源配置
|
||||
spring:
|
||||
application:
|
||||
name: rtos-mini
|
||||
profiles:
|
||||
active: pre
|
||||
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/rtos_wx_applet?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: wsnet_906 #Fineidc@2023 #wsnet_906
|
||||
|
||||
# # 丰网服务器环境:IP:61.184.202.72; port:5432; db:rtos_applet_v2; user: postgres password: Fineidc@2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://61.184.202.72:5432/rtos_applet_v2?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: Fineidc@2023 #Fineidc@2023 #wsnet_906
|
||||
|
||||
# 海通测试环境:IP:192.168.61.114; port:5432; db:rtos_wh; user: rtops_wh password: wh#2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://192.168.61.114:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: rtops_wh
|
||||
# password: wh#2023
|
||||
|
||||
|
||||
# 开发库本地(公司):IP:192.168.0.16; port:5432; db:rtops_wh; user: rtos_wh password: wh#2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://192.168.0.16:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: rtops_wh
|
||||
# password: wh#2023
|
||||
|
||||
# # 开发库本地:IP:localhost; port:5432; db:rtos_wh; user: postgres password: wsnet906
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: wsnet906
|
||||
|
||||
# 华为云测试环境:IP:116.205.142.169; port:5432; db:rtos_wh; user: rtops_wh password: wh#2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://116.205.142.169:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: rtops_wh
|
||||
# password: wh#2023
|
||||
|
||||
# mybatis配置
|
||||
#mybatis:
|
||||
#mapper-locations: classpath:mappers/*/*.xml
|
||||
|
||||
#
|
||||
## pagehelper 分页插件
|
||||
#pagehelper:
|
||||
#helperDialect: postgresql
|
||||
#reasonable: true
|
||||
#supportMethodsArguments: true
|
||||
#rowBoundsWithCount: true
|
||||
|
||||
|
||||
#params: count=countSql
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"url": "http://192.168.161.81:8090/rtopswebapi/api/NsOrder/",
|
||||
"isOpen": true
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="WARN">
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="debug">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
Binary file not shown.
After Width: | Height: | Size: 574 KiB |
Binary file not shown.
After Width: | Height: | Size: 574 KiB |
|
@ -0,0 +1 @@
|
|||
ok?
|
|
@ -0,0 +1,66 @@
|
|||
# 微信小程序服务配置
|
||||
server:
|
||||
port: 8891
|
||||
|
||||
|
||||
# postgresql数据源配置
|
||||
spring:
|
||||
# profiles:
|
||||
# active: pre
|
||||
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/rtos_wx_applet?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: wsnet_906 #Fineidc@2023 #wsnet_906
|
||||
|
||||
# # 丰网服务器环境:IP:61.184.202.72; port:5432; db:rtos_applet_v2; user: postgres password: Fineidc@2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://61.184.202.72:5432/rtos_applet_v2?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: Fineidc@2023 #Fineidc@2023 #wsnet_906
|
||||
|
||||
# 海通测试环境:IP:192.168.61.114; port:5432; db:rtos_wh; user: rtops_wh password: wh#2023
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://192.168.61.114:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
username: rtops_wh
|
||||
password: wh#2023
|
||||
|
||||
|
||||
# 开发库本地(公司):IP:192.168.0.16; port:5432; db:rtops_wh; user: rtos_wh password: wh#2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://192.168.0.16:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: rtops_wh
|
||||
# password: wh#2023
|
||||
|
||||
# # 开发库本地:IP:localhost; port:5432; db:rtos_wh; user: postgres password: wsnet906
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: postgres
|
||||
# password: wsnet906
|
||||
|
||||
# 华为云测试环境:IP:116.205.142.169; port:5432; db:rtos_wh; user: rtops_wh password: wh#2023
|
||||
# datasource:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://116.205.142.169:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
# username: rtops_wh
|
||||
# password: wh#2023
|
||||
|
||||
# mybatis配置
|
||||
mybatis:
|
||||
mapper-locations: classpath:mappers/*/*.xml
|
||||
|
||||
# pagehelper 分页插件
|
||||
pagehelper:
|
||||
helperDialect: postgresql
|
||||
reasonable: true
|
||||
supportMethodsArguments: true
|
||||
rowBoundsWithCount: true
|
||||
|
||||
|
||||
#params: count=countSql
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
server:
|
||||
port: 8891
|
||||
spring:
|
||||
profiles:
|
||||
active: pre
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://192.168.61.114:5432/rtos_wh?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
|
||||
username: rtops_wh
|
||||
password: wh#2023
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="SonarLintModuleSettings">
|
||||
<option name="uniqueId" value="2e30baa5-f470-4c32-bb44-f814fd1f9d59" />
|
||||
</component>
|
||||
</module>
|
Loading…
Reference in New Issue