first commit

This commit is contained in:
李玉东 2025-08-07 18:41:30 +08:00
commit f745a2e0fa
1008 changed files with 348424 additions and 0 deletions

161
pom.xml Normal file
View File

@ -0,0 +1,161 @@
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.hshh.nation</groupId>
<artifactId>hshh-defence</artifactId>
<packaging>jar</packaging>
<name>hshh-defence</name>
<url>http://maven.apache.org</url>
<properties>
<!-- 指定编译使用的 Java 版本 -->
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<!-- 可选:指定编译编码 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- 可选,推荐加上连接池 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version>
</dependency>
<!-- Apache POI OOXML 支持 xlsx 文件 -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>2.0.53</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.13</version> <!-- 或 1.7.0 -->
</dependency>
<!-- https://mvnrepository.com/artifact/dm.jdbc.driver/dm8 -->
<dependency>
<groupId>com</groupId>
<artifactId>dmjdbc</artifactId>
<version>8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.hshh.DefenceApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,25 @@
package com.hshh;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 程序入口启动类 .
*/
@SpringBootApplication
@MapperScan("com.hshh.nation.**.mapper")
public class DefenceApplication {
/**
* 入口启动函数.
*
* @param args 入口参数.
*/
public static void main(final String[] args) {
SpringApplication.run(DefenceApplication.class, args);
}
}

View File

@ -0,0 +1,28 @@
package com.hshh;
import com.hshh.nation.code.entity.CodeOption;
import com.hshh.nation.common.MockMessageTip;
import com.hshh.nation.menu.entity.Menu;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.DelayQueue;
/**
* 全局统一对象.
*/
public class Global {
public static DelayQueue<MockMessageTip> delayQueue = new DelayQueue<MockMessageTip>();
//href对应的菜单对象 this.href->this
public static Map<String, Menu> menuHrefMap = new HashMap<>();
//菜单对象对应的上级菜单ID id->parentId
public static Map<Integer, Integer> parentMenuMap = new HashMap<>();
//全局title
public static String globalTitle = "";
//全局码表map
public static Map<String, List<CodeOption>> codeOptionMap = new HashMap<>();
//码表数据列表
public static Map<Integer, String> optionMap = new HashMap<>();
}

View File

@ -0,0 +1,108 @@
package com.hshh;
import com.hshh.nation.code.service.CodeOptionService;
import com.hshh.nation.menu.entity.Menu;
import com.hshh.nation.menu.service.MenuService;
import com.hshh.nation.set.service.ConfigService;
import com.hshh.nation.thread.WebsocketMessageThread;
import com.hshh.nation.ws.WsServer;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
/**
* 初始化系统相关属性.
*/
@Component("defenceInit")
@Slf4j
public class Init {
/**
* wsServer 实例 .
*/
@Resource
private WsServer wsServer;
/**
* 获取数据库中config .
*/
@Resource
private ConfigService configService;
/**
* 菜单服务 .
*/
@Resource
private MenuService menuService;
/**
* 码表服务 .
*/
@Resource
private CodeOptionService codeOptionService;
/**
* 初始化执行 .
*/
@PostConstruct
public void defenceInit() {
initGlobalTitle();
//初始化菜单相关map; 1.href与菜单的对应关系 ;2. 菜单ID和父Id对应关系
initMenuMap();
//初始化系统码表按照类型分类
initSystemDictOptions();
//初始化码表 key-name
initOptionMap();
startPushMessageThread();
}
private void startPushMessageThread() {
new Thread(new WebsocketMessageThread(wsServer)).start();
}
//1.初始化全局title
private void initGlobalTitle() {
try {
Global.globalTitle = configService.getMapAllSet().get("system.title") == null ? ""
: configService.getMapAllSet().get("system.title");
} catch (Exception e) {
log.error(e.getMessage());
}
}
//2. 菜单ID和父Id对应关系
private void initMenuMap() {
try {
List<Menu> list = menuService.getAllMenu();
list.forEach(a -> {
if (!StringUtils.isEmpty(a.getMenuHref())) {
Global.menuHrefMap.put(a.getMenuHref(), a);
}
Global.parentMenuMap.put(a.getId(), a.getParentId() == null ? 0 : a.getParentId());
});
} catch (Exception e) {
log.error(e.getMessage());
}
}
private void initSystemDictOptions() {
Global.codeOptionMap.putAll(codeOptionService.selectAllByCodeTypeForMap());
}
private void initOptionMap() {
try {
codeOptionService.list().forEach(a -> {
Global.optionMap.put(a.getId(), a.getOptionName());
});
} catch (Exception e) {
log.error(e.getMessage());
}
}
}

View File

@ -0,0 +1,37 @@
package com.hshh;
import java.sql.Connection;
import java.sql.DriverManager;
/**
* Test
*
* @author LiDongYU
* @date 2025/7/16
* @description
*/
public class Test {
public static void main(String[] args) {
// 1. JDBC 连接参数
String url = "jdbc:dm://localhost:5236/NATION_DEFENCE"; // TESTDB为你的数据库名
String username = "nation";
String password = "Hshh123456";
// 2. 加载驱动可省略JDBC 4.0后自动加载
try {
Class.forName("dm.jdbc.driver.DmDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
// 3. 正常连接
try (Connection conn = DriverManager.getConnection(url, username, password);
) {
System.out.println(conn.getMetaData().getDatabaseProductName()); ;
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,156 @@
package com.hshh.nation.action.controller;
import com.hshh.nation.fuel.bean.EquipResource;
import com.hshh.nation.fuel.service.FuelArmyService;
import com.hshh.nation.fuel.service.FuelTruckService;
import com.hshh.nation.medical.bean.MedicalResource;
import com.hshh.nation.medical.bean.MedicalTransportResource;
import com.hshh.nation.medical.service.MedicalHospitalService;
import com.hshh.nation.medical.service.MedicalPlaneService;
import com.hshh.nation.transport.bean.PortResource;
import com.hshh.nation.transport.bean.RegularTransportResource;
import com.hshh.nation.transport.service.TransportAirPortService;
import com.hshh.nation.transport.service.TransportAirService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* 行动控制
*/
@Controller
@RequestMapping("/action")
public class ActionController {
//油品服务类
@Resource
private FuelTruckService fuelTruckService;
//保障部队服务类
@Resource
private FuelArmyService armyService;
//卫生医院服务类
@Resource
private MedicalHospitalService medicalHospitalService;
//卫生飞机服务类
@Resource
private MedicalPlaneService medicalPlaneService;
//运输交通工具
@Resource
private TransportAirService transportAirService;
//运输港口
@Resource
private TransportAirPortService transportAirPortService;
@RequestMapping("/{action}")
public String action(@PathVariable("action") String action, Model model) {
setNow(model);
switch (action) {
case "receive":
//获取保障实体实例列表
setGuaranteeResource(model);
return "FuelAction/action_receive";
//油料发放行动模型
case "send":
setGuaranteeResource(model);
setEquipAttribute(model);
return "FuelAction/action_send";
//油料输送模型
case "transport":
setGuaranteeResource(model);
setEquipAttribute(model);
return "FuelAction/action_transfer";
case "plane":
setEquipAttribute(model);
return "FuelAction/action_air_plane";
case "boat":
setEquipAttribute(model);
return "FuelAction/action_boat";
//伤病后送
case "casualty-back":
setMedicalResource(model);
setMedicalTransport(model);
return "MedicalAction/medicalCasualBack";
//救治物资补给
case "medical-supply":
setMedicalResource(model);
setMedicalTransport(model);
return "MedicalAction/medicalStuffRenew";
//装载行动
case "load":
setTransportation(model);
setPort(model);
return "transportAction/load";
//卸载行动
case "unload":
setTransportation(model);
setPort(model);
return "transportAction/unload";
//海上输送
case "transport_sea":
setTransportation(model);
setPort(model);
return "transportAction/sea";
//空中输送
case "transport_plane":
setTransportation(model);
setPort(model);
return "transportAction/airplane";
}
return null;
}
private void setGuaranteeResource(Model model) {
model.addAttribute("guaranteeResource", armyService.selectOrganizeResource());
}
private void setNow(Model model) {
LocalDateTime now = LocalDateTime.now();
String formatNow = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(now);
model.addAttribute("now", formatNow);
}
private void setEquipAttribute(Model model) {
List<EquipResource> resources = fuelTruckService.selectAllResource();
model.addAttribute("equipments", resources);
}
private void setMedicalResource(Model model) {
List<MedicalResource> resources = medicalHospitalService.selectAllMedicalResource();
model.addAttribute("medical_secure_resources", resources);
}
private void setMedicalTransport(Model model) {
List<MedicalTransportResource> resources = medicalPlaneService.selectMedicalTransport();
model.addAttribute("medical_transport_resources", resources);
}
private void setPort(Model model) {
List<PortResource> resources = transportAirPortService.selectAllResource();
model.addAttribute("ports", resources);
}
private void setTransportation(Model model) {
List<RegularTransportResource> resources = transportAirService.selectAllResource();
model.addAttribute("transportations", resources);
}
}

View File

@ -0,0 +1,15 @@
package com.hshh.nation.advice;
import com.hshh.nation.common.OperateResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
@ControllerAdvice
public class GlobalExceptionHandler {
public static final int SERVER_ERROR_CODE = 500;
@ExceptionHandler(Exception.class)
public OperateResult<String> handleException(Exception ex) {
// 你可以记录日志自定义返回信息等
return OperateResult.error("",ex.getMessage(), SERVER_ERROR_CODE);
}
}

View File

@ -0,0 +1,116 @@
package com.hshh.nation.advice;
import com.hshh.nation.login.model.ExtendUserDetails;
import com.hshh.Global;
import com.hshh.nation.code.entity.CodeOption;
import com.hshh.nation.menu.entity.Menu;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ModelAttribute;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ControllerAdvice
@Slf4j
public class GlobalModelAttributeAdvice {
/**
* 设置全局系统名称
*
* @return
*/
@ModelAttribute("globalTitle")
public String systemTile() {
log.info("systemTile={}", Global.globalTitle);
return Global.globalTitle;
}
/**
* 设置全局用户信息
*
* @param session
* @param request
* @return
*/
@ModelAttribute("user")
public ExtendUserDetails user(HttpSession session, HttpServletRequest request) {
ExtendUserDetails sessionUser = (ExtendUserDetails) session.getAttribute("user");
try {
if (sessionUser != null) {
String href = request.getRequestURI();
log.info("href::{}", href);
//设置当前页面title
sessionUser.setPageTitle(Global.menuHrefMap.get(href) == null ? "" : Global.menuHrefMap.get(href).getTitle());
//复位菜单选中状态
resetMenuActive(sessionUser.getMenuList());
//设置菜单的选中状态
Menu currentMenu = Global.menuHrefMap.get(href);
if (currentMenu != null) {
setMenuActive(sessionUser, currentMenu);
}
}
} catch (Exception e) {
log.error(e.getMessage());
}
return sessionUser;
}
@ModelAttribute("codeMap")
public Map<String, List<CodeOption>> codeMap() {
return Global.codeOptionMap;
}
@ModelAttribute("OptionMap")
public Map<Integer,String> optioinMap(){
return Global.optionMap;
}
//复位所有菜单未选中
private void resetMenuActive(List<Menu> menus) {
menus.forEach(menu -> {
menu.setActive(false);
if (!menu.getChildren().isEmpty()) {
resetMenuActive(menu.getChildren());
}
});
}
//设置当前菜单及其父菜单选中
private void setMenuActive(ExtendUserDetails sessionUser, Menu currentMenu) {
Set<Integer> idSet = new HashSet<>();
recursionAddId(idSet, currentMenu.getId());
sessionUser.getMenuList().forEach(menu -> {
recursionSetMenuActive(menu, idSet);
});
}
//递归添加所有父ID
private void recursionAddId(Set<Integer> idSet, Integer id) {
idSet.add(id);
if (Global.parentMenuMap.get(id) != 0) {
recursionAddId(idSet, Global.parentMenuMap.get(id));
}
}
//递归设置所有父菜单active
private void recursionSetMenuActive(Menu menu, Set<Integer> idSet) {
if (idSet.contains(menu.getId())) {
//当前菜单设置为true
menu.setActive(true);
if (menu.getChildren() != null && !menu.getChildren().isEmpty()) {
menu.getChildren().forEach(menuChild -> {
recursionSetMenuActive(menuChild, idSet);
});
}
}
}
}

View File

@ -0,0 +1,83 @@
package com.hshh.nation.code.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.code.service.CodeDictService;;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.code.entity.CodeDict;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 码表类别表 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-02
*/
@Controller
@RequestMapping("/codeDict")
public class CodeDictController extends BaseController {
@Resource
private CodeDictService service;
@GetMapping("/list")
public String list(CodeDict search, Model model) {
List<CodeDict> list = service.list(search);
long total = service.count(search);
TableRowsResult<CodeDict> tableRowsResult = makeTableRowsResult(search,list,total);
model.addAttribute("data", tableRowsResult);
return "CodeDict/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute CodeDict model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if(model.getId() == null){
service.save(model);
}else{
service.updateById(model);
} return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<CodeDict> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<CodeDict> view(@PathVariable("id") Integer id) {
CodeDict data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<CodeDict> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,120 @@
package com.hshh.nation.code.controller;
import com.hshh.nation.code.entity.CodeDict;
import com.hshh.nation.code.service.CodeDictService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.code.service.CodeOptionService;;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.code.entity.CodeOption;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/codeOption")
public class CodeOptionController extends BaseController {
@Resource
private CodeOptionService service;
@Resource
private CodeDictService codeDictService;
@GetMapping("/list")
public String list(CodeOption search, Model model) {
//查询列表
List<CodeOption> list = service.list(search);
//当前条件下总数
long total = service.count(search);
//查询所有的类别
List<CodeDict> allDict = codeDictService.all();
//类别key+类别信息;用于给选项设置类别名称
Map<Integer, CodeDict> dictMap = new HashMap<>();
allDict.forEach(dict -> {
dictMap.put(dict.getId(), dict);
});
//设置类别名称
list.forEach(dict -> {
if (dictMap.containsKey(dict.getDictId())) {
dict.setDictName(dictMap.get(dict.getDictId()).getCodeNameCn());
}
});
TableRowsResult<CodeOption> tableRowsResult = makeTableRowsResult(search, list, total);
//设置页面数据list
model.addAttribute("data", tableRowsResult);
//设置类别列表
model.addAttribute("allDict", allDict);
return "CodeOption/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute CodeOption model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if (model.getId() == null) {
service.save(model);
} else {
service.updateById(model);
}
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<CodeOption> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<CodeOption> view(@PathVariable("id") Integer id) {
CodeOption data = service.getById(id);
if (data != null) {
CodeDict dict = codeDictService.getById(data.getDictId());
if (dict != null) {
data.setDictName(dict.getCodeNameCn());
}
return OperateResult.success(data, "success");
}
return OperateResult.error(null, "对象不存在", 500);
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<CodeOption> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,63 @@
package com.hshh.nation.code.entity;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 码表类别表
* </p>
*
* @author lidy
* @since 2025-07-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_code_dict")
public class CodeDict extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 中文名称
*/
@Size(max = 50, message = "中文名称不能超过50")
@NotBlank(message = "中文名称不能为空")
private String codeNameCn;
/**
* 英文名称
*/
@Size(max = 50, message = "英文名称不能超过50")
@NotBlank(message = "英文名称不能为空")
private String codeNameEn;
/**
* 描述信息
*/
@Size(max = 255, message = "描述信息不能超过255")
private String codeDesc;
}

View File

@ -0,0 +1,71 @@
package com.hshh.nation.code.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_code_option")
public class CodeOption extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 码表目录ID
*/
@NotNull(message = "所属码表不能为空")
private Integer dictId;
/**
* 选项名
*/
@Size(max = 50, message = "项名不能超过50")
@NotBlank(message = "项名不能为空")
private String optionName;
/**
* 选项值
*/
@Size(max = 255, message = "项值不能超过255")
private String optionValue;
/**
* 选项顺序
*/
private Integer optionOrder;
@TableField(exist = false)
private String dictName;
}

View File

@ -0,0 +1,24 @@
package com.hshh.nation.code.mapper;
import com.hshh.nation.code.entity.CodeDict;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 码表类别表 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-02
*/
public interface CodeDictMapper extends BaseMapper<CodeDict> {
List<CodeDict> list(@Param("model") CodeDict model);
long count(@Param("model") CodeDict model);
}

View File

@ -0,0 +1,24 @@
package com.hshh.nation.code.mapper;
import com.hshh.nation.code.entity.CodeOption;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface CodeOptionMapper extends BaseMapper<CodeOption> {
List<CodeOption> list(@Param("model") CodeOption model);
long count(@Param("model") CodeOption model);
}

View File

@ -0,0 +1,27 @@
package com.hshh.nation.code.service;
import com.hshh.nation.code.entity.CodeDict;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 码表类别表 服务类
* </p>
*
* @author lidy
* @since 2025-07-02
*/
public interface CodeDictService extends IService<CodeDict> {
List<CodeDict> list(CodeDict model);
long count(CodeDict model);
void batchDelete(List<Integer> list);
List<CodeDict> all();
}

View File

@ -0,0 +1,27 @@
package com.hshh.nation.code.service;
import com.hshh.nation.code.entity.CodeOption;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface CodeOptionService extends IService<CodeOption> {
List<CodeOption> list(CodeOption model);
long count(CodeOption model);
void batchDelete(List<Integer> list);
Map<String,List<CodeOption>> selectAllByCodeTypeForMap();
}

View File

@ -0,0 +1,45 @@
package com.hshh.nation.code.service.impl;
import com.hshh.nation.code.entity.CodeDict;
import com.hshh.nation.code.mapper.CodeDictMapper;
import com.hshh.nation.code.service.CodeDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 码表类别表 服务实现类
* </p>
*
* @author lidy
* @since 2025-07-02
*/
@Service
public class CodeDictServiceImpl extends ServiceImpl<CodeDictMapper, CodeDict> implements CodeDictService {
public List<CodeDict> list(CodeDict model) {
return this.baseMapper.list(model);
}
public long count(CodeDict model) {
return this.baseMapper.count(model);
}
@Override
@Transactional
public void batchDelete(List<Integer> list) {
list.forEach(id -> {
this.removeById(id);
});
}
@Override
public List<CodeDict> all() {
return this.list();
}
}

View File

@ -0,0 +1,76 @@
package com.hshh.nation.code.service.impl;
import com.hshh.nation.code.entity.CodeDict;
import com.hshh.nation.code.entity.CodeOption;
import com.hshh.nation.code.mapper.CodeOptionMapper;
import com.hshh.nation.code.service.CodeDictService;
import com.hshh.nation.code.service.CodeOptionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* <p>
* 服务实现类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Service
public class CodeOptionServiceImpl extends ServiceImpl<CodeOptionMapper, CodeOption> implements CodeOptionService {
@Resource
private CodeDictService codeDictService;
@Resource
private CodeOptionService codeOptionService;
public List<CodeOption> list(CodeOption model) {
return this.baseMapper.list(model);
}
public long count(CodeOption model) {
return this.baseMapper.count(model);
}
@Override
@Transactional
public void batchDelete(List<Integer> list) {
list.forEach(id -> {
this.removeById(id);
});
}
@Override
public Map<String, List<CodeOption>> selectAllByCodeTypeForMap() {
List<CodeOption> optionList = codeOptionService.list();
Map<String, List<CodeOption>> optionMap = new HashMap<>();
List<CodeDict> dictList = codeDictService.list();
Map<Integer, CodeDict> dictMap = new HashMap<>();
dictList.forEach(dict -> {
dictMap.put(dict.getId(), dict);
});
for (CodeOption option : optionList) {
String dictName = dictMap.get(option.getDictId()).getCodeNameEn();
if(optionMap.get(dictName) == null) {
optionMap.put(dictName,new ArrayList<>());
optionMap.get(dictName).add(option);
}else{
optionMap.get(dictName).add(option);
}
}
return optionMap;
}
}

View File

@ -0,0 +1,39 @@
package com.hshh.nation.common;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
/**
* 分页基础参数
*/
public class BaseBean implements Serializable {
@TableField(exist = false)
@Getter
@Setter
private Integer pageSize = 10;
@TableField(exist = false)
@Getter
@Setter
private long total;
@TableField(exist = false)
private int start;
@TableField(exist = false)
@Getter
@Setter
private int seq = 1;
@TableField(exist = false)
@Getter
@Setter
private int currentPage = 1;
public int getStart() {
return (this.getCurrentPage() - 1) * (this.getPageSize());
}
}

View File

@ -0,0 +1,57 @@
package com.hshh.nation.common;
import org.springframework.validation.BindingResult;
import java.util.ArrayList;
import java.util.List;
public class BaseController {
/**
* 输入错误验证
*
* @param bindingResult 绑定错误信息
* @return 返回错误信息
*/
protected OperateResult<String> errorsInputHandle(BindingResult bindingResult) {
List<ErrorField> errors = new ArrayList<>();
bindingResult.getFieldErrors().forEach(error -> {
ErrorField errorField = new ErrorField();
errorField.setElementId(error.getField());
errorField.setMessage(error.getDefaultMessage());
errors.add(errorField);
});
return OperateResult.error(null, "fail", -1, errors);
}
protected <T extends BaseBean> TableRowsResult<T> makeTableRowsResult(T search, List<T> list, long total) {
TableRowsResult<T> tableRowsResult = new TableRowsResult<>();
int start = (search.getCurrentPage() - 1) * search.getPageSize();
tableRowsResult.setList(list);
tableRowsResult.setTotalCount(total);
tableRowsResult.setSearchForm(search);
tableRowsResult.setCurrentPage(search.getCurrentPage());
tableRowsResult.setPageSize(search.getPageSize());
tableRowsResult.setTotalPage(total % search.getPageSize() == 0 ? total / search.getPageSize() : (total / search.getPageSize()) + 1);
tableRowsResult.setStartCount(start + 1);
tableRowsResult.setEndCount(Math.min(tableRowsResult.getStartCount() + search.getPageSize(), total));
if (search.getCurrentPage() > 1) {
tableRowsResult.setHasPrevious(true);
}
if (search.getCurrentPage() < tableRowsResult.getTotalPage()) {
tableRowsResult.setHasNext(true);
}
int startPage = search.getCurrentPage() / 5 + 1;
int endPage = Math.toIntExact((startPage + 5) > tableRowsResult.getTotalPage() ? tableRowsResult.getTotalPage() : startPage + 5);
tableRowsResult.setStartDisplayPage(startPage);
tableRowsResult.setEndDisplayPage(endPage);
return tableRowsResult;
}
}

View File

@ -0,0 +1,13 @@
package com.hshh.nation.common;
import lombok.Data;
/**
* 错误字段定义.
*/
@Data
public class ErrorField {
private String message;
private String elementId;
}

View File

@ -0,0 +1,87 @@
package com.hshh.nation.common;
public class GeoCalculator {
// 返回结果对象
public static class Result {
public final double latitude;
public final double longitude;
public final boolean arrived;
public Result(double latitude, double longitude, boolean arrived) {
this.latitude = latitude;
this.longitude = longitude;
this.arrived = arrived;
}
}
/**
* 计算给定速度千米/小时时间后的位置经纬度并判断是否到达终点
* @param lat1 起点纬度
* @param lon1 起点经度
* @param lat2 终点纬度
* @param lon2 终点经度
* @param speedKmh 速度千米/小时
* @param timeSec 经过的时间
* @return Result包含当前纬度经度是否到达终点
*/
public static Result getCurrentLatLon(
double lat1, double lon1,
double lat2, double lon2,
double speedKmh, double timeSec) {
// 地球半径
final double R = 6371000;
// 速度由千米/小时转为米/
double speed = speedKmh * 1000 / 3600.0;
// 坐标转弧度
double φ1 = Math.toRadians(lat1);
double λ1 = Math.toRadians(lon1);
double φ2 = Math.toRadians(lat2);
double λ2 = Math.toRadians(lon2);
// 计算球面距离
double delta = 2 * Math.asin(Math.sqrt(
Math.pow(Math.sin((φ2-φ1)/2),2) +
Math.cos(φ1)*Math.cos(φ2)*Math.pow(Math.sin((λ2-λ1)/2),2)
));
double totalDist = R * delta;
// 已运动的距离
double moveDist = speed * timeSec;
if (moveDist >= totalDist) {
// 到达或已超过终点
return new Result(lat2, lon2, true);
}
// 球面插值比例
double fraction = moveDist / totalDist;
// 球面插值Slerp
double A = Math.sin((1-fraction)*delta) / Math.sin(delta);
double B = Math.sin(fraction*delta) / Math.sin(delta);
double x = A * Math.cos(φ1) * Math.cos(λ1) + B * Math.cos(φ2) * Math.cos(λ2);
double y = A * Math.cos(φ1) * Math.sin(λ1) + B * Math.cos(φ2) * Math.sin(λ2);
double z = A * Math.sin(φ1) + B * Math.sin(φ2);
double φ3 = Math.atan2(z, Math.sqrt(x*x + y*y));
double λ3 = Math.atan2(y, x);
return new Result(
Math.toDegrees(φ3), // 当前纬度
Math.toDegrees(λ3), // 当前经度
false // 未到达终点
);
}
// 示例
public static void main(String[] args) {
double speedKmh = 60; // 速度单位千米/小时
double timeSec = 3600; // 时间单位
Result result = getCurrentLatLon(39.9042, 116.4074, 31.2304, 121.4737, speedKmh, timeSec);
System.out.printf("当前经度: %.6f, 当前纬度: %.6f, 是否到达: %s\n", result.longitude, result.latitude, result.arrived);
}
}

View File

@ -0,0 +1,150 @@
package com.hshh.nation.common;
public class JourneyCalculatorGeodesic {
// 地球半径单位 km
private static final double EARTH_RADIUS = 6371.0;
// 表示经纬度坐标
public static class Point {
public double latitude; // 纬度单位
public double longitude; // 经度单位
public Point(double latitude, double longitude) {
this.latitude = latitude;
this.longitude = longitude;
}
@Override
public String toString() {
return "(" + latitude + ", " + longitude + ")";
}
}
// 封装计算结果
public static class Result {
public Point currentPoint; // 当前坐标
public boolean arrived; // 是否到达终点
public double timeUsed; // 如果到达则为实际到达所需时间否则为传入的时间
public Result(Point currentPoint, boolean arrived, double timeUsed) {
this.currentPoint = currentPoint;
this.arrived = arrived;
this.timeUsed = timeUsed;
}
}
/**
* 根据 Haversine 公式计算球面两点之间的距离单位 km
*/
public static double haversineDistance(Point start, Point end) {
double lat1 = Math.toRadians(start.latitude);
double lon1 = Math.toRadians(start.longitude);
double lat2 = Math.toRadians(end.latitude);
double lon2 = Math.toRadians(end.longitude);
double deltaLat = lat2 - lat1;
double deltaLon = lon2 - lon1;
double a = Math.pow(Math.sin(deltaLat / 2), 2)
+ Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(deltaLon / 2), 2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return EARTH_RADIUS * c;
}
/**
* 计算从起点到终点的初始航向角单位弧度
*/
public static double calculateBearing(Point start, Point end) {
double lat1 = Math.toRadians(start.latitude);
double lat2 = Math.toRadians(end.latitude);
double deltaLon = Math.toRadians(end.longitude - start.longitude);
double y = Math.sin(deltaLon) * Math.cos(lat2);
double x = Math.cos(lat1) * Math.sin(lat2)
- Math.sin(lat1) * Math.cos(lat2) * Math.cos(deltaLon);
return Math.atan2(y, x);
}
/**
* 根据给定起点航向角以及行驶距离计算出当前位置的经纬度
*
* @param startPoint 起点坐标经纬度单位度
* @param bearing 航向角单位弧度
* @param distance 行驶距离单位km
* @return 当前位置坐标
*/
public static Point calculateDestination(Point startPoint, double bearing, double distance) {
double lat1 = Math.toRadians(startPoint.latitude);
double lon1 = Math.toRadians(startPoint.longitude);
double angularDistance = distance / EARTH_RADIUS;
double lat2 = Math.asin(Math.sin(lat1) * Math.cos(angularDistance)
+ Math.cos(lat1) * Math.sin(angularDistance) * Math.cos(bearing));
double lon2 = lon1 + Math.atan2(
Math.sin(bearing) * Math.sin(angularDistance) * Math.cos(lat1),
Math.cos(angularDistance) - Math.sin(lat1) * Math.sin(lat2)
);
return new Point(Math.toDegrees(lat2), Math.toDegrees(lon2));
}
/**
* 根据起点终点速度以及行驶的时间计算当前位置
* 如果当前已经到达终点返回到达标志 timeUsed 为实际到达所需时间
*
* @param start 起点经纬度
* @param end 终点经纬度
* @param speed 速度单位 km/h
* @param time 输入的时间单位小时
* @return 结果对象包含当前位置到达标志和时间
*/
public static Result calculatePosition(Point start, Point end, double speed, double time) {
// 计算起点与终点的总距离km
double totalDistance = haversineDistance(start, end);
// 根据速度和输入时间计算行驶的距离
double traveledDistance = speed * time;
// 计算实际到达终点所需时间
double requiredTime = totalDistance / speed;
if (traveledDistance >= totalDistance) {
// 表示在 input 时间内已经到达目的地返回目的地的坐标
// arrived 标志为 true timeUsed 为实际到达所需时间小于或等于输入的 time
return new Result(new Point(end.latitude, end.longitude), true, requiredTime);
} else {
// 计算起点到终点的初始航向角
double bearing = calculateBearing(start, end);
// 根据行驶距离计算当前位置
Point currentPoint = calculateDestination(start, bearing, traveledDistance);
return new Result(currentPoint, false, time);
}
}
// 主函数进行测试
// public static void main(String[] args) {
// // 假设起点为北京经纬度
// Point start = new Point(39.9042, 116.4074);
// // 终点为天津经纬度
// Point end = new Point(39.3434, 117.3616);
// double speed = 80.0; // km/h
//
// // 测试 0.5 小时未到达终点
// double time1 = 0.5;
// Result result1 = calculatePosition(start, end, speed, time1);
// System.out.println("经过 " + time1 + " 小时后的状态:");
// System.out.println("当前坐标:" + result1.currentPoint);
// System.out.println("是否到达目的地:" + result1.arrived);
// System.out.println("使用的时间:" + result1.timeUsed + " 小时");
//
// // 测试 2 小时超过所需时间实际上应该提前到达终点
// double time2 = 2;
// Result result2 = calculatePosition(start, end, speed, time2);
// System.out.println("\n经过 " + time2 + " 小时后的状态:");
// System.out.println("当前坐标:" + result2.currentPoint);
// System.out.println("是否到达目的地:" + result2.arrived);
// if (result2.arrived) {
// System.out.println("实际到达时间:" + result2.timeUsed + " 小时");
// } else {
// System.out.println("使用的时间:" + result2.timeUsed + " 小时");
// }
// }
}

View File

@ -0,0 +1,63 @@
package com.hshh.nation.common;
import lombok.Data;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
@Data
public class MockMessageTip implements Delayed {
private String message;
private String title;
private String time;
private long order;
private long expireTime;
public static MockMessageTip createMessage(String time, String title, String message, long order, long expireTimes) {
MockMessageTip tip = new MockMessageTip();
tip.setTime(time);
tip.setTitle(title);
tip.setMessage(message);
tip.setOrder(order);
tip.setExpireTime(expireTimes);
return tip;
}
@Override
public long getDelay(TimeUnit unit) {
long diff = expireTime - System.currentTimeMillis();
return unit.convert(diff, TimeUnit.MILLISECONDS);
}
// 定义任务的优先级排序较早到期的任务排在前面
@Override
public int compareTo(Delayed o) {
if (this.expireTime < ((MockMessageTip) o).expireTime) {
return -1;
}
if (this.expireTime > ((MockMessageTip) o).expireTime) {
return 1;
}
return 0;
}
public static MockMessageTip create() {
return new MockMessageTip();
}
public MockMessageTip setMessage(String message) {
this.message = message;
return this;
}
public MockMessageTip setTime(String time) {
this.time = time;
return this;
}
public MockMessageTip setTitle(String title) {
this.title = title;
return this;
}
}

View File

@ -0,0 +1,109 @@
package com.hshh.nation.common;
import java.util.List;
import lombok.Data;
/**
* 通用操作结果.
*
* @param <T> 泛型类
*/
@Data
public class OperateResult<T> {
/**
* 数据.
*/
private T result;
/**
* 消息.
*/
private String message;
/**
* 编码.
*/
private int code;
/**
* 字段错误信息.
*/
private List<ErrorField> errors;
/**
* 构造函数.
*
* @param result 数据
* @param message 消息
* @param code 编码
*/
public OperateResult(T result, String message, int code) {
this.result = result;
this.message = message;
this.code = code;
}
/**
* 构造函数.
*
* @param result 数据
* @param message 消息
* @param code 编码
* @param errors 字段错误信息
*/
public OperateResult(T result, String message, int code, List<ErrorField> errors) {
this.result = result;
this.message = message;
this.code = code;
this.errors = errors;
}
/**
* 构造函数.
*
* @param result 数据
* @param message 消息
* @param <T> 泛型
* @return 结果对象
*/
public static <T> OperateResult<T> success(T result, String message) {
return new OperateResult<T>(result, message, 0);
}
/**
* 成功响应.
*
* @param <T> 泛型
* @return 成功结果对象
*/
public static <T> OperateResult<T> success() {
return new OperateResult<T>(null, "", 0);
}
/**
* 错误响应.
*
* @param message 消息
* @param result 数据
* @param <T> 泛型
* @return 成功结果对象
*/
public static <T> OperateResult<T> error(T result, String message, int code,
List<ErrorField> errors) {
return new OperateResult<T>(result, message, code, errors);
}
/**
* 错误响应.
*
* @param result 数据
* @param message 消息
* @param code code
* @param <T> 泛型
* @return 结果对象
*/
public static <T> OperateResult<T> error(T result, String message, int code) {
return new OperateResult<T>(result, message, code);
}
}

View File

@ -0,0 +1,28 @@
package com.hshh.nation.common;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class SpringContextHolder implements ApplicationContextAware {
private static ApplicationContext context;
@Override
public synchronized void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
SpringContextHolder.context = applicationContext;
}
public static ApplicationContext getApplicationContext() {
return context;
}
// 便于直接获取 Bean
public static <T> T getBean(String beanName, Class<T> clazz) {
return context.getBean(beanName, clazz);
}
public static <T> T getBean(Class<T> clazz) {
return context.getBean( clazz );
}
}

View File

@ -0,0 +1,69 @@
package com.hshh.nation.common;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Data;
/**
* 前端封装的表格对象.
*
* @param <T> 泛型类型
*/
@Data
public class TableRowsResult<T> {
/**
* 结果列表.
*/
private List<T> list;
/**
* 当前页.
*/
private long currentPage;
/**
* 总页.
*/
private long totalPage;
/**
* 分页大小.
*/
private long pageSize;
/**
* 总条数.
*/
private long totalCount;
/**
* 开始页.
*/
private long startDisplayPage;
/**
* 结束页.
*/
private long endDisplayPage;
/**
* 是否可以往后.
*/
private boolean hasNext;
/**
* 是否可以往前.
*/
private boolean hasPrevious;
/**
* 开始记录条目.
*/
private long startCount;
/**
* 结束记录条目.
*/
private long endCount;
/**
* 查询条件集合.
*/
private Object searchForm;
/**
* 属性集合.
*/
private Map<String, Object> params = new HashMap<>();
}

View File

@ -0,0 +1,34 @@
package com.hshh.nation.common;
import java.util.Base64;
/**
* 系统公共类.
*/
public class Utility {
/**
* 转化二进制到base64 string.
*
* @param bytes 二进制数据
* @return base64 str
*/
public static String bytesToBase64(byte[] bytes) {
return Base64.getEncoder().encodeToString(bytes);
}
/**
* 转化时间为特定格式.
*
* @param totalMinutes 分钟
* @return 字符串
*/
public static String convertTime(int totalMinutes) {
int hours = totalMinutes / 60;
int minutes = totalMinutes % 60;
return hours + "小时" + minutes + "";
}
}

View File

@ -0,0 +1,86 @@
package com.hshh.nation.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
/**
* 安全配置.
*/
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
/**
* 用户认证.
*/
@Autowired
private UserDetailsService UserAuthService;
/**
* 密码加密解密.
*
* @return 加密
*/
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// 配置使用自定义的UserDetailsService以及对应的密码编码器
auth.authenticationProvider(authenticationProvider());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/login", "/css/**", "/js/**", "/img/**", "/libs/**", "/captcha", "/toAuth",
"/ws", "/swagger-ui.html",
"/swagger-ui/**",
"/v3/api-docs",
"/v3/api-docs/**",
"/swagger-resources/**",
"/webjars/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.defaultSuccessUrl("/home")
.permitAll()
.and()
.logout()
.permitAll();
http.csrf().disable();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
/**
* 认证提供者.
*
* @return 数据库认证.
*/
@Bean
public DaoAuthenticationProvider authenticationProvider() {
DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
authProvider.setUserDetailsService(UserAuthService);
// 确保数据库存储的密码加密方式与这里一致
authProvider.setPasswordEncoder(passwordEncoder());
return authProvider;
}
}

View File

@ -0,0 +1,21 @@
package com.hshh.nation.enums;
import lombok.Getter;
/**
* 资源类型.
*/
@Getter
public enum ResourceEnum {
METAL_JAR(1),
SOFT_JAR(2),
TRUCK(3),
BOAT(4),
PLANET(5);
private final int code;
ResourceEnum(int code) {
this.code = code;
}
}

View File

@ -0,0 +1,21 @@
package com.hshh.nation.exception;
import lombok.Getter;
/**
* 自定义异常.
*/
public enum Exceptions {
USER_EXIT("用户不存在"),
USER_PASSWD_WRONG("用户密码错误");
@Getter
private final String msg;
Exceptions(String msg) {
this.msg = msg;
}
}

View File

@ -0,0 +1,36 @@
package com.hshh.nation.file.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author lidy
* @since 2025-07-05
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_file")
public class File implements Serializable {
private static final long serialVersionUID=1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private byte[] data;
private String fileName;
private Integer relId;
private String tableName;
}

View File

@ -0,0 +1,16 @@
package com.hshh.nation.file.mapper;
import com.hshh.nation.file.entity.File;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-05
*/
public interface FileMapper extends BaseMapper<File> {
}

View File

@ -0,0 +1,18 @@
package com.hshh.nation.file.service;
import com.hshh.nation.file.entity.File;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author lidy
* @since 2025-07-05
*/
public interface FileService extends IService<File> {
void deleteByRelId(Integer relId, String tableName);
byte[] getDataByRelId(Integer relId, String tableName);
void saveFileWithRelId(Integer relId, byte[] data, String fileName, String tableName);
}

View File

@ -0,0 +1,52 @@
package com.hshh.nation.file.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hshh.nation.file.entity.File;
import com.hshh.nation.file.mapper.FileMapper;
import com.hshh.nation.file.service.FileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author lidy
* @since 2025-07-05
*/
@Service
public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements FileService {
@Override
public void deleteByRelId(Integer relId,String tableName) {
QueryWrapper<File> qw = new QueryWrapper<File>();
qw.eq("rel_id", relId);
qw.eq("table_name", tableName);
this.remove(qw);
}
@Override
public byte[] getDataByRelId(Integer relId,String tableName) {
QueryWrapper<File> qw = new QueryWrapper<>();
qw.eq("rel_id", relId);
qw.eq("table_name", tableName);
List<File> list = this.list(qw);
if (!list.isEmpty()) {
return list.get(0).getData();
}
return null;
}
@Override
public void saveFileWithRelId(Integer relId, byte[] data, String fileName,String tableName) {
this.deleteByRelId(relId,"defence_fuel_army");
File file = new File();
file.setRelId(relId);
file.setFileName(fileName);
file.setData(data);
file.setTableName(tableName);
this.save(file);
}
}

View File

@ -0,0 +1,44 @@
package com.hshh.nation.fuel.bean;
import lombok.Data;
/**
* 资源.
*/
@Data
public class EquipResource {
private int id;
/**
* 编号.
*/
private String eNo;
/**
* 容量.
*/
private double capacity;
/**
* 3: 4: 5:飞机.
*/
private int resourceType;
/**
* 类型名称.
*/
private String resourceTypeName;
/**
* 加注能力.
*/
private double fillingSpeed;
/**
* 当前容量.
*/
private double currentCapacity;
/**
* 速度.
*/
private double speed;
/**
* 名称.
*/
private String equipName;
}

View File

@ -0,0 +1,31 @@
package com.hshh.nation.fuel.bean;
import lombok.Data;
@Data
public class FacilitiesResource {
private int id;
//灌编号
private String jarNo;
//可接收油种类
private int jarFuelType;
//可接受油种类
private String jarFuelTypeName;
//容量
private double jarCapacity;
//类型 1:金属罐 2:软罐
private Integer resourceType;
private boolean isSelected;
//类型名称
private String resourceTypeName;
//接收能力
private double jarReceiveAbility;
//当前容量
private double jarCurrentCapacity;
//油罐位置
private String location;
//所属单位ID
private Integer belongUnit;
private String belongUnitType;
}

View File

@ -0,0 +1,24 @@
package com.hshh.nation.fuel.bean;
import lombok.Data;
/**
* 组织机构资源.
*/
@Data
public class OrganizeResource {
private int id;
/**
* 保障分队类别.
*/
private String code;
/**
* 名称.
*/
private String organizeName;
/**
* 坐标.
*/
private String location;
}

View File

@ -0,0 +1,59 @@
package com.hshh.nation.fuel.controller;
import com.hshh.Global;
import com.hshh.nation.fuel.bean.OrganizeResource;
import com.hshh.nation.fuel.entity.FuelMetalJar;
import com.hshh.nation.fuel.service.FuelArmyService;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class BaseController {
@Resource
private FuelArmyService armyService;//保障分队服务类
public void setTypeName(FuelMetalJar a) {
//设置油罐类型名称
if (a.getJarType() != null) {
a.setJarTypeName(Global.optionMap.get(a.getJarType()) == null ? "" : Global.optionMap.get(a.getJarType()));
}
//设置质量状态
if (a.getJarStatus() != null) {
a.setJarStatusName(Global.optionMap.get(a.getJarStatus()) == null ? "" : Global.optionMap.get(a.getJarStatus()));
}
//设置可储油种类
if (a.getJarFuelType() != null) {
a.setJarFuelTypeName(Global.optionMap.get(a.getJarFuelType()) == null ? "" : Global.optionMap.get(a.getJarFuelType()));
}
}
public void setOrganizeAttribute( Model model) {
List<OrganizeResource> list = armyService.selectOrganizeResource();
Map<String,OrganizeResource> map = new HashMap<>();
list.forEach(organizeResource -> {
map.put(organizeResource.getId()+"|"+organizeResource.getCode(),organizeResource);
});
model.addAttribute("organizeList",list);
model.addAttribute("organizeMap",map);
}
public String getOrgName(String key,Model model){
Object organizeMapObj = model.asMap().get("organizeMap");
if(organizeMapObj!=null){
if(organizeMapObj instanceof Map){
organizeMapObj = ((Map)organizeMapObj).get(key);
if(organizeMapObj!=null){
OrganizeResource resource = (OrganizeResource)organizeMapObj;
return resource.getOrganizeName();
}
}
}
return "";
}
}

View File

@ -0,0 +1,108 @@
package com.hshh.nation.fuel.controller;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import com.hshh.nation.fuel.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.fuel.entity.FuelArmy;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>
* 保障分队 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/fuelArmy")
@Slf4j
public class FuelArmyController extends BaseController {
@Resource
private FileService fileService;
@Resource
private FuelArmyService service;
@GetMapping("/list")
public String list(FuelArmy search, Model model) {
List<FuelArmy> all = service.list();
Map<Integer,FuelArmy> armyMap = all.stream().collect(Collectors.toMap(FuelArmy::getId, obj -> obj));
List<FuelArmy> list = service.list(search);
for (FuelArmy fuelArmy : list) {
if(armyMap.get(fuelArmy.getParentId()) != null){
fuelArmy.setParentName(armyMap.get(fuelArmy.getParentId()).getArmyName());
}
}
long total = service.count(search);
TableRowsResult<FuelArmy> tableRowsResult = makeTableRowsResult(search, list, total);
model.addAttribute("data", tableRowsResult);
model.addAttribute("all", all);
return "FuelArmy/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute FuelArmy model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
service.saveWhole(model);
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<FuelArmy> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<FuelArmy> view(@PathVariable("id") Integer id) {
FuelArmy data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
byte[] fileData = fileService.getDataByRelId(id, "defence_fuel_army");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<FuelArmy> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,112 @@
package com.hshh.nation.fuel.controller;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import com.hshh.nation.fuel.entity.FuelArmy;
import com.hshh.nation.fuel.entity.FuelBaseStrong;
import com.hshh.nation.fuel.service.FuelBaseStrongService;
import com.hshh.nation.fuel.service.FuelMetalJarService;
import com.hshh.nation.fuel.service.FuelTruckService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>
* 基地油料保障力量 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/fuelBaseStrong")
public class FuelBaseStrongController extends BaseController {
@Resource
private FuelBaseStrongService service;
@Resource
private FileService fileService;
@GetMapping("/list")
public String list(FuelBaseStrong search, Model model) {
List<FuelBaseStrong> list = service.list(search);
List<FuelBaseStrong> all = service.list();
Map<Integer, FuelBaseStrong> armyMap = all.stream().collect(Collectors.toMap(FuelBaseStrong::getId, obj -> obj));
for(FuelBaseStrong fuelBaseStrong : list){
if(armyMap.get(fuelBaseStrong.getParentId()) != null){
fuelBaseStrong.setParentName(armyMap.get(fuelBaseStrong.getParentId()).getBaseName());
}
}
long total = service.count(search);
TableRowsResult<FuelBaseStrong> tableRowsResult = makeTableRowsResult(search, list, total);
model.addAttribute("data", tableRowsResult);
model.addAttribute("all", all);
return "FuelBaseStrong/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute FuelBaseStrong model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if (model.getId() == null) {
service.save(model);
} else {
service.updateById(model);
}
if(model.getFile()!=null&&model.getFile().getBytes().length>0){
fileService.saveFileWithRelId(model.getId(),model.getFile().getBytes(),"","defence_fuel_base_strong");
}
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<FuelBaseStrong> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<FuelBaseStrong> view(@PathVariable("id") Integer id) {
FuelBaseStrong data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
byte[] fileData = fileService.getDataByRelId(id,"defence_fuel_base_strong");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<FuelBaseStrong> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,98 @@
package com.hshh.nation.fuel.controller;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.fuel.service.FuelBoatService;;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.fuel.entity.FuelBoat;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 油船 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/fuelBoat")
public class FuelBoatController extends BaseController {
@Resource
private FuelBoatService service;
@Resource
private FileService fileService;
@GetMapping("/list")
public String list(FuelBoat search, Model model) {
List<FuelBoat> list = service.list(search);
long total = service.count(search);
TableRowsResult<FuelBoat> tableRowsResult = makeTableRowsResult(search, list, total);
model.addAttribute("data", tableRowsResult);
return "FuelBoat/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute FuelBoat model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if (model.getId() == null) {
service.save(model);
} else {
service.updateById(model);
}
if(model.getFile()!=null&&model.getFile().getBytes().length>0){
fileService.saveFileWithRelId(model.getId(),model.getFile().getBytes(),"","defence_fuel_boat");
}
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<FuelBoat> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<FuelBoat> view(@PathVariable("id") Integer id) {
FuelBoat data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
byte[] fileData = fileService.getDataByRelId(id,"defence_fuel_boat");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<FuelBoat> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,145 @@
package com.hshh.nation.fuel.controller;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import com.hshh.nation.fuel.bean.FacilitiesResource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.fuel.service.FuelMetalJarService;;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.fuel.entity.FuelMetalJar;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 金属油罐 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/fuelMetalJar")
@Slf4j
public class FuelMetalJarController extends com.hshh.nation.common.BaseController {
@Resource
private FuelMetalJarService service;//操作服务类
@Resource
private FileService fileService;//文件服务类
@Resource
private BaseController fuelBaseController;//复用方法类
@GetMapping("/list")
public String list(FuelMetalJar search, Model model) {
fuelBaseController.setOrganizeAttribute(model);
List<FuelMetalJar> list = service.list(search);
long total = service.count(search);
TableRowsResult<FuelMetalJar> tableRowsResult = makeTableRowsResult(search, list, total);
tableRowsResult.getList().forEach(a -> {
fuelBaseController.setTypeName(a);//设置油罐类型名称
a.setBelongUnitName(fuelBaseController.getOrgName(a.getBelongUnit() + "|" + a.getBelongUnitType(), model));//设置所属单位名称
});
//数据信息
model.addAttribute("data", tableRowsResult);
return "FuelMetalJar/list";
}
//保存
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute FuelMetalJar model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
service.saveWhole(model);
return OperateResult.success("", "success");
}
//删除
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<FuelMetalJar> remove(@PathVariable("id") Integer id) throws IOException {
service.deleteWhole(id);
return OperateResult.success(null, "success");
}
/**
* 查看实体信息
*
* @param id 实体ID
* @return 结果
*/
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<FuelMetalJar> view(@PathVariable("id") Integer id) {
FuelMetalJar data = service.getById(id);
//查询图标信息
byte[] fileData = fileService.getDataByRelId(id, "defence_fuel_metal_jar");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
fuelBaseController.setTypeName(data);
return OperateResult.success(data, "success");
}
/**
* 批量删除
*
* @param list 实体ID列表
* @return 操作结果
* @throws IOException 异常
*/
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<FuelMetalJar> batchRemove(List<Integer> list) throws IOException {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
@PostMapping("/resourceByOrganize")
@ResponseBody
public OperateResult<List<FacilitiesResource>> getResourcesByIdInfo(String id) {
log.info("id={}" , id);
List<FacilitiesResource> resources = service.selectAllResource();
Map<String, List<FacilitiesResource>> resourcesMap = new HashMap<>();
resources.forEach(resource -> {
String key = resource.getBelongUnit() + "|" + resource.getBelongUnitType();
if (resourcesMap.get(key) == null) {
resourcesMap.put(key, new ArrayList<>());
resourcesMap.get(key).add(resource);
} else {
resourcesMap.get(key).add(resource);
}
});
List<FacilitiesResource> list = resourcesMap.get(id);
if (list == null) {
return OperateResult.error(null, "无记录", -1);
}
return OperateResult.success(list, "success");
}
}

View File

@ -0,0 +1,98 @@
package com.hshh.nation.fuel.controller;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.fuel.service.FuelPlaneService;;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.fuel.entity.FuelPlane;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 飞机 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/fuelPlane")
public class FuelPlaneController extends BaseController {
@Resource
private FuelPlaneService service;
@Resource
private FileService fileService;
@GetMapping("/list")
public String list(FuelPlane search, Model model) {
List<FuelPlane> list = service.list(search);
long total = service.count(search);
TableRowsResult<FuelPlane> tableRowsResult = makeTableRowsResult(search, list, total);
model.addAttribute("data", tableRowsResult);
return "FuelPlane/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute FuelPlane model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if (model.getId() == null) {
service.save(model);
} else {
service.updateById(model);
}
if(model.getFile()!=null&&model.getFile().getBytes().length>0){
fileService.saveFileWithRelId(model.getId(),model.getFile().getBytes(),"","defence_fuel_plane");
}
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<FuelPlane> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<FuelPlane> view(@PathVariable("id") Integer id) {
FuelPlane data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
byte[] fileData = fileService.getDataByRelId(id,"defence_fuel_plane");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<FuelPlane> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,132 @@
package com.hshh.nation.fuel.controller;
import com.hshh.Global;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import com.hshh.nation.fuel.entity.FuelSoftJar;
import com.hshh.nation.fuel.service.FuelSoftJarService;
import java.io.IOException;
import java.util.List;
import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* <p>
* 金属油罐 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/fuelSoftJar")
public class FuelSoftJarController extends BaseController {
@Resource
private FuelSoftJarService service;
@Resource
private FileService fileService;
@Resource
private com.hshh.nation.fuel.controller.BaseController fuelBaseController;
@GetMapping("/list")
public String list(FuelSoftJar search, Model model) {
fuelBaseController.setOrganizeAttribute(model);
List<FuelSoftJar> list = service.list(search);
long total = service.count(search);
TableRowsResult<FuelSoftJar> tableRowsResult = makeTableRowsResult(search, list, total);
tableRowsResult.getList().forEach(this::setTypeName);
tableRowsResult.getList().forEach(a -> {
setTypeName(a);
a.setBelongUnitName(
fuelBaseController.getOrgName(a.getBelongUnit() + "|" + a.getBelongUnitType(),
model));//设置所属单位名称
});
model.addAttribute("data", tableRowsResult);
return "FuelSoftJar/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute FuelSoftJar model,
BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
//todo 临时测试
model.setJarCurrentCapacity(model.getJarCapacity());
service.saveWhole(model);
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<FuelSoftJar> remove(@PathVariable("id") Integer id) {
service.deleteWhole(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<FuelSoftJar> view(@PathVariable("id") Integer id) {
FuelSoftJar data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
setTypeName(data);
byte[] fileData = fileService.getDataByRelId(id, "defence_fuel_soft_jar");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<FuelSoftJar> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
private void setTypeName(FuelSoftJar a) {
//设置油罐类型名称
if (a.getJarType() != null) {
a.setJarTypeName(
Global.optionMap.get(a.getJarType()) == null ? "" : Global.optionMap.get(a.getJarType()));
}
//设置质量状态
if (a.getJarStatus() != null) {
a.setJarStatusName(Global.optionMap.get(a.getJarStatus()) == null ? ""
: Global.optionMap.get(a.getJarStatus()));
}
//设置可储油种类
if (a.getJarFuelType() != null) {
a.setJarFuelTypeName(Global.optionMap.get(a.getJarFuelType()) == null ? ""
: Global.optionMap.get(a.getJarFuelType()));
}
}
}

View File

@ -0,0 +1,98 @@
package com.hshh.nation.fuel.controller;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.fuel.service.FuelTruckService;;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.fuel.entity.FuelTruck;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 码表类别表 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/fuelTruck")
public class FuelTruckController extends BaseController {
@Resource
private FuelTruckService service;
@Resource
private FileService fileService;
@GetMapping("/list")
public String list(FuelTruck search, Model model) {
List<FuelTruck> list = service.list(search);
long total = service.count(search);
TableRowsResult<FuelTruck> tableRowsResult = makeTableRowsResult(search, list, total);
model.addAttribute("data", tableRowsResult);
return "FuelTruck/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute FuelTruck model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if (model.getId() == null) {
service.save(model);
} else {
service.updateById(model);
}
if(model.getFile()!=null&&model.getFile().getBytes().length>0){
fileService.saveFileWithRelId(model.getId(),model.getFile().getBytes(),"","defence_fuel_truck");
}
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<FuelTruck> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<FuelTruck> view(@PathVariable("id") Integer id) {
FuelTruck data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
byte[] fileData = fileService.getDataByRelId(id,"defence_fuel_truck");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<FuelTruck> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,143 @@
package com.hshh.nation.fuel.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 保障分队
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_fuel_army")
public class FuelArmy extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 名称/番号
*/
@Size(max = 100, message = "名称/番号不能超过100字符")
private String armyName;
/**
* 编制人员
*/
@NotNull(message = "编制人员总数不能为空")
private Integer unitAmount;
@NotNull(message = "军官数量不能为空")
private Integer officerAmount;
@NotNull(message = "士兵数量不能为空")
private Integer soldierAmount;
/**
* 编制装备
*/
private Integer teamEquipCount;
/**
* 编制设施
*/
private Integer teamStoreCount;
/**
* 上级指挥部队
*/
private Integer parentId;
/**
* 展开时间
*/
@NotNull(message = "展开时间不能为空")
private Double expressHour;
/**
* 撤收时间
*/
@NotNull(message = "撤收时间不能为空")
private Double takeBackHour;
/**
* 坐标位置
*/
@Size(max = 100, message = "坐标位置(经纬度)不能超过100字符")
@NotNull(message = "坐标位置不能为空")
private String teamLocation;
/**
* 油料物资总库容量
*/
@NotNull(message = "油料物资总库容量不能为空")
private Double storeAmount;
/**
* 平均道路速度
*/
@NotNull(message = "平均道路速度不能为空")
private Double drivingAvgSpeed;
/**
* 最高道路机动速度
*/
@NotNull(message = "最高道路机动速度不能为空")
private Double drivingMaxSpeed;
/**
* 单位时间出入库物资上限
*/
@NotNull(message = "单位时间出入库物资上限不能为空")
private Double storeUpLimit;
/**
* 单位时间物资装卸能力上限
*/
@NotNull(message = "单位时间物资装卸能力上限不能为空")
private Double loadUpLimit;
/**
* 备注
*/
@Size(max = 500, message = "备注不能超过500字符")
private String armyMemo;
@TableField(exist = false)
private List<String> equipIdList;
@TableField(exist = false)
private List<String> facilitiesIdList;
@TableField(exist = false)
private MultipartFile file;
@TableField(exist = false)
private String base64Img;
@TableField(exist = false)
private String parentName;
}

View File

@ -0,0 +1,182 @@
package com.hshh.nation.fuel.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 基地油料保障力量
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_fuel_base_strong")
public class FuelBaseStrong extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 图片
*/
private byte[] baseImg;
/**
* 名称/番号
*/
@Size(max = 100, message = "名称/番号不能超过100")
private String baseName;
/**
* 编制人员
*/
private Integer unitAmount;
/**
* 编制装备
*/
private Integer teamEquipId;
/**
* 编制设施
*/
private Integer teamStoreId;
/**
* 上级指挥部队
*/
private Integer parentId;
/**
* 展开野战油库数量
*/
private Integer expressFuelAmount;
/**
* 展开野战油库容量
*/
private Double expressFuelCapacity;
/**
* 一次性运油能力
*/
private Integer onceTransportAbility;
/**
* 最大油枪展开数量
*/
private Integer expressNozzleAmount;
/**
* 同时给轮式装备加油能力
*/
private Integer simultaneousWheelAbility;
/**
* 同时给履带式装备加油能力
*/
private Integer simultaneousTrackAbility;
/**
* 展开时间
*/
private Integer expressHour;
/**
* 撤收时间
*/
private Integer takeBackHour;
/**
* 坐标位置
*/
@Size(max = 100, message = "坐标位置不能超过100")
private String baseCoordinate;
/**
* 油料物资总库容量
*/
private Integer baseCapacity;
/**
* 平均道路速度
*/
private Double drivingAvgSpeed;
/**
* 最高道路机动速度
*/
private Double drivingMaxSpeed;
/**
* 单位时间出入库物资上限
*/
private Double storeUpLimit;
/**
* 单位时间物资装卸能力上限
*/
private Double loadUpLimit;
/**
* 备注
*/
@Size(max = 500, message = "备注不能超过500")
private String armyMemo;
@TableField(exist = false)
private List<String> equipIdList;
@TableField(exist = false)
private List<String> facilitiesIdList;
@TableField(exist = false)
private MultipartFile file;
@TableField(exist = false)
private String base64Img;
@TableField(exist = false)
private String parentName;
}

View File

@ -0,0 +1,132 @@
package com.hshh.nation.fuel.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 油船
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_fuel_boat")
public class FuelBoat extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 船舶名称
*/
@Size(max = 50, message = "船舶名称不能超过50")
private String boatName;
/**
* 种类
*/
@NotNull(message = "种类不能为空")
private Integer boatType;
/**
* 舰长
*/
@NotNull(message = "舰长不能为空")
private Double boatLength;
/**
* 舰宽
*/
@NotNull(message = "舰宽不能为空")
private Double boatWidth;
/**
* 吃水
*/
@NotNull(message = "吃水不能为空")
private Double boatWaterDeep;
/**
* 满载排水量
*/
@NotNull(message = "不能为空")
private Double boatFullWaterLoan;
/**
* 标准排水量
*/
@NotNull(message = "不能为空")
private Double boatStandardWaterLoan;
/**
* 最大航速
*/
@NotNull(message = "不能为空")
private Double boatMaxSpeed;
/**
* 续航力
*/
@NotNull(message = "不能为空")
private Double boatAbility;
/**
* 舰员
*/
@NotNull(message = "不能为空")
private Integer boatWorker;
/**
* 装载能力
*/
@NotNull(message = "装载能力不能为空")
private Double boatLoadAbility;
/**
* 备注
*/
@Size(max = 500, message = "备注不能超过500")
private String truckMemo;
@NotNull(message = "加注能力不能为空")
private Double boatFilingSpeed;
private double currentCapacity;//当前容量;
@TableField(exist = false)
private MultipartFile file;
@TableField(exist = false)
private String base64Img;
}

View File

@ -0,0 +1,155 @@
package com.hshh.nation.fuel.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.*;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 金属油罐
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_fuel_metal_jar")
public class FuelMetalJar extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 图片
*/
@TableField(exist = false)
private MultipartFile file;
/**
* 所属单位
*/
private Integer belongUnit;
@TableField(exist = false)
private String belongUnitName;
/**
* 油罐编号
*/
@Size(max = 50, message = "油罐编号不能超过50")
@NotBlank(message = "油罐编号不能为空")
private String jarNo;
/**
* 油罐类型
*/
@NotNull(message = "油罐类型不能为空")
private Integer jarType;
@TableField(exist = false)
private String jarTypeName;
/**
* 容量
*/
@NotNull(message = "容量不能为空")
@Positive(message = "数值必须大于0")
private Double jarCapacity;
/**
* 内径约数
*/
@NotNull(message = "内径约数不能为空")
private Double innerDiameter;
/**
* 高度
*/
@NotNull(message = "高度不能为空")
private Double jarHeight;
/**
* 净重约数
*/
@NotNull(message = "净重约数不能为空")
private Double jarEmptyWeight;
/**
* 运输体积
*/
@NotNull(message = "运输体积不能为空")
private Double jarVolume;
/**
* 运输油箱毛重约数
*/
@NotNull(message = "运输油箱毛重约数不能为空")
private Double jarBoxWeight;
/**
* 质量状态
*/
@NotNull(message = "质量状态不能为空")
private Integer jarStatus;
@TableField(exist = false)
private String jarStatusName;
/**
* 建成时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate jarBuildDate;
@NotNull(message = "可储油种类不能为空")
//可储油种类
private Integer jarFuelType;
@TableField(exist = false)
private String jarFuelTypeName;
private Integer jarNowFuelType;
/**
* 位置
*/
@Size(max = 100, message = "位置(经纬度)不能超过100")
private String jarCoordinate;
/**
* 备注
*/
@Size(max = 255, message = "备注不能超过255")
private String jarMeno;
@TableField(exist = false)
private String base64Img;
@NotNull(message = "接收能力不能为空")
@Positive(message = "数值必须大于0")
private double jarReceiveAbility;
//当前容量
private double jarCurrentCapacity;
private String belongUnitType;
}

View File

@ -0,0 +1,155 @@
package com.hshh.nation.fuel.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 飞机
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_fuel_plane")
public class FuelPlane extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 名称
*/
private String planeName;
/**
* 军标
*/
private byte[] planeIcon;
/**
* 型号
*/
@NotNull(message = "型号不能为空")
private Integer planeType;
/**
* 乘员
*/
private Integer planeWork;
/**
* 翼展
*/
private Double planeWingLength;
/**
* 机身长度
*/
private Double planeLength;
/**
* 高度
*/
private Double planeHeight;
/**
* 空重
*/
private Double planeWeight;
/**
* 最大起飞重量
*/
private Double planeFlightWeight;
/**
* 最大载油量
*/
private Double planeLoadFuel;
/**
* 装载能力
*/
private Double planeLoadAbility;
/**
* 最大速度
*/
private Double planeMaxSpeed;
/**
* 巡航速度
*/
private Double planeSpeed;
/**
* 最大航程
*/
private Double planeFlightDistance;
/**
* 油量加注速度
*/
@NotNull(message = "油量加注速度不能为空")
private Double planeFuelSpeed;
/**
* 备注
*/
@Size(max = 500, message = "备注)不能超过500")
private String planeMemo;
private double currentCapacity;//当前容量;
@TableField(exist = false)
private MultipartFile file;
@TableField(exist = false)
private String base64Img;
}

View File

@ -0,0 +1,160 @@
package com.hshh.nation.fuel.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 金属油罐
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_fuel_soft_jar")
public class FuelSoftJar extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 图片
*/
@TableField(exist = false)
private MultipartFile file;
/**
* 所属单位
*/
private Integer belongUnit;
@TableField(exist = false)
private String belongUnitName;
/**
* 油罐编号
*/
@Size(max = 50, message = "油罐编号不能超过50字符")
@NotBlank(message = "油罐编号不能为空")
private String jarNo;
/**
* 油罐类型
*/
@NotNull(message = "油罐类型不能为空")
private Integer jarType;
@TableField(exist = false)
private String jarTypeName;
/**
* 容量
*/
@NotNull(message = "容量不能为空")
@Positive(message = "数值必须大于0")
private double jarCapacity;
/**
*
*/
@NotNull(message = "长不能为空")
private Double jarLength;
/**
* 宽度
*/
@NotNull(message = "宽度不能为空")
private Double jarWidth;
/**
* 高度
*/
@NotNull(message = "高度不能为空")
private Double jarHeight;
/**
* 直径
*/
@NotNull(message = "直径不能为空")
private Double jarDiameter;
/**
* 净重约数
*/
@NotNull(message = "净重约数不能为空")
private Double jarEmptyWeight;
/**
* 质量状态
*/
private Integer jarStatus;
@TableField(exist = false)
private String jarStatusName;
/**
* 建成时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate jarBuildDate;
@NotNull(message = "可存储油类型不能为空")
private Integer jarFuelType;
@TableField(exist = false)
private String jarFuelTypeName;
private Integer jarNowFuelType;
/**
* 位置
*/
@Size(max = 100, message = "位置(经纬度)不能超过100字符")
private String jarCoordinate;
/**
* 备注
*/
@Size(max = 255, message = "备注不能超过255字符")
private String jarMeno;
@TableField(exist = false)
private String base64Img;
@NotNull(message = "接收能力不能为空")
@Positive(message = "数值必须大于0")
private Double jarReceiveAbility;
//当前容量
private double jarCurrentCapacity;
private String belongUnitType;
}

View File

@ -0,0 +1,164 @@
package com.hshh.nation.fuel.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 码表类别表
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_fuel_truck")
public class FuelTruck extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@NotBlank(message = "编号不能为空")
@Size(max = 50, message = "编号不能超过255字符")
private String truckNo;
@TableField(exist = false)
private MultipartFile file;
/**
* 驾驶室座位
*/
@Size(max = 50, message = "运加油车名称不能超过50字符")
private String truckCabSeat;
/**
* 运加油车名称
*/
@Size(max = 255, message = "运加油车名称不能超过255字符")
private String truckModelName;
/**
* 空重
*/
@NotNull(message = "空重不能为空")
private double truckWeight;
/**
* 油罐容量
*/
@NotNull(message = "油罐容量不能为空")
private double truckFuelJar;
/**
* 油厢容量
*/
@NotNull(message = "油厢容量不能为空")
private double truckFuelBox;
/**
* 行驶里程
*/
@NotNull(message = "行驶里程不能为空")
private double truckOdometer;
/**
*
*/
@NotNull(message = "长不能为空")
private double truckLength;
/**
*
*/
@NotNull(message = "宽不能为空")
private double truckWidth;
/**
*
*/
@NotNull(message = "高不能为空")
private double truckHeight;
/**
* 最高时速
*/
@NotNull(message = "最高时速不能为空")
private double truckMaxSpeed;
/**
* 车辆状态
*/
private Integer truckStatus;
@TableField(exist = false)
private String truckStatusName;
/**
* 储油种类
*/
private Integer truckStoreType;
@TableField(exist = false)
private String truckStoreTypeName;
/**
* 加注能力
*/
@NotNull(message = "加注能力不能为空")
private double truckAbility;
/**
* 驱动型式
*/
@Size(max = 20, message = "驱动型式不能超过20字符")
private String truckDrive;
/**
* 备注
*/
@Size(max = 500, message = "备注不能超过500字符")
private String truckMemo;
private Integer truckType;
@TableField(exist = false)
private String truckTypeName;
@TableField(exist = false)
private String belongOrganize;
private double currentCapacity;//当前容量;
@TableField(exist = false)
private String base64Img;
}

View File

@ -0,0 +1,27 @@
package com.hshh.nation.fuel.mapper;
import com.hshh.nation.fuel.bean.OrganizeResource;
import com.hshh.nation.fuel.entity.FuelArmy;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 保障分队 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelArmyMapper extends BaseMapper<FuelArmy> {
List<FuelArmy> list(@Param("model") FuelArmy model);
long count(@Param("model") FuelArmy model);
List<OrganizeResource> selectOrganizeResource();
}

View File

@ -0,0 +1,24 @@
package com.hshh.nation.fuel.mapper;
import com.hshh.nation.fuel.entity.FuelBaseStrong;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 基地油料保障力量 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelBaseStrongMapper extends BaseMapper<FuelBaseStrong> {
List<FuelBaseStrong> list(@Param("model") FuelBaseStrong model);
long count(@Param("model") FuelBaseStrong model);
}

View File

@ -0,0 +1,24 @@
package com.hshh.nation.fuel.mapper;
import com.hshh.nation.fuel.entity.FuelBoat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 油船 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelBoatMapper extends BaseMapper<FuelBoat> {
List<FuelBoat> list(@Param("model") FuelBoat model);
long count(@Param("model") FuelBoat model);
}

View File

@ -0,0 +1,25 @@
package com.hshh.nation.fuel.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hshh.nation.fuel.bean.FacilitiesResource;
import com.hshh.nation.fuel.entity.FuelMetalJar;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 金属油罐 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelMetalJarMapper extends BaseMapper<FuelMetalJar> {
List<FuelMetalJar> list(@Param("model") FuelMetalJar model);
long count(@Param("model") FuelMetalJar model);
List<FacilitiesResource> selectAllResource();
}

View File

@ -0,0 +1,24 @@
package com.hshh.nation.fuel.mapper;
import com.hshh.nation.fuel.entity.FuelPlane;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 飞机 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelPlaneMapper extends BaseMapper<FuelPlane> {
List<FuelPlane> list(@Param("model") FuelPlane model);
long count(@Param("model") FuelPlane model);
}

View File

@ -0,0 +1,24 @@
package com.hshh.nation.fuel.mapper;
import com.hshh.nation.fuel.entity.FuelSoftJar;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 金属油罐 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelSoftJarMapper extends BaseMapper<FuelSoftJar> {
List<FuelSoftJar> list(@Param("model") FuelSoftJar model);
long count(@Param("model") FuelSoftJar model);
}

View File

@ -0,0 +1,26 @@
package com.hshh.nation.fuel.mapper;
import com.hshh.nation.fuel.bean.EquipResource;
import com.hshh.nation.fuel.entity.FuelTruck;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 码表类别表 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelTruckMapper extends BaseMapper<FuelTruck> {
List<FuelTruck> list(@Param("model") FuelTruck model);
long count(@Param("model") FuelTruck model);
List<EquipResource> selectAllResource();
}

View File

@ -0,0 +1,29 @@
package com.hshh.nation.fuel.service;
import com.hshh.nation.fuel.bean.OrganizeResource;
import com.hshh.nation.fuel.entity.FuelArmy;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 保障分队 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelArmyService extends IService<FuelArmy> {
List<FuelArmy> list(FuelArmy model);
long count(FuelArmy model);
void batchDelete(List<Integer> list);
void saveWhole(FuelArmy model) throws IOException;
//获取所有保障主题保障基地
List<OrganizeResource> selectOrganizeResource();
}

View File

@ -0,0 +1,26 @@
package com.hshh.nation.fuel.service;
import com.hshh.nation.fuel.entity.FuelBaseStrong;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 基地油料保障力量 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelBaseStrongService extends IService<FuelBaseStrong> {
List<FuelBaseStrong> list(FuelBaseStrong model);
long count(FuelBaseStrong model);
void batchDelete(List<Integer> list);
void saveWhole(FuelBaseStrong model) throws IOException;
}

View File

@ -0,0 +1,22 @@
package com.hshh.nation.fuel.service;
import com.hshh.nation.fuel.entity.FuelBoat;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 油船 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelBoatService extends IService<FuelBoat> {
List<FuelBoat> list( FuelBoat model);
long count( FuelBoat model);
void batchDelete(List<Integer> list);
void saveWhole(FuelBoat model);
}

View File

@ -0,0 +1,30 @@
package com.hshh.nation.fuel.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hshh.nation.fuel.bean.FacilitiesResource;
import com.hshh.nation.fuel.entity.FuelMetalJar;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 金属油罐 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelMetalJarService extends IService<FuelMetalJar> {
List<FuelMetalJar> list(FuelMetalJar model);
long count(FuelMetalJar model);
void batchDelete(List<Integer> list) throws IOException;
void saveWhole(FuelMetalJar model) throws IOException;
void deleteWhole(Integer id) throws IOException;
List<FacilitiesResource> selectAllResource();
}

View File

@ -0,0 +1,22 @@
package com.hshh.nation.fuel.service;
import com.hshh.nation.fuel.entity.FuelPlane;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 飞机 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelPlaneService extends IService<FuelPlane> {
List<FuelPlane> list( FuelPlane model);
long count( FuelPlane model);
void batchDelete(List<Integer> list);
}

View File

@ -0,0 +1,27 @@
package com.hshh.nation.fuel.service;
import com.hshh.nation.fuel.entity.FuelSoftJar;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 金属油罐 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelSoftJarService extends IService<FuelSoftJar> {
List<FuelSoftJar> list(FuelSoftJar model);
long count(FuelSoftJar model);
void batchDelete(List<Integer> list);
void saveWhole(FuelSoftJar model) throws IOException;
void deleteWhole(Integer id);
}

View File

@ -0,0 +1,27 @@
package com.hshh.nation.fuel.service;
import com.hshh.nation.fuel.bean.EquipResource;
import com.hshh.nation.fuel.entity.FuelTruck;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 码表类别表 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface FuelTruckService extends IService<FuelTruck> {
List<FuelTruck> list(FuelTruck model);
long count(FuelTruck model);
void batchDelete(List<Integer> list);
List<EquipResource> selectAllResource();
}

View File

@ -0,0 +1,86 @@
package com.hshh.nation.fuel.service.impl;
import com.hshh.nation.file.service.FileService;
import com.hshh.nation.fuel.bean.OrganizeResource;
import com.hshh.nation.fuel.entity.FuelArmy;
import com.hshh.nation.fuel.mapper.FuelArmyMapper;
import com.hshh.nation.fuel.service.FuelArmyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hshh.nation.resource.service.FuelArmyResourceService;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* <p>
* 保障分队 服务实现类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Service
public class FuelArmyServiceImpl extends ServiceImpl<FuelArmyMapper, FuelArmy> implements FuelArmyService {
@Resource
private FuelArmyResourceService fuelArmyResourceService;
@Resource
private FileService fileService;
public List<FuelArmy> list(FuelArmy model) {
return this.baseMapper.list(model);
}
public long count(FuelArmy model) {
return this.baseMapper.count(model);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void batchDelete(List<Integer> list) {
list.forEach(id -> {
this.removeById(id);
fuelArmyResourceService.removeByRel(id);
});
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveWhole(FuelArmy model) throws IOException {
this.saveOrUpdate(model);
if (model.getFile() != null && model.getFile().getBytes().length > 0) {
fileService.deleteByRelId(model.getId(), "defence_fuel_army");
fileService.saveFileWithRelId(model.getId(), model.getFile().getBytes(), "", "defence_fuel_army");
}
//处理关联设施
if (model.getFacilitiesIdList() != null) {
fuelArmyResourceService.removeFacilityResourceRelId(model.getId());
model.getFacilitiesIdList().forEach(facilityId -> {
//设施ID,资源类型
String[] info = facilityId.split("\\|");
fuelArmyResourceService.saveRel(model.getId(), Integer.parseInt(info[0]), Integer.parseInt(info[1]));
});
}
//处理装备
if (model.getEquipIdList() != null) {
fuelArmyResourceService.removeEquipResourceRelId(model.getId());
model.getEquipIdList().forEach(equipId -> {
String[] info = equipId.split("\\|");
fuelArmyResourceService.saveRel(model.getId(), Integer.parseInt(info[0]), Integer.parseInt(info[1]));
});
}
}
@Override
public List<OrganizeResource> selectOrganizeResource() {
return this.baseMapper.selectOrganizeResource();
}
}

View File

@ -0,0 +1,81 @@
package com.hshh.nation.fuel.service.impl;
import com.hshh.nation.file.service.FileService;
import com.hshh.nation.fuel.entity.FuelBaseStrong;
import com.hshh.nation.fuel.mapper.FuelBaseStrongMapper;
import com.hshh.nation.fuel.service.FuelBaseStrongService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hshh.nation.resource.service.FuelBaseResourceService;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
/**
* <p>
* 基地油料保障力量 服务实现类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Service
public class FuelBaseStrongServiceImpl extends ServiceImpl<FuelBaseStrongMapper, FuelBaseStrong> implements FuelBaseStrongService {
@Resource
private FileService fileService;
@Resource
private FuelBaseResourceService fuelBaseResourceService;
public List<FuelBaseStrong> list(FuelBaseStrong model) {
return this.baseMapper.list(model);
}
public long count(FuelBaseStrong model) {
return this.baseMapper.count(model);
}
@Override
@Transactional
public void batchDelete(List<Integer> list) {
list.forEach(id -> {
this.removeById(id);
fuelBaseResourceService.removeByRel(id);
});
}
@Transactional
@Override
public void saveWhole(FuelBaseStrong model) throws IOException {
saveOrUpdate(model);
//获取文件
MultipartFile iconFile = model.getFile();
if (iconFile != null) {
fileService.saveFileWithRelId(model.getId(), iconFile.getBytes(), iconFile.getOriginalFilename(),"defence_fuel_base_strong");
}
//处理关联设施
if (model.getFacilitiesIdList() != null) {
fuelBaseResourceService.removeFacilityResourceRelId(model.getId());
model.getFacilitiesIdList().forEach(facilityId -> {
//设施ID,资源类型
String[] info = facilityId.split("\\|");
fuelBaseResourceService.saveRel(model.getId(), Integer.parseInt(info[0]), Integer.parseInt(info[1]));
});
}
//处理装备
if (model.getEquipIdList() != null) {
fuelBaseResourceService.removeEquipResourceRelId(model.getId());
model.getEquipIdList().forEach(equipId -> {
String[] info = equipId.split("\\|");
fuelBaseResourceService.saveRel(model.getId(), Integer.parseInt(info[0]), Integer.parseInt(info[1]));
});
}
}
}

View File

@ -0,0 +1,44 @@
package com.hshh.nation.fuel.service.impl;
import com.hshh.nation.fuel.entity.FuelBoat;
import com.hshh.nation.fuel.mapper.FuelBoatMapper;
import com.hshh.nation.fuel.service.FuelBoatService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 油船 服务实现类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Service
public class FuelBoatServiceImpl extends ServiceImpl<FuelBoatMapper, FuelBoat> implements FuelBoatService {
public List<FuelBoat> list(FuelBoat model) {
return this.baseMapper.list(model);
}
public long count(FuelBoat model) {
return this.baseMapper.count(model);
}
@Override
@Transactional
public void batchDelete(List<Integer> list) {
list.forEach(id -> {
this.removeById(id);
});
}
@Override
public void saveWhole(FuelBoat model) {
}
}

View File

@ -0,0 +1,85 @@
package com.hshh.nation.fuel.service.impl;
import com.hshh.Global;
import com.hshh.nation.enums.ResourceEnum;
import com.hshh.nation.file.service.FileService;
import com.hshh.nation.fuel.bean.FacilitiesResource;
import com.hshh.nation.fuel.entity.FuelMetalJar;
import com.hshh.nation.fuel.mapper.FuelMetalJarMapper;
import com.hshh.nation.fuel.service.FuelMetalJarService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
/**
* <p>
* 金属油罐 服务实现类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Service
public class FuelMetalJarServiceImpl extends ServiceImpl<FuelMetalJarMapper, FuelMetalJar> implements FuelMetalJarService {
@Resource
private FileService fileService;
public List<FuelMetalJar> list(FuelMetalJar model) {
return this.baseMapper.list(model);
}
public long count(FuelMetalJar model) {
return this.baseMapper.count(model);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void batchDelete(List<Integer> list) {
list.forEach(this::deleteWhole);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveWhole(FuelMetalJar model) throws IOException {
this.saveOrUpdate(model);
//获取文件
MultipartFile iconFile = model.getFile();
if (iconFile != null) {
fileService.saveFileWithRelId(model.getId(), iconFile.getBytes(), iconFile.getOriginalFilename(),"defence_fuel_metal_jar");
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void deleteWhole(Integer id) {
fileService.deleteByRelId(id,"defence_fuel_metal_jar");
this.removeById(id);
}
@Override
public List<FacilitiesResource> selectAllResource() {
List<FacilitiesResource> facilities = this.baseMapper.selectAllResource();
facilities.forEach(a->{
if(a.getResourceType()== ResourceEnum.METAL_JAR.getCode()){
a.setResourceTypeName("金属油罐");
}
if(a.getResourceType()== ResourceEnum.SOFT_JAR.getCode()){
a.setResourceTypeName("软质贮油罐");
}
a.setJarFuelTypeName(Global.optionMap.get(a.getJarFuelType())==null?"":Global.optionMap.get(a.getJarFuelType()));
});
return facilities;
}
}

View File

@ -0,0 +1,35 @@
package com.hshh.nation.fuel.service.impl;
import com.hshh.nation.fuel.entity.FuelPlane;
import com.hshh.nation.fuel.mapper.FuelPlaneMapper;
import com.hshh.nation.fuel.service.FuelPlaneService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 飞机 服务实现类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Service
public class FuelPlaneServiceImpl extends ServiceImpl<FuelPlaneMapper, FuelPlane> implements FuelPlaneService {
public List<FuelPlane> list( FuelPlane model){ return this.baseMapper.list(model);
}
public long count( FuelPlane model){ return this.baseMapper.count(model);
}
@Override
@Transactional
public void batchDelete(List<Integer> list) {
list.forEach(id -> {
this.removeById(id);
});
}
}

View File

@ -0,0 +1,64 @@
package com.hshh.nation.fuel.service.impl;
import com.hshh.nation.file.service.FileService;
import com.hshh.nation.fuel.entity.FuelSoftJar;
import com.hshh.nation.fuel.mapper.FuelSoftJarMapper;
import com.hshh.nation.fuel.service.FuelSoftJarService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
/**
* <p>
* 金属油罐 服务实现类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Service
public class FuelSoftJarServiceImpl extends ServiceImpl<FuelSoftJarMapper, FuelSoftJar> implements FuelSoftJarService {
@Resource
private FileService fileService;
public List<FuelSoftJar> list(FuelSoftJar model) {
return this.baseMapper.list(model);
}
public long count(FuelSoftJar model) {
return this.baseMapper.count(model);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void batchDelete(List<Integer> list) {
list.forEach(this::deleteWhole);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveWhole(FuelSoftJar model) throws IOException {
this.saveOrUpdate(model);
//获取文件
MultipartFile iconFile = model.getFile();
if (iconFile != null) {
fileService.saveFileWithRelId(model.getId(), iconFile.getBytes(), iconFile.getOriginalFilename(),"defence_fuel_soft_jar");
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void deleteWhole(Integer id) {
this.removeById(id);
fileService.deleteByRelId(id,"defence_fuel_soft_jar");
}
}

View File

@ -0,0 +1,60 @@
package com.hshh.nation.fuel.service.impl;
import com.hshh.nation.enums.ResourceEnum;
import com.hshh.nation.fuel.bean.EquipResource;
import com.hshh.nation.fuel.entity.FuelTruck;
import com.hshh.nation.fuel.mapper.FuelTruckMapper;
import com.hshh.nation.fuel.service.FuelTruckService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 码表类别表 服务实现类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Service
public class FuelTruckServiceImpl extends ServiceImpl<FuelTruckMapper, FuelTruck> implements FuelTruckService {
public List<FuelTruck> list(FuelTruck model) {
return this.baseMapper.list(model);
}
public long count(FuelTruck model) {
return this.baseMapper.count(model);
}
@Override
@Transactional
public void batchDelete(List<Integer> list) {
list.forEach(id -> {
this.removeById(id);
});
}
@Override
public List<EquipResource> selectAllResource() {
List<EquipResource> resources = this.baseMapper.selectAllResource();
resources.forEach(resource -> {
if(resource.getResourceType()== ResourceEnum.TRUCK.getCode()){
resource.setResourceTypeName("运加油车");
}
if(resource.getResourceType()==ResourceEnum.BOAT.getCode()){
resource.setResourceTypeName("补给油船");
}
if(resource.getResourceType()==ResourceEnum.PLANET.getCode()){
resource.setResourceTypeName("空中加油机");
}
});
return resources;
}
}

View File

@ -0,0 +1,31 @@
package com.hshh.nation.inter.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 互动模型控制
*/
@Controller
@RequestMapping("/inter")
public class InterController {
@RequestMapping("/{inter}")
public String action(@PathVariable("inter") String inter) {
switch (inter) {
case "transport":
return "transportAction/inter";
case "fuel":
return "FuelAction/inter";
case "medical":
return "MedicalAction/medicalInter";
default:
return null;
}
}
}

View File

@ -0,0 +1,76 @@
package com.hshh.nation.login.controller;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.advice.GlobalExceptionHandler;
import com.hshh.nation.login.model.ExtendUserDetails;
import com.hshh.nation.set.service.ConfigService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@Controller
@Slf4j
public class LoginController extends BaseController {
@Resource
private ConfigService configService;//全局配置service
@Autowired
private AuthenticationManager authenticationManager;
//导向到登录页面
@RequestMapping("/login")
public String loginPage(Model model) {
Map<String, String> setMap = configService.getMapAllSet();
String systemTitle = setMap.get("system.title");
model.addAttribute("systemTitle", systemTitle);
return "login";
}
//登录
@PostMapping("/toAuth")
@ResponseBody
public OperateResult<String> login(@RequestBody LoginForm loginForm, HttpServletRequest request) {
try {
log.info("username={}", loginForm.getUsername());
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(loginForm.getUsername(), loginForm.getPassword());
authenticationManager.authenticate(token);
Authentication authentication = authenticationManager.authenticate(token);
SecurityContextHolder.getContext().setAuthentication(authentication);
request.getSession().setAttribute("user", authentication.getPrincipal());
request.getSession(true).setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, SecurityContextHolder.getContext());
} catch (Exception e) {
log.error(e.getMessage());
return OperateResult.error(null, e.getMessage(), GlobalExceptionHandler.SERVER_ERROR_CODE);
}
return OperateResult.success();
}
@GetMapping("/home")
public String home(Model model) {
log.info("home");
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
ExtendUserDetails user = (ExtendUserDetails) authentication.getPrincipal();
model.addAttribute("currentUser", user);
return "fragments/layout";
}
@Data
private static class LoginForm{
String username;
String password;
}
}

View File

@ -0,0 +1,74 @@
package com.hshh.nation.login.model;
import com.hshh.nation.menu.entity.Menu;
import java.util.Collection;
import java.util.List;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
/**
* 认证用户bean.
*/
@Data
public class ExtendUserDetails implements UserDetails {
private static final long serialVersionUID = -6665164985838916630L;
private String userName;
private String nickName;
private String password;
private List<Menu> menuList;
private String pageTitle = "";
/**
* 构造函数.
*
* @param userName 用户名
* @param nickName 昵称
* @param password 密码
* @param menuList 菜单
*/
public ExtendUserDetails(String userName, String nickName, String password, List<Menu> menuList) {
this.userName = userName;
this.nickName = nickName;
this.password = password;
this.menuList = menuList;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return List.of();
}
@Override
public String getPassword() {
return this.password;
}
@Override
public String getUsername() {
return this.userName;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
}

View File

@ -0,0 +1,49 @@
package com.hshh.nation.login.service;
import static com.hshh.nation.exception.Exceptions.USER_EXIT;
import com.hshh.nation.login.model.ExtendUserDetails;
import com.hshh.nation.menu.entity.Menu;
import com.hshh.nation.menu.service.MenuService;
import com.hshh.nation.user.entity.User;
import com.hshh.nation.user.service.UserService;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Service;
/**
* 用户认证.
*/
@Service
public class UserAuthService implements UserDetailsService {
/**
* 用户查询服务类.
*/
@Resource
private UserService userService;
/**
* 菜单服务类.
*/
@Resource
private MenuService menuService;
/**
* 查询用户信息.
*
* @param userName 用户名
* @return 认证用户对象
*/
@Override
public ExtendUserDetails loadUserByUsername(String userName) {
User user = userService.getUserByUsername(userName);
if (user == null) {
throw new RuntimeException(USER_EXIT.getMsg());
}
//获取所有菜单
List<Menu> menuList = menuService.getMenuByUserId(user);
return new ExtendUserDetails(userName, user.getNickName(), user.getPassword(), menuList);
}
}

View File

@ -0,0 +1,23 @@
package com.hshh.nation.medical.bean;
import lombok.Data;
/**
* 资源.
*/
@Data
public class MedicalResource {
private String id;
private String name;
private String no;
/**
* 位置.
*/
private String location;
private String typeName;
/**
* 类别army hospital.
*/
private String typeCode;
}

View File

@ -0,0 +1,19 @@
package com.hshh.nation.medical.bean;
import lombok.Data;
@Data
public class MedicalTransportResource {
private int id;
private String name;
private String no;
private String location;
//救治能力
private String ability;
//速度
private double speed;
private String typeCode;//用于区分 飞机 轮船
private String typeName;
private double payload;
}

View File

@ -0,0 +1,98 @@
package com.hshh.nation.medical.controller;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.medical.service.MedicalArmyService;;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.medical.entity.MedicalArmy;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 医疗队模型 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/medicalArmy")
public class MedicalArmyController extends BaseController {
@Resource
private MedicalArmyService service;
@Resource
private FileService fileService;
@GetMapping("/list")
public String list(MedicalArmy search, Model model) {
List<MedicalArmy> list = service.list(search);
long total = service.count(search);
TableRowsResult<MedicalArmy> tableRowsResult = makeTableRowsResult(search, list, total);
model.addAttribute("data", tableRowsResult);
return "MedicalArmy/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute MedicalArmy model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if (model.getId() == null) {
service.save(model);
} else {
service.updateById(model);
}
if(model.getFile()!=null&&model.getFile().getBytes().length>0){
fileService.saveFileWithRelId(model.getId(),model.getFile().getBytes(),"","defence_medical_army");
}
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<MedicalArmy> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<MedicalArmy> view(@PathVariable("id") Integer id) {
MedicalArmy data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
byte[] fileData = fileService.getDataByRelId(id,"defence_medical_army");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<MedicalArmy> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,99 @@
package com.hshh.nation.medical.controller;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.medical.service.MedicalBoatService;;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.medical.entity.MedicalBoat;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 医院船 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/medicalBoat")
public class MedicalBoatController extends BaseController {
@Resource
private MedicalBoatService service;
@Resource
private FileService fileService;
@GetMapping("/list")
public String list(MedicalBoat search, Model model) {
List<MedicalBoat> list = service.list(search);
long total = service.count(search);
TableRowsResult<MedicalBoat> tableRowsResult = makeTableRowsResult(search, list, total);
model.addAttribute("data", tableRowsResult);
return "MedicalBoat/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute MedicalBoat model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if (model.getId() == null) {
service.save(model);
} else {
service.updateById(model);
}
if (model.getFile() != null && model.getFile().getBytes().length > 0) {
fileService.saveFileWithRelId(model.getId(), model.getFile().getBytes(), "","defence_medical_boat");
}
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<MedicalBoat> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<MedicalBoat> view(@PathVariable("id") Integer id) {
MedicalBoat data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
byte[] fileData = fileService.getDataByRelId(id,"defence_medical_boat");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<MedicalBoat> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,93 @@
package com.hshh.nation.medical.controller;
import com.hshh.Global;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.medical.service.MedicalCasualtyService;;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.medical.entity.MedicalCasualty;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 伤员模型 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/medicalCasualty")
public class MedicalCasualtyController extends BaseController {
@Resource
private MedicalCasualtyService service;
@GetMapping("/list")
public String list(MedicalCasualty search, Model model) {
List<MedicalCasualty> list = service.list(search);
for(MedicalCasualty mc : list) {
mc.setBodyConditionName(Global.optionMap.get(mc.getBodyCondition()));
}
long total = service.count(search);
TableRowsResult<MedicalCasualty> tableRowsResult = makeTableRowsResult(search, list, total);
model.addAttribute("data", tableRowsResult);
return "MedicalCasualty/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute MedicalCasualty model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if (model.getId() == null) {
service.save(model);
} else {
service.updateById(model);
}
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<MedicalCasualty> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<MedicalCasualty> view(@PathVariable("id") Integer id) {
MedicalCasualty data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<MedicalCasualty> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,98 @@
package com.hshh.nation.medical.controller;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.medical.service.MedicalHospitalService;;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.medical.entity.MedicalHospital;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 医院模型 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/medicalHospital")
public class MedicalHospitalController extends BaseController {
@Resource
private MedicalHospitalService service;
@Resource
private FileService fileService;
@GetMapping("/list")
public String list(MedicalHospital search, Model model) {
List<MedicalHospital> list = service.list(search);
long total = service.count(search);
TableRowsResult<MedicalHospital> tableRowsResult = makeTableRowsResult(search, list, total);
model.addAttribute("data", tableRowsResult);
return "MedicalHospital/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute MedicalHospital model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if (model.getId() == null) {
service.save(model);
} else {
service.updateById(model);
}
if(model.getFile()!=null&&model.getFile().getBytes().length>0){
fileService.saveFileWithRelId(model.getId(),model.getFile().getBytes(),"","defence_medical_hospital");
}
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<MedicalHospital> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<MedicalHospital> view(@PathVariable("id") Integer id) {
MedicalHospital data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
byte[] fileData = fileService.getDataByRelId(id,"defence_medical_hospital");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<MedicalHospital> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,99 @@
package com.hshh.nation.medical.controller;
import com.hshh.nation.common.Utility;
import com.hshh.nation.file.service.FileService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.hshh.nation.medical.service.MedicalPlaneService;;
import com.hshh.nation.common.BaseController;
import com.hshh.nation.common.OperateResult;
import com.hshh.nation.common.TableRowsResult;
import com.hshh.nation.medical.entity.MedicalPlane;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
/**
* <p>
* 卫生飞机 前端控制器
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Controller
@RequestMapping("/medicalPlane")
public class MedicalPlaneController extends BaseController {
@Resource
private MedicalPlaneService service;
@Resource
private FileService fileService;
@GetMapping("/list")
public String list(MedicalPlane search, Model model) {
List<MedicalPlane> list = service.list(search);
long total = service.count(search);
TableRowsResult<MedicalPlane> tableRowsResult = makeTableRowsResult(search, list, total);
model.addAttribute("data", tableRowsResult);
return "MedicalPlane/list";
}
@PostMapping("/save")
@ResponseBody
public OperateResult<String> save(@Valid @ModelAttribute MedicalPlane model, BindingResult bindingResult) throws IOException {
if (bindingResult.hasErrors()) {
return errorsInputHandle(bindingResult);
}
if (model.getId() == null) {
service.save(model);
} else {
service.updateById(model);
}
if (model.getFile() != null && model.getFile().getBytes().length > 0) {
fileService.saveFileWithRelId(model.getId(), model.getFile().getBytes(), "","defence_medical_plane");
}
return OperateResult.success("", "success");
}
@GetMapping("/remove/{id}")
@ResponseBody
public OperateResult<MedicalPlane> remove(@PathVariable("id") Integer id) {
service.removeById(id);
return OperateResult.success(null, "success");
}
@GetMapping("/view/{id}")
@ResponseBody
public OperateResult<MedicalPlane> view(@PathVariable("id") Integer id) {
MedicalPlane data = service.getById(id);
if (data == null) {
return OperateResult.error(null, "无记录", -1);
}
byte[] fileData = fileService.getDataByRelId(id,"defence_medical_plane");
if (fileData != null) {
data.setBase64Img(Utility.bytesToBase64(fileData));
}
return OperateResult.success(data, "success");
}
@PostMapping("/batchRemove")
@ResponseBody
public OperateResult<MedicalPlane> batchRemove(List<Integer> list) {
service.batchDelete(list);
return OperateResult.success(null, "success");
}
}

View File

@ -0,0 +1,127 @@
package com.hshh.nation.medical.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 医疗队模型
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_medical_army")
public class MedicalArmy extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 部队编号
*/
@Size(max = 100, message = "部队编号不能超过100")
@NotBlank(message = "部队编号不能为空")
private String armyNo;
/**
* ()队名称
*/
@Size(max = 200, message = "部(分)队名称不能超过200")
@NotBlank(message = "部(分)队名称不能为空")
private String armyName;
/**
* 部队类型
*/
@Size(max = 200, message = "部队类型不能超过200")
private String armyType;
/**
* 编制级别
*/
@Size(max = 20, message = "编制级别不能超过20")
@NotBlank(message = "编制级别不能为空")
private String armyLevel;
/**
* 驻地/基地
*/
@Size(max = 200, message = "驻地/基地不能超过200")
@NotBlank(message = "驻地/基地不能为空")
private String armyLocation;
/**
* 血浆最大储量
*/
@Size(max = 200, message = "血浆最大储量不能超过200")
private String bloodPlasmaMax;
/**
* 最大展开床位数
*/
private Integer expressMaxBed;
/**
* 开设手术台数
*/
private Integer operationTable;
/**
* 重伤员持续监护能力
*/
@Size(max = 50, message = "重伤员持续监护能力不能超过50")
private String seriousCasualtyMonitorAbility;
/**
* 野战救护车数量
*/
private Integer wildVehicleCount;
/**
* 伤员运输车数量
*/
private Integer casualtyVehicleCount;
/**
* 备注
*/
@Size(max = 255, message = "备注不能超过255")
private String jarMeno;
@TableField(exist = false)
private MultipartFile file;
@TableField(exist = false)
private String base64Img;
}

View File

@ -0,0 +1,172 @@
package com.hshh.nation.medical.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 医院船
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_medical_boat")
public class MedicalBoat extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 装备编号
*/
@Size(max = 100, message = "装备编号不能超过100")
@NotBlank(message = "装备编号不能为空")
private String boatNo;
/**
* 装备名称
*/
@Size(max = 200, message = "装备名称不能超过200")
@NotBlank(message = "装备名称不能为空")
private String boatName;
/**
* 隶属单位
*/
@Size(max = 200, message = "隶属单位不能超过200")
private String belongUnit;
/**
*
*/
private double boatLength;
/**
*
*/
private double boatWidth;
/**
* 吃水
*/
private double boatDeep;
/**
* 满载排水量
*/
private double boatFullDisplacement;
/**
* 航行速度
*/
private double cruisingSpeed;
/**
* 续航力
*/
@Size(max = 200, message = "续航力不能超过200")
private String boatContinuousStrong;
/**
* 船员
*/
private Integer crewCount;
/**
* 海军医护人员
*/
private Integer nurseCount;
/**
* 海军支援人员
*/
private Integer soldierCount;
/**
* 医疗救护能力
*/
@Size(max = 1000, message = "医疗救护能力不能超过1000")
private String secureAbility;
/**
* 直升机平台数量
*/
private Integer helicopterCount;
/**
* 救生艇数量
*/
private Integer lifeBoatCount;
/**
* 地址位置
*/
@Size(max = 255, message = "地址位置不能超过255")
private String planeLocation;
/**
* 装备状态
*/
@Size(max = 11, message = "装备状态不能超过11")
private String planeStatus;
/**
* 装卸载伤员耗时
*/
private Double loadUnloadTime;
/**
* 备注
*/
@Size(max = 255, message = "备注不能超过255")
private String jarMeno;
@TableField(exist = false)
private MultipartFile file;
@TableField(exist = false)
private String base64Img;
private double payload;
}

View File

@ -0,0 +1,111 @@
package com.hshh.nation.medical.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 伤员模型
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_medical_casualty")
public class MedicalCasualty extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 伤员编号
*/
@Size(max = 100, message = "伤员编号不能超过100")
private String casualtyNo;
/**
* 所属部队
*/
@Size(max = 200, message = "所属部队不能超过200")
private String armyTeam;
/**
* 性别
*/
@Size(max = 10, message = "性别不能超过10")
@NotBlank(message = "性别不能为空")
private String sex;
/**
* 出生年月
*/
@Size(max = 50, message = "出生年月不能超过50")
@NotBlank(message = "出生年月不能为空")
private String birthday;
/**
* 籍贯
*/
@Size(max = 200, message = "籍贯不能超过200")
private String bornCity;
/**
* 伤势
*/
private Integer bodyCondition;
/**
* 伤因
*/
@Size(max = 1000, message = "伤因不能超过1000")
private String casualtyReason;
/**
* 伤类
*/
@Size(max = 255, message = "伤类不能超过255")
private String casualtyClass;
/**
* 备注
*/
@Size(max = 255, message = "备注不能超过255")
private String jarMeno;
@TableField(exist = false)
private MultipartFile file;
@TableField(exist = false)
private String base64Img;
@TableField(exist = false)
private String bodyConditionName;
}

View File

@ -0,0 +1,170 @@
package com.hshh.nation.medical.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 医院模型
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_medical_hospital")
public class MedicalHospital extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 医院编号
*/
@Size(max = 100, message = "医院编号不能超过100")
@NotBlank(message = "医院编号不能为空")
private String hospitalNo;
/**
* 医院类型
*/
@Size(max = 200, message = "医院类型不能超过200")
@NotBlank(message = "医院类型不能为空")
private String hospitalType;
/**
* 医院级别
*/
@Size(max = 200, message = "医院级别不能超过200")
private String hospitalLevel;
/**
* 医院名称
*/
@Size(max = 200, message = "医院名称不能超过20")
@NotBlank(message = "医院名称不能为空")
private String hospitalName;
/**
* 隶属单位
*/
@Size(max = 200, message = "隶属单位不能超过200")
private String belongUnit;
/**
* 地址位置
*/
@Size(max = 255, message = "地址位置不能超过255")
private String hospitalLocation;
/**
* 科室种类
*/
private String hospitalDepartment;
/**
* 编制总人数
*/
private Integer hospitalWorkerTotal;
/**
* 医师数量
*/
private Integer doctorCount;
/**
* 护士数量
*/
private Integer nurseCount;
/**
* 看护兵数量
*/
private Integer soldierCount;
/**
* 病床总数量
*/
private Integer bedTotal;
/**
* 空余床位数
*/
private Integer bedFreeCount;
/**
* 手术台数
*/
private Integer operationTableCount;
/**
* 伤员通过数
*/
private Integer casualAcceptCount;
/**
* 有无直升机平台
*/
private Integer helicopterFlag;
/**
* 转运急救车数量
*/
private Integer transportAmbulanceCount;
/**
* 监护急救车数量
*/
private Integer watchAmbulanceCount;
/**
* 备注
*/
@Size(max = 255, message = "备注不能超过255")
private String jarMeno;
@TableField(exist = false)
private MultipartFile file;
@TableField(exist = false)
private String base64Img;
}

View File

@ -0,0 +1,158 @@
package com.hshh.nation.medical.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hshh.nation.common.BaseBean;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 卫生飞机
* </p>
*
* @author lidy
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("defence_medical_plane")
public class MedicalPlane extends BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 装备编号
*/
@Size(max = 100, message = "装备编号不能超过100")
@NotBlank(message = "装备编号不能为空")
private String planeNo;
/**
* 装备名称
*/
@Size(max = 200, message = "装备名称不能超过200")
@NotBlank(message = "装备名称不能为空")
private String planeName;
/**
* 飞机型号
*/
@Size(max = 200, message = "飞机型号不能超过200")
private String planeModel;
/**
* 隶属单位
*/
@Size(max = 200, message = "隶属单位不能超过200")
private String belongUnit;
/**
* 军医数量
*/
private Integer doctorCount;
/**
* 护士数量
*/
private Integer nurseCount;
/**
* 医疗保障人员数量
*/
private Integer soldierCount;
/**
* 地址位置
*/
@Size(max = 255, message = "地址位置不能超过255")
private String planeLocation;
/**
* 装备状态
*/
@Size(max = 11, message = "装备状态不能超过11")
private String planeStatus;
/**
* 飞行速度
*/
private double flightSpeed;
/**
* 服役时间
*/
private String serverTime;
/**
* 动力系统
*/
@Size(max = 100, message = "动力系统不能超过100")
private String engineerSystem;
/**
* 床位数量
*/
private Integer bedCount;
/**
* 运输能力
*/
@Size(max = 100, message = "运输能力不能超过100")
private String transportAbility;
/**
* 救治能力
*/
@Size(max = 100, message = "救治能力不能超过100")
private String secureAbility;
/**
* 备注
*/
@Size(max = 255, message = "备注不能超过255")
private String jarMeno;
@TableField(exist = false)
private MultipartFile file;
@TableField(exist = false)
private String base64Img;
private double payload;
}

View File

@ -0,0 +1,24 @@
package com.hshh.nation.medical.mapper;
import com.hshh.nation.medical.entity.MedicalArmy;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 医疗队模型 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface MedicalArmyMapper extends BaseMapper<MedicalArmy> {
List<MedicalArmy> list(@Param("model") MedicalArmy model);
long count(@Param("model") MedicalArmy model);
}

View File

@ -0,0 +1,24 @@
package com.hshh.nation.medical.mapper;
import com.hshh.nation.medical.entity.MedicalBoat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 医院船 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface MedicalBoatMapper extends BaseMapper<MedicalBoat> {
List<MedicalBoat> list(@Param("model") MedicalBoat model);
long count(@Param("model") MedicalBoat model);
}

View File

@ -0,0 +1,24 @@
package com.hshh.nation.medical.mapper;
import com.hshh.nation.medical.entity.MedicalCasualty;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 伤员模型 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface MedicalCasualtyMapper extends BaseMapper<MedicalCasualty> {
List<MedicalCasualty> list(@Param("model") MedicalCasualty model);
long count(@Param("model") MedicalCasualty model);
}

View File

@ -0,0 +1,26 @@
package com.hshh.nation.medical.mapper;
import com.hshh.nation.medical.bean.MedicalResource;
import com.hshh.nation.medical.entity.MedicalHospital;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 医院模型 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface MedicalHospitalMapper extends BaseMapper<MedicalHospital> {
List<MedicalHospital> list(@Param("model") MedicalHospital model);
long count(@Param("model") MedicalHospital model);
//查询所有的保障单位包含医院和小分队
List<MedicalResource> selectAllMedicalResource();
}

View File

@ -0,0 +1,26 @@
package com.hshh.nation.medical.mapper;
import com.hshh.nation.medical.bean.MedicalTransportResource;
import com.hshh.nation.medical.entity.MedicalPlane;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 卫生飞机 Mapper 接口
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface MedicalPlaneMapper extends BaseMapper<MedicalPlane> {
List<MedicalPlane> list(@Param("model") MedicalPlane model);
long count(@Param("model") MedicalPlane model);
//获取所有的运输设施
List<MedicalTransportResource> selectMedicalTransport();
}

View File

@ -0,0 +1,23 @@
package com.hshh.nation.medical.service;
import com.hshh.nation.medical.entity.MedicalArmy;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 医疗队模型 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface MedicalArmyService extends IService<MedicalArmy> {
List<MedicalArmy> list(MedicalArmy model);
long count(MedicalArmy model);
void batchDelete(List<Integer> list);
}

View File

@ -0,0 +1,25 @@
package com.hshh.nation.medical.service;
import com.hshh.nation.medical.entity.MedicalBoat;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 医院船 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface MedicalBoatService extends IService<MedicalBoat> {
List<MedicalBoat> list(MedicalBoat model);
long count(MedicalBoat model);
void batchDelete(List<Integer> list);
}

View File

@ -0,0 +1,22 @@
package com.hshh.nation.medical.service;
import com.hshh.nation.medical.entity.MedicalCasualty;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 伤员模型 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface MedicalCasualtyService extends IService<MedicalCasualty> {
List<MedicalCasualty> list( MedicalCasualty model);
long count( MedicalCasualty model);
void batchDelete(List<Integer> list);
}

View File

@ -0,0 +1,26 @@
package com.hshh.nation.medical.service;
import com.hshh.nation.medical.bean.MedicalResource;
import com.hshh.nation.medical.entity.MedicalHospital;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 医院模型 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface MedicalHospitalService extends IService<MedicalHospital> {
List<MedicalHospital> list(MedicalHospital model);
long count(MedicalHospital model);
void batchDelete(List<Integer> list);
List<MedicalResource> selectAllMedicalResource();
}

View File

@ -0,0 +1,26 @@
package com.hshh.nation.medical.service;
import com.hshh.nation.medical.bean.MedicalTransportResource;
import com.hshh.nation.medical.entity.MedicalPlane;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 卫生飞机 服务类
* </p>
*
* @author lidy
* @since 2025-07-03
*/
public interface MedicalPlaneService extends IService<MedicalPlane> {
List<MedicalPlane> list(MedicalPlane model);
long count(MedicalPlane model);
void batchDelete(List<Integer> list);
List<MedicalTransportResource> selectMedicalTransport();
}

Some files were not shown because too many files have changed in this diff Show More