init
commit
bc6c938b8c
|
@ -0,0 +1,11 @@
|
|||
/.idea/
|
||||
/logs/
|
||||
/wsnet-cargo-sharing-core/target/
|
||||
/wsnet-cargo-sharing-core/.flattened-pom.xml
|
||||
/wsnet-cargo-sharing-gateway/target/
|
||||
/wsnet-cargo-sharing-gateway/.flattened-pom.xml
|
||||
/wsnet-cargo-sharing-oauth-service/target/
|
||||
/wsnet-cargo-sharing-oauth-service/.flattened-pom.xml
|
||||
/wsnet-cargo-sharing-service/target/
|
||||
/wsnet-cargo-sharing-service/.flattened-pom.xml
|
||||
/.flattened-pom.xml
|
|
@ -0,0 +1,106 @@
|
|||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>cargo-sharing-platform</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>${revision}</version>
|
||||
<modules>
|
||||
<module>wsnet-cargo-sharing-oauth-service</module>
|
||||
<module>wsnet-cargo-sharing-service</module>
|
||||
<module>wsnet-cargo-sharing-gateway</module>
|
||||
<module>wsnet-cargo-sharing-core</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<wsnet-platform.version>2024.08.30</wsnet-platform.version>
|
||||
<revision>1.0</revision>
|
||||
<spring-boot.version>3.2.5</spring-boot.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<!-- 统一依赖 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-boot3-platform</artifactId>
|
||||
<version>${wsnet-platform.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.7.4</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.mapstruct/mapstruct -->
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.mapstruct/mapstruct-processor -->
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-cargo-sharing-core</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- maven 编译插件 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- 统一 revision 版本 -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<configuration>
|
||||
<flattenMode>resolveCiFriendliesOnly</flattenMode>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
<id>flatten.clean</id>
|
||||
<phase>clean</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,28 @@
|
|||
<?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>cargo-sharing-platform</artifactId>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>wsnet-cargo-sharing-core</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--bootstrap-->
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,22 @@
|
|||
package com.wsnet.dto;
|
||||
|
||||
import com.wsnet.core.api.ApiUser;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 对登录用户进行扩展
|
||||
*/
|
||||
@Data
|
||||
public class CargoApiUser extends ApiUser {
|
||||
// 企业ID
|
||||
private Long enterpriseId;
|
||||
|
||||
// 企业名称
|
||||
private String enterpriseName;
|
||||
|
||||
// 用户所在的港口
|
||||
private Long portId;
|
||||
|
||||
// 用户所在的码头
|
||||
private Long wharfId;
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
<?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>cargo-sharing-platform</artifactId>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wsnet-cargo-sharing-gateway</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--spring cloud alibaba 注册中心-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--spring cloud alibaba 配置中心-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--spring cloud bootstrap 支撑-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring cloud gateway-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring cloud loadbalancer-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-gateway-spring-boot-starter</artifactId>
|
||||
<version>4.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
<version>4.5.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,14 @@
|
|||
package com.wsnet.cargo.gateway;
|
||||
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class GatewayApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(GatewayApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
spring:
|
||||
profiles:
|
||||
active: dev # 表示生产环境
|
|
@ -0,0 +1,14 @@
|
|||
spring:
|
||||
application:
|
||||
name: wsnet-gateway-server
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: localhost:8848 #Nacos服务注册中心地址
|
||||
config:
|
||||
server-addr: localhost:8848 #Nacos作为配置中心地址
|
||||
file-extension: yaml #指定yaml格式的配置
|
||||
group: DEFAULT_GROUP
|
||||
namespace: 79855585-5921-4b8b-bfb6-ff502c66f19a
|
||||
username: nacos
|
||||
password: nacos
|
|
@ -0,0 +1,81 @@
|
|||
<?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>cargo-sharing-platform</artifactId>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wsnet-cargo-sharing-oauth-service</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--bootstrap-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
<!--nacos-config-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!--nacos-discovery-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-user-service</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-log-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-cargo-sharing-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,14 @@
|
|||
package com.wsnet.user;
|
||||
|
||||
import com.wsnet.launcher.launcher.LauncherApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class OauthServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
LauncherApplication.run("wsnet-oauth-server", OauthServiceApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.wsnet.user.config;
|
||||
|
||||
import com.aliyun.teaopenapi.models.Config;
|
||||
import com.aliyun.dysmsapi20170525.Client;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class SmsConfig {
|
||||
@Bean
|
||||
public Client client(SmsProperties properties) throws Exception {
|
||||
Config config = new Config()
|
||||
// 配置 AccessKey ID,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
||||
.setAccessKeyId("LTAI5tEhpW5Z17Z9ZkLJAuXg")
|
||||
// 配置 AccessKey Secret,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
||||
.setAccessKeySecret("SAwwJNRlvDTGH0KbVf6fJ4h4xX0wfH");
|
||||
|
||||
// 配置 Endpoint
|
||||
config.endpoint = "dysmsapi.aliyuncs.com";
|
||||
|
||||
return new Client(config);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.wsnet.user.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "launcher.sms")
|
||||
public class SmsProperties {
|
||||
private String accessKeyId;
|
||||
private String accessKeySecret;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.wsnet.user.controller;
|
||||
|
||||
import com.wsnet.core.api.ApiUser;
|
||||
import com.wsnet.dto.CargoApiUser;
|
||||
import com.wsnet.user.entity.DictEmployee;
|
||||
import com.wsnet.user.entity.DictEnterprise;
|
||||
import com.wsnet.user.login.AbstractUserLoginController;
|
||||
import com.wsnet.user.service.DictEmployeeService;
|
||||
import com.wsnet.user.service.DictEnterpriseService;
|
||||
import com.wsnet.web.exception.AclException;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "用户登录")
|
||||
public class LoginController extends AbstractUserLoginController {
|
||||
|
||||
@Resource
|
||||
private DictEnterpriseService enterpriseService;
|
||||
|
||||
@Resource
|
||||
private DictEmployeeService employeeService;
|
||||
|
||||
@Override
|
||||
protected List<String> getAuthPkgs() {
|
||||
List<String> pkgs = new ArrayList<>();
|
||||
pkgs.add("com.wsnet.cargo.controller");
|
||||
return pkgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ApiUser extendLoginUser(ApiUser apiUser) {
|
||||
CargoApiUser user = new CargoApiUser();
|
||||
BeanUtils.copyProperties(apiUser, user);
|
||||
|
||||
// 获取用户企业信息
|
||||
Optional<DictEnterprise> enterprise = enterpriseService.lambdaQuery().eq(DictEnterprise::getUserId, Long.valueOf(apiUser.getId())).oneOpt();
|
||||
if (enterprise.isPresent()) { // 管理员登录
|
||||
DictEnterprise e = enterprise.get();
|
||||
if (!StringUtils.equals(e.getEnterpriseStatus(), "1")) {
|
||||
throw new AclException("企业处于非正常状态,不允许登录");
|
||||
}
|
||||
user.setEnterpriseId(e.getId());
|
||||
user.setEnterpriseName(e.getName());
|
||||
user.setPortId(e.getPortId());
|
||||
} else { // 普通用户登录
|
||||
Optional<DictEmployee> employee = employeeService.lambdaQuery().eq(DictEmployee::getUserId, Long.valueOf(apiUser.getId())).oneOpt();
|
||||
if (employee.isPresent()) {
|
||||
DictEmployee e = employee.get();
|
||||
user.setWharfId(e.getWharfId());
|
||||
|
||||
DictEnterprise enterprise1 = enterpriseService.getById(e.getEnterpriseId());
|
||||
if (!StringUtils.equals(enterprise1.getEnterpriseStatus(), "1")) {
|
||||
throw new AclException("企业处于非正常状态,不允许登录");
|
||||
}
|
||||
user.setEnterpriseId(enterprise1.getId());
|
||||
user.setEnterpriseName(enterprise1.getName());
|
||||
user.setPortId(enterprise1.getPortId());
|
||||
}
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package com.wsnet.user.controller;
|
||||
|
||||
import com.wsnet.core.annotation.Anonymous;
|
||||
import com.wsnet.core.annotation.InternalInterface;
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.user.entity.SysRole;
|
||||
import com.wsnet.user.entity.SysUser;
|
||||
import com.wsnet.user.entity.SysUserRole;
|
||||
import com.wsnet.user.enums.RoleTypeEnum;
|
||||
import com.wsnet.user.service.SysRoleService;
|
||||
import com.wsnet.user.service.SysUserRoleService;
|
||||
import com.wsnet.user.service.SysUserService;
|
||||
import com.wsnet.web.cache.PojoCache;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "用户注册")
|
||||
public class UserRegController {
|
||||
|
||||
@Resource
|
||||
protected PojoCache pojoCache;
|
||||
|
||||
@Resource
|
||||
private SysUserService userService;
|
||||
|
||||
@Resource
|
||||
private SysRoleService roleService;
|
||||
|
||||
@Resource
|
||||
private SysUserRoleService userRoleService;
|
||||
|
||||
@Anonymous
|
||||
@InternalInterface
|
||||
@PostMapping("/user/reg")
|
||||
@Operation(summary = "用户注册")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultData<Long> register(@RequestBody @Validated SysUser user) {
|
||||
if (user.getId() != null) {
|
||||
// 移除缓存
|
||||
pojoCache.getEntityCache().remove(String.valueOf(user.getId()));
|
||||
}
|
||||
|
||||
// 验证用户名是否已经存在
|
||||
boolean exists = userService.lambdaQuery().eq(SysUser::getUsername, user.getUsername()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("用户名已经存在");
|
||||
}
|
||||
|
||||
// 验证手机号码是否已经存在
|
||||
exists = userService.lambdaQuery().eq(SysUser::getPhone, user.getPhone()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("电话号码已经存在");
|
||||
}
|
||||
|
||||
String userType = user.getOpenId();
|
||||
user.setOpenId(null);
|
||||
|
||||
userService.save(user);
|
||||
|
||||
String code = StringUtils.equals(userType, "admin") ? "enterprise_admin" : "enterprise_user";
|
||||
|
||||
// 分配角色
|
||||
Optional<SysRole> admin = roleService.lambdaQuery().eq(SysRole::getCode, code)
|
||||
.eq(SysRole::getDstatus, StatusEnums.active)
|
||||
.oneOpt();
|
||||
|
||||
Long roleId = null;
|
||||
if (!admin.isPresent()) {
|
||||
// 创建角色
|
||||
SysRole role = new SysRole();
|
||||
role.setCode(code);
|
||||
role.setName(StringUtils.equals(userType, "admin") ? "企业管理员" : "企业用户");
|
||||
role.setType(RoleTypeEnum.COMMON);
|
||||
role.setDstatus(StatusEnums.active);
|
||||
|
||||
roleService.save(role);
|
||||
|
||||
roleId = role.getId();
|
||||
} else {
|
||||
roleId = admin.get().getId();
|
||||
}
|
||||
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(user.getId());
|
||||
userRole.setRoles(roleId + "");
|
||||
|
||||
userRoleService.save(userRole);
|
||||
|
||||
return ResultData.success(user.getId());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.wsnet.user.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 企业员工
|
||||
* @TableName dict_employee
|
||||
*/
|
||||
@TableName(value ="dict_employee")
|
||||
@Data
|
||||
public class DictEmployee extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 企业ID
|
||||
*/
|
||||
@TableField(value = "enterprise_id")
|
||||
private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@TableField(value = "nickname")
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@TableField(value = "username")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 码头ID
|
||||
*/
|
||||
@TableField(value = "wharf_id")
|
||||
private Long wharfId;
|
||||
|
||||
/**
|
||||
* 绑定用户ID
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
private StatusEnums status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package com.wsnet.user.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 企业
|
||||
* @TableName dict_enterprise
|
||||
*/
|
||||
@TableName(value ="dict_enterprise")
|
||||
@Data
|
||||
public class DictEnterprise extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 企业编码
|
||||
*/
|
||||
@TableField(value = "code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@TableField(value = "address")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 法人代表
|
||||
*/
|
||||
@TableField(value = "legal_person")
|
||||
private String legalPerson;
|
||||
|
||||
/**
|
||||
* 合同编号
|
||||
*/
|
||||
@TableField(value = "contract_no")
|
||||
private String contractNo;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@TableField(value = "linkman")
|
||||
private String linkman;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@TableField(value = "phone")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
@TableField(value = "enterprise_status")
|
||||
private String enterpriseStatus;
|
||||
|
||||
/**
|
||||
* 关联登录账号ID
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 绑定的港口ID
|
||||
*/
|
||||
@TableField(value = "port_id")
|
||||
private Long portId;
|
||||
|
||||
/**
|
||||
* 企业类别
|
||||
*/
|
||||
@TableField(value = "enterprise_type")
|
||||
private String enterpriseType;
|
||||
|
||||
/**
|
||||
* 营业执照图片
|
||||
*/
|
||||
@TableField(value = "license_photo")
|
||||
private String licensePhoto;
|
||||
|
||||
/**
|
||||
* 身份证图片
|
||||
*/
|
||||
@TableField(value = "id_photo")
|
||||
private String idPhoto;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.user.mapper;
|
||||
|
||||
import com.wsnet.user.entity.DictEmployee;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_employee(企业员工)】的数据库操作Mapper
|
||||
* @createDate 2024-10-24 09:16:15
|
||||
* @Entity com.wsnet.user.entity.DictEmployee
|
||||
*/
|
||||
public interface DictEmployeeMapper extends BaseMapper<DictEmployee> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.user.mapper;
|
||||
|
||||
import com.wsnet.user.entity.DictEnterprise;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_enterprise(企业)】的数据库操作Mapper
|
||||
* @createDate 2024-10-24 09:16:15
|
||||
* @Entity com.wsnet.user.entity.DictEnterprise
|
||||
*/
|
||||
public interface DictEnterpriseMapper extends BaseMapper<DictEnterprise> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wsnet.user.service;
|
||||
|
||||
import com.wsnet.user.entity.DictEmployee;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_employee(企业员工)】的数据库操作Service
|
||||
* @createDate 2024-10-24 09:16:15
|
||||
*/
|
||||
public interface DictEmployeeService extends IService<DictEmployee> {
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.wsnet.user.service;
|
||||
|
||||
import com.wsnet.user.entity.DictEnterprise;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_enterprise(企业)】的数据库操作Service
|
||||
* @createDate 2024-10-24 09:16:15
|
||||
*/
|
||||
public interface DictEnterpriseService extends IService<DictEnterprise> {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.wsnet.user.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wsnet.user.entity.DictEmployee;
|
||||
import com.wsnet.user.service.DictEmployeeService;
|
||||
import com.wsnet.user.mapper.DictEmployeeMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_employee(企业员工)】的数据库操作Service实现
|
||||
* @createDate 2024-10-24 09:16:15
|
||||
*/
|
||||
@Service
|
||||
public class DictEmployeeServiceImpl extends ServiceImpl<DictEmployeeMapper, DictEmployee>
|
||||
implements DictEmployeeService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.wsnet.user.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wsnet.user.entity.DictEnterprise;
|
||||
import com.wsnet.user.service.DictEnterpriseService;
|
||||
import com.wsnet.user.mapper.DictEnterpriseMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_enterprise(企业)】的数据库操作Service实现
|
||||
* @createDate 2024-10-24 09:16:15
|
||||
*/
|
||||
@Service
|
||||
public class DictEnterpriseServiceImpl extends ServiceImpl<DictEnterpriseMapper, DictEnterprise>
|
||||
implements DictEnterpriseService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.wsnet.user.service.impl;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.aliyun.dysmsapi20170525.Client;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||
import com.wsnet.user.service.SmsService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
public class SmsServiceImpl implements SmsService {
|
||||
|
||||
@Resource
|
||||
private Client client;
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public String sendSms(String phone) {
|
||||
String code = RandomUtil.randomNumbers(4);
|
||||
// 构造请求对象,请填入请求参数值
|
||||
SendSmsRequest sendSmsRequest = new SendSmsRequest()
|
||||
.setPhoneNumbers(phone)
|
||||
.setSignName("瑞通智慧科技")
|
||||
.setTemplateCode("SMS_305459771")
|
||||
.setTemplateParam("{\"code\":\""+code+"\"}");
|
||||
|
||||
// 获取响应对象
|
||||
SendSmsResponse sendSmsResponse = client.sendSms(sendSmsRequest);
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
spring:
|
||||
profiles:
|
||||
active: dev # 表示生产环境
|
||||
|
||||
logging:
|
||||
level:
|
||||
org.springframework.security: debug
|
||||
org.springframework.security.oauth2: debug
|
||||
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping: trace
|
||||
org.springframework.security.web.FilterChainProxy: trace
|
||||
org.springframework.security.web.access.ExceptionTranslationFilter: trace
|
|
@ -0,0 +1,14 @@
|
|||
spring:
|
||||
application:
|
||||
name: wsnet-oauth-server
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: localhost:8848 #Nacos服务注册中心地址
|
||||
config:
|
||||
server-addr: localhost:8848 #Nacos作为配置中心地址
|
||||
file-extension: yaml #指定yaml格式的配置
|
||||
group: DEFAULT_GROUP
|
||||
namespace: 79855585-5921-4b8b-bfb6-ff502c66f19a
|
||||
username: nacos
|
||||
password: nacos
|
|
@ -0,0 +1,144 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
|
||||
<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true -->
|
||||
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
|
||||
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
|
||||
<configuration scan="true" scanPeriod="10 seconds">
|
||||
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
|
||||
<property name="log.path" value="./logs"/>
|
||||
<property name="log.name" value="wsnet-cargo-sharing-oauth-service"/>
|
||||
<!-- 彩色日志 -->
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
|
||||
<!-- 控制台输出日志 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
|
||||
<charset class="java.nio.charset.Charset">UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--输出到文件-->
|
||||
<!-- 时间滚动输出 level为 DEBUG 日志 -->
|
||||
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文件的路径及文件名 -->
|
||||
<!-- <file>${log.path}/debug/%d{yyyy-MM-dd}.log</file>-->
|
||||
<!--日志文件输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志归档 -->
|
||||
<fileNamePattern>${log.path}/${log.name}-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>7</maxHistory>
|
||||
<!-- <cleanHistoryOnStart>true</cleanHistoryOnStart>-->
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文件只记录debug级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>debug</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
<!-- 时间滚动输出 level为 INFO 日志 -->
|
||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文件的路径及文件名 -->
|
||||
<!-- <file>${log.path}/log_info.log</file>-->
|
||||
<!--日志文件输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 每天日志归档路径以及格式 -->
|
||||
<fileNamePattern>${log.path}/${log.name}-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>1</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文件只记录info级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>info</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 时间滚动输出 level为 WARN 日志 -->
|
||||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文件的路径及文件名 -->
|
||||
<!-- <file>${log.path}/log_warn.log</file>-->
|
||||
<!--日志文件输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/${log.name}-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>1</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文件只记录warn级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>warn</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
|
||||
<!-- 时间滚动输出 level为 ERROR 日志 -->
|
||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文件的路径及文件名 -->
|
||||
<!-- <file>${log.path}/log_error.log</file>-->
|
||||
<!--日志文件输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/${log.name}-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>1</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文件只记录ERROR级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="DEBUG_FILE"/>
|
||||
<appender-ref ref="INFO_FILE"/>
|
||||
<appender-ref ref="ERROR_FILE"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wsnet.user.mapper.DictEmployeeMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.wsnet.user.entity.DictEmployee">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="createBy" column="create_by" jdbcType="BIGINT"/>
|
||||
<result property="createDate" column="create_date" jdbcType="DATE"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="BIGINT"/>
|
||||
<result property="updateDate" column="update_date" jdbcType="DATE"/>
|
||||
<result property="version" column="version" jdbcType="SMALLINT"/>
|
||||
<result property="enterpriseId" column="enterprise_id" jdbcType="BIGINT"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="nickname" column="nickname" jdbcType="VARCHAR"/>
|
||||
<result property="username" column="username" jdbcType="VARCHAR"/>
|
||||
<result property="wharfId" column="wharf_id" jdbcType="BIGINT"/>
|
||||
<result property="userId" column="user_id" jdbcType="BIGINT"/>
|
||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,create_by,create_date,
|
||||
update_by,update_date,version,
|
||||
enterprise_id,name,nickname,
|
||||
username,wharf_id,user_id,
|
||||
status
|
||||
</sql>
|
||||
</mapper>
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wsnet.user.mapper.DictEnterpriseMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.wsnet.user.entity.DictEnterprise">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="createBy" column="create_by" jdbcType="BIGINT"/>
|
||||
<result property="createDate" column="create_date" jdbcType="DATE"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="BIGINT"/>
|
||||
<result property="updateDate" column="update_date" jdbcType="DATE"/>
|
||||
<result property="version" column="version" jdbcType="SMALLINT"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="code" column="code" jdbcType="VARCHAR"/>
|
||||
<result property="address" column="address" jdbcType="VARCHAR"/>
|
||||
<result property="legalPerson" column="legal_person" jdbcType="VARCHAR"/>
|
||||
<result property="contractNo" column="contract_no" jdbcType="VARCHAR"/>
|
||||
<result property="linkman" column="linkman" jdbcType="VARCHAR"/>
|
||||
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
||||
<result property="enterpriseStatus" column="enterprise_status" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="BIGINT"/>
|
||||
<result property="portId" column="port_id" jdbcType="BIGINT"/>
|
||||
<result property="enterpriseType" column="enterprise_type" jdbcType="VARCHAR"/>
|
||||
<result property="licensePhoto" column="license_photo" jdbcType="VARCHAR"/>
|
||||
<result property="idPhoto" column="id_photo" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,create_by,create_date,
|
||||
update_by,update_date,version,
|
||||
name,code,address,
|
||||
legal_person,contract_no,linkman,
|
||||
phone,enterprise_status,user_id,
|
||||
port_id,enterprise_type,license_photo,
|
||||
id_photo
|
||||
</sql>
|
||||
</mapper>
|
|
@ -0,0 +1,33 @@
|
|||
package com.wsnet.user.service;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.aliyun.dysmsapi20170525.Client;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class DictEmployeeServiceTest {
|
||||
@Resource
|
||||
private Client client;
|
||||
|
||||
@Test
|
||||
public void sentMsg() throws Exception {
|
||||
String code = RandomUtil.randomNumbers(4);
|
||||
// 构造请求对象,请填入请求参数值
|
||||
SendSmsRequest sendSmsRequest = new SendSmsRequest()
|
||||
.setPhoneNumbers("13120665928")
|
||||
.setSignName("瑞通智慧科技")
|
||||
.setTemplateCode("SMS_305459771")
|
||||
.setTemplateParam("{\"code\":\""+code+"\"}");
|
||||
|
||||
// 获取响应对象
|
||||
SendSmsResponse sendSmsResponse = client.sendSms(sendSmsRequest);
|
||||
|
||||
// 响应包含服务端响应的 body 和 headers
|
||||
System.out.println(JSONObject.toJSONString(sendSmsResponse));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
<?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>cargo-sharing-platform</artifactId>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wsnet-cargo-sharing-service</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--bootstrap-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
<!--nacos-config-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!--nacos-discovery-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-authorization-server-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-web-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-log-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-user-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-feign-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-cargo-sharing-core</artifactId>
|
||||
</dependency>
|
||||
<!-- 文件导入 -->
|
||||
<dependency>
|
||||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-excel-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-all -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.32</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.mapstruct/mapstruct-processor -->
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,19 @@
|
|||
package com.wsnet.cargo;
|
||||
|
||||
import com.wsnet.launcher.launcher.LauncherApplication;
|
||||
import com.wsnet.user.service.impl.PermServiceImpl;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackageClasses = {PermServiceImpl.class})
|
||||
@MapperScan({"com.wsnet.cargo.mapper"})
|
||||
public class CargoServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
LauncherApplication.run("wsnet-cargo-server", CargoServiceApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.wsnet.cargo.entity.HelpApi;
|
||||
import com.wsnet.cargo.service.HelpApiService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.web.controller.BaseController;
|
||||
import com.wsnet.web.query.BaseQuery;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
@Menu(code = "0301", name = "对外开放接口")
|
||||
@Tag(name = "对外开放接口")
|
||||
public class ApiController extends BaseController<HelpApiService, HelpApi, BaseQuery> {
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.DictBrand;
|
||||
import com.wsnet.cargo.query.BrandQuery;
|
||||
import com.wsnet.cargo.service.DictBrandService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/brand")
|
||||
@Menu(code = "0203", name = "品牌")
|
||||
@Tag(name = "品牌")
|
||||
public class BrandController extends BaseDictController<DictBrandService, DictBrand, BrandQuery> {
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictBrand>> page(@RequestBody BrandQuery query) {
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated DictBrand entity) {
|
||||
// 验证港口编码是否重复
|
||||
boolean exists = service.lambdaQuery().eq(DictBrand::getName, entity.getName()).ne(entity.getId() != null, DictBrand::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("名称已存在");
|
||||
}
|
||||
|
||||
exists = service.lambdaQuery().eq(DictBrand::getCode, entity.getCode()).ne(entity.getId() != null, DictBrand::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("编码已存在");
|
||||
}
|
||||
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.DictEmployee;
|
||||
import com.wsnet.cargo.query.EmployeeQuery;
|
||||
import com.wsnet.cargo.service.DictEmployeeService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.holder.UserContext;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.dto.CargoApiUser;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/employee")
|
||||
@Tag(name = "企业员工管理")
|
||||
@Menu(code = "0202", name = "企业员工管理")
|
||||
@Validated
|
||||
public class EmployeeController extends BaseDictController<DictEmployeeService, DictEmployee, EmployeeQuery> {
|
||||
// 员工列表
|
||||
@Override
|
||||
public ResultData<Page<DictEmployee>> page(@RequestBody EmployeeQuery query) {
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
query.setEnterpriseId(user.getEnterpriseId());
|
||||
|
||||
query.setFields("*+enterprise@name+wharf@name");
|
||||
|
||||
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,287 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.dto.EnterpriseVo;
|
||||
import com.wsnet.cargo.entity.DictEmployee;
|
||||
import com.wsnet.cargo.entity.DictEnterprise;
|
||||
import com.wsnet.cargo.entity.DictWharf;
|
||||
import com.wsnet.cargo.enums.EnterpriseStatusEnums;
|
||||
import com.wsnet.cargo.enums.EnterpriseTypeEnums;
|
||||
import com.wsnet.cargo.query.EnterpriseQuery;
|
||||
import com.wsnet.cargo.service.CargoUserRegService;
|
||||
import com.wsnet.cargo.service.DictEmployeeService;
|
||||
import com.wsnet.cargo.service.DictEnterpriseService;
|
||||
import com.wsnet.cargo.service.DictWharfService;
|
||||
import com.wsnet.core.annotation.Anonymous;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import com.wsnet.core.holder.UserContext;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.dto.CargoApiUser;
|
||||
import com.wsnet.user.dto.RegUser;
|
||||
import com.wsnet.user.service.impl.UserRegService;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.YearMonth;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/enterprise")
|
||||
@Tag(name = "企业管理")
|
||||
@Menu(code = "0201", name = "企业管理")
|
||||
@Validated
|
||||
public class EnterpriseController extends BaseDictController<DictEnterpriseService, DictEnterprise, EnterpriseQuery> {
|
||||
|
||||
@Value("${launcher.upload.path}")
|
||||
private String path;
|
||||
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@Resource
|
||||
private CargoUserRegService cargoUserRegService;
|
||||
|
||||
@Resource
|
||||
private DictEnterpriseService enterpriseService;
|
||||
|
||||
@Resource
|
||||
private DictEmployeeService employeeService;
|
||||
|
||||
@Resource
|
||||
private UserRegService userRegService;
|
||||
|
||||
@Resource
|
||||
private DictWharfService wharfService;
|
||||
|
||||
@Anonymous
|
||||
@Operation(summary = "企业注册", operationId = "10")
|
||||
@PostMapping("/reg")
|
||||
public ResultData<String> enterpriseReg(@RequestBody @Validated EnterpriseVo enterprise) {
|
||||
// 验证手机号是否存在
|
||||
boolean phoneExists = enterpriseService.lambdaQuery().eq(DictEnterprise::getPhone, enterprise.getPhone()).exists();
|
||||
if (phoneExists) {
|
||||
return ResultData.fail("该手机号已存在");
|
||||
}
|
||||
|
||||
// 验证信用代码是否存在
|
||||
boolean codeExists = enterpriseService.lambdaQuery().eq(DictEnterprise::getCode, enterprise.getCode()).exists();
|
||||
if (codeExists) {
|
||||
return ResultData.fail("信用代码已存在");
|
||||
}
|
||||
|
||||
// 判断 名称是否一致
|
||||
String license =StringUtils.substringBetween(enterprise.getLicensePhoto(), "license-", ".");
|
||||
if (!StringUtils.equals(license, enterprise.getCode())) {
|
||||
return ResultData.fail("信用代码与上传文件名称不一致");
|
||||
}
|
||||
|
||||
String id =StringUtils.substringBetween(enterprise.getIdPhoto(), "id-", ".");
|
||||
if (!StringUtils.equals(id, enterprise.getPhone())) {
|
||||
return ResultData.fail("身份证号与上传文件名称不一致");
|
||||
}
|
||||
|
||||
// 如果企业为港口类型,关联港口不能为空
|
||||
if (enterprise.getEnterpriseType() == EnterpriseTypeEnums.PORT && enterprise.getPortId() == null) {
|
||||
return ResultData.fail("港口类型必须关联港口");
|
||||
}
|
||||
|
||||
cargoUserRegService.register(enterprise);
|
||||
return ResultData.success("success");
|
||||
}
|
||||
|
||||
@Anonymous
|
||||
@Operation(summary = "文件上传")
|
||||
@PostMapping("/upload")
|
||||
public ResultData<String> upload(
|
||||
@NotNull(message = "文件类型不能为空")
|
||||
@Parameter(name = "type", description = "文件类型 0-营业执照, 1-身份证") Integer type,
|
||||
@NotBlank(message = "文件编号不能为空")
|
||||
@Parameter(name = "no", description = "文件编号, 营业执照则为信用代码, 身份证则为手机号码") String no,
|
||||
MultipartFile file) throws IOException {
|
||||
// 按年月创建目录
|
||||
YearMonth ym = YearMonth.now();
|
||||
String foldPath = StringUtils.join(path, File.pathSeparator, ym.getYear(), File.pathSeparator, ym.getMonthValue());
|
||||
|
||||
// 创建文件目录
|
||||
File fold = new File(foldPath);
|
||||
if (!fold.exists()) {
|
||||
fold.mkdirs();
|
||||
}
|
||||
|
||||
String fileName = StringUtils.join(type == 0 ? "license" : "id", "-",
|
||||
no, ".", StringUtils.substringAfterLast(file.getOriginalFilename(), "."));
|
||||
String filePath = StringUtils.join(foldPath, File.pathSeparator, fileName);
|
||||
|
||||
file.transferTo(new File(filePath));
|
||||
|
||||
return ResultData.success(fileName);
|
||||
}
|
||||
|
||||
@Operation(summary = "添加员工", operationId = "11")
|
||||
@PostMapping("/employee/add")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultData<Long> addEnterpriseEmployee(@RequestBody @Validated DictEmployee employee) {
|
||||
// 验证用户名是否已经存在
|
||||
boolean exists = employeeService.lambdaQuery().eq(DictEmployee::getUsername, employee.getUsername()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("用户名已经存在");
|
||||
}
|
||||
// 验证电话号码是否已经存在
|
||||
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
|
||||
DictEnterprise enterprise = enterpriseService.getById(user.getEnterpriseId());
|
||||
// 添加员工
|
||||
// 如果企业类型为港口码头,则必须指定码头
|
||||
if (enterprise.getEnterpriseType() == EnterpriseTypeEnums.PORT) {
|
||||
if (employee.getWharfId() == null) {
|
||||
return ResultData.fail("港口码头企业员工必须绑定码头");
|
||||
}
|
||||
}
|
||||
if (employee.getWharfId() != null) {
|
||||
// 验证码头和企业绑定的港口是否一致
|
||||
DictWharf wharf = wharfService.getById(employee.getWharfId());
|
||||
if (wharf.getPortId().compareTo(enterprise.getPortId()) != 0) {
|
||||
return ResultData.fail("码头与港口不一致");
|
||||
}
|
||||
}
|
||||
|
||||
employee.setStatus(StatusEnums.active);
|
||||
|
||||
employeeService.save(employee);
|
||||
|
||||
// 分配账号
|
||||
RegUser regUser = new RegUser();
|
||||
regUser.setPassword(passwordEncoder.encode(employee.getPassword()));
|
||||
regUser.setUsername(employee.getUsername());
|
||||
regUser.setName(employee.getName());
|
||||
regUser.setDstatus(StatusEnums.active);
|
||||
regUser.setPhone(employee.getPhone());
|
||||
regUser.setOpenId("user");
|
||||
|
||||
ResultData<Long> register = userRegService.register(regUser);
|
||||
if (!StringUtils.equals(register.getCode(), "200")) {
|
||||
throw new RuntimeException(register.getMessage());
|
||||
}
|
||||
|
||||
// 修改企业的绑定管理员账号
|
||||
employeeService.lambdaUpdate().set(DictEmployee::getUserId, register.getData()).eq(DictEmployee::getId, employee.getId()).update();
|
||||
|
||||
return ResultData.success(employee.getId());
|
||||
}
|
||||
|
||||
@Operation(summary = "获取营业执照图片", operationId = "12")
|
||||
@GetMapping("/image/license/{id}")
|
||||
public ResponseEntity<org.springframework.core.io.Resource> getLicenseImage(@PathVariable Long id) {
|
||||
DictEnterprise enterprise = enterpriseService.getById(id);
|
||||
if (enterprise == null) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
Path imageStoragePath = Paths.get(path); // 修改为你的图片存储路径
|
||||
try {
|
||||
Path file = imageStoragePath.resolve(enterprise.getLicensePhoto());
|
||||
org.springframework.core.io.Resource resource = new UrlResource(file.toUri());
|
||||
|
||||
if (resource.exists() || resource.isReadable()) {
|
||||
return ResponseEntity.ok().body(resource);
|
||||
} else {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.internalServerError().build();
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "获取身份证图片", operationId = "13")
|
||||
@GetMapping("/image/id/{id}")
|
||||
public ResponseEntity<org.springframework.core.io.Resource> getIdImage(@PathVariable Long id) {
|
||||
DictEnterprise enterprise = enterpriseService.getById(id);
|
||||
if (enterprise == null) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
Path imageStoragePath = Paths.get(path); // 修改为你的图片存储路径
|
||||
try {
|
||||
Path file = imageStoragePath.resolve(enterprise.getIdPhoto());
|
||||
org.springframework.core.io.Resource resource = new UrlResource(file.toUri());
|
||||
|
||||
if (resource.exists() || resource.isReadable()) {
|
||||
return ResponseEntity.ok().body(resource);
|
||||
} else {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.internalServerError().build();
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "待审核数量", operationId = "14")
|
||||
@PostMapping("/reg/audit/count")
|
||||
public ResultData<Long> enterpriseRegCount() {
|
||||
Long count = service.lambdaQuery().eq(DictEnterprise::getEnterpriseStatus, EnterpriseStatusEnums.AUDIT).count();
|
||||
return ResultData.success(count);
|
||||
}
|
||||
|
||||
@Operation(summary = "审核通过", operationId = "15")
|
||||
@PostMapping("/reg/audit/pass")
|
||||
public ResultData<String> enterpriseRegPass(@RequestBody @Validated @Size(min = 1,message = "ID列表不能为空") @Parameter(description = "ID列表") List<Long> ids) {
|
||||
service.lambdaUpdate().set(DictEnterprise::getEnterpriseStatus, EnterpriseStatusEnums.USED)
|
||||
.in(DictEnterprise::getId, ids)
|
||||
.update();
|
||||
return ResultData.success("success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictEnterprise>> page(@RequestBody EnterpriseQuery query) {
|
||||
Page page = service.lambdaQuery().eq(query.getEnterpriseStatus() != null, DictEnterprise::getEnterpriseStatus, query.getEnterpriseStatus())
|
||||
.and(StringUtils.isNotEmpty(query.getKey()), (w) -> w.like(DictEnterprise::getName, query.getKey())
|
||||
.or().like(DictEnterprise::getCode, query.getKey()))
|
||||
.page(new Page((long) query.getPage(), (long) query.getRows()));
|
||||
return ResultData.success(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<String> enable(@RequestBody @Validated @Size(min = 1,message = "ID列表不能为空") @Parameter(description = "ID列表") List<Long> ids) {
|
||||
this.pojoCache.getEntityCache().removeAll((Set)ids.stream().map((item) -> {
|
||||
return String.valueOf(item);
|
||||
}).collect(Collectors.toSet()));
|
||||
service.lambdaUpdate().set(DictEnterprise::getEnterpriseStatus, EnterpriseStatusEnums.USED)
|
||||
.eq(DictEnterprise::getId, ids)
|
||||
.update();
|
||||
|
||||
return ResultData.success("success");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<String> disable(@RequestBody @Validated @Size(min = 1,message = "ID列表不能为空") @Parameter(description = "ID列表") List<Long> ids) {
|
||||
this.pojoCache.getEntityCache().removeAll((Set)ids.stream().map((item) -> {
|
||||
return String.valueOf(item);
|
||||
}).collect(Collectors.toSet()));
|
||||
service.lambdaUpdate().set(DictEnterprise::getEnterpriseStatus, EnterpriseStatusEnums.CLOSE)
|
||||
.eq(DictEnterprise::getId, ids)
|
||||
.update();
|
||||
|
||||
return ResultData.success("success");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.wsnet.cargo.entity.HelpDoc;
|
||||
import com.wsnet.cargo.service.HelpDocService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.web.controller.BaseController;
|
||||
import com.wsnet.web.query.BaseQuery;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/help")
|
||||
@Menu(code = "0302", name = "帮助文档")
|
||||
@Tag(name = "帮助文档")
|
||||
public class HelpController extends BaseController<HelpDocService, HelpDoc, BaseQuery> {
|
||||
|
||||
}
|
|
@ -0,0 +1,375 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.controller.mapper.PoMapper;
|
||||
import com.wsnet.cargo.entity.*;
|
||||
import com.wsnet.cargo.enums.GoodsStatusEnums;
|
||||
import com.wsnet.cargo.excel.ManifestDetailImportExcel;
|
||||
import com.wsnet.cargo.excel.ManifestImportExcel;
|
||||
import com.wsnet.cargo.query.ManifestDetailQuery;
|
||||
import com.wsnet.cargo.query.ManifestQuery;
|
||||
import com.wsnet.cargo.service.BusManifestService;
|
||||
import com.wsnet.cargo.service.DictBrandService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.excel.handler.CascadeGroup;
|
||||
import com.wsnet.excel.handler.CustomCellWriteHandler;
|
||||
import com.wsnet.excel.utils.ExcelPropertiesUtils;
|
||||
import com.wsnet.excel.utils.ExcelUtils;
|
||||
import com.wsnet.web.controller.BaseController;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.Validation;
|
||||
import jakarta.validation.Validator;
|
||||
import jakarta.validation.ValidatorFactory;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/manifest")
|
||||
@Menu(code = "0302", name = "舱单")
|
||||
@Tag(name = "舱单")
|
||||
public class ManifestController extends BaseController<BusManifestService, BusManifest, ManifestQuery> {
|
||||
|
||||
@Resource
|
||||
private DictBrandService brandService;
|
||||
|
||||
@Override
|
||||
public ResultData<Page<BusManifest>> page(@RequestBody ManifestQuery query) {
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated BusManifest entity) {
|
||||
// 提单号不允许重复
|
||||
boolean exists = service.lambdaQuery().eq(BusManifest::getBillNo, entity.getBillNo())
|
||||
.eq(BusManifest::getScheduleId, entity.getScheduleId())
|
||||
.ne(entity.getId() != null, BusManifest::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("提单号已存在");
|
||||
}
|
||||
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "舱单模板下载", operationId = "11")
|
||||
@GetMapping("/tmp/export")
|
||||
public void tmpExport(HttpServletResponse response) {
|
||||
ExcelWriter excelWriter = null;
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = response.getOutputStream();
|
||||
|
||||
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
String fileName = URLEncoder.encode("舱单模板", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
Map<String, Integer> cols = ExcelPropertiesUtils.getExcelCols(ManifestImportExcel.class);
|
||||
|
||||
// 显示下拉框数据
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
|
||||
// 隐匿下拉框
|
||||
Map<String, List<String>> excelMap = new HashMap<>();
|
||||
{
|
||||
// 品牌
|
||||
List<String> brandList = brandService.lambdaQuery().eq(DictBrand::getStatus, StatusEnums.active).list()
|
||||
.stream().map(s -> s.getName()).collect(Collectors.toList());
|
||||
|
||||
excelMap.put("*品牌", brandList);
|
||||
|
||||
}
|
||||
|
||||
// 级联下拉框
|
||||
List<CascadeGroup> groups = new ArrayList<>();
|
||||
|
||||
excelWriter = EasyExcel.write(out)
|
||||
.registerWriteHandler(new CustomCellWriteHandler(cols, map, excelMap, groups))
|
||||
.build();
|
||||
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(0, "舱单模板").head(ManifestImportExcel.class).build();
|
||||
|
||||
// 查询数据
|
||||
List<ManifestImportExcel> rows = new ArrayList<>();
|
||||
|
||||
excelWriter.write(rows, writeSheet);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (excelWriter != null) {
|
||||
excelWriter.finish();
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "舱单导入", operationId = "12")
|
||||
@PostMapping("/import")
|
||||
public ResultData<String> importExcel(
|
||||
@Parameter(description = "船期ID") Long scheduleId,
|
||||
MultipartFile file) throws IOException {
|
||||
ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
|
||||
Validator validator = vf.getValidator();
|
||||
// 错误信息
|
||||
List<JSONObject> errors = new ArrayList<>();
|
||||
// 已经存在的提单号
|
||||
List<String> existsBillNos = new ArrayList<>();
|
||||
// 读取的有效的数据
|
||||
List<ManifestImportExcel> dataList = new ArrayList<>();
|
||||
ExcelUtils.readExcel(file.getInputStream(), ManifestImportExcel.class, (rowData) -> {
|
||||
// 这里只验证格式是否正确,并不验证数据的有效性
|
||||
// 对数据进行检验
|
||||
Set<ConstraintViolation<ManifestImportExcel>> set = validator.validate(rowData);
|
||||
if (!CollectionUtils.isEmpty(set)) { // 验证失败的
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", set.stream().map(p -> p.getMessage()).collect(Collectors.joining(",")));
|
||||
errors.add(o);
|
||||
}
|
||||
|
||||
// 船名、航次不允许重复
|
||||
if (existsBillNos.contains(rowData.getBillNo())) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "excel中提单号:" + rowData.getBillNo() + "重复");
|
||||
errors.add(o);
|
||||
} else {
|
||||
existsBillNos.add(rowData.getBillNo());
|
||||
}
|
||||
|
||||
return true;
|
||||
}, (rowDataList) -> {
|
||||
if (CollectionUtils.isNotEmpty(errors)) { // 有错误信息,不做处理
|
||||
return;
|
||||
}
|
||||
dataList.addAll(rowDataList);
|
||||
});
|
||||
|
||||
if (CollectionUtils.isNotEmpty(errors)) {
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
return ResultData.fail("没有读取到有效数据");
|
||||
}
|
||||
|
||||
// 对数据的合法性进行验证
|
||||
// 数据库中的品牌
|
||||
List<DictBrand> brandList = brandService.lambdaQuery()
|
||||
.eq(DictBrand::getStatus, StatusEnums.active)
|
||||
.in(DictBrand::getName, dataList.stream().map(s -> s.getBrandName()).collect(Collectors.toList())).list();
|
||||
|
||||
List<BusManifest> saveDataList = new ArrayList<>();
|
||||
|
||||
for (ManifestImportExcel rowData : dataList) {
|
||||
|
||||
// 品牌是否存在
|
||||
Optional<DictBrand> brand = brandList.stream().filter(s -> StringUtils.equals(s.getName(), rowData.getBrandName())).findAny();
|
||||
if (!brand.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "品牌不存在:" + rowData.getBrandName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 提单号是否已经存在
|
||||
boolean exists = service.lambdaQuery().eq(BusManifest::getBillNo, rowData.getBillNo()).eq(BusManifest::getScheduleId, scheduleId).exists();
|
||||
if (exists) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "数据库中,提单号:" + rowData.getBillNo() + "已存在");
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
BusManifest manifest = PoMapper.instance.manifestExcelToEntity(rowData);
|
||||
manifest.setScheduleId(scheduleId);
|
||||
manifest.setBrandId(brand.get().getId());
|
||||
manifest.setGoodsStatus(GoodsStatusEnums.RIVER);
|
||||
|
||||
saveDataList.add(manifest);
|
||||
}
|
||||
|
||||
service.saveBatch(saveDataList);
|
||||
|
||||
return ResultData.success("success");
|
||||
}
|
||||
|
||||
@Operation(summary = "舱单导出", operationId = "13")
|
||||
@GetMapping("/export")
|
||||
public void exportExcel(ManifestQuery query, HttpServletResponse response) {
|
||||
query.setPage(1);
|
||||
query.setRows(500);
|
||||
query.setFields("*+brand@name");
|
||||
|
||||
ExcelWriter excelWriter = null;
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = response.getOutputStream();
|
||||
|
||||
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
String fileName = URLEncoder.encode(DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN) + "舱单", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
excelWriter = EasyExcel.write(out).build();
|
||||
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(0, "舱单").head(ManifestImportExcel.class).build();
|
||||
|
||||
WriteSheet writeDetailSheet = EasyExcel.writerSheet(1, "舱单明细").head(ManifestDetailImportExcel.class).build();
|
||||
|
||||
// 查询数据
|
||||
Page<BusManifest> page = baseService.page(BusManifest.class, query);
|
||||
|
||||
write(page.getRecords(), excelWriter, writeSheet, writeDetailSheet);
|
||||
|
||||
for (int i = 2; i <= page.getPages(); i++) {
|
||||
query.setPage(i);
|
||||
page = baseService.page(BusManifest.class, query);
|
||||
|
||||
write(page.getRecords(), excelWriter, writeSheet, writeDetailSheet);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (excelWriter != null) {
|
||||
excelWriter.finish();
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void write(List<BusManifest> headers, ExcelWriter excelWriter, WriteSheet writeSheet, WriteSheet writeDetailSheet) {
|
||||
if (CollectionUtils.isEmpty(headers)) {
|
||||
return;
|
||||
}
|
||||
List<ManifestImportExcel> rows = headers.stream().map(item -> PoMapper.instance.manifestEntityToExcel(item)).collect(Collectors.toList());
|
||||
|
||||
excelWriter.write(rows, writeSheet);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(rows)) {
|
||||
ManifestDetailQuery wdQuery = new ManifestDetailQuery();
|
||||
wdQuery.setFields("*+manifest@billNo+vehicleType@name+vehicleTypeDetail@name");
|
||||
wdQuery.setManifestId(headers.stream().map(s -> s.getId()).collect(Collectors.toList()));
|
||||
List<BusManifestDetail> list = baseService.list(BusManifestDetail.class, wdQuery);
|
||||
List<ManifestDetailImportExcel> details = list.stream().map(item -> PoMapper.instance.manifestDetailEntityToExcel(item)).collect(Collectors.toList());
|
||||
excelWriter.write(details, writeDetailSheet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@Operation(summary = "舱单导入", operationId = "11")
|
||||
@GetMapping("/tmp/export")
|
||||
public void tmpExport(HttpServletResponse response) {
|
||||
ExcelWriter excelWriter = null;
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = response.getOutputStream();
|
||||
|
||||
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
String fileName = URLEncoder.encode("内贸整船车辆导入模板", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
|
||||
Map<String, Integer> cols = new HashMap<>();
|
||||
cols.put("船名", 0);
|
||||
cols.put("省份", 1);
|
||||
cols.put("城市", 2);
|
||||
//普通下拉数据
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
String[] isZgArray = {"正常", "国内中转", "外进转内出", "长江", "沿海"};
|
||||
map.put("船名", Arrays.asList(isZgArray));
|
||||
|
||||
Cascade c1 = new Cascade();
|
||||
c1.setColName("城市");
|
||||
c1.setParentColName("省份");
|
||||
Map<String, List<String>> cityMap = new HashMap<>();
|
||||
List<String> cityList1 = new ArrayList<>();
|
||||
cityList1.add("武汉");
|
||||
cityList1.add("孝感");
|
||||
cityList1.add("钟祥");
|
||||
|
||||
List<String> cityList2 = new ArrayList<>();
|
||||
cityList2.add("苏州");
|
||||
cityList2.add("扬州");
|
||||
cityList2.add("镇江");
|
||||
|
||||
cityMap.put("湖北省", cityList1);
|
||||
cityMap.put("江苏省", cityList2);
|
||||
|
||||
c1.setSonValues(cityMap);
|
||||
|
||||
|
||||
CascadeGroup group1 = new CascadeGroup();
|
||||
group1.setName("国家城市");
|
||||
group1.setRootColName("省份");
|
||||
group1.setRootValues(Arrays.asList("湖北省", "江苏省"));
|
||||
group1.setCascades(Arrays.asList(c1));
|
||||
|
||||
|
||||
excelWriter = EasyExcel.write(out)
|
||||
.registerWriteHandler(new CustomCellWriteHandler(cols, map, null, Arrays.asList(group1)))
|
||||
.build();
|
||||
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(0, "内贸整船车辆导入模板").head(ManifestImportExcel.class).build();
|
||||
|
||||
// 查询数据
|
||||
List<ManifestImportExcel> rows = new ArrayList<>();
|
||||
|
||||
excelWriter.write(rows, writeSheet);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (excelWriter != null) {
|
||||
excelWriter.finish();
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,274 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.controller.mapper.PoMapper;
|
||||
import com.wsnet.cargo.entity.*;
|
||||
import com.wsnet.cargo.excel.ManifestDetailImportExcel;
|
||||
import com.wsnet.cargo.query.ManifestQuery;
|
||||
import com.wsnet.cargo.service.BusManifestDetailService;
|
||||
import com.wsnet.cargo.service.BusManifestService;
|
||||
import com.wsnet.cargo.service.DictVehicleTypeDetailService;
|
||||
import com.wsnet.cargo.service.DictVehicleTypeService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.excel.handler.Cascade;
|
||||
import com.wsnet.excel.handler.CascadeGroup;
|
||||
import com.wsnet.excel.handler.CustomCellWriteHandler;
|
||||
import com.wsnet.excel.utils.ExcelPropertiesUtils;
|
||||
import com.wsnet.excel.utils.ExcelUtils;
|
||||
import com.wsnet.web.controller.BaseController;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.Validation;
|
||||
import jakarta.validation.Validator;
|
||||
import jakarta.validation.ValidatorFactory;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/manifest/detail")
|
||||
@Menu(code = "0303", name = "舱单明细")
|
||||
@Tag(name = "舱单明细")
|
||||
public class ManifestDetailController extends BaseController<BusManifestDetailService, BusManifestDetail, ManifestQuery> {
|
||||
|
||||
@Resource
|
||||
private DictVehicleTypeService vehicleTypeService;
|
||||
|
||||
@Resource
|
||||
private DictVehicleTypeDetailService vehicleTypeDetailService;
|
||||
|
||||
@Resource
|
||||
private BusManifestService manifestService;
|
||||
|
||||
@Resource
|
||||
private BusManifestDetailService manifestDetailService;
|
||||
|
||||
@Override
|
||||
public ResultData<Page<BusManifestDetail>> page(@RequestBody ManifestQuery query) {
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Operation(summary = "舱单明细模板下载", operationId = "11")
|
||||
@GetMapping("/tmp/export")
|
||||
public void tmpExport(HttpServletResponse response) {
|
||||
ExcelWriter excelWriter = null;
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = response.getOutputStream();
|
||||
|
||||
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
String fileName = URLEncoder.encode("舱单明细模板", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
Map<String, Integer> cols = ExcelPropertiesUtils.getExcelCols(ManifestDetailImportExcel.class);
|
||||
|
||||
// 显示下拉框数据
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
|
||||
// 隐匿下拉框
|
||||
Map<String, List<String>> excelMap = new HashMap<>();
|
||||
|
||||
// 级联下拉框
|
||||
List<CascadeGroup> groups = new ArrayList<>();
|
||||
{
|
||||
// 车型与车型明细
|
||||
CascadeGroup loadGroup = new CascadeGroup();
|
||||
groups.add(loadGroup);
|
||||
|
||||
List<Cascade> cascades = new ArrayList<>();
|
||||
loadGroup.setCascades(cascades);
|
||||
|
||||
loadGroup.setName("车型与车型明细");
|
||||
loadGroup.setRootColName("*车型");
|
||||
|
||||
// 港口列表
|
||||
List<DictVehicleType> vehicleTypeList = vehicleTypeService.lambdaQuery().eq(DictVehicleType::getStatus, StatusEnums.active).list();
|
||||
loadGroup.setRootValues(vehicleTypeList.stream().map(s -> s.getName()).collect(Collectors.toList()));
|
||||
|
||||
if (CollectionUtils.isNotEmpty(vehicleTypeList)) {
|
||||
Cascade c = new Cascade();
|
||||
cascades.add(c);
|
||||
|
||||
c.setColName("*车型明细");
|
||||
c.setParentColName("*车型");
|
||||
|
||||
// 码头列表
|
||||
Map<String, List<String>> sonValues = new HashMap<>();
|
||||
c.setSonValues(sonValues);
|
||||
|
||||
List<DictVehicleTypeDetail> vehicleTypeDetailList = vehicleTypeDetailService.lambdaQuery().eq(DictVehicleTypeDetail::getStatus, StatusEnums.active).list();
|
||||
|
||||
vehicleTypeList.stream().forEach(s -> {
|
||||
sonValues.put(s.getName(), vehicleTypeDetailList.stream().filter(w -> w.getVehicleTypeId().equals(s.getId())).map(w -> w.getName()).collect(Collectors.toList()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
excelWriter = EasyExcel.write(out)
|
||||
.registerWriteHandler(new CustomCellWriteHandler(cols, map, excelMap, groups))
|
||||
.build();
|
||||
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(0, "舱单明细模板").head(ManifestDetailImportExcel.class).build();
|
||||
|
||||
// 查询数据
|
||||
List<ManifestDetailImportExcel> rows = new ArrayList<>();
|
||||
|
||||
excelWriter.write(rows, writeSheet);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (excelWriter != null) {
|
||||
excelWriter.finish();
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "舱单明细导入", operationId = "12")
|
||||
@PostMapping("/import")
|
||||
public ResultData<String> importExcel(
|
||||
@Parameter(description = "船期ID") Long scheduleId, MultipartFile file) throws IOException {
|
||||
|
||||
ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
|
||||
Validator validator = vf.getValidator();
|
||||
// 错误信息
|
||||
List<JSONObject> errors = new ArrayList<>();
|
||||
// 读取的有效数据
|
||||
List<ManifestDetailImportExcel> dataList = new ArrayList<>();
|
||||
ExcelUtils.readExcel(file.getInputStream(), ManifestDetailImportExcel.class, (rowData) -> {
|
||||
// 这里只验证格式是否正确,并不验证数据的有效性
|
||||
// 对数据进行检验
|
||||
Set<ConstraintViolation<ManifestDetailImportExcel>> set = validator.validate(rowData);
|
||||
if (!CollectionUtils.isEmpty(set)) { // 验证失败的
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", set.stream().map(p -> p.getMessage()).collect(Collectors.joining(",")));
|
||||
errors.add(o);
|
||||
}
|
||||
|
||||
return true;
|
||||
}, (rowDataList) -> {
|
||||
if (CollectionUtils.isNotEmpty(errors)) { // 有错误信息,不做处理
|
||||
return;
|
||||
}
|
||||
|
||||
dataList.addAll(rowDataList);
|
||||
});
|
||||
|
||||
if (CollectionUtils.isNotEmpty(errors)) {
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
return ResultData.fail("没有读取到有效数据");
|
||||
}
|
||||
|
||||
// 对数据的合法性进行验证
|
||||
// 数据库中的车型
|
||||
List<DictVehicleType> vehicleTypeList = vehicleTypeService.lambdaQuery()
|
||||
.eq(DictVehicleType::getStatus, StatusEnums.active)
|
||||
.in(DictVehicleType::getName, dataList.stream().map(s -> s.getVehicleTypeName()).collect(Collectors.toList())).list();
|
||||
|
||||
// 数据库中的车型明细
|
||||
List<DictVehicleTypeDetail> vehicleTypeDetailList = vehicleTypeDetailService.lambdaQuery()
|
||||
.eq(DictVehicleTypeDetail::getStatus, StatusEnums.active)
|
||||
.in(DictVehicleTypeDetail::getName, dataList.stream().map(s -> s.getVehicleTypeDetailName()).collect(Collectors.toList())).list();
|
||||
|
||||
// 数据库中的提单号
|
||||
List<BusManifest> manifestList = manifestService.lambdaQuery()
|
||||
.eq(BusManifest::getScheduleId, scheduleId)
|
||||
.list();
|
||||
|
||||
// 已经存在的车架号
|
||||
List<BusManifestDetail> manifestDetailList = manifestDetailService.lambdaQuery()
|
||||
.in(BusManifestDetail::getManifestId, manifestList.stream().map(s -> s.getId()).collect(Collectors.toList()))
|
||||
.list();
|
||||
|
||||
List<BusManifestDetail> saveDataList = new ArrayList<>();
|
||||
|
||||
for (ManifestDetailImportExcel rowData : dataList) {
|
||||
// 验证提单号是否存在
|
||||
Optional<BusManifest> manifest = manifestList.stream().filter(s -> StringUtils.equals(s.getBillNo(), rowData.getBillNo())).findAny();
|
||||
if (!manifest.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "提单号不存在:" + rowData.getBillNo());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 验证车架号是否已经存在
|
||||
Optional<BusManifestDetail> manifestDetail = manifestDetailList.stream().filter(s -> StringUtils.equals(s.getVin(), rowData.getVin())).findAny();
|
||||
if (manifestDetail.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "VIN已存在:" + rowData.getVin());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 验证车型
|
||||
Optional<DictVehicleType> vehicleType = vehicleTypeList.stream().filter(s -> StringUtils.equals(s.getName(), rowData.getVehicleTypeName())).findAny();
|
||||
if (!vehicleType.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "车型明细不存在:" + rowData.getVehicleTypeName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
|
||||
// 验证车型明细
|
||||
Optional<DictVehicleTypeDetail> vehicleTypeDetail = vehicleTypeDetailList.stream().filter(s -> StringUtils.equals(s.getName(), rowData.getVehicleTypeDetailName())).findAny();
|
||||
if (!vehicleTypeDetail.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "明细不存在:" + rowData.getVehicleTypeDetailName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 验证装车型和车型明细是否一致
|
||||
if (vehicleTypeDetail.get().getVehicleTypeId().compareTo(vehicleType.get().getId()) != 0) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "车型与车型明细不一致:" + rowData.getVehicleTypeDetailName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
BusManifestDetail detail = PoMapper.instance.manifestDetailExcelToEntity(rowData);
|
||||
detail.setManifestId(manifest.get().getId());
|
||||
detail.setVehicleTypeId(vehicleType.get().getId());
|
||||
detail.setVehicleTypeDetailId(vehicleTypeDetail.get().getId());
|
||||
|
||||
saveDataList.add(detail);
|
||||
}
|
||||
|
||||
service.saveBatch(saveDataList);
|
||||
|
||||
return ResultData.success("success");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.BusNotice;
|
||||
import com.wsnet.cargo.query.NoticeQuery;
|
||||
import com.wsnet.cargo.service.BusNoticeService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.web.controller.BaseController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/notice")
|
||||
@Menu(code = "0305", name = "公告")
|
||||
@Tag(name = "公告")
|
||||
public class NoticeController extends BaseController<BusNoticeService, BusNotice, NoticeQuery> {
|
||||
@Override
|
||||
public ResultData<Page<BusNotice>> page(@RequestBody NoticeQuery query) {
|
||||
Set<String> excludeFields = new HashSet<>();
|
||||
excludeFields.add("content");
|
||||
query.setExcludeFields(excludeFields);
|
||||
return super.page(query);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.DictPort;
|
||||
import com.wsnet.cargo.query.PortQuery;
|
||||
import com.wsnet.cargo.service.DictPortService;
|
||||
import com.wsnet.core.annotation.Anonymous;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.dto.DictDTO;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import com.wsnet.web.service.BaseService;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/port")
|
||||
@Tag(name = "港口")
|
||||
@Menu(code = "0204", name = "港口")
|
||||
@Validated
|
||||
public class PortController extends BaseDictController<DictPortService, DictPort, PortQuery> {
|
||||
|
||||
// 注册时也会用到港口列表
|
||||
@Override
|
||||
@Anonymous
|
||||
protected ResultData<List<DictDTO>> list(@RequestParam(name = "q",required = false) @Parameter(description = "过滤查询") String q, @RequestParam(name = "ref",required = false) @Parameter(description = "外键值") String ref) {
|
||||
return super.list(q, ref);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictPort>> page(@RequestBody PortQuery query) {
|
||||
query.setFields("*+province@name+city@name");
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated DictPort entity) {
|
||||
// 验证港口编码是否重复
|
||||
boolean exists = service.lambdaQuery().eq(DictPort::getCode, entity.getCode()).ne(entity.getId() != null, DictPort::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("港口编码重复");
|
||||
}
|
||||
|
||||
exists = service.lambdaQuery().eq(DictPort::getName, entity.getName()).ne(entity.getId() != null, DictPort::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("港口名称重复");
|
||||
}
|
||||
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.DictShipRoute;
|
||||
import com.wsnet.cargo.query.RouteQuery;
|
||||
import com.wsnet.cargo.service.DictShipRouteService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/route")
|
||||
@Tag(name = "航线")
|
||||
@Menu(code = "0205", name = "航线")
|
||||
@Validated
|
||||
public class RouteController extends BaseDictController<DictShipRouteService, DictShipRoute, RouteQuery> {
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictShipRoute>> page(@RequestBody RouteQuery query) {
|
||||
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated DictShipRoute entity) {
|
||||
// 验证港口编码是否重复
|
||||
boolean exists = service.lambdaQuery().eq(DictShipRoute::getCode, entity.getCode()).ne(entity.getId() != null, DictShipRoute::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("名称已存在");
|
||||
}
|
||||
|
||||
exists = service.lambdaQuery().eq(DictShipRoute::getName, entity.getName()).ne(entity.getId() != null, DictShipRoute::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("代码已存在");
|
||||
}
|
||||
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.DictShipRoutePort;
|
||||
import com.wsnet.cargo.query.RoutePortQuery;
|
||||
import com.wsnet.cargo.service.DictShipRoutePortService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/route/wharf")
|
||||
@Tag(name = "航线码头")
|
||||
@Menu(code = "0206", name = "航线码头")
|
||||
@Validated
|
||||
public class RouteWharfController extends BaseDictController<DictShipRoutePortService, DictShipRoutePort, RoutePortQuery> {
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictShipRoutePort>> page(@RequestBody RoutePortQuery query) {
|
||||
query.setFields("*+route@name+port@name+wharf@name");
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated DictShipRoutePort entity) {
|
||||
// 验证港口编码是否重复
|
||||
boolean exists = service.lambdaQuery().eq(DictShipRoutePort::getWharfId, entity.getWharfId())
|
||||
.eq(DictShipRoutePort::getRouteId, entity.getRouteId()).eq(DictShipRoutePort::getPortId, entity.getPortId())
|
||||
.ne(entity.getId() != null, DictShipRoutePort::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("航线码头已存在");
|
||||
}
|
||||
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,439 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.controller.mapper.PoMapper;
|
||||
import com.wsnet.cargo.entity.*;
|
||||
import com.wsnet.cargo.enums.ShipStatusEnums;
|
||||
import com.wsnet.cargo.enums.TradeTypeEnums;
|
||||
import com.wsnet.cargo.excel.SailScheduleImportExcel;
|
||||
import com.wsnet.cargo.query.SailScheduleQuery;
|
||||
import com.wsnet.cargo.service.*;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import com.wsnet.core.holder.UserContext;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.dto.CargoApiUser;
|
||||
import com.wsnet.excel.handler.Cascade;
|
||||
import com.wsnet.excel.handler.CascadeGroup;
|
||||
import com.wsnet.excel.handler.CustomCellWriteHandler;
|
||||
import com.wsnet.excel.utils.ExcelPropertiesUtils;
|
||||
import com.wsnet.excel.utils.ExcelUtils;
|
||||
import com.wsnet.web.controller.BaseController;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.Validation;
|
||||
import jakarta.validation.Validator;
|
||||
import jakarta.validation.ValidatorFactory;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sail_schedule")
|
||||
@Menu(code = "0301", name = "船期")
|
||||
@Tag(name = "船期")
|
||||
public class SailScheduleController extends BaseController<BusSailScheduleService, BusSailSchedule, SailScheduleQuery> {
|
||||
@Resource
|
||||
private DictShipService shipService;
|
||||
|
||||
@Resource
|
||||
private DictShipRouteService routeService;
|
||||
|
||||
@Resource
|
||||
private DictPortService portService;
|
||||
|
||||
@Resource
|
||||
private DictWharfService wharfService;
|
||||
|
||||
@Override
|
||||
public ResultData<Page<BusSailSchedule>> page(@RequestBody SailScheduleQuery query) {
|
||||
query.setFields("*+enterprise@name+ship@name+route@name+loadWharf@name+dischargeWharf@name+loadPort@name+dischargePort@name");
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated BusSailSchedule entity) {
|
||||
// 验证 船名,航次不允许重复
|
||||
boolean exists = service.lambdaQuery().eq(BusSailSchedule::getShipId, entity.getShipId())
|
||||
.eq(BusSailSchedule::getVoyage, entity.getVoyage())
|
||||
.ne(entity.getId() != null, BusSailSchedule::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("船名,航次已存在");
|
||||
}
|
||||
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "船期模板下载", operationId = "11")
|
||||
@GetMapping("/tmp/export")
|
||||
public void tmpExport(HttpServletResponse response) {
|
||||
ExcelWriter excelWriter = null;
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = response.getOutputStream();
|
||||
|
||||
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
String fileName = URLEncoder.encode("船期模板", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
Map<String, Integer> cols = ExcelPropertiesUtils.getExcelCols(SailScheduleImportExcel.class);
|
||||
|
||||
// 显示下拉框数据
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
{
|
||||
// 贸易类型
|
||||
List<String> list = Arrays.stream(TradeTypeEnums.values()).map(s -> s.getDesc()).collect(Collectors.toList());
|
||||
map.put("*贸易类型", list);
|
||||
|
||||
}
|
||||
|
||||
// 隐匿下拉框
|
||||
Map<String, List<String>> excelMap = new HashMap<>();
|
||||
{
|
||||
// 船舶
|
||||
List<String> shipList = shipService.lambdaQuery().eq(DictShip::getStatus, StatusEnums.active).list()
|
||||
.stream().map(s -> s.getName()).collect(Collectors.toList());
|
||||
|
||||
excelMap.put("*船名", shipList);
|
||||
|
||||
// 航线
|
||||
List<String> routeList = routeService.lambdaQuery().eq(DictShipRoute::getStatus, StatusEnums.active).list()
|
||||
.stream().map(s -> s.getName()).collect(Collectors.toList());
|
||||
excelMap.put("*航线", routeList);
|
||||
}
|
||||
|
||||
// 级联下拉框
|
||||
|
||||
List<CascadeGroup> groups = new ArrayList<>();
|
||||
|
||||
{
|
||||
{
|
||||
// 装货港港口与码头
|
||||
CascadeGroup loadGroup = new CascadeGroup();
|
||||
groups.add(loadGroup);
|
||||
|
||||
List<Cascade> cascades = new ArrayList<>();
|
||||
loadGroup.setCascades(cascades);
|
||||
|
||||
loadGroup.setName("装货港港口与码头");
|
||||
loadGroup.setRootColName("*装货港口");
|
||||
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
Long bindPortId = user.getPortId();
|
||||
// 港口列表
|
||||
List<DictPort> ports = portService.lambdaQuery().eq(DictPort::getStatus, StatusEnums.active).eq(bindPortId != null, DictPort::getId, bindPortId).list();
|
||||
loadGroup.setRootValues(ports.stream().map(s -> s.getName()).collect(Collectors.toList()));
|
||||
|
||||
if (CollectionUtils.isNotEmpty(ports)) {
|
||||
Cascade c = new Cascade();
|
||||
cascades.add(c);
|
||||
|
||||
c.setColName("*装货码头");
|
||||
c.setParentColName("*装货港口");
|
||||
|
||||
// 码头列表
|
||||
Map<String, List<String>> sonValues = new HashMap<>();
|
||||
c.setSonValues(sonValues);
|
||||
|
||||
List<DictWharf> wharfList = wharfService.lambdaQuery().eq(DictWharf::getStatus, StatusEnums.active)
|
||||
.in(DictWharf::getPortId, ports.stream().map(s -> s.getId()).collect(Collectors.toList())).list();
|
||||
|
||||
ports.stream().forEach(s -> {
|
||||
sonValues.put(s.getName(), wharfList.stream().filter(w -> w.getPortId().equals(s.getId())).map(w -> w.getName()).collect(Collectors.toList()));
|
||||
});
|
||||
}
|
||||
}
|
||||
{
|
||||
// 缷货港港口与码头
|
||||
CascadeGroup dischargeGroup = new CascadeGroup();
|
||||
groups.add(dischargeGroup);
|
||||
|
||||
List<Cascade> cascades = new ArrayList<>();
|
||||
dischargeGroup.setCascades(cascades);
|
||||
|
||||
dischargeGroup.setName("缷货港港口与码头");
|
||||
dischargeGroup.setRootColName("*卸货港口");
|
||||
|
||||
// 港口列表
|
||||
List<DictPort> ports = portService.lambdaQuery().eq(DictPort::getStatus, StatusEnums.active).list();
|
||||
dischargeGroup.setRootValues(ports.stream().map(s -> s.getName()).collect(Collectors.toList()));
|
||||
|
||||
if (CollectionUtils.isNotEmpty(ports)) {
|
||||
Cascade c = new Cascade();
|
||||
cascades.add(c);
|
||||
|
||||
c.setColName("*卸货码头");
|
||||
c.setParentColName("*卸货港口");
|
||||
|
||||
// 码头列表
|
||||
Map<String, List<String>> sonValues = new HashMap<>();
|
||||
c.setSonValues(sonValues);
|
||||
|
||||
List<DictWharf> wharfList = wharfService.lambdaQuery().eq(DictWharf::getStatus, StatusEnums.active)
|
||||
.in(DictWharf::getPortId, ports.stream().map(s -> s.getId()).collect(Collectors.toList())).list();
|
||||
|
||||
ports.stream().forEach(s -> {
|
||||
sonValues.put(s.getName(), wharfList.stream().filter(w -> w.getPortId().equals(s.getId())).map(w -> w.getName()).collect(Collectors.toList()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
excelWriter = EasyExcel.write(out)
|
||||
.registerWriteHandler(new CustomCellWriteHandler(cols, map, excelMap, groups))
|
||||
.build();
|
||||
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(0, "船期模板").head(SailScheduleImportExcel.class).build();
|
||||
|
||||
// 查询数据
|
||||
List<SailScheduleImportExcel> rows = new ArrayList<>();
|
||||
|
||||
excelWriter.write(rows, writeSheet);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (excelWriter != null) {
|
||||
excelWriter.finish();
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "船期导入", operationId = "12")
|
||||
@PostMapping("/import")
|
||||
public ResultData<String> importExcel(MultipartFile file) throws IOException {
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
|
||||
ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
|
||||
Validator validator = vf.getValidator();
|
||||
// 错误信息
|
||||
List<JSONObject> errors = new ArrayList<>();
|
||||
// 读取的excel中,已经存在的船名,航次
|
||||
List<String> existsShipVoyages = new ArrayList<>();
|
||||
// 读取的有效数据
|
||||
List<SailScheduleImportExcel> dataList = new ArrayList<>();
|
||||
ExcelUtils.readExcel(file.getInputStream(), SailScheduleImportExcel.class, (rowData) -> {
|
||||
// 这里只验证格式是否正确,并不验证数据的有效性
|
||||
// 对数据进行检验
|
||||
Set<ConstraintViolation<SailScheduleImportExcel>> set = validator.validate(rowData);
|
||||
if (!CollectionUtils.isEmpty(set)) { // 验证失败的
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", set.stream().map(p -> p.getMessage()).collect(Collectors.joining(",")));
|
||||
errors.add(o);
|
||||
}
|
||||
|
||||
// 船名、航次不允许重复
|
||||
if (existsShipVoyages.contains(StringUtils.join(rowData.getShipName(), "#$#", rowData.getVoyage()))) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "excel中船名:" + rowData.getShipName()+", 航次:" + rowData.getVoyage() + "重复");
|
||||
errors.add(o);
|
||||
} else {
|
||||
existsShipVoyages.add(StringUtils.join(rowData.getShipName(), "#$#", rowData.getVoyage()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}, (rowDataList) -> {
|
||||
if (CollectionUtils.isNotEmpty(errors)) { // 有错误信息,不做处理
|
||||
return;
|
||||
}
|
||||
|
||||
dataList.addAll(rowDataList);
|
||||
});
|
||||
|
||||
if (CollectionUtils.isNotEmpty(errors)) {
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
return ResultData.fail("没有读取到有效数据");
|
||||
}
|
||||
|
||||
// 对数据的合法性进行验证
|
||||
// 数据库中的船舶
|
||||
List<DictShip> shipList = shipService.lambdaQuery()
|
||||
.eq(DictShip::getStatus, StatusEnums.active)
|
||||
.in(DictShip::getName, dataList.stream().map(s -> s.getShipName()).collect(Collectors.toList())).list();
|
||||
|
||||
// 数据库中的航线
|
||||
List<DictShipRoute> routeList = routeService.lambdaQuery()
|
||||
.eq(DictShipRoute::getStatus, StatusEnums.active)
|
||||
.in(DictShipRoute::getName, dataList.stream().map(s -> s.getShipRoute()).collect(Collectors.toList())).list();
|
||||
|
||||
// 数据库中的港口
|
||||
List<DictPort> portList = portService.lambdaQuery()
|
||||
.eq(DictPort::getStatus, StatusEnums.active)
|
||||
.in(DictPort::getName, CollectionUtils.union(dataList.stream().map(s -> s.getLoadPortName()).collect(Collectors.toList()), dataList.stream().map(s -> s.getDischargePortName()).collect(Collectors.toList())))
|
||||
.list();
|
||||
|
||||
// 数据库中的码头
|
||||
List<DictWharf> wharfList = wharfService.lambdaQuery()
|
||||
.eq(DictWharf::getStatus, StatusEnums.active)
|
||||
.in(DictWharf::getName, CollectionUtils.union(dataList.stream().map(s -> s.getLoadWharfName()).collect(Collectors.toList()), dataList.stream().map(s -> s.getDischargeWharfName()).collect(Collectors.toList())))
|
||||
.list();
|
||||
|
||||
List<BusSailSchedule> saveDataList = new ArrayList<>();
|
||||
|
||||
for (SailScheduleImportExcel rowData : dataList) {
|
||||
|
||||
// 贸易类型是否存在
|
||||
TradeTypeEnums tradeType = TradeTypeEnums.getEnumByDesc(rowData.getTradeTypeDesc());
|
||||
if (tradeType == null) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "贸易类型不存在:" + rowData.getShipName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 航线是否存在
|
||||
Optional<DictShipRoute> route = routeList.stream().filter(s -> StringUtils.equals(s.getName(), rowData.getShipRoute())).findAny();
|
||||
if (!route.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "航线不存在:" + rowData.getShipRoute());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 船名是否存在
|
||||
Optional<DictShip> ship = shipList.stream().filter(s -> StringUtils.equals(s.getName(), rowData.getShipName())).findAny();
|
||||
if (!ship.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "船名不存在:" + rowData.getShipName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 船名航次是否存在
|
||||
boolean exists = service.lambdaQuery().eq(BusSailSchedule::getShipId, ship.get().getId()).eq(BusSailSchedule::getVoyage, rowData.getVoyage()).exists();
|
||||
if (exists) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "数据库中,船名:" + rowData.getShipName()+", 航次:" + rowData.getVoyage() + "已存在");
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 验证装货港口
|
||||
Optional<DictPort> loadPort = portList.stream().filter(s -> StringUtils.equals(s.getName(), rowData.getLoadPortName())).findAny();
|
||||
if (!loadPort.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "港口不存在:" + rowData.getLoadPortName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 是否与登录的港口一致
|
||||
if (user.getPortId().compareTo(loadPort.get().getId()) != 0) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "登录用户港口与导入的港口不一致:" + rowData.getLoadPortName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 验证装货码头
|
||||
Optional<DictWharf> loadWharf = wharfList.stream().filter(s -> StringUtils.equals(s.getName(), rowData.getLoadWharfName())).findAny();
|
||||
if (!loadWharf.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "码头不存在:" + rowData.getLoadWharfName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 是否与登录的码头一致
|
||||
if (user.getWharfId().compareTo(loadWharf.get().getId()) != 0) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "登录用户码头与导入的码头不一致:" + rowData.getLoadWharfName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 验证装货码头是否和港口一致
|
||||
if (loadWharf.get().getPortId().compareTo(loadPort.get().getId()) != 0) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "装货码头与装货港口不一致:" + rowData.getLoadWharfName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 验证卸货港口
|
||||
Optional<DictPort> dischargePort = portList.stream().filter(s -> StringUtils.equals(s.getName(), rowData.getDischargePortName())).findAny();
|
||||
if (!dischargePort.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "卸货港口不存在:" + rowData.getDischargePortName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 验证卸货码头
|
||||
Optional<DictWharf> dischargeWharf = wharfList.stream().filter(s -> StringUtils.equals(s.getName(), rowData.getDischargeWharfName())).findAny();
|
||||
if (!dischargeWharf.isPresent()) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "卸货码头不存在:" + rowData.getDischargeWharfName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
// 验证卸货码头是否和港口一致
|
||||
if (dischargeWharf.get().getPortId().compareTo(dischargePort.get().getId()) != 0) {
|
||||
JSONObject o = JSONObject.from(rowData);
|
||||
o.put("status", "卸货码头与卸货港口不一致:" + rowData.getDischargeWharfName());
|
||||
errors.add(o);
|
||||
return ResultData.fail(JSON.toJSONString(errors));
|
||||
}
|
||||
|
||||
BusSailSchedule schedule = PoMapper.instance.sailScheduleExcelToEntity(rowData);
|
||||
schedule.setEnterpriseId(user.getEnterpriseId());
|
||||
schedule.setTradeType(tradeType);
|
||||
schedule.setShipRouteId(route.get().getId());
|
||||
schedule.setShipId(ship.get().getId());
|
||||
schedule.setLoadPortId(loadPort.get().getId());
|
||||
schedule.setLoadWharfId(loadWharf.get().getId());
|
||||
schedule.setDischargePortId(dischargePort.get().getId());
|
||||
schedule.setDischargeWharfId(dischargeWharf.get().getId());
|
||||
schedule.setShipStatus(ShipStatusEnums.SEA);
|
||||
|
||||
saveDataList.add(schedule);
|
||||
}
|
||||
|
||||
service.saveBatch(saveDataList);
|
||||
|
||||
return ResultData.success("success");
|
||||
}
|
||||
|
||||
@Operation(summary = "船期导出", operationId = "13")
|
||||
@GetMapping("/export")
|
||||
public void exportExcel(SailScheduleQuery query, HttpServletResponse response) throws IOException {
|
||||
query.setFields("*+enterprise@name+ship@name+route@name+loadWharf@name+dischargeWharf@name+loadPort@name+dischargePort@name");
|
||||
List<BusSailSchedule> list = baseService.list(BusSailSchedule.class, query);
|
||||
|
||||
List<SailScheduleImportExcel> collect = list.stream().map(s -> PoMapper.instance.sailScheduleEntityToExcel(s)).collect(Collectors.toList());
|
||||
|
||||
ExcelUtils.export(response, DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN) + "船期", "船期", collect, SailScheduleImportExcel.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.DictShipChart;
|
||||
import com.wsnet.cargo.query.ShipChartQuery;
|
||||
import com.wsnet.cargo.service.DictShipChartService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/ship/chart")
|
||||
@Menu(code = "0208", name = "船图")
|
||||
@Tag(name = "船图")
|
||||
public class ShipChartController extends BaseDictController<DictShipChartService, DictShipChart, ShipChartQuery> {
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictShipChart>> page(@RequestBody ShipChartQuery query) {
|
||||
query.setFields("*+ship@name");
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated DictShipChart entity) {
|
||||
// 验证港口编码是否重复
|
||||
boolean exists = service.lambdaQuery().eq(DictShipChart::getShipId, entity.getShipId()).ne(entity.getId() != null, DictShipChart::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("船图已存在");
|
||||
}
|
||||
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.DictShip;
|
||||
import com.wsnet.cargo.query.ShipQuery;
|
||||
import com.wsnet.cargo.service.DictShipService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/ship")
|
||||
@Tag(name = "船舶")
|
||||
@Menu(code = "0207", name = "船舶")
|
||||
@Validated
|
||||
public class ShipController extends BaseDictController<DictShipService, DictShip, ShipQuery> {
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictShip>> page(@RequestBody ShipQuery query) {
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated DictShip entity) {
|
||||
boolean exists = service.lambdaQuery().eq(DictShip::getName, entity.getName()).ne(entity.getId() != null, DictShip::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("名称已存在");
|
||||
}
|
||||
|
||||
exists = service.lambdaQuery().eq(DictShip::getMmsi, entity.getMmsi()).ne(entity.getId() != null, DictShip::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("码码已存在");
|
||||
}
|
||||
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.wsnet.cargo.entity.BusSubscribe;
|
||||
import com.wsnet.cargo.query.SubscribeQuery;
|
||||
import com.wsnet.cargo.service.BusSubscribeService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.holder.UserContext;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.dto.CargoApiUser;
|
||||
import com.wsnet.web.controller.BaseController;
|
||||
import com.wsnet.web.service.BaseService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/subscribe")
|
||||
@Menu(code = "0304", name = "订阅")
|
||||
@Tag(name = "订阅")
|
||||
public class SubscribeController extends BaseController<BusSubscribeService, BusSubscribe, SubscribeQuery> {
|
||||
|
||||
@Resource
|
||||
private BaseService baseService;
|
||||
|
||||
@Operation(summary = "我发布的订阅", operationId = "10")
|
||||
@PostMapping("/publish/page")
|
||||
public ResultData<IPage<BusSubscribe>> publishPage(@RequestBody SubscribeQuery query) {
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
query.setEnterpriseId(user.getEnterpriseId());
|
||||
IPage<BusSubscribe> page = baseService.page(BusSubscribe.class, query);
|
||||
return ResultData.success(page);
|
||||
}
|
||||
|
||||
@Operation(summary = "我收到的订阅", operationId = "11")
|
||||
@PostMapping("/receive/page")
|
||||
public ResultData<IPage<BusSubscribe>> receivePage(@RequestBody SubscribeQuery query) {
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
query.setSubEnterpriseId(user.getEnterpriseId());
|
||||
IPage<BusSubscribe> page = baseService.page(BusSubscribe.class, query);
|
||||
return ResultData.success(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated BusSubscribe entity) {
|
||||
// 提单号不允许重复
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
entity.setEnterpriseId(user.getEnterpriseId());
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.DictVehicleType;
|
||||
import com.wsnet.cargo.query.VehicleTypeQuery;
|
||||
import com.wsnet.cargo.service.DictVehicleTypeService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/vehicle_type")
|
||||
@Tag(name = "车型")
|
||||
@Menu(code = "0209", name = "车型")
|
||||
@Validated
|
||||
public class VehicleTypeController extends BaseDictController<DictVehicleTypeService, DictVehicleType, VehicleTypeQuery> {
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictVehicleType>> page(@RequestBody VehicleTypeQuery query) {
|
||||
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated DictVehicleType entity) {
|
||||
// 验证港口编码是否重复
|
||||
boolean exists = service.lambdaQuery().eq(DictVehicleType::getName, entity.getName()).ne(entity.getId() != null, DictVehicleType::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("名称已存在");
|
||||
}
|
||||
|
||||
exists = service.lambdaQuery().eq(DictVehicleType::getCode, entity.getCode()).ne(entity.getId() != null, DictVehicleType::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("编码已存在");
|
||||
}
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.DictVehicleTypeDetail;
|
||||
import com.wsnet.cargo.query.VehicleTypeDetailQuery;
|
||||
import com.wsnet.cargo.service.DictVehicleTypeDetailService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/vehicle_type/detail")
|
||||
@Tag(name = "车型明细")
|
||||
@Menu(code = "0210", name = "车型明细")
|
||||
@Validated
|
||||
public class VehicleTypeDetailController extends BaseDictController<DictVehicleTypeDetailService, DictVehicleTypeDetail, VehicleTypeDetailQuery> {
|
||||
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictVehicleTypeDetail>> page(@RequestBody VehicleTypeDetailQuery query) {
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated DictVehicleTypeDetail entity) {
|
||||
// 验证港口编码是否重复
|
||||
boolean exists = service.lambdaQuery().eq(DictVehicleTypeDetail::getName, entity.getName()).ne(entity.getId() != null, DictVehicleTypeDetail::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("名称已存在");
|
||||
}
|
||||
|
||||
exists = service.lambdaQuery().eq(DictVehicleTypeDetail::getCode, entity.getCode()).ne(entity.getId() != null, DictVehicleTypeDetail::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("编码已存在");
|
||||
}
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wsnet.cargo.entity.DictWharf;
|
||||
import com.wsnet.cargo.query.WharfQuery;
|
||||
import com.wsnet.cargo.service.DictWharfService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.web.controller.BaseDictController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/wharf")
|
||||
@Tag(name = "码头")
|
||||
@Menu(code = "0211", name = "码头")
|
||||
@Validated
|
||||
public class WharfController extends BaseDictController<DictWharfService, DictWharf, WharfQuery> {
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictWharf>> page(@RequestBody WharfQuery query) {
|
||||
query.setFields("*+port@name");
|
||||
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultData<Long> save(@RequestBody @Validated DictWharf entity) {
|
||||
// 验证港口编码是否重复
|
||||
boolean exists = service.lambdaQuery().eq(DictWharf::getName, entity.getName()).eq(DictWharf::getPortId, entity.getPortId()).ne(entity.getId() != null,DictWharf::getId, entity.getId()).exists();
|
||||
if (exists) {
|
||||
return ResultData.fail("码头名称已存在");
|
||||
}
|
||||
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.wsnet.cargo.controller.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.BusManifest;
|
||||
import com.wsnet.cargo.entity.BusManifestDetail;
|
||||
import com.wsnet.cargo.entity.BusSailSchedule;
|
||||
import com.wsnet.cargo.excel.ManifestDetailImportExcel;
|
||||
import com.wsnet.cargo.excel.ManifestImportExcel;
|
||||
import com.wsnet.cargo.excel.SailScheduleImportExcel;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface PoMapper {
|
||||
PoMapper instance = Mappers.getMapper(PoMapper.class);
|
||||
|
||||
BusSailSchedule sailScheduleExcelToEntity(SailScheduleImportExcel excel);
|
||||
|
||||
BusManifest manifestExcelToEntity(ManifestImportExcel excel);
|
||||
|
||||
BusManifestDetail manifestDetailExcelToEntity(ManifestDetailImportExcel excel);
|
||||
|
||||
@Mapping(target = "tradeTypeDesc", source = "tradeType.desc")
|
||||
@Mapping(target = "shipRoute", source = "route.name")
|
||||
@Mapping(target = "shipName", source = "ship.name")
|
||||
@Mapping(target = "loadPortName", source = "loadPort.name")
|
||||
@Mapping(target = "loadWharfName", source = "loadWharf.name")
|
||||
@Mapping(target = "dischargePortName", source = "dischargePort.name")
|
||||
@Mapping(target = "dischargeWharfName", source = "dischargeWharf.name")
|
||||
SailScheduleImportExcel sailScheduleEntityToExcel(BusSailSchedule entity);
|
||||
|
||||
@Mapping(target = "brandName", source = "brand.name")
|
||||
ManifestImportExcel manifestEntityToExcel(BusManifest entity);
|
||||
|
||||
@Mapping(target = "billNo", source = "manifest.billNo")
|
||||
@Mapping(target = "vehicleTypeName", source = "vehicleType.name")
|
||||
@Mapping(target = "vehicleTypeDetailName", source = "vehicleTypeDetail.name")
|
||||
ManifestDetailImportExcel manifestDetailEntityToExcel(BusManifestDetail entity);
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.wsnet.cargo.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.wsnet.cargo.enums.EnterpriseTypeEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Schema(title = "企业注册信息")
|
||||
public class EnterpriseVo implements Serializable {
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
@Schema(description = "企业名称")
|
||||
@NotBlank(message = "企业名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 企业编码
|
||||
*/
|
||||
@Schema(description = "企业编码")
|
||||
@NotBlank(message = "企业编码不能为空")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@Schema(description = "详细地址")
|
||||
@NotBlank(message = "详细地址不能为空")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 法人代表
|
||||
*/
|
||||
@Schema(description = "法人代表")
|
||||
@NotBlank(message = "法人代表不能为空")
|
||||
private String legalPerson;
|
||||
|
||||
/**
|
||||
* 合同编号
|
||||
*/
|
||||
@Schema(description = "合同编号")
|
||||
@NotBlank(message = "合同编号不能为空")
|
||||
private String contractNo;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@Schema(description = "联系人")
|
||||
@NotBlank(message = "联系人不能为空")
|
||||
private String linkman;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Schema(description = "联系电话")
|
||||
@NotBlank(message = "联系电话不能为空")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Schema(description = "登录密码")
|
||||
@NotBlank(message = "登录密码不能为空")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 绑定的港口ID
|
||||
*/
|
||||
@Schema(description = "绑定的港口ID")
|
||||
private Long portId;
|
||||
|
||||
@Schema(description = "营业执照")
|
||||
@NotBlank(message = "营业执照不能为空")
|
||||
private String licensePhoto;
|
||||
|
||||
@Schema(description = "身份证")
|
||||
@NotBlank(message = "身份证不能为空")
|
||||
private String idPhoto;
|
||||
|
||||
/**
|
||||
* 企业类别
|
||||
*/
|
||||
@Schema(description = "企业类别")
|
||||
@NotNull(message = "企业类别不能为空")
|
||||
@TableField(value = "enterprise_type")
|
||||
private EnterpriseTypeEnums enterpriseType;
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.cargo.enums.GoodsStatusEnums;
|
||||
import com.wsnet.core.db.annos.DbBean;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 舱单信息
|
||||
* @TableName bus_manifest
|
||||
*/
|
||||
@TableName(value ="bus_manifest")
|
||||
@Data
|
||||
@Schema(title = "舱单信息")
|
||||
public class BusManifest extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 船期ID
|
||||
*/
|
||||
@TableField(value = "schedule_id")
|
||||
@Schema(description = "船期ID")
|
||||
@NotNull(message = "船期ID不能为空")
|
||||
private Long scheduleId;
|
||||
|
||||
/**
|
||||
* 舱层
|
||||
*/
|
||||
@TableField(value = "deck")
|
||||
@Schema(description = "舱层")
|
||||
@NotNull(message = "舱层不能为空")
|
||||
private Integer deck;
|
||||
|
||||
/**
|
||||
* 舱段
|
||||
*/
|
||||
@TableField(value = "cabin")
|
||||
@Schema(description = "舱段")
|
||||
@NotNull(message = "舱段不能为空")
|
||||
private Integer cabin;
|
||||
|
||||
/**
|
||||
* 提单号
|
||||
*/
|
||||
@TableField(value = "bill_no")
|
||||
@Schema(description = "提单号")
|
||||
@NotNull(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
/**
|
||||
* 货名
|
||||
*/
|
||||
@TableField(value = "goods_name")
|
||||
@Schema(description = "货名")
|
||||
@NotNull(message = "货名不能为空")
|
||||
private String goodsName;
|
||||
|
||||
/**
|
||||
* 品牌ID
|
||||
*/
|
||||
@TableField(value = "brand_id")
|
||||
@Schema(description = "品牌ID")
|
||||
@NotNull(message = "品牌ID不能为空")
|
||||
private Long brandId;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
@TableField(value = "model")
|
||||
@Schema(description = "型号")
|
||||
@NotNull(message = "型号不能为空")
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 唛头
|
||||
*/
|
||||
@TableField(value = "shipping_mark")
|
||||
@Schema(description = "唛头")
|
||||
private String shippingMark;
|
||||
|
||||
/**
|
||||
* 车数量
|
||||
*/
|
||||
@TableField(value = "car_num")
|
||||
@Schema(description = "车数量")
|
||||
private Integer carNum;
|
||||
|
||||
/**
|
||||
* 件杂货数
|
||||
*/
|
||||
@TableField(value = "spare_num")
|
||||
@Schema(description = "件杂货数")
|
||||
private Integer spareNum;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@TableField(value = "weight")
|
||||
@Schema(description = "重量")
|
||||
@NotNull(message = "重量不能为空")
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
* 体积
|
||||
*/
|
||||
@TableField(value = "volume")
|
||||
@Schema(description = "体积")
|
||||
@NotNull(message = "体积不能为空")
|
||||
private BigDecimal volume;
|
||||
|
||||
/**
|
||||
* 发货人
|
||||
*/
|
||||
@TableField(value = "consigner")
|
||||
@Schema(description = "发货人")
|
||||
private String consigner;
|
||||
|
||||
/**
|
||||
* 收货人
|
||||
*/
|
||||
@TableField(value = "consignee")
|
||||
@Schema(description = "收货人")
|
||||
private String consignee;
|
||||
|
||||
/**
|
||||
* 货物状态
|
||||
*/
|
||||
@TableField(value = "goods_status")
|
||||
@Schema(description = "货物状态")
|
||||
private GoodsStatusEnums goodsStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "品牌")
|
||||
@DbBean(ref = "brandId")
|
||||
private DictBrand brand;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.annos.DbBean;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 舱单明细
|
||||
* @TableName bus_manifest_detail
|
||||
*/
|
||||
@TableName(value ="bus_manifest_detail")
|
||||
@Data
|
||||
@Schema(title = "舱单明细")
|
||||
public class BusManifestDetail extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 舱单ID
|
||||
*/
|
||||
@TableField(value = "manifest_id")
|
||||
@Schema(description = "舱单ID")
|
||||
@NotNull(message = "舱单ID不能为空")
|
||||
private Long manifestId;
|
||||
|
||||
/**
|
||||
* 车型ID
|
||||
*/
|
||||
@TableField(value = "vehicle_type_id")
|
||||
@Schema(description = "车型ID")
|
||||
@NotNull(message = "车型ID不能为空")
|
||||
private Long vehicleTypeId;
|
||||
|
||||
/**
|
||||
* 车型明细
|
||||
*/
|
||||
@TableField(value = "vehicle_type_detail_id")
|
||||
@Schema(description = "车型明细ID")
|
||||
@NotNull(message = "车型明细ID不能为空")
|
||||
private Long vehicleTypeDetailId;
|
||||
|
||||
/**
|
||||
* vin
|
||||
*/
|
||||
@TableField(value = "vin")
|
||||
@Schema(description = "vin")
|
||||
@NotBlank(message = "vin码不能为空")
|
||||
private String vin;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@TableField(value = "weight")
|
||||
@Schema(description = "重量")
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
* 体积
|
||||
*/
|
||||
@TableField(value = "volume")
|
||||
@Schema(description = "体积")
|
||||
private BigDecimal volume;
|
||||
|
||||
/**
|
||||
* 长
|
||||
*/
|
||||
@TableField(value = "length")
|
||||
@Schema(description = "长")
|
||||
private BigDecimal length;
|
||||
|
||||
/**
|
||||
* 宽
|
||||
*/
|
||||
@TableField(value = "width")
|
||||
@Schema(description = "宽")
|
||||
private BigDecimal width;
|
||||
|
||||
/**
|
||||
* 高
|
||||
*/
|
||||
@TableField(value = "height")
|
||||
@Schema(description = "高")
|
||||
private BigDecimal height;
|
||||
|
||||
/**
|
||||
* BAmm
|
||||
*/
|
||||
@TableField(value = "b_amm")
|
||||
@Schema(description = "BAmm")
|
||||
private String bAmm;
|
||||
|
||||
/**
|
||||
* LRmm
|
||||
*/
|
||||
@TableField(value = "l_rmm")
|
||||
@Schema(description = "LRmm")
|
||||
private String lRmm;
|
||||
|
||||
/**
|
||||
* 有无质损
|
||||
*/
|
||||
@TableField(value = "damage")
|
||||
@Schema(description = "有无质损")
|
||||
private String damage;
|
||||
|
||||
/**
|
||||
* 质损描述
|
||||
*/
|
||||
@TableField(value = "damage_desc")
|
||||
@Schema(description = "质损描述")
|
||||
private String damageDesc;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "vehicleTypeId")
|
||||
@Schema(description = "车型")
|
||||
private DictVehicleType vehicleType;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "vehicleTypeDetailId")
|
||||
@Schema(description = "车型明细")
|
||||
private DictVehicleTypeDetail vehicleTypeDetail;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "manifestId")
|
||||
@Schema(description = "舱单")
|
||||
private BusManifest manifest;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 公告
|
||||
* @TableName bus_notice
|
||||
*/
|
||||
@TableName(value ="bus_notice")
|
||||
@Data
|
||||
@Schema(title = "公告")
|
||||
public class BusNotice extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 公告标题
|
||||
*/
|
||||
@TableField(value = "title")
|
||||
@Schema(description = "公告标题")
|
||||
@NotBlank(message = "公告标题不能为空")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 公告内容
|
||||
*/
|
||||
@TableField(value = "content")
|
||||
@Schema(description = "公告内容")
|
||||
@NotBlank(message = "公告内容不能为空")
|
||||
private String content;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.cargo.enums.ShipStatusEnums;
|
||||
import com.wsnet.cargo.enums.TradeTypeEnums;
|
||||
import com.wsnet.core.db.annos.DbBean;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 船期
|
||||
* @TableName bus_sail_schedule
|
||||
*/
|
||||
@TableName(value ="bus_sail_schedule")
|
||||
@Data
|
||||
@Schema(title = "船期")
|
||||
public class BusSailSchedule extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 企业ID
|
||||
*/
|
||||
@TableField(value = "enterprise_id")
|
||||
@Schema(description = "企业ID")
|
||||
@NotNull(message = "企业ID不能为空")
|
||||
private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 船ID
|
||||
*/
|
||||
@TableField(value = "ship_id")
|
||||
@Schema(description = "船ID")
|
||||
@NotNull(message = "船ID不能为空")
|
||||
private Long shipId;
|
||||
|
||||
/**
|
||||
* 航次
|
||||
*/
|
||||
@TableField(value = "voyage")
|
||||
@Schema(description = "航次")
|
||||
@NotBlank(message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
/**
|
||||
* 航线ID
|
||||
*/
|
||||
@TableField(value = "ship_route_id")
|
||||
@Schema(description = "航线ID")
|
||||
@NotNull(message = "航线ID不能为空")
|
||||
private Long shipRouteId;
|
||||
|
||||
/**
|
||||
* 装货码头
|
||||
*/
|
||||
@TableField(value = "load_wharf_id")
|
||||
@Schema(description = "装货码头")
|
||||
@NotNull(message = "装货码头不能为空")
|
||||
private Long loadWharfId;
|
||||
|
||||
/**
|
||||
* 卸货码头
|
||||
*/
|
||||
@TableField(value = "discharge_wharf_id")
|
||||
@Schema(description = "卸货码头")
|
||||
@NotNull(message = "卸货码头不能为空")
|
||||
private Long dischargeWharfId;
|
||||
|
||||
/**
|
||||
* 计划商品车数量
|
||||
*/
|
||||
@TableField(value = "car_num_plan")
|
||||
@Schema(description = "计划商品车数量")
|
||||
@NotNull(message = "计划商品车数量不能为空")
|
||||
private Integer carNumPlan;
|
||||
|
||||
/**
|
||||
* 计划件杂货数量
|
||||
*/
|
||||
@TableField(value = "spare_num_plan")
|
||||
@Schema(description = "计划件杂货数量")
|
||||
@NotNull(message = "计划件杂货数量不能为空")
|
||||
private Integer spareNumPlan;
|
||||
|
||||
/**
|
||||
* 实际商品车数量
|
||||
*/
|
||||
@TableField(value = "car_num_actual")
|
||||
@Schema(description = "实际商品车数量")
|
||||
@NotNull(message = "实际商品车数量不能为空")
|
||||
private Integer carNumActual;
|
||||
|
||||
/**
|
||||
* 实际件杂货数量
|
||||
*/
|
||||
@TableField(value = "spare_num_actual")
|
||||
@Schema(description = "实际件杂货数量")
|
||||
@NotNull(message = "实际件杂货数量不能为空")
|
||||
private Integer spareNumActual;
|
||||
|
||||
/**
|
||||
* 计划离泊时间
|
||||
*/
|
||||
@TableField(value = "departure_date_plan")
|
||||
@Schema(description = "计划离泊时间")
|
||||
@NotNull(message = "计划离泊时间不能为空")
|
||||
private Date departureDatePlan;
|
||||
|
||||
/**
|
||||
* 实际离泊时间
|
||||
*/
|
||||
@TableField(value = "departure_date_actual")
|
||||
@Schema(description = "实际离泊时间")
|
||||
@NotNull(message = "实际离泊时间不能为空")
|
||||
private Date departureDateActual;
|
||||
|
||||
/**
|
||||
* 船舶状态
|
||||
*/
|
||||
@TableField(value = "ship_status")
|
||||
@Schema(description = "船舶状态")
|
||||
@NotNull(message = "船舶状态不能为空")
|
||||
private ShipStatusEnums shipStatus;
|
||||
|
||||
/**
|
||||
* 贸易类型
|
||||
*/
|
||||
@TableField(value = "trade_type")
|
||||
@Schema(description = "贸易类型")
|
||||
@NotNull(message = "贸易类型不能为空")
|
||||
private TradeTypeEnums tradeType;
|
||||
|
||||
/**
|
||||
* 装货港口
|
||||
*/
|
||||
@TableField(value = "load_port_id")
|
||||
@Schema(description = "装货港口")
|
||||
@NotNull(message = "装货港口不能为空")
|
||||
private Long loadPortId;
|
||||
|
||||
/**
|
||||
* 卸货港口
|
||||
*/
|
||||
@TableField(value = "discharge_port_id")
|
||||
@Schema(description = "卸货港口")
|
||||
@NotNull(message = "卸货港口不能为空")
|
||||
private Long dischargePortId;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "shipId")
|
||||
@Schema(description = "船舶")
|
||||
private DictShip ship;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "shipRouteId")
|
||||
@Schema(description = "航线")
|
||||
private DictShipRoute route;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "loadWharfId")
|
||||
@Schema(description = "装货码头")
|
||||
private DictWharf loadWharf;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "dischargeWharfId")
|
||||
@Schema(description = "卸货码头")
|
||||
private DictWharf dischargeWharf;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "loadPortId")
|
||||
@Schema(description = "装货港口")
|
||||
private DictPort loadPort;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "dischargePortId")
|
||||
@Schema(description = "卸货港口")
|
||||
private DictPort dischargePort;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "enterpriseId")
|
||||
@Schema(description = "企业")
|
||||
private DictEnterprise enterprise;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.cargo.enums.SubscribeStatusEnums;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 订阅
|
||||
* @TableName bus_subscribe
|
||||
*/
|
||||
@TableName(value ="bus_subscribe")
|
||||
@Data
|
||||
@Schema(title = "订阅")
|
||||
public class BusSubscribe extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 订阅企业ID
|
||||
*/
|
||||
@TableField(value = "enterprise_id")
|
||||
@Schema(description = "订阅企业ID")
|
||||
private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 订阅港口ID
|
||||
*/
|
||||
@TableField(value = "port_id")
|
||||
@Schema(description = "订阅港口ID")
|
||||
@NotNull(message = "订阅港口ID不能为空")
|
||||
private Long portId;
|
||||
|
||||
/**
|
||||
* 订阅码头ID
|
||||
*/
|
||||
@TableField(value = "wharf_id")
|
||||
@Schema(description = "订阅码头ID")
|
||||
@NotNull(message = "订阅码头ID不能为空")
|
||||
private Long wharfId;
|
||||
|
||||
/**
|
||||
* 订阅的企业ID
|
||||
*/
|
||||
@TableField(value = "sub_enterprise_id")
|
||||
@Schema(description = "订阅的企业ID")
|
||||
@NotNull(message = "订阅的企业ID不能为空")
|
||||
private Long subEnterpriseId;
|
||||
|
||||
/**
|
||||
* 订阅的航线ID
|
||||
*/
|
||||
@TableField(value = "sub_ship_route_id")
|
||||
@Schema(description = "订阅的航线ID")
|
||||
@NotNull(message = "订阅的航线ID不能为空")
|
||||
private Long subShipRouteId;
|
||||
|
||||
/**
|
||||
* 订阅的港口ID
|
||||
*/
|
||||
@TableField(value = "sub_port_id")
|
||||
@Schema(description = "订阅的港口ID")
|
||||
@NotNull(message = "订阅的港口ID不能为空")
|
||||
private Long subPortId;
|
||||
|
||||
/**
|
||||
* 订阅的码头ID
|
||||
*/
|
||||
@TableField(value = "sub_wharf_id")
|
||||
@Schema(description = "订阅的码头ID")
|
||||
@NotNull(message = "订阅的码头ID不能为空")
|
||||
private Long subWharfId;
|
||||
|
||||
/**
|
||||
* 订阅类型,枚举可以多选
|
||||
*/
|
||||
@TableField(value = "sub_info")
|
||||
@Schema(description = "订阅类型,枚举可以多选")
|
||||
@NotBlank(message = "订阅类型,枚举可以多选不能为空")
|
||||
private String subInfo;
|
||||
|
||||
/**
|
||||
* 订阅开始日期
|
||||
*/
|
||||
@TableField(value = "begin_date")
|
||||
@Schema(description = "订阅开始日期")
|
||||
@NotNull(message = "订阅开始日期不能为空")
|
||||
private Date beginDate;
|
||||
|
||||
/**
|
||||
* 订阅结束日期
|
||||
*/
|
||||
@TableField(value = "end_date")
|
||||
@Schema(description = "订阅结束日期")
|
||||
@NotNull(message = "订阅结束日期不能为空")
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* 订阅状态
|
||||
*/
|
||||
@TableField(value = "sub_status")
|
||||
@Schema(description = "订阅状态")
|
||||
private SubscribeStatusEnums subStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.annos.DbDict;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
* @TableName dict_brand
|
||||
*/
|
||||
@TableName(value ="dict_brand")
|
||||
@Data
|
||||
@DbDict
|
||||
@Schema(title = "品牌")
|
||||
public class DictBrand extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 品牌名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
@Schema(description = "品牌名称")
|
||||
@NotBlank(message = "品牌名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 品牌编码
|
||||
*/
|
||||
@TableField(value = "code")
|
||||
@Schema(description = "品牌编码")
|
||||
@NotBlank(message = "品牌编码不能为空")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 品牌英文名称
|
||||
*/
|
||||
@TableField(value = "en_name")
|
||||
@Schema(description = "品牌英文名称")
|
||||
@NotBlank(message = "品牌英文名称不能为空")
|
||||
private String enName;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
@Schema(description = "状态")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private StatusEnums status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 全国城市列表
|
||||
* @TableName dict_city
|
||||
*/
|
||||
@TableName(value ="dict_city")
|
||||
@Data
|
||||
public class DictCity extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@TableField(value = "code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
private StatusEnums status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.annos.DbBean;
|
||||
import com.wsnet.core.db.annos.DbDict;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 企业员工
|
||||
* @TableName dict_employee
|
||||
*/
|
||||
@TableName(value ="dict_employee")
|
||||
@Data
|
||||
@DbDict(ref = "enterpriseId")
|
||||
@Schema(title = "员工")
|
||||
public class DictEmployee extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 企业ID
|
||||
*/
|
||||
@Schema(description = "企业ID")
|
||||
@NotNull(message = "企业ID不能为空")
|
||||
@TableField(value = "enterprise_id")
|
||||
private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名")
|
||||
@NotBlank(message = "姓名不能为空")
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Schema(description = "昵称")
|
||||
@TableField(value = "nickname")
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Schema(description = "用户名")
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
@TableField(value = "username")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Schema(description = "联系电话")
|
||||
@NotBlank(message = "联系电话不能为空")
|
||||
@TableField(value = "phone")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 码头ID
|
||||
*/
|
||||
@Schema(description = "码头ID")
|
||||
@TableField(value = "wharf_id")
|
||||
private Long wharfId;
|
||||
|
||||
/**
|
||||
* 绑定用户ID
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@TableField(exist = false)
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
private StatusEnums status;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "enterpriseId")
|
||||
@Schema(description = "企业")
|
||||
private DictEnterprise enterprise;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "wharfId")
|
||||
@Schema(description = "码头")
|
||||
private DictWharf wharf;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.cargo.enums.EnterpriseStatusEnums;
|
||||
import com.wsnet.cargo.enums.EnterpriseTypeEnums;
|
||||
import com.wsnet.core.db.annos.DbDict;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 企业
|
||||
* @TableName dict_enterprise
|
||||
*/
|
||||
@TableName(value ="dict_enterprise")
|
||||
@Data
|
||||
@DbDict
|
||||
public class DictEnterprise extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 企业编码
|
||||
*/
|
||||
@TableField(value = "code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@TableField(value = "address")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 法人代表
|
||||
*/
|
||||
@TableField(value = "legal_person")
|
||||
private String legalPerson;
|
||||
|
||||
/**
|
||||
* 合同编号
|
||||
*/
|
||||
@TableField(value = "contract_no")
|
||||
private String contractNo;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@TableField(value = "linkman")
|
||||
private String linkman;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@TableField(value = "phone")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
@TableField(value = "enterprise_status")
|
||||
private EnterpriseStatusEnums enterpriseStatus;
|
||||
|
||||
/**
|
||||
* 关联登录账号ID
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 绑定的港口ID
|
||||
*/
|
||||
@TableField(value = "port_id")
|
||||
private Long portId;
|
||||
|
||||
/**
|
||||
* 企业类别
|
||||
*/
|
||||
@TableField(value = "enterprise_type")
|
||||
private EnterpriseTypeEnums enterpriseType;
|
||||
|
||||
/**
|
||||
* 营业执照图片
|
||||
*/
|
||||
@TableField(value = "license_photo")
|
||||
private String licensePhoto;
|
||||
|
||||
/**
|
||||
* 身份证图片
|
||||
*/
|
||||
@TableField(value = "id_photo")
|
||||
private String idPhoto;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.cargo.enums.PortTypeEnums;
|
||||
import com.wsnet.core.db.annos.DbBean;
|
||||
import com.wsnet.core.db.annos.DbDict;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 港口
|
||||
* @TableName dict_port
|
||||
*/
|
||||
@TableName(value ="dict_port")
|
||||
@Data
|
||||
@DbDict
|
||||
@Schema(title = "港口")
|
||||
public class DictPort extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 港口名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
@Schema(description = "港口名称")
|
||||
@NotBlank(message = "港口名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 港口编码
|
||||
*/
|
||||
@TableField(value = "code")
|
||||
@Schema(description = "港口编码")
|
||||
@NotBlank(message = "港口编码不能为空")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
@TableField(value = "province_id")
|
||||
@Schema(description = "省份")
|
||||
@NotNull(message = "省份不能为空")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@TableField(value = "city_id")
|
||||
@Schema(description = "城市")
|
||||
@NotNull(message = "城市不能为空")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* 港口地址
|
||||
*/
|
||||
@TableField(value = "address")
|
||||
@Schema(description = "港口地址")
|
||||
@NotBlank(message = "港口地址不能为空")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 港口类型
|
||||
*/
|
||||
@TableField(value = "port_type")
|
||||
@Schema(description = "港口类型")
|
||||
@NotNull(message = "港口类型不能为空")
|
||||
private PortTypeEnums portType;
|
||||
|
||||
/**
|
||||
* 通过能力
|
||||
*/
|
||||
@TableField(value = "transit_capacity")
|
||||
@Schema(description = "通过能力")
|
||||
@NotNull(message = "通过能力不能为空")
|
||||
private Integer transitCapacity;
|
||||
|
||||
/**
|
||||
* 堆存能力
|
||||
*/
|
||||
@TableField(value = "storage_capacity")
|
||||
@Schema(description = "堆存能力")
|
||||
@NotNull(message = "堆存能力不能为空")
|
||||
private Integer storageCapacity;
|
||||
|
||||
/**
|
||||
* 接卸能力
|
||||
*/
|
||||
@TableField(value = "handling_capacity")
|
||||
@Schema(description = "接卸能力")
|
||||
@NotNull(message = "接卸能力不能为空")
|
||||
private Integer handlingCapacity;
|
||||
|
||||
/**
|
||||
* 码头数量
|
||||
*/
|
||||
@TableField(value = "wharf_num")
|
||||
@Schema(description = "码头数量")
|
||||
@NotNull(message = "码头数量不能为空")
|
||||
private Integer wharfNum;
|
||||
|
||||
/**
|
||||
* 泊位总数
|
||||
*/
|
||||
@TableField(value = "berthage_num")
|
||||
@Schema(description = "泊位总数")
|
||||
@NotNull(message = "泊位总数不能为空")
|
||||
private Integer berthageNum;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
@Schema(description = "状态")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private StatusEnums status;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "省")
|
||||
@DbBean(ref = "provinceId")
|
||||
private DictCity province;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "市")
|
||||
@DbBean(ref="cityId")
|
||||
private DictCity city;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.cargo.enums.SeaworthinessEnums;
|
||||
import com.wsnet.cargo.enums.ShipTypeEnums;
|
||||
import com.wsnet.core.db.annos.DbDict;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 船舶
|
||||
* @TableName dict_ship
|
||||
*/
|
||||
@TableName(value ="dict_ship")
|
||||
@Data
|
||||
@DbDict
|
||||
@Schema(title = "船舶")
|
||||
public class DictShip extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 船舶名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
@Schema(description = "船舶名称")
|
||||
@NotBlank(message = "船舶名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 船舶海事识别编号
|
||||
*/
|
||||
@TableField(value = "mmsi")
|
||||
@Schema(description = "船舶海事识别编号")
|
||||
@NotBlank(message = "船舶海事识别编号不能为空")
|
||||
private String mmsi;
|
||||
|
||||
/**
|
||||
* 船龄
|
||||
*/
|
||||
@TableField(value = "ship_age")
|
||||
@Schema(description = "船龄")
|
||||
@NotNull(message = "船龄不能为空")
|
||||
private Integer shipAge;
|
||||
|
||||
/**
|
||||
* 船舶类型
|
||||
*/
|
||||
@TableField(value = "ship_type")
|
||||
@Schema(description = "船舶类型")
|
||||
@NotNull(message = "船舶类型不能为空")
|
||||
private ShipTypeEnums shipType;
|
||||
|
||||
/**
|
||||
* 载重
|
||||
*/
|
||||
@TableField(value = "load")
|
||||
@Schema(description = "载重")
|
||||
@NotNull(message = "载重不能为空")
|
||||
private BigDecimal load;
|
||||
|
||||
/**
|
||||
* 船长(米)
|
||||
*/
|
||||
@TableField(value = "ship_length")
|
||||
@Schema(description = "船长(米)")
|
||||
@NotNull(message = "船长(米)不能为空")
|
||||
private BigDecimal shipLength;
|
||||
|
||||
/**
|
||||
* 空船吃水(米)
|
||||
*/
|
||||
@TableField(value = "empty_ship_draft")
|
||||
@Schema(description = "空船吃水(米)")
|
||||
@NotNull(message = "空船吃水(米)不能为空")
|
||||
private BigDecimal emptyShipDraft;
|
||||
|
||||
/**
|
||||
* 满载吃水(米)
|
||||
*/
|
||||
@TableField(value = "full_load_draft")
|
||||
@Schema(description = "满载吃水(米)")
|
||||
@NotNull(message = "满载吃水(米)不能为空")
|
||||
private BigDecimal fullLoadDraft;
|
||||
|
||||
/**
|
||||
* 跳板数量
|
||||
*/
|
||||
@TableField(value = "springboard_num")
|
||||
@Schema(description = "跳板数量")
|
||||
@NotNull(message = "跳板数量不能为空")
|
||||
private Integer springboardNum;
|
||||
|
||||
/**
|
||||
* 跳板位置
|
||||
*/
|
||||
@TableField(value = "springboard_location")
|
||||
@Schema(description = "跳板位置")
|
||||
@NotBlank(message = "跳板位置不能为空")
|
||||
private String springboardLocation;
|
||||
|
||||
/**
|
||||
* 适航航线
|
||||
*/
|
||||
@TableField(value = "seaworthiness")
|
||||
@Schema(description = "适航航线")
|
||||
private SeaworthinessEnums seaworthiness;
|
||||
|
||||
/**
|
||||
* 常走航线
|
||||
*/
|
||||
@TableField(value = "regular")
|
||||
@Schema(description = "常走航线")
|
||||
private String regular;
|
||||
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
@Schema(description = "状态")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private StatusEnums status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.annos.DbBean;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 船图
|
||||
* @TableName dict_ship_chart
|
||||
*/
|
||||
@TableName(value ="dict_ship_chart")
|
||||
@Data
|
||||
@Schema(title = "船图")
|
||||
public class DictShipChart extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 船舶ID
|
||||
*/
|
||||
@TableField(value = "ship_id")
|
||||
@Schema(description = "船舶ID")
|
||||
@NotNull(message = "船舶ID不能为空")
|
||||
private Long shipId;
|
||||
|
||||
/**
|
||||
* 舱层数量
|
||||
*/
|
||||
@TableField(value = "decks_num")
|
||||
@Schema(description = "舱层数量")
|
||||
@NotNull(message = "舱层数量不能为空")
|
||||
private Integer decksNum;
|
||||
|
||||
/**
|
||||
* 舱层分段及积载能力
|
||||
*/
|
||||
@TableField(value = "stowage_capacity")
|
||||
@Schema(description = "舱层分段及积载能力")
|
||||
@NotBlank(message = "舱层分段及积载能力不能为空")
|
||||
private String stowageCapacity;
|
||||
|
||||
/**
|
||||
* 舱层分层平面布局图
|
||||
*/
|
||||
@TableField(value = "floor_plan")
|
||||
@Schema(description = "舱层分层平面布局图")
|
||||
@NotBlank(message = "舱层分层平面布局图不能为空")
|
||||
private String floorPlan;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
@Schema(description = "状态")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private StatusEnums status;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "shipId")
|
||||
@Schema(description = "船舶")
|
||||
private DictShip ship;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.annos.DbDict;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 航线
|
||||
* @TableName dict_ship_route
|
||||
*/
|
||||
@TableName(value ="dict_ship_route")
|
||||
@Data
|
||||
@DbDict
|
||||
@Schema(title = "航线")
|
||||
public class DictShipRoute extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 航线名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
@Schema(description = "航线名称")
|
||||
@NotBlank(message = "航线名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 航线编码
|
||||
*/
|
||||
@TableField(value = "code")
|
||||
@Schema(description = "航线编码")
|
||||
@NotBlank(message = "航线编码不能为空")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
@Schema(description = "状态")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private StatusEnums status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 航线-码头对照表
|
||||
* @TableName dict_ship_route_port
|
||||
*/
|
||||
@TableName(value ="dict_ship_route_port")
|
||||
@Data
|
||||
@Schema(title = "航线-码头对照表")
|
||||
public class DictShipRoutePort extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 航线ID
|
||||
*/
|
||||
@TableField(value = "route_id")
|
||||
@Schema(description = "航线ID")
|
||||
@NotNull(message = "航线ID不能为空")
|
||||
private Long routeId;
|
||||
|
||||
/**
|
||||
* 港口ID
|
||||
*/
|
||||
@TableField(value = "port_id")
|
||||
@Schema(description = "港口ID")
|
||||
@NotNull(message = "港口ID不能为空")
|
||||
private Long portId;
|
||||
|
||||
/**
|
||||
* 码头ID
|
||||
*/
|
||||
@TableField(value = "wharf_id")
|
||||
@Schema(description = "码头ID")
|
||||
@NotNull(message = "码头ID不能为空")
|
||||
private Long wharfId;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
@Schema(description = "状态")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.annos.DbDict;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 车型
|
||||
* @TableName dict_vehicle_type
|
||||
*/
|
||||
@TableName(value ="dict_vehicle_type")
|
||||
@Data
|
||||
@DbDict
|
||||
@Schema(title = "车型")
|
||||
public class DictVehicleType extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 码头名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
@Schema(description = "车型名称")
|
||||
@NotBlank(message = "车型名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 码头编码
|
||||
*/
|
||||
@TableField(value = "code")
|
||||
@Schema(description = "车型编码")
|
||||
@NotBlank(message = "车型编码不能为空")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 码头英文名称
|
||||
*/
|
||||
@TableField(value = "en_name")
|
||||
@Schema(description = "车型英文名称")
|
||||
@NotBlank(message = "车型英文名称不能为空")
|
||||
private String enName;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
@Schema(description = "状态")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private StatusEnums status;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.annos.DbBean;
|
||||
import com.wsnet.core.db.annos.DbDict;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 车型明细
|
||||
* @TableName dict_vehicle_type_detail
|
||||
*/
|
||||
@TableName(value ="dict_vehicle_type_detail")
|
||||
@Data
|
||||
@DbDict(ref = "vehicleTypeId")
|
||||
@Schema(title = "车型明细")
|
||||
public class DictVehicleTypeDetail extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
@Schema(description = "名称")
|
||||
@NotBlank(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@TableField(value = "code")
|
||||
@Schema(description = "编码")
|
||||
@NotBlank(message = "编码不能为空")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 英文名称
|
||||
*/
|
||||
@TableField(value = "en_name")
|
||||
@Schema(description = "英文名称")
|
||||
@NotBlank(message = "英文名称不能为空")
|
||||
private String enName;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
@Schema(description = "状态")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private StatusEnums status;
|
||||
|
||||
/**
|
||||
* 车型ID
|
||||
*/
|
||||
@TableField(value = "vehicle_type_id")
|
||||
@Schema(description = "车型ID")
|
||||
@NotNull(message = "车型ID不能为空")
|
||||
private Long vehicleTypeId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "vehicleTypeId")
|
||||
@Schema(description = "车型")
|
||||
private DictVehicleType vehicleType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.annos.DbBean;
|
||||
import com.wsnet.core.db.annos.DbDict;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 码头
|
||||
* @TableName dict_wharf
|
||||
*/
|
||||
@TableName(value ="dict_wharf")
|
||||
@Data
|
||||
@DbDict(ref = "portId")
|
||||
@Schema(title = "码头")
|
||||
public class DictWharf extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 码头名称
|
||||
*/
|
||||
@Schema(description = "码头名称")
|
||||
@NotBlank(message = "码头名称不能为空")
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 港口ID
|
||||
*/
|
||||
@TableField(value = "port_id")
|
||||
@Schema(description = "港口ID")
|
||||
@NotNull(message = "港口ID不能为空")
|
||||
private Long portId;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@TableField(value = "address")
|
||||
@Schema(description = "详细地址")
|
||||
@NotBlank(message = "详细地址不能为空")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@TableField(value = "longitude")
|
||||
@Schema(description = "经度")
|
||||
private BigDecimal longitude;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@TableField(value = "latitude")
|
||||
@Schema(description = "纬度")
|
||||
private BigDecimal latitude;
|
||||
|
||||
/**
|
||||
* 泊位数量
|
||||
*/
|
||||
@TableField(value = "berthage_num")
|
||||
@Schema(description = "泊位数量")
|
||||
@NotNull(message = "泊位数量不能为空")
|
||||
private Integer berthageNum;
|
||||
|
||||
/**
|
||||
* 通过能力
|
||||
*/
|
||||
@TableField(value = "transit_capacity")
|
||||
@Schema(description = "通过能力")
|
||||
@NotNull(message = "通过能力不能为空")
|
||||
private Integer transitCapacity;
|
||||
|
||||
/**
|
||||
* 堆存能力
|
||||
*/
|
||||
@TableField(value = "storage_capacity")
|
||||
@Schema(description = "堆存能力")
|
||||
@NotNull(message = "堆存能力不能为空")
|
||||
private Integer storageCapacity;
|
||||
|
||||
/**
|
||||
* 接卸能力
|
||||
*/
|
||||
@TableField(value = "handling_capacity")
|
||||
@Schema(description = "接卸能力")
|
||||
@NotNull(message = "接卸能力不能为空")
|
||||
private Integer handlingCapacity;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
@Schema(description = "状态")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private StatusEnums status;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "港口")
|
||||
@DbBean(ref = "portId")
|
||||
private DictPort port;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* API
|
||||
* @TableName help_api
|
||||
*/
|
||||
@TableName(value ="help_api")
|
||||
@Data
|
||||
@Schema(title = "API")
|
||||
public class HelpApi extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
@Schema(description = "名称")
|
||||
@NotBlank(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 接口地址
|
||||
*/
|
||||
@TableField(value = "url")
|
||||
@Schema(description = "接口地址")
|
||||
@NotBlank(message = "接口地址不能为空")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
@Schema(description = "功能描述")
|
||||
@NotBlank(message = "功能描述不能为空")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 接口参数
|
||||
*/
|
||||
@TableField(value = "req")
|
||||
@Schema(description = "接口参数")
|
||||
@NotBlank(message = "接口参数不能为空")
|
||||
private String req;
|
||||
|
||||
/**
|
||||
* 接口返回
|
||||
*/
|
||||
@TableField(value = "resp")
|
||||
@Schema(description = "接口返回")
|
||||
@NotBlank(message = "接口返回不能为空")
|
||||
private String resp;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.cargo.enums.QuestionTypeEnums;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* help
|
||||
* @TableName help_doc
|
||||
*/
|
||||
@TableName(value ="help_doc")
|
||||
@Data
|
||||
@Schema(title = "帮助文档")
|
||||
public class HelpDoc extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
@TableField(value = "serial")
|
||||
@Schema(description = "序号")
|
||||
@NotNull(message = "序号不能为空")
|
||||
private BigDecimal serial;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
@Schema(description = "名称")
|
||||
@NotBlank(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
@Schema(description = "备注")
|
||||
@NotBlank(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@TableField(value = "type")
|
||||
@Schema(description = "类型")
|
||||
@NotNull(message = "类型不能为空")
|
||||
private QuestionTypeEnums type;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.wsnet.cargo.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum EnterpriseStatusEnums {
|
||||
AUDIT("0", "待审核"),
|
||||
USED("1", "正常"),
|
||||
CLOSE("2", "已关闭"),
|
||||
SIGN_OUT("3", "已注册")
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
EnterpriseStatusEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static EnterpriseStatusEnums getEnum(String code) {
|
||||
for (EnterpriseStatusEnums e : EnterpriseStatusEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.wsnet.cargo.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum EnterpriseTypeEnums {
|
||||
PORT("1", "港口码头"),
|
||||
SHIP("2", "船公司"),
|
||||
CARGO_OWNER("3", "货主"),
|
||||
SHIP_LOAN("4", "船代"),
|
||||
GOODS_LOAN("5", "货贷"),
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
EnterpriseTypeEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static EnterpriseTypeEnums getEnum(String code) {
|
||||
for (EnterpriseTypeEnums e : EnterpriseTypeEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.wsnet.cargo.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum GoodsStatusEnums {
|
||||
SEA("1", "海港"),
|
||||
RIVER("2", "河港")
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
GoodsStatusEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static GoodsStatusEnums getEnum(String code) {
|
||||
for (GoodsStatusEnums e : GoodsStatusEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.wsnet.cargo.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum PortTypeEnums {
|
||||
SEA("1", "海港"),
|
||||
RIVER("2", "河港")
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
PortTypeEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static PortTypeEnums getEnum(String code) {
|
||||
for (PortTypeEnums e : PortTypeEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.wsnet.cargo.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum QuestionTypeEnums {
|
||||
SUBJECT("1", "主题"),
|
||||
QUESTION("2", "问题"),
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
QuestionTypeEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static QuestionTypeEnums getEnum(String code) {
|
||||
for (QuestionTypeEnums e : QuestionTypeEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.wsnet.cargo.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum SeaworthinessEnums {
|
||||
OCEAN("1", "远洋"),
|
||||
INSHORE("2", "近海"),
|
||||
COASTAL("2", "沿海"),
|
||||
INLAND_RIVER("3", "内河");
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
SeaworthinessEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static SeaworthinessEnums getEnum(String code) {
|
||||
for (SeaworthinessEnums e : SeaworthinessEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.wsnet.cargo.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum ShipStatusEnums {
|
||||
SEA("1", "海港"),
|
||||
RIVER("2", "河港")
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
ShipStatusEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static ShipStatusEnums getEnum(String code) {
|
||||
for (ShipStatusEnums e : ShipStatusEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.wsnet.cargo.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum ShipTypeEnums {
|
||||
ROLL_SHIP("1", "滚装船"),
|
||||
CAR_ROLL_SHIP("2", "汽车专用滚装船"),
|
||||
OTHER_ROLL_SHIP("2", "其他滚装船")
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
ShipTypeEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static ShipTypeEnums getEnum(String code) {
|
||||
for (ShipTypeEnums e : ShipTypeEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.wsnet.cargo.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum SubscribeStatusEnums {
|
||||
NO_ACCEPTED("1", "待接受"),
|
||||
CLOSED("2", "已关闭"),
|
||||
SUBSCRIBE("3", "订阅中"),
|
||||
CANCELLED("4", "已取消")
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
SubscribeStatusEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static SubscribeStatusEnums getEnum(String code) {
|
||||
for (SubscribeStatusEnums e : SubscribeStatusEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.wsnet.cargo.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum TradeTypeEnums {
|
||||
OUT_IMPORT("1", "外贸进口"),
|
||||
OUT_EXPORT("2", "外贸出口"),
|
||||
IN("3", "内贸"),
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
TradeTypeEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static TradeTypeEnums getEnum(String code) {
|
||||
for (TradeTypeEnums e : TradeTypeEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TradeTypeEnums getEnumByDesc(String desc) {
|
||||
for (TradeTypeEnums e : TradeTypeEnums.values()) {
|
||||
if (StringUtils.equals(e.getDesc(), desc)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package com.wsnet.cargo.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Schema(title = "舱单明细导入")
|
||||
public class ManifestDetailImportExcel implements Serializable {
|
||||
/**
|
||||
* 舱单ID
|
||||
*/
|
||||
@ExcelProperty(value = "*提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
/**
|
||||
* 车型ID
|
||||
*/
|
||||
@ExcelProperty(value = "*车型")
|
||||
@NotBlank(message = "车型不能为空")
|
||||
private String vehicleTypeName;
|
||||
|
||||
/**
|
||||
* 车型明细
|
||||
*/
|
||||
@ExcelProperty(value = "*车型明细")
|
||||
@NotBlank(message = "车型明细不能为空")
|
||||
private String vehicleTypeDetailName;
|
||||
|
||||
/**
|
||||
* vin
|
||||
*/
|
||||
@ExcelProperty(value = "vin")
|
||||
@NotBlank(message = "vin码不能为空")
|
||||
private String vin;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@ExcelProperty(value = "重量")
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
* 体积
|
||||
*/
|
||||
@ExcelProperty(value = "体积")
|
||||
private BigDecimal volume;
|
||||
|
||||
/**
|
||||
* 长
|
||||
*/
|
||||
@ExcelProperty(value = "长")
|
||||
private BigDecimal length;
|
||||
|
||||
/**
|
||||
* 宽
|
||||
*/
|
||||
@ExcelProperty(value = "宽")
|
||||
private BigDecimal width;
|
||||
|
||||
/**
|
||||
* 高
|
||||
*/
|
||||
@ExcelProperty(value = "高")
|
||||
private BigDecimal height;
|
||||
|
||||
/**
|
||||
* BAmm
|
||||
*/
|
||||
@ExcelProperty(value = "BAmm")
|
||||
private String bAmm;
|
||||
|
||||
/**
|
||||
* LRmm
|
||||
*/
|
||||
@ExcelProperty(value = "LRmm")
|
||||
private String lRmm;
|
||||
|
||||
/**
|
||||
* 有无质损
|
||||
*/
|
||||
@ExcelProperty(value = "有无质损")
|
||||
private String damage;
|
||||
|
||||
/**
|
||||
* 质损描述
|
||||
*/
|
||||
@ExcelProperty(value = "质损描述")
|
||||
private String damageDesc;
|
||||
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package com.wsnet.cargo.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Schema(title = "舱单导入")
|
||||
public class ManifestImportExcel implements Serializable {
|
||||
|
||||
// @ExcelProperty(value = "船名")
|
||||
// private String shipName;
|
||||
//
|
||||
// @ExcelProperty(value = "省份")
|
||||
// private String province;
|
||||
//
|
||||
// @ExcelProperty(value = "城市")
|
||||
// private String city;
|
||||
|
||||
/**
|
||||
* 舱层
|
||||
*/
|
||||
@ExcelProperty(value = "舱层")
|
||||
@NotNull(message = "舱层不能为空")
|
||||
private Integer deck;
|
||||
|
||||
/**
|
||||
* 舱段
|
||||
*/
|
||||
@ExcelProperty(value = "舱段")
|
||||
@NotNull(message = "舱段不能为空")
|
||||
private Integer cabin;
|
||||
|
||||
/**
|
||||
* 提单号
|
||||
*/
|
||||
@ExcelProperty(value = "*提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
/**
|
||||
* 货名
|
||||
*/
|
||||
@ExcelProperty(value = "*货名")
|
||||
@NotBlank(message = "货名不能为空")
|
||||
private String goodsName;
|
||||
|
||||
/**
|
||||
* 品牌ID
|
||||
*/
|
||||
@ExcelProperty(value = "*品牌")
|
||||
@NotNull(message = "品牌不能为空")
|
||||
private String brandName;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
@ExcelProperty(value = "型号")
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 唛头
|
||||
*/
|
||||
@ExcelProperty(value = "唛头")
|
||||
private String shippingMark;
|
||||
|
||||
/**
|
||||
* 车数量
|
||||
*/
|
||||
@ExcelProperty(value = "车数量")
|
||||
private Integer carNum;
|
||||
|
||||
/**
|
||||
* 件杂货数
|
||||
*/
|
||||
@ExcelProperty(value = "件杂货数")
|
||||
private Integer spareNum;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@ExcelProperty(value = "重量")
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
* 体积
|
||||
*/
|
||||
@ExcelProperty(value = "体积")
|
||||
private BigDecimal volume;
|
||||
|
||||
/**
|
||||
* 发货人
|
||||
*/
|
||||
@ExcelProperty(value = "发货人")
|
||||
private String consigner;
|
||||
|
||||
/**
|
||||
* 收货人
|
||||
*/
|
||||
@ExcelProperty(value = "收货人")
|
||||
private String consignee;
|
||||
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package com.wsnet.cargo.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(title = "船期导入")
|
||||
public class SailScheduleImportExcel implements Serializable {
|
||||
/**
|
||||
* 贸易类型
|
||||
*/
|
||||
@ExcelProperty(value = "*贸易类型")
|
||||
@NotBlank(message = "贸易类型不能为空")
|
||||
private String tradeTypeDesc;
|
||||
|
||||
/**
|
||||
* 航线ID
|
||||
*/
|
||||
@ExcelProperty(value = "*航线")
|
||||
@NotNull(message = "航线不能为空")
|
||||
private String shipRoute;
|
||||
|
||||
/**
|
||||
* 船ID
|
||||
*/
|
||||
@ExcelProperty(value = "*船名")
|
||||
@NotBlank(message = "船名不能为空")
|
||||
private String shipName;
|
||||
|
||||
/**
|
||||
* 航次
|
||||
*/
|
||||
@ExcelProperty(value = "*航次")
|
||||
@NotBlank(message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
/**
|
||||
* 装货港口
|
||||
*/
|
||||
@ExcelProperty(value = "*装货港口")
|
||||
@NotBlank(message = "装货港口不能为空")
|
||||
private String loadPortName;
|
||||
|
||||
/**
|
||||
* 装货码头
|
||||
*/
|
||||
@ExcelProperty(value = "*装货码头")
|
||||
@NotBlank(message = "装货码头不能为空")
|
||||
private String loadWharfName;
|
||||
|
||||
|
||||
/**
|
||||
* 卸货港口
|
||||
*/
|
||||
@ExcelProperty(value = "*卸货港口")
|
||||
@NotBlank(message = "卸货港口不能为空")
|
||||
private String dischargePortName;
|
||||
|
||||
/**
|
||||
* 卸货码头
|
||||
*/
|
||||
@ExcelProperty(value = "*卸货码头")
|
||||
@NotBlank(message = "卸货码头不能为空")
|
||||
private String dischargeWharfName;
|
||||
|
||||
/**
|
||||
* 计划商品车数量
|
||||
*/
|
||||
@ExcelProperty(value = "计划商品车数量")
|
||||
@NotNull(message = "计划商品车数量不能为空")
|
||||
private Integer carNumPlan;
|
||||
|
||||
/**
|
||||
* 计划件杂货数量
|
||||
*/
|
||||
@ExcelProperty(value = "计划件杂货数量")
|
||||
@NotNull(message = "计划件杂货数量不能为空")
|
||||
private Integer spareNumPlan;
|
||||
|
||||
/**
|
||||
* 实际商品车数量
|
||||
*/
|
||||
@ExcelProperty(value = "实际商品车数量")
|
||||
@NotNull(message = "实际商品车数量不能为空")
|
||||
private Integer carNumActual;
|
||||
|
||||
/**
|
||||
* 实际件杂货数量
|
||||
*/
|
||||
@ExcelProperty(value = "实际件杂货数量")
|
||||
@NotNull(message = "实际件杂货数量不能为空")
|
||||
private Integer spareNumActual;
|
||||
|
||||
/**
|
||||
* 计划离泊时间
|
||||
*/
|
||||
@ExcelProperty(value = "计划离泊时间(yyyy/MM/dd HH:mm)")
|
||||
@NotNull(message = "计划离泊时间不能为空")
|
||||
@DateTimeFormat("yyyy/MM/dd HH:mm")
|
||||
private Date departureDatePlan;
|
||||
|
||||
|
||||
/**
|
||||
* 实际离泊时间
|
||||
*/
|
||||
@ExcelProperty(value = "实际离泊时间(yyyy/MM/dd HH:mm)")
|
||||
@NotNull(message = "实际离泊时间不能为空")
|
||||
@DateTimeFormat("yyyy/MM/dd HH:mm")
|
||||
private Date departureDateActual;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.BusManifestDetail;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【bus_manifest_detail(舱单明细)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:19
|
||||
* @Entity com.wsnet.cargo.entity.BusManifestDetail
|
||||
*/
|
||||
public interface BusManifestDetailMapper extends BaseMapper<BusManifestDetail> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.BusManifest;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【bus_manifest(舱单信息)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:19
|
||||
* @Entity com.wsnet.cargo.entity.BusManifest
|
||||
*/
|
||||
public interface BusManifestMapper extends BaseMapper<BusManifest> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.BusNotice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【bus_notice(公告)】的数据库操作Mapper
|
||||
* @createDate 2024-10-25 15:46:05
|
||||
* @Entity com.wsnet.cargo.entity.BusNotice
|
||||
*/
|
||||
public interface BusNoticeMapper extends BaseMapper<BusNotice> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.BusSailSchedule;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【bus_sail_schedule(船期)】的数据库操作Mapper
|
||||
* @createDate 2024-10-24 19:25:59
|
||||
* @Entity com.wsnet.cargo.entity.BusSailSchedule
|
||||
*/
|
||||
public interface BusSailScheduleMapper extends BaseMapper<BusSailSchedule> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.BusSubscribe;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【bus_subscribe(订阅)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:20
|
||||
* @Entity com.wsnet.cargo.entity.BusSubscribe
|
||||
*/
|
||||
public interface BusSubscribeMapper extends BaseMapper<BusSubscribe> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictBrand;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_brand(品牌)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:20
|
||||
* @Entity com.wsnet.cargo.entity.DictBrand
|
||||
*/
|
||||
public interface DictBrandMapper extends BaseMapper<DictBrand> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictCity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_city(全国城市列表)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:20
|
||||
* @Entity com.wsnet.cargo.entity.DictCity
|
||||
*/
|
||||
public interface DictCityMapper extends BaseMapper<DictCity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictEmployee;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_employee(企业员工)】的数据库操作Mapper
|
||||
* @createDate 2024-10-24 09:36:32
|
||||
* @Entity com.wsnet.cargo.entity.DictEmployee
|
||||
*/
|
||||
public interface DictEmployeeMapper extends BaseMapper<DictEmployee> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictEnterprise;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_enterprise(企业)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 14:58:37
|
||||
* @Entity com.wsnet.cargo.entity.DictEnterprise
|
||||
*/
|
||||
public interface DictEnterpriseMapper extends BaseMapper<DictEnterprise> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictPort;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_port(港口)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:20
|
||||
* @Entity com.wsnet.cargo.entity.DictPort
|
||||
*/
|
||||
public interface DictPortMapper extends BaseMapper<DictPort> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictShipChart;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_ship_chart(船图)】的数据库操作Mapper
|
||||
* @createDate 2024-10-24 15:39:46
|
||||
* @Entity com.wsnet.cargo.entity.DictShipChart
|
||||
*/
|
||||
public interface DictShipChartMapper extends BaseMapper<DictShipChart> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictShip;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_ship(船舶)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:20
|
||||
* @Entity com.wsnet.cargo.entity.DictShip
|
||||
*/
|
||||
public interface DictShipMapper extends BaseMapper<DictShip> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictShipRoute;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_ship_route(航线)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:20
|
||||
* @Entity com.wsnet.cargo.entity.DictShipRoute
|
||||
*/
|
||||
public interface DictShipRouteMapper extends BaseMapper<DictShipRoute> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictShipRoutePort;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_ship_route_port(航线-码头对照表)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:20
|
||||
* @Entity com.wsnet.cargo.entity.DictShipRoutePort
|
||||
*/
|
||||
public interface DictShipRoutePortMapper extends BaseMapper<DictShipRoutePort> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictVehicleTypeDetail;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_vehicle_type_detail(车型明细)】的数据库操作Mapper
|
||||
* @createDate 2024-10-24 15:23:16
|
||||
* @Entity com.wsnet.cargo.entity.DictVehicleTypeDetail
|
||||
*/
|
||||
public interface DictVehicleTypeDetailMapper extends BaseMapper<DictVehicleTypeDetail> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictVehicleType;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_vehicle_type(车型)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:20
|
||||
* @Entity com.wsnet.cargo.entity.DictVehicleType
|
||||
*/
|
||||
public interface DictVehicleTypeMapper extends BaseMapper<DictVehicleType> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.DictWharf;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【dict_wharf(码头)】的数据库操作Mapper
|
||||
* @createDate 2024-10-23 10:12:20
|
||||
* @Entity com.wsnet.cargo.entity.DictWharf
|
||||
*/
|
||||
public interface DictWharfMapper extends BaseMapper<DictWharf> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue