update
parent
31972e4e67
commit
4907cde8a1
|
@ -23,6 +23,11 @@
|
|||
<groupId>com.wsnet</groupId>
|
||||
<artifactId>wsnet-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.11.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -17,6 +17,10 @@ public class CargoApiUser extends ApiUser {
|
|||
// 用户所在的港口
|
||||
private Long portId;
|
||||
|
||||
private String portName;
|
||||
|
||||
// 用户所在的码头
|
||||
private Long wharfId;
|
||||
|
||||
private String wharfName;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,217 @@
|
|||
package com.wsnet.utils;
|
||||
|
||||
|
||||
import okhttp3.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class OkHttpUtils {
|
||||
|
||||
// 创建OkHttpClient对象
|
||||
private static final OkHttpClient client = new OkHttpClient.Builder()
|
||||
.protocols(List.of(Protocol.H2_PRIOR_KNOWLEDGE))
|
||||
.connectTimeout(30, TimeUnit.SECONDS) // 连接超时时间
|
||||
.readTimeout(30, TimeUnit.SECONDS) // 读取超时时间
|
||||
.writeTimeout(30, TimeUnit.SECONDS) // 写入超时时间
|
||||
.build();
|
||||
|
||||
/**
|
||||
* GET请求
|
||||
* @param url 请求URL
|
||||
* @return 响应体字符串
|
||||
* @throws IOException 请求或响应过程中发生的错误
|
||||
*/
|
||||
public static String get(String url) throws IOException {
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
if (response.isSuccessful()) {
|
||||
return response.body().string();
|
||||
} else {
|
||||
throw new IOException("Unexpected code " + response);
|
||||
}
|
||||
}
|
||||
|
||||
public static String get(String url, Map<String, String> headers) throws IOException {
|
||||
Request.Builder builder = new Request.Builder()
|
||||
.url(url);
|
||||
if (headers != null && headers.size() > 0) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
builder.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
Request request = builder.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
if (response.isSuccessful()) {
|
||||
return response.body().string();
|
||||
} else {
|
||||
throw new IOException("Unexpected code " + response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* POST请求
|
||||
* @param url 请求URL
|
||||
* @param requestBody 请求体
|
||||
* @param headers 请求头
|
||||
* @return 响应体字符串
|
||||
* @throws IOException 请求或响应过程中发生的错误
|
||||
*/
|
||||
public static String post(String url, RequestBody requestBody, Map<String, String> headers) throws IOException {
|
||||
Request.Builder builder = new Request.Builder()
|
||||
.url(url)
|
||||
.post(requestBody);
|
||||
if (headers != null && headers.size() > 0) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
builder.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
Request request = builder.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
if (response.isSuccessful()) {
|
||||
return response.body().string();
|
||||
} else {
|
||||
throw new IOException("Unexpected code " + response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造JSON请求体
|
||||
* @param jsonStr JSON字符串
|
||||
* @return JSON请求体
|
||||
*/
|
||||
public static RequestBody buildJsonRequestBody(String jsonStr) {
|
||||
return RequestBody.create(jsonStr, MediaType.parse("application/json"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造表单请求体
|
||||
* @param formParams 表单参数
|
||||
* @return 表单请求体
|
||||
*/
|
||||
public static RequestBody buildFormRequestBody(Map<String, String> formParams) {
|
||||
FormBody.Builder builder = new FormBody.Builder();
|
||||
if (formParams != null && formParams.size() > 0) {
|
||||
for (Map.Entry<String, String> entry : formParams.entrySet()) {
|
||||
builder.add(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造Multipart请求体
|
||||
* @param multipartParams Multipart参数
|
||||
* @return Multipart请求体
|
||||
*/
|
||||
public static RequestBody buildMultipartRequestBody(Map<String, Object> multipartParams) {
|
||||
MultipartBody.Builder builder = new MultipartBody.Builder()
|
||||
.setType(MultipartBody.FORM);
|
||||
if (multipartParams != null && multipartParams.size() > 0) {
|
||||
for (Map.Entry<String, Object> entry : multipartParams.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
builder.addFormDataPart(key, (String) value);
|
||||
} else if (value instanceof byte[]) {
|
||||
builder.addFormDataPart(key, null,
|
||||
RequestBody.create(MediaType.parse("application/octet-stream"), (byte[]) value));
|
||||
} else if (value instanceof RequestBody) {
|
||||
builder.addFormDataPart(key, null, (RequestBody) value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造Multipart请求体,支持上传文件
|
||||
* @param multipartParams Multipart参数
|
||||
* @return Multipart请求体
|
||||
*/
|
||||
public static RequestBody buildMultipartRequestBodyWithFiles(Map<String, Object> multipartParams) {
|
||||
MultipartBody.Builder builder = new MultipartBody.Builder()
|
||||
.setType(MultipartBody.FORM);
|
||||
if (multipartParams != null && multipartParams.size() > 0) {
|
||||
for (Map.Entry<String, Object> entry : multipartParams.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
builder.addFormDataPart(key, (String) value);
|
||||
} else if (value instanceof byte[]) {
|
||||
builder.addFormDataPart(key, null,
|
||||
RequestBody.create((byte[]) value, MediaType.parse("application/octet-stream")));
|
||||
} else if (value instanceof RequestBody) {
|
||||
builder.addFormDataPart(key, null, (RequestBody) value);
|
||||
} else if (value instanceof UploadFile) { // 支持上传文件
|
||||
UploadFile file = (UploadFile) value;
|
||||
builder.addFormDataPart(key, file.getName(),
|
||||
RequestBody.create(MediaType.parse(file.getMimeType()), file.getFile()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param url 请求URL
|
||||
* @param file 上传的文件
|
||||
* @param headers 请求头
|
||||
* @return 响应体字符串
|
||||
* @throws IOException 请求或响应过程中发生的错误
|
||||
*/
|
||||
public static String uploadFile(String url, UploadFile file, Map<String, String> headers) throws IOException {
|
||||
RequestBody requestBody = new MultipartBody.Builder()
|
||||
.setType(MultipartBody.FORM)
|
||||
.addFormDataPart("file", file.getName(),
|
||||
RequestBody.create(MediaType.parse(file.getMimeType()), file.getFile()))
|
||||
.build();
|
||||
Request.Builder builder = new Request.Builder()
|
||||
.url(url)
|
||||
.post(requestBody);
|
||||
if (headers != null && headers.size() > 0) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
builder.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
Request request = builder.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
if (response.isSuccessful()) {
|
||||
return response.body().string();
|
||||
} else {
|
||||
throw new IOException("Unexpected code " + response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装文件上传参数
|
||||
*/
|
||||
public static class UploadFile {
|
||||
private final String name;
|
||||
private final String mimeType;
|
||||
private final byte[] file;
|
||||
|
||||
public UploadFile(String name, String mimeType, byte[] file) {
|
||||
this.name = name;
|
||||
this.mimeType = mimeType;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getMimeType() {
|
||||
return mimeType;
|
||||
}
|
||||
|
||||
public byte[] getFile() {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,9 @@ import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
|||
import com.wsnet.user.service.SmsService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
//@Service
|
||||
public class SmsServiceImpl implements SmsService {
|
||||
|
||||
@Resource
|
||||
|
|
|
@ -81,6 +81,17 @@
|
|||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.18.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.11.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.wsnet.cargo.entity.HelpApi;
|
||||
import com.wsnet.cargo.query.ApiQuery;
|
||||
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 = "对外开放接口")
|
||||
@Menu(code = "0308", name = "对外开放接口")
|
||||
@Tag(name = "对外开放接口")
|
||||
public class ApiController extends BaseController<HelpApiService, HelpApi, BaseQuery> {
|
||||
public class ApiController extends BaseController<HelpApiService, HelpApi, ApiQuery> {
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
@RestController
|
||||
@RequestMapping("/help")
|
||||
@Menu(code = "0302", name = "帮助文档")
|
||||
@Menu(code = "0307", name = "帮助文档")
|
||||
@Tag(name = "帮助文档")
|
||||
public class HelpController extends BaseController<HelpDocService, HelpDoc, BaseQuery> {
|
||||
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/adver")
|
||||
@Tag(name = "广告图")
|
||||
@Menu(code = "0213", name = "广告图")
|
||||
public class PhotoController {
|
||||
@Value("${launcher.upload.path}")
|
||||
private String path;
|
||||
|
||||
@Operation(summary = "文件上传", operationId = "01")
|
||||
@PostMapping("/upload")
|
||||
@Parameters(value = {
|
||||
@Parameter(name = "file", description = "文件")
|
||||
})
|
||||
public ResultData<String> upload(MultipartFile file) throws IOException {
|
||||
// 按年月创建目录
|
||||
String foldPath = StringUtils.join(path);
|
||||
|
||||
// 创建文件目录
|
||||
File fold = new File(foldPath);
|
||||
if (!fold.exists()) {
|
||||
fold.mkdirs();
|
||||
}
|
||||
|
||||
String fileName = StringUtils.join("adver", ".", "jpg");
|
||||
String filePath = StringUtils.join(foldPath, File.separator, fileName);
|
||||
|
||||
file.transferTo(new File(filePath));
|
||||
|
||||
return ResultData.success(fileName);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取广告图", operationId = "02")
|
||||
@GetMapping("/image")
|
||||
public ResponseEntity<Resource> getIdImage() {
|
||||
Path imageStoragePath = Paths.get(path); // 修改为你的图片存储路径
|
||||
try {
|
||||
Path file = imageStoragePath.resolve("adver.jpg");
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ import com.wsnet.core.dto.DictDTO;
|
|||
import com.wsnet.core.enums.StatusEnums;
|
||||
import com.wsnet.core.holder.UserContext;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.core.utils.DateUtils;
|
||||
import com.wsnet.dto.CargoApiUser;
|
||||
import com.wsnet.excel.handler.Cascade;
|
||||
import com.wsnet.excel.handler.CascadeGroup;
|
||||
|
@ -28,7 +29,9 @@ 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 com.wsnet.web.query.BaseQuery;
|
||||
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;
|
||||
|
@ -36,9 +39,11 @@ import jakarta.validation.ConstraintViolation;
|
|||
import jakarta.validation.Validation;
|
||||
import jakarta.validation.Validator;
|
||||
import jakarta.validation.ValidatorFactory;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -69,6 +74,9 @@ public class SailScheduleController extends BaseController<BusSailScheduleServic
|
|||
@Resource
|
||||
private BusSubscribeService subscribeService;
|
||||
|
||||
@Resource
|
||||
private BusSailScheduleHistoryService sailScheduleHistoryService;
|
||||
|
||||
/**
|
||||
* 查看我发布的
|
||||
*
|
||||
|
@ -470,6 +478,7 @@ public class SailScheduleController extends BaseController<BusSailScheduleServic
|
|||
List<Long> collect = subscribes.stream().map(s -> s.getSubWharfId()).collect(Collectors.toList());
|
||||
query.setDischargeWharfId(user.getWharfId());
|
||||
query.setSubWharfIdIds(collect);
|
||||
query.setCreateDate(DateUtils.addDays(new Date(), -11));
|
||||
query.setFields("*+enterprise@name+ship@name+route@name+loadWharf@name+dischargeWharf@name+loadPort@name+dischargePort@name");
|
||||
return super.page(query);
|
||||
}
|
||||
|
@ -477,8 +486,13 @@ public class SailScheduleController extends BaseController<BusSailScheduleServic
|
|||
@Validated
|
||||
@Operation(summary = "修改船舶状态", operationId = "15")
|
||||
@PostMapping("/status/update")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultData<String> updateStatus(@RequestParam("id") @NotNull(message = "ID不能为空") Long id, @RequestParam("status") @NotNull(message = "船舶状态不能为空") ShipStatusEnums status) {
|
||||
service.lambdaUpdate().eq(BusSailSchedule::getId, id).set(BusSailSchedule::getShipStatus, status).update();
|
||||
BusSailScheduleHistory history = new BusSailScheduleHistory();
|
||||
history.setScheduleId(id);
|
||||
history.setShipStatus(status);
|
||||
sailScheduleHistoryService.save(history);
|
||||
return ResultData.success("success");
|
||||
}
|
||||
|
||||
|
@ -509,14 +523,61 @@ public class SailScheduleController extends BaseController<BusSailScheduleServic
|
|||
return ResultData.success(rst);
|
||||
}
|
||||
|
||||
@Operation(summary = "历史分页列表", operationId = "17")
|
||||
@PostMapping("/history/page")
|
||||
public ResultData<Page<BusSailSchedule>> historyPage(@RequestBody SailScheduleQuery query) {
|
||||
@Operation(summary = "我发布的历史分页列表", operationId = "17")
|
||||
@PostMapping("/history/publish/page")
|
||||
public ResultData<Page<BusSailSchedule>> historyPublishPage(@RequestBody SailScheduleQuery query) {
|
||||
// 我订阅的码头
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
query.setCreateDate(DateUtils.addDays(new Date(), -31));
|
||||
// 订阅的码头ID
|
||||
query.setLoadWharfId(user.getWharfId());
|
||||
query.setFields("*+enterprise@name+ship@name+route@name+loadWharf@name+dischargeWharf@name+loadPort@name+dischargePort@name");
|
||||
query.setSorts(Arrays.asList(new BaseQuery.SortField("createDate", "desc")));
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Operation(summary = "我收到的历史分页列表", operationId = "18")
|
||||
@PostMapping("/history/receive/page")
|
||||
public ResultData<Page<BusSailSchedule>> historyReceivePage(@RequestBody SailScheduleQuery query) {
|
||||
// 我订阅的码头
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
query.setCreateDate(DateUtils.addDays(new Date(), -31));
|
||||
// 订阅的码头ID
|
||||
query.setDischargeWharfId(user.getWharfId());
|
||||
query.setFields("*+enterprise@name+ship@name+route@name+loadWharf@name+dischargeWharf@name+loadPort@name+dischargePort@name");
|
||||
query.setSorts(Arrays.asList(new BaseQuery.SortField("createDate", "desc")));
|
||||
return super.page(query);
|
||||
}
|
||||
|
||||
@Operation(summary = "车架号查询", operationId = "19")
|
||||
@GetMapping("/vin/query")
|
||||
public ResultData<List<BusSailScheduleHistory>> vinQuery(@RequestParam(name = "vin") @Validated @NotBlank(message = "车架号不能为空") @Parameter(description = "车架号") String vin) {
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
SailScheduleQuery query = new SailScheduleQuery();
|
||||
query.setDischargeWharfId(user.getWharfId());
|
||||
query.setFields("*+enterprise@name+ship@name+route@name+loadWharf@name+dischargeWharf@name+loadPort@name+dischargePort@name");
|
||||
query.setVin(vin);
|
||||
List<BusSailSchedule> list = baseService.list(BusSailSchedule.class, query);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return ResultData.success(Collections.emptyList());
|
||||
}
|
||||
|
||||
List<BusSailScheduleHistory> rst = new ArrayList<>();
|
||||
|
||||
BusSailSchedule schedule = list.get(0);
|
||||
|
||||
BusSailScheduleHistory history = new BusSailScheduleHistory();
|
||||
history.setScheduleId(schedule.getId());
|
||||
history.setShipStatus(schedule.getShipStatus());
|
||||
history.setSchedule(schedule);
|
||||
rst.add(history);
|
||||
|
||||
List<BusSailScheduleHistory> historyList = sailScheduleHistoryService.lambdaQuery().eq(BusSailScheduleHistory::getScheduleId, schedule.getId()).list();
|
||||
rst.addAll(historyList.stream().map(s -> {
|
||||
s.setSchedule(schedule);
|
||||
return s;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
return ResultData.success(rst);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.wsnet.cargo.entity.DictShipRoute;
|
|||
import com.wsnet.cargo.enums.TradeTypeEnums;
|
||||
import com.wsnet.cargo.service.BusSailScheduleService;
|
||||
import com.wsnet.cargo.service.DictShipRouteService;
|
||||
import com.wsnet.core.annotation.Guest;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import com.wsnet.core.holder.UserContext;
|
||||
|
@ -39,6 +40,7 @@ public class StatisticsController {
|
|||
@Resource
|
||||
private DictShipRouteService shipRouteService;
|
||||
|
||||
@Guest
|
||||
@Operation(summary = "数据统计", operationId = "01")
|
||||
@GetMapping("/")
|
||||
public ResultData<StatisticsVo> statistics() {
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package com.wsnet.cargo.controller;
|
||||
|
||||
import com.wsnet.cargo.entity.HelpText;
|
||||
import com.wsnet.cargo.entity.HelpTextSign;
|
||||
import com.wsnet.cargo.enums.TextTypeEnums;
|
||||
import com.wsnet.cargo.service.HelpTextService;
|
||||
import com.wsnet.cargo.service.HelpTextSignService;
|
||||
import com.wsnet.core.annotation.Menu;
|
||||
import com.wsnet.core.holder.UserContext;
|
||||
import com.wsnet.core.response.ResultData;
|
||||
import com.wsnet.dto.CargoApiUser;
|
||||
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 org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/text")
|
||||
@Menu(code = "0309", name = "协议规则")
|
||||
@Tag(name = "协议规则")
|
||||
public class TextController {
|
||||
@Resource
|
||||
private HelpTextService helpTextService;
|
||||
|
||||
@Resource
|
||||
private HelpTextSignService helpTextSignService;
|
||||
|
||||
@Operation(summary = "获取", operationId = "01")
|
||||
@GetMapping({"/get"})
|
||||
public ResultData<HelpText> get(@RequestParam("textType") TextTypeEnums textType) {
|
||||
HelpText text = helpTextService.lambdaQuery().eq(HelpText::getTextType, textType).one();
|
||||
return ResultData.success(text);
|
||||
}
|
||||
|
||||
@Operation(summary = "保存", operationId = "02")
|
||||
@PostMapping({"/save"})
|
||||
public ResultData<Long> save(@RequestBody @Validated HelpText entity) {
|
||||
helpTextService.saveOrUpdate(entity);
|
||||
return ResultData.success(entity.getId());
|
||||
}
|
||||
|
||||
@Operation(summary = "同意协议", operationId = "03")
|
||||
@PostMapping({"/agree"})
|
||||
public ResultData<String> agree() {
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
boolean exists = helpTextSignService.lambdaQuery().eq(HelpTextSign::getUserId, Long.valueOf(user.getId())).exists();
|
||||
if (!exists) {
|
||||
HelpTextSign entity = new HelpTextSign();
|
||||
entity.setUserId(Long.valueOf(user.getId()));
|
||||
helpTextSignService.save(entity);
|
||||
}
|
||||
return ResultData.success("success");
|
||||
}
|
||||
|
||||
@Operation(summary = "是否同意", operationId = "04")
|
||||
@PostMapping({"/sign"})
|
||||
public ResultData<Boolean> sign() {
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
boolean exists = helpTextSignService.lambdaQuery().eq(HelpTextSign::getUserId, Long.valueOf(user.getId())).exists();
|
||||
return ResultData.success(exists);
|
||||
}
|
||||
}
|
|
@ -5,13 +5,28 @@ 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.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.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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;
|
||||
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.util.Date;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/wharf")
|
||||
|
@ -20,6 +35,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@Validated
|
||||
public class WharfController extends BaseDictController<DictWharfService, DictWharf, WharfQuery> {
|
||||
|
||||
@Value("${launcher.upload.path}")
|
||||
private String path;
|
||||
|
||||
@Override
|
||||
public ResultData<Page<DictWharf>> page(@RequestBody WharfQuery query) {
|
||||
query.setFields("*+port@name");
|
||||
|
@ -37,4 +55,60 @@ public class WharfController extends BaseDictController<DictWharfService, DictWh
|
|||
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "文件上传", operationId = "09")
|
||||
@PostMapping("/upload")
|
||||
@Parameters(value = {
|
||||
@Parameter(name = "file", description = "文件")
|
||||
})
|
||||
public ResultData<String> upload(MultipartFile file) throws IOException {
|
||||
// 按年月创建目录
|
||||
String foldPath = StringUtils.join(path);
|
||||
|
||||
// 创建文件目录
|
||||
File fold = new File(foldPath);
|
||||
if (!fold.exists()) {
|
||||
fold.mkdirs();
|
||||
}
|
||||
|
||||
String fileName = StringUtils.join("wharf", "-",
|
||||
String.valueOf(new Date().getTime()), ".", StringUtils.substringAfterLast(file.getOriginalFilename(), "."));
|
||||
String filePath = StringUtils.join(foldPath, File.separator, fileName);
|
||||
|
||||
file.transferTo(new File(filePath));
|
||||
|
||||
return ResultData.success(fileName);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取码头图片", operationId = "13")
|
||||
@GetMapping("/image/{id}")
|
||||
public ResponseEntity<Resource> getIdImage(@PathVariable Long id) {
|
||||
DictWharf wharf = service.getById(id);
|
||||
if (wharf == null) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
Path imageStoragePath = Paths.get(path); // 修改为你的图片存储路径
|
||||
try {
|
||||
Path file = imageStoragePath.resolve(wharf.getPhoto());
|
||||
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")
|
||||
@GetMapping("/get/info")
|
||||
public ResultData<DictWharf> getWharfInfo() {
|
||||
CargoApiUser user = (CargoApiUser) UserContext.getUser();
|
||||
if (user.getWharfId() != null) {
|
||||
return ResultData.success(service.getById(user.getWharfId()));
|
||||
}
|
||||
return ResultData.success(null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
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.core.db.annos.DbBean;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 船期
|
||||
* @TableName bus_sail_schedule_history
|
||||
*/
|
||||
@TableName(value ="bus_sail_schedule_history")
|
||||
@Data
|
||||
@Schema(title = "船期历史记录")
|
||||
public class BusSailScheduleHistory extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 船期ID
|
||||
*/
|
||||
@TableField(value = "schedule_id")
|
||||
@Schema(description = "船期ID")
|
||||
private Long scheduleId;
|
||||
|
||||
/**
|
||||
* 船舶状态
|
||||
*/
|
||||
@TableField(value = "ship_status")
|
||||
@Schema(description = "船舶状态")
|
||||
private ShipStatusEnums shipStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
@DbBean(ref = "scheduleId")
|
||||
@Schema(description = "船期")
|
||||
private BusSailSchedule schedule;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.wsnet.cargo.entity;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.cargo.enums.SubStatusEnums;
|
||||
import com.wsnet.cargo.enums.SubscribeStatusEnums;
|
||||
import com.wsnet.core.db.entity.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
@ -81,7 +82,7 @@ public class BusSubscribe extends BaseEntity implements Serializable {
|
|||
@TableField(value = "sub_info")
|
||||
@Schema(description = "订阅类型,枚举可以多选")
|
||||
@NotBlank(message = "订阅类型,枚举可以多选不能为空")
|
||||
private String subInfo;
|
||||
private SubStatusEnums subInfo;
|
||||
|
||||
/**
|
||||
* 订阅开始日期
|
||||
|
|
|
@ -61,6 +61,16 @@ public class DictEmployee extends BaseEntity implements Serializable {
|
|||
@TableField(value = "phone")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "部门")
|
||||
@NotBlank(message = "部门不能为空")
|
||||
@TableField(value = "dept")
|
||||
private String dept;
|
||||
|
||||
@Schema(description = "职务")
|
||||
@NotBlank(message = "职务不能为空")
|
||||
@TableField(value = "job")
|
||||
private String job;
|
||||
|
||||
/**
|
||||
* 码头ID
|
||||
*/
|
||||
|
|
|
@ -118,6 +118,27 @@ public class DictShip extends BaseEntity implements Serializable {
|
|||
@Schema(description = "常走航线")
|
||||
private String regular;
|
||||
|
||||
/**
|
||||
* 舱层
|
||||
*/
|
||||
@TableField(value = "layer")
|
||||
@Schema(description = "舱层")
|
||||
private Integer layer;
|
||||
|
||||
/**
|
||||
* 舱段
|
||||
*/
|
||||
@TableField(value = "fragment")
|
||||
@Schema(description = "舱段")
|
||||
private Integer fragment;
|
||||
|
||||
/**
|
||||
* 舱段
|
||||
*/
|
||||
@TableField(value = "capacity")
|
||||
@Schema(description = "容量描述")
|
||||
private String capacity;
|
||||
|
||||
|
||||
/**
|
||||
* 状态
|
||||
|
|
|
@ -93,6 +93,18 @@ public class DictWharf extends BaseEntity implements Serializable {
|
|||
@NotNull(message = "接卸能力不能为空")
|
||||
private Integer handlingCapacity;
|
||||
|
||||
/**
|
||||
* 泊位图片
|
||||
*/
|
||||
@TableField(value = "photo")
|
||||
@Schema(description = "泊位图片")
|
||||
@NotNull(message = "接卸能力不能为空")
|
||||
private String photo;
|
||||
|
||||
@TableField(value = "intro")
|
||||
@Schema(description = "码头简介")
|
||||
private String intro;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
|
|
|
@ -2,11 +2,13 @@ package com.wsnet.cargo.entity;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.cargo.enums.ApiTypeEnums;
|
||||
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 jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
@ -57,6 +59,14 @@ public class HelpApi extends BaseEntity implements Serializable {
|
|||
@NotBlank(message = "接口返回不能为空")
|
||||
private String resp;
|
||||
|
||||
/**
|
||||
* 接口类型
|
||||
*/
|
||||
@TableField(value = "api_type")
|
||||
@Schema(description = "接口类型")
|
||||
@NotNull(message = "接口类型不能为空")
|
||||
private ApiTypeEnums apiType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.wsnet.cargo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wsnet.cargo.enums.TextTypeEnums;
|
||||
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 jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* help
|
||||
* @TableName help_text
|
||||
*/
|
||||
@TableName(value ="help_text")
|
||||
@Data
|
||||
@Schema(title = "帮助文本")
|
||||
public class HelpText extends BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@TableField(value = "content")
|
||||
@Schema(description = "内容")
|
||||
@NotBlank(message = "内容不能为空")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "text_type")
|
||||
@Schema(description = "类型")
|
||||
@NotNull(message = "类型不能为空")
|
||||
private TextTypeEnums textType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
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 lombok.Data;
|
||||
|
||||
/**
|
||||
* help
|
||||
* @TableName help_text_sign
|
||||
*/
|
||||
@TableName(value ="help_text_sign")
|
||||
@Data
|
||||
public class HelpTextSign extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private Long userId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
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 ApiTypeEnums {
|
||||
DICT_DATE("1", "基础数据"),
|
||||
PUBLISH("2", "信息发布"),
|
||||
SUB("3", "信息订阅"),
|
||||
QUERY("4", "信息查询"),
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
ApiTypeEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static ApiTypeEnums getEnum(String code) {
|
||||
for (ApiTypeEnums e : ApiTypeEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ApiTypeEnums getEnumByDesc(String desc) {
|
||||
for (ApiTypeEnums e : ApiTypeEnums.values()) {
|
||||
if (StringUtils.equals(e.getDesc(), desc)) {
|
||||
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 SubStatusEnums {
|
||||
SUB_SCHEDULE("0", "船期信息"),
|
||||
SUB_MANIFEST("1", "舱单信息"),
|
||||
SUB_MANIFEST_DETAIL("2", "舱单明细")
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
SubStatusEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static SubStatusEnums getEnum(String code) {
|
||||
for (SubStatusEnums e : SubStatusEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
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 TextTypeEnums {
|
||||
AGREEMENT("1", "用户协议"),
|
||||
RULE("2", "共享规则"),
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
@JsonValue
|
||||
private final String desc;
|
||||
|
||||
TextTypeEnums(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static TextTypeEnums getEnum(String code) {
|
||||
for (TextTypeEnums e : TextTypeEnums.values()) {
|
||||
if (StringUtils.equals(e.getCode(), code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TextTypeEnums getEnumByDesc(String desc) {
|
||||
for (TextTypeEnums e : TextTypeEnums.values()) {
|
||||
if (StringUtils.equals(e.getDesc(), desc)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.BusSailScheduleHistory;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【bus_sail_schedule_history(船期)】的数据库操作Mapper
|
||||
* @createDate 2024-11-25 09:14:12
|
||||
* @Entity com.wsnet.cargo.entity.BusSailScheduleHistory
|
||||
*/
|
||||
public interface BusSailScheduleHistoryMapper extends BaseMapper<BusSailScheduleHistory> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.HelpText;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【help_text(help)】的数据库操作Mapper
|
||||
* @createDate 2024-11-25 20:05:11
|
||||
* @Entity com.wsnet.cargo.entity.HelpText
|
||||
*/
|
||||
public interface HelpTextMapper extends BaseMapper<HelpText> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wsnet.cargo.mapper;
|
||||
|
||||
import com.wsnet.cargo.entity.HelpTextSign;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【help_text_sign(help)】的数据库操作Mapper
|
||||
* @createDate 2024-11-25 20:05:11
|
||||
* @Entity com.wsnet.cargo.entity.HelpTextSign
|
||||
*/
|
||||
public interface HelpTextSignMapper extends BaseMapper<HelpTextSign> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.wsnet.cargo.query;
|
||||
|
||||
import com.wsnet.cargo.enums.ApiTypeEnums;
|
||||
import com.wsnet.core.enums.StatusEnums;
|
||||
import com.wsnet.web.query.BaseQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(title = "接口查询")
|
||||
public class ApiQuery extends BaseQuery {
|
||||
@Schema(description = "接口类型")
|
||||
private ApiTypeEnums apiType;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.wsnet.cargo.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.wsnet.cargo.enums.ShipStatusEnums;
|
||||
import com.wsnet.cargo.enums.TradeTypeEnums;
|
||||
import com.wsnet.core.db.annos.DbQuery;
|
||||
|
@ -8,6 +9,7 @@ import com.wsnet.web.query.BaseQuery;
|
|||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -89,4 +91,12 @@ public class SailScheduleQuery extends BaseQuery {
|
|||
@Schema(description = "我订阅的码头ID列表")
|
||||
@DbQuery(symbol = SqlSymbol.IN, field = "loadWharfId")
|
||||
private List<Long> subWharfIdIds;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "发布日期")
|
||||
@DbQuery(symbol = SqlSymbol.GT)
|
||||
private Date createDate;
|
||||
|
||||
@DbQuery(symbol = SqlSymbol.EXISTS, outer = true, field = "SELECT A.id from bus_manifest_detail A INNER JOIN bus_manifest B ON A.manifest_id=B.id where B.schedule_id=bus_sail_schedule.id and A.vin='${vin}'")
|
||||
private String vin;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.wsnet.cargo.service;
|
||||
|
||||
import com.wsnet.cargo.entity.BusSailScheduleHistory;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【bus_sail_schedule_history(船期)】的数据库操作Service
|
||||
* @createDate 2024-11-25 09:14:12
|
||||
*/
|
||||
public interface BusSailScheduleHistoryService extends IService<BusSailScheduleHistory> {
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.wsnet.cargo.service;
|
||||
|
||||
import com.wsnet.cargo.entity.HelpText;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【help_text(help)】的数据库操作Service
|
||||
* @createDate 2024-11-25 20:05:11
|
||||
*/
|
||||
public interface HelpTextService extends IService<HelpText> {
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.wsnet.cargo.service;
|
||||
|
||||
import com.wsnet.cargo.entity.HelpTextSign;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【help_text_sign(help)】的数据库操作Service
|
||||
* @createDate 2024-11-25 20:05:11
|
||||
*/
|
||||
public interface HelpTextSignService extends IService<HelpTextSign> {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.wsnet.cargo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wsnet.cargo.entity.BusSailScheduleHistory;
|
||||
import com.wsnet.cargo.service.BusSailScheduleHistoryService;
|
||||
import com.wsnet.cargo.mapper.BusSailScheduleHistoryMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【bus_sail_schedule_history(船期)】的数据库操作Service实现
|
||||
* @createDate 2024-11-25 09:14:12
|
||||
*/
|
||||
@Service
|
||||
public class BusSailScheduleHistoryServiceImpl extends ServiceImpl<BusSailScheduleHistoryMapper, BusSailScheduleHistory>
|
||||
implements BusSailScheduleHistoryService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.wsnet.cargo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wsnet.cargo.entity.HelpText;
|
||||
import com.wsnet.cargo.service.HelpTextService;
|
||||
import com.wsnet.cargo.mapper.HelpTextMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【help_text(help)】的数据库操作Service实现
|
||||
* @createDate 2024-11-25 20:05:11
|
||||
*/
|
||||
@Service
|
||||
public class HelpTextServiceImpl extends ServiceImpl<HelpTextMapper, HelpText>
|
||||
implements HelpTextService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.wsnet.cargo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wsnet.cargo.entity.HelpTextSign;
|
||||
import com.wsnet.cargo.service.HelpTextSignService;
|
||||
import com.wsnet.cargo.mapper.HelpTextSignMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dj
|
||||
* @description 针对表【help_text_sign(help)】的数据库操作Service实现
|
||||
* @createDate 2024-11-25 20:05:11
|
||||
*/
|
||||
@Service
|
||||
public class HelpTextSignServiceImpl extends ServiceImpl<HelpTextSignMapper, HelpTextSign>
|
||||
implements HelpTextSignService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?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.cargo.mapper.BusSailScheduleHistoryMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.wsnet.cargo.entity.BusSailScheduleHistory">
|
||||
<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="scheduleId" column="schedule_id" jdbcType="BIGINT"/>
|
||||
<result property="shipStatus" column="ship_status" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,create_by,create_date,
|
||||
update_by,update_date,version,
|
||||
schedule_id,ship_status
|
||||
</sql>
|
||||
</mapper>
|
|
@ -0,0 +1,23 @@
|
|||
<?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.cargo.mapper.HelpTextMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.wsnet.cargo.entity.HelpText">
|
||||
<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="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="textType" column="text_type" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,create_by,create_date,
|
||||
update_by,update_date,version,
|
||||
content,text_type
|
||||
</sql>
|
||||
</mapper>
|
|
@ -0,0 +1,22 @@
|
|||
<?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.cargo.mapper.HelpTextSignMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.wsnet.cargo.entity.HelpTextSign">
|
||||
<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="userId" column="user_id" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,create_by,create_date,
|
||||
update_by,update_date,version,
|
||||
user_id
|
||||
</sql>
|
||||
</mapper>
|
|
@ -0,0 +1,43 @@
|
|||
package com.wsnet.cargo;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.jsoup.Connection;
|
||||
import org.jsoup.Jsoup;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class JsoupTest {
|
||||
@SneakyThrows
|
||||
public static void main(String[] args) {
|
||||
//登录船讯网
|
||||
String url = "https://www.shipxy.com/Home/Login";
|
||||
|
||||
//帐号参数
|
||||
String username = "g1f";
|
||||
String password= "wsnet906";
|
||||
String autologin= "true";
|
||||
String authCode="";
|
||||
|
||||
//帐号参数添加到参数Map
|
||||
Map<String,String> accountsMap = new HashMap<>();
|
||||
accountsMap.put("username", username);
|
||||
accountsMap.put("password", password);
|
||||
accountsMap.put("autologin", autologin);
|
||||
accountsMap.put("authCode", authCode);
|
||||
|
||||
//模拟登录,默认使用了g1f/wsnet906帐号登录,获取请求头的cookies
|
||||
Connection.Response logindata = Jsoup.connect(url)
|
||||
.header("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
|
||||
.userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36 Edg/101.0.1210.53")
|
||||
.followRedirects(true)
|
||||
.data(accountsMap)
|
||||
.ignoreHttpErrors(true)
|
||||
.timeout(30000)
|
||||
.method(Connection.Method.POST)
|
||||
.execute();
|
||||
|
||||
//显示登录成功 login success
|
||||
System.out.println(logindata.body());
|
||||
}
|
||||
}
|
|
@ -1,21 +1,48 @@
|
|||
package com.wsnet.cargo;
|
||||
|
||||
import cn.hutool.core.lang.generator.SnowflakeGenerator;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.alibaba.excel.util.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.wsnet.cargo.query.ManifestQuery;
|
||||
import com.wsnet.core.utils.HttpClientUtils;
|
||||
import com.wsnet.utils.OkHttpUtils;
|
||||
import com.wsnet.web.query.BaseQuery;
|
||||
import lombok.SneakyThrows;
|
||||
import net.sf.jsqlparser.JSQLParserException;
|
||||
import okhttp3.RequestBody;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class SqlTest {
|
||||
public static void main(String[] args) throws JSQLParserException {
|
||||
@SneakyThrows
|
||||
public static void main(String[] args) throws JSQLParserException, InterruptedException {
|
||||
String s = OkHttpUtils.get("https://www.shipxy.com/");
|
||||
System.err.println(s);
|
||||
TimeUnit.MILLISECONDS.sleep(1000);
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("mmsi", "417000009");
|
||||
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put(":authority", "www.shipxy.com");
|
||||
headers.put(":method", "POST");
|
||||
headers.put(":path", "/ship/GetShipm");
|
||||
|
||||
|
||||
headers.put(":scheme", "https");
|
||||
headers.put("referer", "https://www.shipxy.com/");
|
||||
headers.put("s", "1561cf6d6fbf6bdd5f0bec0cd262ae6b");
|
||||
headers.put("t", new Date().getTime()+"");
|
||||
// headers.put()
|
||||
|
||||
RequestBody requestBody = OkHttpUtils.buildFormRequestBody(params);
|
||||
|
||||
String rst = OkHttpUtils.post("https://www.shipxy.com/ship/GetShipm", requestBody, headers);
|
||||
System.err.println(rst);
|
||||
// String sql = "select id from bus_sail_schedule b where b.id=bus_manifest.schedule_id and b.ship_id = ${shipId} and b.voyage = '${voyage}' and b.status='${status}' and b.create_date='${createDate}' and b.status in (${statusList}) and b.status in (${statusArray})";
|
||||
//
|
||||
//
|
||||
|
@ -37,6 +64,12 @@ public class SqlTest {
|
|||
//
|
||||
// System.err.println(fmtSql);
|
||||
|
||||
|
||||
// SnowflakeGenerator generator = new SnowflakeGenerator(1, 1);
|
||||
// for (int i = 0; i < 20; i++) {
|
||||
// System.err.println(generator.next());
|
||||
// }
|
||||
|
||||
System.err.println(File.separator);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue