Compare commits
110 Commits
0400398361
...
claude/obj
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c5722c47c | |||
| 598f88b03a | |||
| 5544056833 | |||
| bf7ee08b08 | |||
| b2a9a117bc | |||
| 234e5b866f | |||
| e6a4f475a4 | |||
| 00ad7fdf06 | |||
| 5790f7e9ec | |||
| 980aeb1bb0 | |||
| 94c5e076f8 | |||
| 046f4c5e1b | |||
| c6a3b6723f | |||
| c4f0070065 | |||
| acaf13ff95 | |||
| 88c374952a | |||
| 8ad3f2d7dd | |||
| 2b19ef7d68 | |||
| f7c4d3fb90 | |||
| ec464c7d28 | |||
| 2f92ef57de | |||
| 184202b82f | |||
| 7efc03570d | |||
| c1a382c255 | |||
| 44949287e0 | |||
| d294c7b5cd | |||
| 8e34f2eb62 | |||
| b7af1b87ab | |||
| 2575483122 | |||
| 22f7c53914 | |||
| 9e6ae1eca9 | |||
| 690729e266 | |||
| 1e140cf1da | |||
| 4f0b919235 | |||
| f745651370 | |||
| a4f479454f | |||
| 7a2603e1f9 | |||
| 23f65c738d | |||
| d46754ede8 | |||
| faca2f85eb | |||
| 005cf47424 | |||
| 6f64c3d4af | |||
| db7cbf8157 | |||
| a9c9b8a5ea | |||
| e5bfa0c78c | |||
| 79e536aeca | |||
| 3334248847 | |||
| 370142a99f | |||
| b475bee7ed | |||
| a556139b68 | |||
| 9ce3bbf118 | |||
| c6e4c4bb06 | |||
| 03ed8f258f | |||
| bb45c2bb38 | |||
| 55443dac9e | |||
| 434e874777 | |||
| 900b3638d4 | |||
| ffcb62cece | |||
| dcc66aa4a9 | |||
| a28ea44cab | |||
| 3dafaceef2 | |||
| 95141d0e1f | |||
| 12076c5d0b | |||
| 81e529a2dd | |||
| 305d8524d1 | |||
| 47baa575df | |||
| 9ce5cb8f2e | |||
| ccf87c06ff | |||
| 156602fd59 | |||
| 2752a31a49 | |||
| 40fdd14d13 | |||
| f1158d1e16 | |||
| 6055f06f83 | |||
| a0d8f459e4 | |||
| 5672b1c07a | |||
| 89f47860a7 | |||
| 7f9ae18022 | |||
| f5b2ddb743 | |||
| 1e128cecfe | |||
| 534a64a874 | |||
| c412f73b80 | |||
| 28a37f4105 | |||
| 975c57f12b | |||
| 67d4519462 | |||
| dc67788f51 | |||
| 04c84a3ed3 | |||
| acf0048bf1 | |||
| 2ac3901f75 | |||
| 3613b6d83a | |||
| 4faad94c79 | |||
| f6b5940a27 | |||
| db90e2a084 | |||
| f48818b14d | |||
| 602928dc0b | |||
|
|
455f3bbf09 | ||
|
|
e0e31c765b | ||
| 335dc88a2a | |||
| 50527f68e0 | |||
| 8b78e82a80 | |||
| 8b3e016568 | |||
| c1c3fdba68 | |||
| 2d86713971 | |||
|
|
f3d5556196 | ||
|
|
f831f29b63 | ||
|
|
03b0e20301 | ||
|
|
ba5796984c | ||
|
|
a69c1f0cb2 | ||
| e728a98dcc | |||
| 54b820cc40 | |||
| f73a002f0f |
@@ -9,6 +9,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* FAD APP 定位控制器
|
||||
*/
|
||||
@@ -21,14 +24,14 @@ public class FadAppLocationController {
|
||||
private final IFadAppLocationService locationService;
|
||||
|
||||
/**
|
||||
* 根据经纬度获取城市
|
||||
*
|
||||
* @param latitude 纬度
|
||||
* @param longitude 经度
|
||||
* @return 城市名称
|
||||
* 根据经纬度获取地址(精确到区/县)。
|
||||
* <p>用 Map 包一层避开 R.ok(String) 把字符串塞到 msg 字段的重载冲突。
|
||||
*/
|
||||
@GetMapping("/city")
|
||||
public R<String> getCity(@RequestParam Double latitude, @RequestParam Double longitude) {
|
||||
return R.ok(locationService.getCityByLocation(latitude, longitude));
|
||||
public R<Map<String, Object>> getCity(@RequestParam Double latitude,
|
||||
@RequestParam Double longitude) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("city", locationService.getCityByLocation(latitude, longitude));
|
||||
return R.ok(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,12 @@ package com.ruoyi.fadapp.service;
|
||||
public interface IFadAppLocationService {
|
||||
|
||||
/**
|
||||
* 根据经纬度获取城市
|
||||
* 根据经纬度返回最精准的地址(精确到区/县)。
|
||||
* 例如 "烟台市芝罘区"、"北京市朝阳区",直辖市可能只有 "朝阳区"。
|
||||
*
|
||||
* @param latitude 纬度
|
||||
* @param longitude 经度
|
||||
* @return 城市名称
|
||||
* @return 地址字符串,失败返回 ""
|
||||
*/
|
||||
String getCityByLocation(Double latitude, Double longitude);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.fadapp.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.fadapp.service.IFadAppLocationService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -11,25 +12,27 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* FAD APP 定位服务实现
|
||||
* FAD APP 定位服务实现,调高德逆地理编码 API
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class FadAppLocationServiceImpl implements IFadAppLocationService {
|
||||
|
||||
private static final String AMAP_REVERSE_URL = "https://restapi.amap.com/v3/geocode/regeo";
|
||||
|
||||
private final RestTemplate restTemplate = new RestTemplate();
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
@Value("${fad.amap.key:}")
|
||||
private String amapKey;
|
||||
|
||||
/**
|
||||
* 根据经纬度返回最精准的可读地址:优先到区/县。
|
||||
* 返回示例:"烟台市芝罘区" / "北京市朝阳区" / "山东省"(兜底)。
|
||||
*/
|
||||
@Override
|
||||
public String getCityByLocation(Double latitude, Double longitude) {
|
||||
if (latitude == null || longitude == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (latitude == null || longitude == null) return "";
|
||||
if (!org.springframework.util.StringUtils.hasText(amapKey)) {
|
||||
log.warn("高德地图 key 未配置");
|
||||
return "";
|
||||
@@ -45,43 +48,40 @@ public class FadAppLocationServiceImpl implements IFadAppLocationService {
|
||||
params.put("output", "JSON");
|
||||
|
||||
StringBuilder url = new StringBuilder(AMAP_REVERSE_URL).append("?");
|
||||
params.forEach((key, value) -> url.append(key).append("=").append(value).append("&"));
|
||||
params.forEach((k, v) -> url.append(k).append("=").append(v).append("&"));
|
||||
url.setLength(url.length() - 1);
|
||||
|
||||
JSONObject response = restTemplate.getForObject(url.toString(), JSONObject.class);
|
||||
if (response == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!"1".equals(response.getString("status"))) {
|
||||
if (response == null || !"1".equals(response.getString("status"))) {
|
||||
log.warn("高德逆地理编码失败: {}", response);
|
||||
return "";
|
||||
}
|
||||
|
||||
JSONObject regeocode = response.getJSONObject("regeocode");
|
||||
if (regeocode == null) {
|
||||
return "";
|
||||
}
|
||||
if (regeocode == null) return "";
|
||||
JSONObject ac = regeocode.getJSONObject("addressComponent");
|
||||
if (ac == null) return "";
|
||||
|
||||
JSONObject addressComponent = regeocode.getJSONObject("addressComponent");
|
||||
if (addressComponent == null) {
|
||||
return "";
|
||||
// 优先到区县级别
|
||||
String district = _str(ac, "district");
|
||||
String city = _str(ac, "city");
|
||||
String province = _str(ac, "province");
|
||||
if (!district.isEmpty()) {
|
||||
// 直辖市 city 为空时只显示区,否则拼"市+区"
|
||||
return city.isEmpty() ? district : (city + district);
|
||||
}
|
||||
|
||||
String city = addressComponent.getString("city");
|
||||
if (org.springframework.util.StringUtils.hasText(city)) {
|
||||
return city;
|
||||
}
|
||||
|
||||
String province = addressComponent.getString("province");
|
||||
if (org.springframework.util.StringUtils.hasText(province)) {
|
||||
return province;
|
||||
}
|
||||
|
||||
return "";
|
||||
if (!city.isEmpty()) return city;
|
||||
return province;
|
||||
} catch (Exception e) {
|
||||
log.warn("根据经纬度获取城市失败, latitude={}, longitude={}, err={}", latitude, longitude, e.getMessage());
|
||||
log.warn("根据经纬度获取地址失败, lat={}, lng={}, err={}", latitude, longitude, e.getMessage());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/** 高德对部分字段(直辖市的 city、无下级的乡镇)返回 [],统一收敛成 "" */
|
||||
private String _str(JSONObject o, String key) {
|
||||
Object v = o.get(key);
|
||||
if (v == null) return "";
|
||||
if (v instanceof java.util.List && ((java.util.List<?>) v).isEmpty()) return "";
|
||||
return v.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,5 +50,28 @@
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>2.0.29</version>
|
||||
</dependency>
|
||||
<!-- 二维码识别(发票二维码兜底) -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
<!-- 本地 OCR(Tesseract JNA 绑定):仅在 PDF 没有文本层且二维码不可读时启用 -->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.tess4j</groupId>
|
||||
<artifactId>tess4j</artifactId>
|
||||
<version>5.11.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -6,9 +6,12 @@ import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.hrm.domain.bo.HrmAppropriationReqBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmAppropriationReqVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmInvoiceOcrResultVo;
|
||||
import com.ruoyi.hrm.service.IHrmAppropriationReqService;
|
||||
import com.ruoyi.hrm.service.IHrmInvoiceOcrService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -28,9 +31,11 @@ import java.util.List;
|
||||
public class HrmAppropriationReqController extends BaseController {
|
||||
|
||||
private final IHrmAppropriationReqService service;
|
||||
private final IHrmInvoiceOcrService invoiceOcrService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HrmAppropriationReqVo> list(HrmAppropriationReqBo bo, PageQuery pageQuery) {
|
||||
bo.setCreateBy(LoginHelper.getUsername());
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@@ -59,7 +64,13 @@ public class HrmAppropriationReqController extends BaseController {
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<List<HrmAppropriationReqVo>> all(HrmAppropriationReqBo bo) {
|
||||
bo.setCreateBy(String.valueOf(LoginHelper.getUserId()));
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
|
||||
@PostMapping("/ocr-by-oss")
|
||||
public R<HrmInvoiceOcrResultVo> ocrByOss(@RequestParam @NotNull Long ossId) {
|
||||
return R.ok(invoiceOcrService.recognizeByOssId(ossId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.ruoyi.hrm.controller;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.hrm.domain.bo.HrmEmergencyContactBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmEmergencyContactImportVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmEmergencyContactVo;
|
||||
import com.ruoyi.hrm.service.IHrmEmergencyContactService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/hrm/emergencyContact")
|
||||
public class HrmEmergencyContactController extends BaseController {
|
||||
|
||||
private final IHrmEmergencyContactService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HrmEmergencyContactVo> list(HrmEmergencyContactBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{contactId}")
|
||||
public R<HrmEmergencyContactVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long contactId) {
|
||||
return R.ok(service.queryById(contactId));
|
||||
}
|
||||
|
||||
@Log(title = "紧急联系人管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody HrmEmergencyContactBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "紧急联系人管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody HrmEmergencyContactBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "紧急联系人管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{contactIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] contactIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(contactIds), true));
|
||||
}
|
||||
|
||||
@Log(title = "紧急联系人管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HrmEmergencyContactBo bo, HttpServletResponse response) {
|
||||
List<HrmEmergencyContactVo> list = service.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "紧急联系人数据", HrmEmergencyContactVo.class, response);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<String> importData(@RequestPart("file") MultipartFile file, @RequestParam(defaultValue = "false") boolean updateSupport) throws IOException {
|
||||
List<HrmEmergencyContactImportVo> list = ExcelUtil.importExcel(file.getInputStream(), HrmEmergencyContactImportVo.class, false).getList();
|
||||
String msg = service.importByVoList(list, updateSupport);
|
||||
return R.ok(msg);
|
||||
}
|
||||
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) throws IOException {
|
||||
// 设置响应头
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = URLEncoder.encode("紧急联系人导入模板", "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
|
||||
// 示例数据(字段名第一行,示例数据第二行)
|
||||
List<HrmEmergencyContactImportVo> exampleList = new ArrayList<>();
|
||||
|
||||
// 添加示例数据
|
||||
HrmEmergencyContactImportVo example = new HrmEmergencyContactImportVo();
|
||||
example.setHireDate("2025.06.18");
|
||||
example.setCompanyName("山东福安德信息科技有限公司");
|
||||
example.setDeptName("信息化部");
|
||||
example.setRealName("张三");
|
||||
example.setPhone("183xxxxxxxx");
|
||||
example.setIdCard("341xxxxxxxxxxxxxxx");
|
||||
example.setGender("男");
|
||||
example.setAge(23);
|
||||
example.setEmergencyContact("李四");
|
||||
example.setRelationship("母子");
|
||||
example.setEmergencyPhone1("159xxxxxxxx");
|
||||
example.setEmergencyPhone2("");
|
||||
example.setEmergencyAddress("xx省xx市xx县xx镇xx村");
|
||||
example.setRemark("仅紧急情况联系");
|
||||
exampleList.add(example);
|
||||
|
||||
// 使用EasyExcel写入(字段名在第一行,示例数据在第二行)
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
EasyExcel.write(out, HrmEmergencyContactImportVo.class)
|
||||
.sheet("导入模板")
|
||||
.doWrite(exampleList);
|
||||
out.flush();
|
||||
}
|
||||
}
|
||||
@@ -64,11 +64,9 @@ public class HrmEmployeeController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/byUserId/{userId}")
|
||||
public R<HrmEmployeeVo> getByUserId(@PathVariable @NotNull Long userId) {
|
||||
HrmEmployeeBo bo = new HrmEmployeeBo();
|
||||
bo.setUserId(userId);
|
||||
List<HrmEmployeeVo> list = service.queryList(bo);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
return R.ok(list.get(0));
|
||||
HrmEmployeeVo vo = service.queryByUserId(userId);
|
||||
if (vo != null) {
|
||||
return R.ok(vo);
|
||||
}
|
||||
return R.fail("未找到该用户对应的员工信息");
|
||||
}
|
||||
|
||||
@@ -66,7 +66,14 @@ public class HrmFlowCcController extends BaseController {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
return toAjax(service.markRead(ccId, userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记抄送未读(新增)
|
||||
*/
|
||||
@PostMapping("/{ccId}/unread")
|
||||
public R<Void> unread(@PathVariable Long ccId) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
return toAjax(service.markUnread(ccId, userId));
|
||||
}
|
||||
@GetMapping("/ping")
|
||||
public R<String> ping(@RequestParam @NotNull String x) {
|
||||
return R.ok(x);
|
||||
|
||||
@@ -56,6 +56,16 @@ public class HrmFlowTaskController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情页使用:按 bizType + bizId 查询审批概要、当前待办和历史记录
|
||||
*/
|
||||
@GetMapping("/detailByBiz")
|
||||
public R<?> detailByBiz(@RequestParam @NotNull String bizType,
|
||||
@RequestParam @NotNull Long bizId,
|
||||
@RequestParam(required = false) Long assigneeUserId) {
|
||||
return R.ok(service.queryDetailByBiz(bizType, bizId, assigneeUserId));
|
||||
}
|
||||
|
||||
@GetMapping("/{taskId}")
|
||||
public R<HrmFlowTaskVo> getInfo(@PathVariable @NotNull Long taskId) {
|
||||
return R.ok(service.queryById(taskId));
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.hrm.domain.HrmLeaveReq;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.hrm.domain.bo.HrmLeaveReqBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmLeaveReqVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmLeaveStatsVo;
|
||||
@@ -30,6 +30,7 @@ public class HrmLeaveReqController extends BaseController {
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HrmLeaveReqVo> list(HrmLeaveReqBo bo, PageQuery pageQuery) {
|
||||
bo.setCreateBy(LoginHelper.getUsername());
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@@ -58,6 +59,7 @@ public class HrmLeaveReqController extends BaseController {
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<List<HrmLeaveReqVo>> all(HrmLeaveReqBo bo) {
|
||||
bo.setCreateBy(LoginHelper.getUsername());
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
package com.ruoyi.hrm.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.hrm.domain.HrmEmployee;
|
||||
import com.ruoyi.hrm.domain.bo.HrmAppropriationReqBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmLeaveReqBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmReimburseReqBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmSealReqBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmTravelReqBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmAppropriationReqVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmLeaveReqVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmMyApplyVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmReimburseReqVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmSealReqVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmTravelReqVo;
|
||||
import com.ruoyi.hrm.domain.HrmFlowInstance;
|
||||
import com.ruoyi.hrm.mapper.HrmAppropriationReqMapper;
|
||||
import com.ruoyi.hrm.mapper.HrmEmployeeMapper;
|
||||
import com.ruoyi.hrm.mapper.HrmFlowInstanceMapper;
|
||||
import com.ruoyi.hrm.mapper.HrmLeaveReqMapper;
|
||||
import com.ruoyi.hrm.mapper.HrmReimburseReqMapper;
|
||||
import com.ruoyi.hrm.mapper.HrmSealReqMapper;
|
||||
import com.ruoyi.hrm.mapper.HrmTravelReqMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/hrm/my-apply")
|
||||
public class HrmMyApplyController extends BaseController {
|
||||
|
||||
private final HrmEmployeeMapper employeeMapper;
|
||||
private final SysUserMapper sysUserMapper;
|
||||
private final HrmLeaveReqMapper leaveReqMapper;
|
||||
private final HrmTravelReqMapper travelReqMapper;
|
||||
private final HrmSealReqMapper sealReqMapper;
|
||||
private final HrmReimburseReqMapper reimburseReqMapper;
|
||||
private final HrmAppropriationReqMapper appropriationReqMapper;
|
||||
private final HrmFlowInstanceMapper flowInstanceMapper;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HrmMyApplyVo> list(String bizType, String status, String keyword, PageQuery pageQuery) {
|
||||
Long currentUserId = LoginHelper.getUserId();
|
||||
if (currentUserId == null) {
|
||||
return TableDataInfo.build();
|
||||
}
|
||||
HrmEmployee emp = employeeMapper.selectOne(new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<HrmEmployee>()
|
||||
.eq(HrmEmployee::getUserId, currentUserId));
|
||||
if (emp == null) {
|
||||
return TableDataInfo.build();
|
||||
}
|
||||
SysUser sysUser = sysUserMapper.selectUserById(emp.getUserId());
|
||||
String nickName = sysUser != null ? sysUser.getNickName() : null;
|
||||
|
||||
List<HrmMyApplyVo> all = new ArrayList<>();
|
||||
if (bizType == null || bizType.isEmpty() || "leave".equals(bizType)) {
|
||||
all.addAll(mapLeave(leaveReqMapper.selectVoWithProjectList(buildLeaveBo(emp.getEmpId(), status)), nickName));
|
||||
}
|
||||
if (bizType == null || bizType.isEmpty() || "travel".equals(bizType)) {
|
||||
all.addAll(mapTravel(travelReqMapper.selectVoWithProjectList(buildTravelBo(emp.getEmpId(), status)), nickName));
|
||||
}
|
||||
if (bizType == null || bizType.isEmpty() || "seal".equals(bizType)) {
|
||||
all.addAll(mapSeal(sealReqMapper.selectVoWithProjectList(buildSealBo(emp.getEmpId(), status)), nickName));
|
||||
}
|
||||
if (bizType == null || bizType.isEmpty() || "reimburse".equals(bizType)) {
|
||||
all.addAll(mapReimburse(reimburseReqMapper.selectVoWithProjectList(buildReimburseBo(emp.getEmpId(), status)), nickName));
|
||||
}
|
||||
if (bizType == null || bizType.isEmpty() || "appropriation".equals(bizType)) {
|
||||
all.addAll(mapAppropriation(appropriationReqMapper.selectVoWithProjectList(buildAppropriationBo(emp.getEmpId(), status)), nickName));
|
||||
}
|
||||
|
||||
// 用流程实例状态覆盖业务表状态,避免历史数据状态未同步
|
||||
overrideStatusByFlowInstance(all);
|
||||
|
||||
if (keyword != null && !keyword.isEmpty()) {
|
||||
String lower = keyword.toLowerCase();
|
||||
all = all.stream().filter(v -> contains(v, lower)).collect(Collectors.toList());
|
||||
}
|
||||
all.sort(Comparator.comparing(HrmMyApplyVo::getCreateTime, Comparator.nullsLast(Comparator.naturalOrder())).reversed());
|
||||
|
||||
long start = (pageQuery.getPageNum() - 1L) * pageQuery.getPageSize();
|
||||
long end = Math.min(start + pageQuery.getPageSize(), all.size());
|
||||
Page<HrmMyApplyVo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize(), all.size());
|
||||
page.setRecords(start >= all.size() ? new ArrayList<>() : all.subList((int) start, (int) end));
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
private void overrideStatusByFlowInstance(List<HrmMyApplyVo> all) {
|
||||
if (all == null || all.isEmpty()) return;
|
||||
Map<String, List<Long>> bizIdsByType = all.stream()
|
||||
.filter(v -> v.getBizType() != null && v.getBizId() != null)
|
||||
.collect(Collectors.groupingBy(
|
||||
HrmMyApplyVo::getBizType,
|
||||
Collectors.mapping(HrmMyApplyVo::getBizId, Collectors.toList())
|
||||
));
|
||||
Map<String, String> statusByKey = new HashMap<>();
|
||||
bizIdsByType.forEach((bizType, bizIds) -> {
|
||||
if (bizIds.isEmpty()) return;
|
||||
List<HrmFlowInstance> insts = flowInstanceMapper.selectList(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<HrmFlowInstance>()
|
||||
.eq(HrmFlowInstance::getBizType, bizType)
|
||||
.in(HrmFlowInstance::getBizId, bizIds)
|
||||
);
|
||||
for (HrmFlowInstance inst : insts) {
|
||||
if (inst.getStatus() == null) continue;
|
||||
// 合并多个流程实例:优先终态 (approved/rejected/withdrawn) > 进行中 (running/pending),
|
||||
// 否则前面遗留的"running"会盖掉新的"approved",导致前端永远显示审批中
|
||||
statusByKey.merge(bizType + "_" + inst.getBizId(), inst.getStatus(),
|
||||
(oldS, newS) -> _statusPriority(newS) > _statusPriority(oldS) ? newS : oldS);
|
||||
}
|
||||
});
|
||||
for (HrmMyApplyVo v : all) {
|
||||
String s = statusByKey.get(v.getBizType() + "_" + v.getBizId());
|
||||
if (s != null) v.setStatus(s);
|
||||
}
|
||||
}
|
||||
|
||||
private int _statusPriority(String s) {
|
||||
if (s == null) return 0;
|
||||
switch (s) {
|
||||
case "approved":
|
||||
case "done":
|
||||
return 3;
|
||||
case "rejected":
|
||||
case "withdrawn":
|
||||
return 2;
|
||||
case "running":
|
||||
case "pending":
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean contains(HrmMyApplyVo v, String lower) {
|
||||
return Objects.toString(v.getTitle(), "").toLowerCase().contains(lower)
|
||||
|| Objects.toString(v.getRemark(), "").toLowerCase().contains(lower)
|
||||
|| Objects.toString(v.getNickName(), "").toLowerCase().contains(lower)
|
||||
|| Objects.toString(v.getEmpName(), "").toLowerCase().contains(lower)
|
||||
|| Objects.toString(v.getBizId(), "").contains(lower);
|
||||
}
|
||||
|
||||
private HrmLeaveReqBo buildLeaveBo(Long empId, String status) { HrmLeaveReqBo bo = new HrmLeaveReqBo(); bo.setEmpId(empId); bo.setStatus(status); return bo; }
|
||||
private HrmTravelReqBo buildTravelBo(Long empId, String status) { HrmTravelReqBo bo = new HrmTravelReqBo(); bo.setEmpId(empId); bo.setStatus(status); return bo; }
|
||||
private HrmSealReqBo buildSealBo(Long empId, String status) { HrmSealReqBo bo = new HrmSealReqBo(); bo.setEmpId(empId); bo.setStatus(status); return bo; }
|
||||
private HrmReimburseReqBo buildReimburseBo(Long empId, String status) { HrmReimburseReqBo bo = new HrmReimburseReqBo(); bo.setEmpId(empId); bo.setStatus(status); return bo; }
|
||||
private HrmAppropriationReqBo buildAppropriationBo(Long empId, String status) { HrmAppropriationReqBo bo = new HrmAppropriationReqBo(); bo.setEmpId(empId); bo.setStatus(status); return bo; }
|
||||
|
||||
private List<HrmMyApplyVo> mapLeave(List<HrmLeaveReqVo> list, String nickName) { return list.stream().map(v -> toVo("leave", v.getBizId(), v.getEmpId(), nickName, v.getReason(), v.getStatus(), v.getCreateTime(), v)).collect(Collectors.toList()); }
|
||||
private List<HrmMyApplyVo> mapTravel(List<HrmTravelReqVo> list, String nickName) { return list.stream().map(v -> toVo("travel", v.getBizId(), v.getEmpId(), nickName, v.getReason(), v.getStatus(), v.getCreateTime(), v)).collect(Collectors.toList()); }
|
||||
private List<HrmMyApplyVo> mapSeal(List<HrmSealReqVo> list, String nickName) { return list.stream().map(v -> toVo("seal", v.getBizId(), v.getEmpId(), nickName, v.getPurpose() != null ? v.getPurpose() : v.getRemark(), v.getStatus(), v.getCreateTime(), v)).collect(Collectors.toList()); }
|
||||
private List<HrmMyApplyVo> mapReimburse(List<HrmReimburseReqVo> list, String nickName) { return list.stream().map(v -> toVo("reimburse", v.getBizId(), v.getEmpId(), nickName, v.getReason(), v.getStatus(), v.getCreateTime(), v)).collect(Collectors.toList()); }
|
||||
private List<HrmMyApplyVo> mapAppropriation(List<HrmAppropriationReqVo> list, String nickName) { return list.stream().map(v -> toVo("appropriation", v.getBizId(), v.getEmpId(), nickName, v.getReason(), v.getStatus(), v.getCreateTime(), v)).collect(Collectors.toList()); }
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private HrmMyApplyVo toVo(String bizType, Long bizId, Long empId, String nickName, String title, String status, java.util.Date createTime, Object source) {
|
||||
HrmMyApplyVo vo = new HrmMyApplyVo();
|
||||
vo.setBizType(bizType);
|
||||
vo.setBizId(bizId);
|
||||
vo.setEmpId(empId);
|
||||
vo.setNickName(nickName);
|
||||
vo.setTitle(title);
|
||||
vo.setStatus(status);
|
||||
vo.setCreateTime(createTime);
|
||||
if (source != null) {
|
||||
vo.setBizData(objectMapper.convertValue(source, Map.class));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,11 @@ import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.hrm.domain.bo.HrmReimburseReqBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmInvoiceOcrResultVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmReimburseReqVo;
|
||||
import com.ruoyi.hrm.service.IHrmInvoiceOcrService;
|
||||
import com.ruoyi.hrm.service.IHrmReimburseReqService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -28,9 +31,11 @@ import java.util.List;
|
||||
public class HrmReimburseReqController extends BaseController {
|
||||
|
||||
private final IHrmReimburseReqService service;
|
||||
private final IHrmInvoiceOcrService invoiceOcrService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HrmReimburseReqVo> list(HrmReimburseReqBo bo, PageQuery pageQuery) {
|
||||
bo.setCreateBy(LoginHelper.getUsername());
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@@ -59,7 +64,13 @@ public class HrmReimburseReqController extends BaseController {
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<List<HrmReimburseReqVo>> all(HrmReimburseReqBo bo) {
|
||||
bo.setCreateBy(LoginHelper.getUsername());
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
|
||||
@PostMapping("/ocr-by-oss")
|
||||
public R<HrmInvoiceOcrResultVo> ocrByOss(@RequestParam @NotNull Long ossId) {
|
||||
return R.ok(invoiceOcrService.recognizeByOssId(ossId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.hrm.domain.bo.HrmSealReqBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmSealStampBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmSealReqVo;
|
||||
@@ -32,6 +33,7 @@ public class HrmSealReqController extends BaseController {
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HrmSealReqVo> list(HrmSealReqBo bo, PageQuery pageQuery) {
|
||||
bo.setCreateBy(LoginHelper.getUsername());
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@@ -40,6 +42,11 @@ public class HrmSealReqController extends BaseController {
|
||||
return R.ok(service.queryById(bizId));
|
||||
}
|
||||
|
||||
@GetMapping("/{bizId}/pdfPages")
|
||||
public R<Integer> pdfPages(@PathVariable @NotNull Long bizId) {
|
||||
return R.ok(service.queryPdfPageTotal(bizId));
|
||||
}
|
||||
|
||||
@Log(title = "用印申请", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<HrmSealReqVo> add(@Validated @RequestBody HrmSealReqBo bo) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.ruoyi.hrm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.AjaxResult;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.hrm.domain.bo.HrmTravelReqBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmTravelReqVo;
|
||||
import com.ruoyi.hrm.service.IHrmTravelReqService;
|
||||
@@ -40,6 +40,7 @@ public class HrmTravelReqController extends BaseController {
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HrmTravelReqVo> list(HrmTravelReqBo bo, PageQuery pageQuery) {
|
||||
bo.setCreateBy(LoginHelper.getUsername());
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@@ -82,6 +83,7 @@ public class HrmTravelReqController extends BaseController {
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<List<HrmTravelReqVo>> all(HrmTravelReqBo bo) {
|
||||
bo.setCreateBy(LoginHelper.getUsername());
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.ruoyi.hrm.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("hrm_emergency_contact")
|
||||
public class HrmEmergencyContact extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long contactId;
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
private String realName;
|
||||
private String phone;
|
||||
private String idCard;
|
||||
private String gender;
|
||||
private Integer age;
|
||||
private String companyName;
|
||||
private Date hireDate;
|
||||
private String emergencyContact;
|
||||
private String relationship;
|
||||
private String emergencyPhone1;
|
||||
private String emergencyPhone2;
|
||||
private String emergencyAddress;
|
||||
private String remark;
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -7,12 +7,11 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("hrm_flow_action")
|
||||
public class HrmFlowAction extends BaseEntity implements Serializable {
|
||||
public class HrmFlowAction extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.hrm.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 发票条目子表(报销单/拨款单共用)
|
||||
*/
|
||||
@Data
|
||||
@TableName("hrm_invoice_item")
|
||||
public class HrmInvoiceItem {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/** 业务类型 reimburse / appropriation */
|
||||
private String bizType;
|
||||
|
||||
/** 关联业务单ID */
|
||||
private Long bizId;
|
||||
|
||||
/** 来源附件ossId */
|
||||
private Long ossId;
|
||||
|
||||
/** 排序序号 */
|
||||
private Integer sortNo;
|
||||
|
||||
/** OCR识别项目名称 */
|
||||
private String itemName;
|
||||
|
||||
/** 事由说明(用户可编辑) */
|
||||
private String reason;
|
||||
|
||||
/** 金额 */
|
||||
private BigDecimal amount;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用印申请
|
||||
@@ -15,7 +14,7 @@ import java.io.Serializable;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("hrm_seal_req")
|
||||
public class HrmSealReq extends BaseEntity implements Serializable {
|
||||
public class HrmSealReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -29,7 +28,7 @@ public class HrmSealReq extends BaseEntity implements Serializable {
|
||||
/** 项目ID */
|
||||
private Long projectId;
|
||||
|
||||
/** 用印类型(公章/合同章/财务章等) */
|
||||
/** 用印类型(对应印章文件名) */
|
||||
private String sealType;
|
||||
|
||||
/** 用途说明 */
|
||||
|
||||
@@ -6,6 +6,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 拨款申请 Bo
|
||||
@@ -59,5 +60,8 @@ public class HrmAppropriationReqBo extends BaseEntity {
|
||||
private String remark;
|
||||
|
||||
private Long tplId;
|
||||
|
||||
/** 发票条目列表(前端提交时携带) */
|
||||
private List<HrmInvoiceItemBo> invoiceItems;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.ruoyi.hrm.domain.bo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class HrmEmergencyContactBo extends BaseEntity {
|
||||
|
||||
private Long contactId;
|
||||
|
||||
@NotNull(message = "用户ID不能为空")
|
||||
private Long userId;
|
||||
|
||||
private Long deptId;
|
||||
private String realName;
|
||||
private String phone;
|
||||
private String idCard;
|
||||
private String gender;
|
||||
private Integer age;
|
||||
private String companyName;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date hireDate;
|
||||
|
||||
@NotBlank(message = "紧急联系人姓名不能为空")
|
||||
private String emergencyContact;
|
||||
|
||||
private String relationship;
|
||||
|
||||
@NotBlank(message = "紧急联系人电话1不能为空")
|
||||
private String emergencyPhone1;
|
||||
|
||||
private String emergencyPhone2;
|
||||
private String emergencyAddress;
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ruoyi.hrm.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 发票条目 BO(用于表单提交)
|
||||
*/
|
||||
@Data
|
||||
public class HrmInvoiceItemBo {
|
||||
|
||||
/** 来源附件ossId */
|
||||
private Long ossId;
|
||||
|
||||
/** 排序序号 */
|
||||
private Integer sortNo;
|
||||
|
||||
/** OCR识别项目名称 */
|
||||
private String itemName;
|
||||
|
||||
/** 事由说明 */
|
||||
private String reason;
|
||||
|
||||
/** 金额 */
|
||||
private BigDecimal amount;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -39,5 +40,8 @@ public class HrmReimburseReqBo extends BaseEntity {
|
||||
private String remark;
|
||||
|
||||
private Long tplId;
|
||||
|
||||
/** 发票条目列表(前端提交时携带) */
|
||||
private List<HrmInvoiceItemBo> invoiceItems;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class HrmSealReqBo extends BaseEntity {
|
||||
/** 项目ID */
|
||||
private Long projectId;
|
||||
|
||||
/** 用印类型 */
|
||||
/** 用印类型(对应印章文件名) */
|
||||
@NotBlank(message = "用印类型不能为空")
|
||||
private String sealType;
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.ruoyi.hrm.domain.HrmInvoiceItem;
|
||||
|
||||
/**
|
||||
* 拨款申请 VO
|
||||
@@ -108,5 +110,7 @@ public class HrmAppropriationReqVo implements Serializable {
|
||||
|
||||
/** 流程实例ID */
|
||||
private Long instId;
|
||||
|
||||
private List<HrmInvoiceItem> invoiceItems;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.ruoyi.hrm.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentStyle;
|
||||
import com.alibaba.excel.annotation.write.style.HeadStyle;
|
||||
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 紧急联系人导入 VO
|
||||
* 与用户提供的Excel格式保持一致
|
||||
*
|
||||
* Excel表头顺序:
|
||||
* 入职时间 | 公司名称 | 部门 | 姓名 | 联系电话 | 身份证号 | 性别 | 年龄 | 紧急联系人 | 与本人关系 | 联系电话1 | 联系电话2 | 紧急联系人地址 | 备注
|
||||
*/
|
||||
@Data
|
||||
@HeadStyle(fillForegroundColor = 44, horizontalAlignment = HorizontalAlignmentEnum.CENTER)
|
||||
@ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.LEFT)
|
||||
public class HrmEmergencyContactImportVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 入职时间
|
||||
* 格式:yyyy.MM.dd 或 yyyy-MM-dd
|
||||
*/
|
||||
@Excel(name = "入职时间", width = 12)
|
||||
@ExcelProperty("入职时间")
|
||||
@ColumnWidth(12)
|
||||
private String hireDate;
|
||||
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
@Excel(name = "公司名称", width = 40)
|
||||
@ExcelProperty("公司名称")
|
||||
@ColumnWidth(40)
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
@Excel(name = "部门", width = 12)
|
||||
@ExcelProperty("部门")
|
||||
@ColumnWidth(12)
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Excel(name = "姓名", width = 10)
|
||||
@ExcelProperty("姓名")
|
||||
@ColumnWidth(10)
|
||||
private String realName;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Excel(name = "联系电话", width = 15)
|
||||
@ExcelProperty("联系电话")
|
||||
@ColumnWidth(15)
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@Excel(name = "身份证号", width = 22)
|
||||
@ExcelProperty("身份证号")
|
||||
@ColumnWidth(22)
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@Excel(name = "性别", width = 8, readConverterExp = "男=0,女=1,未知=2")
|
||||
@ExcelProperty("性别")
|
||||
@ColumnWidth(8)
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@Excel(name = "年龄", width = 8)
|
||||
@ExcelProperty("年龄")
|
||||
@ColumnWidth(8)
|
||||
private Integer age;
|
||||
|
||||
/**
|
||||
* 紧急联系人
|
||||
*/
|
||||
@Excel(name = "紧急联系人", width = 12)
|
||||
@ExcelProperty("紧急联系人")
|
||||
@ColumnWidth(12)
|
||||
private String emergencyContact;
|
||||
|
||||
/**
|
||||
* 与本人关系
|
||||
*/
|
||||
@Excel(name = "与本人关系", width = 12)
|
||||
@ExcelProperty("与本人关系")
|
||||
@ColumnWidth(12)
|
||||
private String relationship;
|
||||
|
||||
/**
|
||||
* 联系电话1
|
||||
*/
|
||||
@Excel(name = "联系电话1", width = 15)
|
||||
@ExcelProperty("联系电话1")
|
||||
@ColumnWidth(15)
|
||||
private String emergencyPhone1;
|
||||
|
||||
/**
|
||||
* 联系电话2
|
||||
*/
|
||||
@Excel(name = "联系电话2", width = 15)
|
||||
@ExcelProperty("联系电话2")
|
||||
@ColumnWidth(15)
|
||||
private String emergencyPhone2;
|
||||
|
||||
/**
|
||||
* 紧急联系人地址
|
||||
*/
|
||||
@Excel(name = "紧急联系人地址", width = 40)
|
||||
@ExcelProperty("紧急联系人地址")
|
||||
@ColumnWidth(40)
|
||||
private String emergencyAddress;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注", width = 20)
|
||||
@ExcelProperty("备注")
|
||||
@ColumnWidth(20)
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.ruoyi.hrm.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class HrmEmergencyContactVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "联系人ID")
|
||||
private Long contactId;
|
||||
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Excel(name = "部门ID")
|
||||
private Long deptId;
|
||||
|
||||
@Excel(name = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Excel(name = "姓名")
|
||||
private String realName;
|
||||
|
||||
@Excel(name = "联系电话")
|
||||
private String phone;
|
||||
|
||||
@Excel(name = "身份证号")
|
||||
private String idCard;
|
||||
|
||||
@Excel(name = "性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String gender;
|
||||
|
||||
@Excel(name = "年龄")
|
||||
private Integer age;
|
||||
|
||||
@Excel(name = "公司名称")
|
||||
private String companyName;
|
||||
|
||||
@Excel(name = "入职时间", width = 20, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date hireDate;
|
||||
|
||||
@Excel(name = "紧急联系人")
|
||||
private String emergencyContact;
|
||||
|
||||
@Excel(name = "与本人关系")
|
||||
private String relationship;
|
||||
|
||||
@Excel(name = "紧急电话1")
|
||||
private String emergencyPhone1;
|
||||
|
||||
@Excel(name = "紧急电话2")
|
||||
private String emergencyPhone2;
|
||||
|
||||
@Excel(name = "紧急联系人地址")
|
||||
private String emergencyAddress;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
private String createBy;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.hrm.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class HrmFlowActionTimelineVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long actionId;
|
||||
private Long taskId;
|
||||
private Long instId;
|
||||
private Long actionUserId;
|
||||
private String actionUserName;
|
||||
private Long assigneeUserId;
|
||||
private String assigneeUserName;
|
||||
private String action;
|
||||
private String actionText;
|
||||
private String remark;
|
||||
private String bizType;
|
||||
private Long bizId;
|
||||
private Long nodeId;
|
||||
private String nodeName;
|
||||
private String taskStatus;
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class HrmFlowInstanceVo implements Serializable {
|
||||
@@ -34,9 +35,14 @@ public class HrmFlowInstanceVo implements Serializable {
|
||||
private Date endTime;
|
||||
private BigDecimal hours;
|
||||
private String procStatus;
|
||||
private Date actualEndTime;
|
||||
private String statusName;
|
||||
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
private Date updateTime;
|
||||
|
||||
/** 业务表回填的数据,用于列表关键信息展示 */
|
||||
private Map<String, Object> bizData;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ruoyi.hrm.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HrmFlowTaskDetailVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 当前业务对应的待办任务 */
|
||||
private HrmFlowTaskVo currentTask;
|
||||
|
||||
/** 当前业务对应的全部任务历史 */
|
||||
private List<HrmFlowTaskVo> taskHistory;
|
||||
|
||||
/** 当前流程实例状态 */
|
||||
private String flowStatus;
|
||||
|
||||
/** 当前节点ID */
|
||||
private Long currentNodeId;
|
||||
|
||||
/** 当前节点名称 */
|
||||
private String currentNodeName;
|
||||
|
||||
/** 审批是否通过 */
|
||||
private Boolean approved;
|
||||
|
||||
/** 流程动作历史(更细粒度) */
|
||||
private List<HrmFlowActionTimelineVo> actionTimeline;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.hrm.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单张发票OCR识别结果(返回给前端用于填充发票条目)
|
||||
*/
|
||||
@Data
|
||||
public class HrmInvoiceOcrResultVo {
|
||||
|
||||
/** 发票类型 */
|
||||
private String invoiceType;
|
||||
|
||||
/** 销售方名称 */
|
||||
private String sellerName;
|
||||
|
||||
/** 开票日期 */
|
||||
private String invoiceDate;
|
||||
|
||||
/** 价税合计 */
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/** 识别出的条目列表 */
|
||||
private List<Item> items;
|
||||
|
||||
@Data
|
||||
public static class Item {
|
||||
/** OCR识别名称 */
|
||||
private String itemName;
|
||||
/** 金额(不含税) */
|
||||
private BigDecimal amount;
|
||||
/** 税率 */
|
||||
private String taxRate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.hrm.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class HrmMyApplyVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String bizType;
|
||||
private Long bizId;
|
||||
private Long empId;
|
||||
private String empName;
|
||||
private Long userId;
|
||||
private String nickName;
|
||||
private String title;
|
||||
private String status;
|
||||
private Date createTime;
|
||||
private Date endTime;
|
||||
private Date actualEndTime;
|
||||
private String remark;
|
||||
private Map<String, Object> bizData;
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.ruoyi.hrm.domain.HrmInvoiceItem;
|
||||
|
||||
@Data
|
||||
public class HrmReimburseReqVo implements Serializable {
|
||||
@@ -95,5 +97,7 @@ public class HrmReimburseReqVo implements Serializable {
|
||||
private Date updateTime;
|
||||
|
||||
private Long instId;
|
||||
|
||||
private List<HrmInvoiceItem> invoiceItems;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,9 @@ public class HrmSealReqVo implements Serializable {
|
||||
@Excel(name = "回执附件ID列表")
|
||||
private String receiptFileIds;
|
||||
|
||||
@Excel(name = "PDF页数")
|
||||
private Integer pdfPageTotal;
|
||||
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ public class HrmTravelReqVo implements Serializable {
|
||||
private String bankAccount;
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
private Date actualEndTime;
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.hrm.event;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 申请提交后产生的事件:通知监听方(如 IM 推送)给当前待办的审批人发提醒。
|
||||
* 由 fad-hrm 发布,ruoyi-oa 监听后调 ImSendService 推送。
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class ApprovalRequestedEvent {
|
||||
/** 业务类型:seal / leave / travel / reimburse / appropriation */
|
||||
private final String bizType;
|
||||
/** 业务主键 */
|
||||
private final Long bizId;
|
||||
/** 流程实例ID */
|
||||
private final Long instId;
|
||||
/** 待审批人 OA userId */
|
||||
private final Long assigneeUserId;
|
||||
/** 申请发起人 OA userId */
|
||||
private final Long startUserId;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ruoyi.hrm.mapper;
|
||||
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
import com.ruoyi.hrm.domain.HrmEmergencyContact;
|
||||
import com.ruoyi.hrm.domain.vo.HrmEmergencyContactVo;
|
||||
|
||||
public interface HrmEmergencyContactMapper extends BaseMapperPlus<HrmEmergencyContactMapper, HrmEmergencyContact, HrmEmergencyContactVo> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ruoyi.hrm.mapper;
|
||||
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
import com.ruoyi.hrm.domain.HrmInvoiceItem;
|
||||
|
||||
public interface HrmInvoiceItemMapper extends BaseMapperPlus<HrmInvoiceItemMapper, HrmInvoiceItem, HrmInvoiceItem> {
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ruoyi.hrm.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmEmergencyContactBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmEmergencyContactVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmEmergencyContactImportVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface IHrmEmergencyContactService {
|
||||
|
||||
HrmEmergencyContactVo queryById(Long contactId);
|
||||
|
||||
TableDataInfo<HrmEmergencyContactVo> queryPageList(HrmEmergencyContactBo bo, PageQuery pageQuery);
|
||||
|
||||
List<HrmEmergencyContactVo> queryList(HrmEmergencyContactBo bo);
|
||||
|
||||
Boolean insertByBo(HrmEmergencyContactBo bo);
|
||||
|
||||
Boolean updateByBo(HrmEmergencyContactBo bo);
|
||||
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
String importByVoList(List<HrmEmergencyContactImportVo> voList, boolean updateSupport);
|
||||
}
|
||||
@@ -15,6 +15,8 @@ public interface IHrmEmployeeService {
|
||||
|
||||
List<HrmEmployeeVo> queryList(HrmEmployeeBo bo);
|
||||
|
||||
HrmEmployeeVo queryByUserId(Long userId);
|
||||
|
||||
Boolean insertByBo(HrmEmployeeBo bo);
|
||||
|
||||
Boolean updateByBo(HrmEmployeeBo bo);
|
||||
|
||||
@@ -27,5 +27,9 @@ public interface IHrmFlowCcService {
|
||||
* 标记已读
|
||||
*/
|
||||
Boolean markRead(Long ccId, Long userId);
|
||||
/**
|
||||
* 标记未读
|
||||
*/
|
||||
Boolean markUnread(Long ccId, Long userId);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.ruoyi.hrm.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.hrm.domain.HrmFlowTask;
|
||||
import com.ruoyi.hrm.domain.bo.HrmFlowTaskBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmFlowTaskDetailVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmFlowTaskVo;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -51,4 +51,9 @@ public interface IHrmFlowTaskService {
|
||||
* 根据业务类型 + 业务ID 查询当前待办任务(pending),用于详情页自动带出 currentTaskId
|
||||
*/
|
||||
HrmFlowTaskVo queryTodoByBiz(String bizType, Long bizId, Long assigneeUserId);
|
||||
|
||||
/**
|
||||
* 按业务查询详情:当前待办、状态和历史审批记录
|
||||
*/
|
||||
HrmFlowTaskDetailVo queryDetailByBiz(String bizType, Long bizId, Long assigneeUserId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.hrm.service;
|
||||
|
||||
import com.ruoyi.hrm.domain.vo.HrmInvoiceOcrResultVo;
|
||||
|
||||
/**
|
||||
* 发票识别服务:本地解析电子发票 PDF。
|
||||
*/
|
||||
public interface IHrmInvoiceOcrService {
|
||||
|
||||
/** 根据 ossId 解析发票 PDF */
|
||||
HrmInvoiceOcrResultVo recognizeByOssId(Long ossId);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ruoyi.hrm.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmMyApplyVo;
|
||||
|
||||
public interface IHrmMyApplyService {
|
||||
TableDataInfo<HrmMyApplyVo> queryPageList(String bizType, String status, String keyword, PageQuery pageQuery);
|
||||
}
|
||||
@@ -13,6 +13,8 @@ public interface IHrmSealReqService {
|
||||
|
||||
HrmSealReqVo queryById(Long bizId);
|
||||
|
||||
Integer queryPdfPageTotal(Long bizId);
|
||||
|
||||
TableDataInfo<HrmSealReqVo> queryPageList(HrmSealReqBo bo, PageQuery pageQuery);
|
||||
|
||||
List<HrmSealReqVo> queryList(HrmSealReqBo bo);
|
||||
|
||||
@@ -9,11 +9,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.hrm.domain.HrmAppropriationReq;
|
||||
import com.ruoyi.hrm.domain.HrmFlowTemplate;
|
||||
import com.ruoyi.hrm.domain.HrmInvoiceItem;
|
||||
import com.ruoyi.hrm.domain.bo.HrmAppropriationReqBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmFlowStartBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmInvoiceItemBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmAppropriationReqVo;
|
||||
import com.ruoyi.hrm.mapper.HrmAppropriationReqMapper;
|
||||
import com.ruoyi.hrm.mapper.HrmFlowTemplateMapper;
|
||||
import com.ruoyi.hrm.mapper.HrmInvoiceItemMapper;
|
||||
import com.ruoyi.hrm.service.IHrmAppropriationReqService;
|
||||
import com.ruoyi.hrm.service.IHrmFlowInstanceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -33,10 +36,18 @@ public class HrmAppropriationReqServiceImpl implements IHrmAppropriationReqServi
|
||||
private final HrmAppropriationReqMapper baseMapper;
|
||||
private final HrmFlowTemplateMapper flowTemplateMapper;
|
||||
private final IHrmFlowInstanceService flowInstanceService;
|
||||
private final HrmInvoiceItemMapper invoiceItemMapper;
|
||||
|
||||
@Override
|
||||
public HrmAppropriationReqVo queryById(Long bizId) {
|
||||
return baseMapper.selectVoWithProjectById(bizId);
|
||||
HrmAppropriationReqVo vo = baseMapper.selectVoWithProjectById(bizId);
|
||||
if (vo != null) {
|
||||
vo.setInvoiceItems(invoiceItemMapper.selectList(Wrappers.<HrmInvoiceItem>lambdaQuery()
|
||||
.eq(HrmInvoiceItem::getBizType, "appropriation")
|
||||
.eq(HrmInvoiceItem::getBizId, bizId)
|
||||
.orderByAsc(HrmInvoiceItem::getSortNo)));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,6 +75,12 @@ public class HrmAppropriationReqServiceImpl implements IHrmAppropriationReqServi
|
||||
boolean ok = baseMapper.insert(add) > 0;
|
||||
|
||||
HrmAppropriationReqVo bean = BeanUtil.toBean(add, HrmAppropriationReqVo.class);
|
||||
|
||||
// 保存发票条目
|
||||
if (ok && bo.getInvoiceItems() != null && !bo.getInvoiceItems().isEmpty()) {
|
||||
saveInvoiceItems("appropriation", add.getBizId(), bo.getInvoiceItems());
|
||||
}
|
||||
|
||||
if (ok && "pending".equalsIgnoreCase(add.getStatus())) {
|
||||
// 获取流程启动人ID
|
||||
Long startUserId = LoginHelper.getUserId();
|
||||
@@ -108,7 +125,11 @@ public class HrmAppropriationReqServiceImpl implements IHrmAppropriationReqServi
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(HrmAppropriationReqBo bo) {
|
||||
HrmAppropriationReq update = BeanUtil.toBean(bo, HrmAppropriationReq.class);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
boolean updated = baseMapper.updateById(update) > 0;
|
||||
if (updated && bo.getInvoiceItems() != null) {
|
||||
saveInvoiceItems("appropriation", bo.getBizId(), bo.getInvoiceItems());
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,6 +146,24 @@ public class HrmAppropriationReqServiceImpl implements IHrmAppropriationReqServi
|
||||
return baseMapper.updateById(req) > 0;
|
||||
}
|
||||
|
||||
private void saveInvoiceItems(String bizType, Long bizId, List<HrmInvoiceItemBo> boList) {
|
||||
invoiceItemMapper.delete(Wrappers.<HrmInvoiceItem>lambdaQuery()
|
||||
.eq(HrmInvoiceItem::getBizType, bizType)
|
||||
.eq(HrmInvoiceItem::getBizId, bizId));
|
||||
for (int i = 0; i < boList.size(); i++) {
|
||||
HrmInvoiceItemBo bo = boList.get(i);
|
||||
HrmInvoiceItem item = new HrmInvoiceItem();
|
||||
item.setBizType(bizType);
|
||||
item.setBizId(bizId);
|
||||
item.setOssId(bo.getOssId());
|
||||
item.setSortNo(bo.getSortNo() != null ? bo.getSortNo() : i);
|
||||
item.setItemName(bo.getItemName());
|
||||
item.setReason(bo.getReason());
|
||||
item.setAmount(bo.getAmount());
|
||||
invoiceItemMapper.insert(item);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private LambdaQueryWrapper<HrmAppropriationReq> buildQueryWrapper(HrmAppropriationReqBo bo) {
|
||||
LambdaQueryWrapper<HrmAppropriationReq> lqw = Wrappers.lambdaQuery();
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
package com.ruoyi.hrm.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.hrm.domain.HrmEmergencyContact;
|
||||
import com.ruoyi.hrm.domain.bo.HrmEmergencyContactBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmEmergencyContactVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmEmergencyContactImportVo;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.hrm.mapper.HrmEmergencyContactMapper;
|
||||
import com.ruoyi.hrm.service.IHrmEmergencyContactService;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HrmEmergencyContactServiceImpl implements IHrmEmergencyContactService {
|
||||
|
||||
private final HrmEmergencyContactMapper baseMapper;
|
||||
private final SysUserMapper sysUserMapper;
|
||||
|
||||
// 手机号正则
|
||||
private static final Pattern PHONE_PATTERN = Pattern.compile("^1[3-9]\\d{9}$");
|
||||
// 身份证号正则(15位或18位)
|
||||
private static final Pattern ID_CARD_PATTERN = Pattern.compile("(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)");
|
||||
|
||||
@Override
|
||||
public HrmEmergencyContactVo queryById(Long contactId) {
|
||||
return baseMapper.selectVoById(contactId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<HrmEmergencyContactVo> queryPageList(HrmEmergencyContactBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<HrmEmergencyContact> lqw = buildQueryWrapper(bo);
|
||||
Page<HrmEmergencyContactVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HrmEmergencyContactVo> queryList(HrmEmergencyContactBo bo) {
|
||||
LambdaQueryWrapper<HrmEmergencyContact> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(HrmEmergencyContactBo bo) {
|
||||
HrmEmergencyContact add = BeanUtil.toBean(bo, HrmEmergencyContact.class);
|
||||
return baseMapper.insert(add) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(HrmEmergencyContactBo bo) {
|
||||
HrmEmergencyContact update = BeanUtil.toBean(bo, HrmEmergencyContact.class);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String importByVoList(List<HrmEmergencyContactImportVo> voList, boolean updateSupport) {
|
||||
if (CollUtil.isEmpty(voList)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
int successNum = 0;
|
||||
int failNum = 0;
|
||||
StringBuilder failMsg = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < voList.size(); i++) {
|
||||
HrmEmergencyContactImportVo vo = voList.get(i);
|
||||
int rowNum = i + 2;
|
||||
|
||||
try {
|
||||
// 转换日期格式:将 yyyy.MM.dd 转换为 yyyy-MM-dd
|
||||
Date hireDate = null;
|
||||
if (StrUtil.isNotBlank(vo.getHireDate())) {
|
||||
String dateStr = vo.getHireDate().replace(".", "-");
|
||||
vo.setHireDate(dateStr);
|
||||
hireDate = DateUtil.parseDate(dateStr);
|
||||
}
|
||||
|
||||
// 性别转换:Excel 中为"男"/"女"/"未知",统一转代码值
|
||||
String gender = vo.getGender();
|
||||
if (StrUtil.isNotBlank(gender)) {
|
||||
if ("男".equals(gender)) { gender = "0"; }
|
||||
else if ("女".equals(gender)) { gender = "1"; }
|
||||
else if ("未知".equals(gender)) { gender = "2"; }
|
||||
vo.setGender(gender);
|
||||
}
|
||||
|
||||
// 数据校验
|
||||
String validateMsg = validateImportData(vo);
|
||||
if (StrUtil.isNotBlank(validateMsg)) {
|
||||
failNum++;
|
||||
failMsg.append("<br/>").append(failNum).append("、第").append(rowNum).append("行 ")
|
||||
.append(StrUtil.blankToDefault(vo.getRealName(), "无名")).append(":").append(validateMsg);
|
||||
continue;
|
||||
}
|
||||
|
||||
HrmEmergencyContact entity = BeanUtil.toBean(vo, HrmEmergencyContact.class);
|
||||
// 根据姓名+身份证号匹配 sys_user,自动填充 userId/deptId
|
||||
Long matchedUserId = matchUserId(vo.getRealName(), vo.getIdCard());
|
||||
entity.setUserId(matchedUserId != null ? matchedUserId : 0L);
|
||||
// 显式设置入职日期(BeanUtil 可能无法自动转换 String -> Date)
|
||||
if (hireDate != null) {
|
||||
entity.setHireDate(hireDate);
|
||||
}
|
||||
|
||||
// 按「姓名 + 身份证号」去重
|
||||
LambdaQueryWrapper<HrmEmergencyContact> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(HrmEmergencyContact::getRealName, entity.getRealName());
|
||||
lqw.eq(HrmEmergencyContact::getIdCard, entity.getIdCard());
|
||||
HrmEmergencyContact existing = baseMapper.selectOne(lqw);
|
||||
|
||||
if (existing != null) {
|
||||
if (updateSupport) {
|
||||
entity.setContactId(existing.getContactId());
|
||||
baseMapper.updateById(entity);
|
||||
successNum++;
|
||||
} else {
|
||||
failNum++;
|
||||
failMsg.append("<br/>").append(failNum).append("、第").append(rowNum).append("行 ")
|
||||
.append(vo.getRealName()).append(":数据已存在(姓名+身份证号重复)");
|
||||
}
|
||||
} else {
|
||||
baseMapper.insert(entity);
|
||||
successNum++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failNum++;
|
||||
failMsg.append("<br/>").append(failNum).append("、第").append(rowNum).append("行 ")
|
||||
.append(StrUtil.blankToDefault(vo.getRealName(), "无名")).append(":导入失败,").append(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (failNum > 0) {
|
||||
return "导入完成!成功 " + successNum + " 条,失败 " + failNum + " 条。错误信息:" + failMsg;
|
||||
}
|
||||
return "恭喜您,数据已全部导入成功!共 " + successNum + " 条";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据姓名+身份证号匹配 sys_user,返回 userId;匹配不到返回 null
|
||||
*/
|
||||
private Long matchUserId(String realName, String idCard) {
|
||||
// 1. 优先按 realName + idCard 精确匹配
|
||||
if (StrUtil.isNotBlank(realName) && StrUtil.isNotBlank(idCard)) {
|
||||
SysUser user = sysUserMapper.selectOne(Wrappers.<SysUser>lambdaQuery()
|
||||
.eq(SysUser::getNickName, realName)
|
||||
.eq(SysUser::getIdCard, idCard)
|
||||
.last("limit 1"));
|
||||
if (user != null) {
|
||||
return user.getUserId();
|
||||
}
|
||||
}
|
||||
// 2. 仅按 idCard 匹配(唯一性高)
|
||||
if (StrUtil.isNotBlank(idCard)) {
|
||||
SysUser user = sysUserMapper.selectOne(Wrappers.<SysUser>lambdaQuery()
|
||||
.eq(SysUser::getIdCard, idCard)
|
||||
.last("limit 1"));
|
||||
if (user != null) {
|
||||
return user.getUserId();
|
||||
}
|
||||
}
|
||||
// 3. 仅按 realName 匹配(有重名风险,作为最后的兜底)
|
||||
if (StrUtil.isNotBlank(realName)) {
|
||||
SysUser user = sysUserMapper.selectOne(Wrappers.<SysUser>lambdaQuery()
|
||||
.eq(SysUser::getNickName, realName)
|
||||
.last("limit 1"));
|
||||
if (user != null) {
|
||||
return user.getUserId();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验导入数据
|
||||
*/
|
||||
private String validateImportData(HrmEmergencyContactImportVo vo) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
|
||||
if (StrUtil.isBlank(vo.getRealName())) {
|
||||
msg.append("姓名为空;");
|
||||
}
|
||||
if (StrUtil.isBlank(vo.getPhone())) {
|
||||
msg.append("联系电话为空;");
|
||||
} else if (!PHONE_PATTERN.matcher(vo.getPhone()).matches()) {
|
||||
msg.append("联系电话格式错误(需11位手机号);");
|
||||
}
|
||||
if (StrUtil.isBlank(vo.getIdCard())) {
|
||||
msg.append("身份证号为空;");
|
||||
} else if (!ID_CARD_PATTERN.matcher(vo.getIdCard()).matches()) {
|
||||
msg.append("身份证号格式错误;");
|
||||
}
|
||||
if (StrUtil.isBlank(vo.getGender())) {
|
||||
msg.append("性别为空;");
|
||||
}
|
||||
if (vo.getAge() == null) {
|
||||
msg.append("年龄为空;");
|
||||
}
|
||||
if (StrUtil.isBlank(vo.getEmergencyContact())) {
|
||||
msg.append("紧急联系人为空;");
|
||||
}
|
||||
if (StrUtil.isBlank(vo.getRelationship())) {
|
||||
msg.append("与本人关系为空;");
|
||||
}
|
||||
if (StrUtil.isBlank(vo.getEmergencyPhone1())) {
|
||||
msg.append("联系电话1为空;");
|
||||
} else if (!PHONE_PATTERN.matcher(vo.getEmergencyPhone1()).matches()) {
|
||||
msg.append("联系电话1格式错误(需11位手机号);");
|
||||
}
|
||||
if (StrUtil.isBlank(vo.getEmergencyAddress())) {
|
||||
msg.append("紧急联系人地址为空;");
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getEmergencyPhone2()) && !PHONE_PATTERN.matcher(vo.getEmergencyPhone2()).matches()) {
|
||||
msg.append("联系电话2格式错误(需11位手机号);");
|
||||
}
|
||||
|
||||
return msg.toString();
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<HrmEmergencyContact> buildQueryWrapper(HrmEmergencyContactBo bo) {
|
||||
LambdaQueryWrapper<HrmEmergencyContact> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getContactId() != null, HrmEmergencyContact::getContactId, bo.getContactId());
|
||||
lqw.eq(bo.getUserId() != null, HrmEmergencyContact::getUserId, bo.getUserId());
|
||||
lqw.like(bo.getRealName() != null, HrmEmergencyContact::getRealName, bo.getRealName());
|
||||
lqw.like(bo.getPhone() != null, HrmEmergencyContact::getPhone, bo.getPhone());
|
||||
lqw.like(bo.getEmergencyContact() != null, HrmEmergencyContact::getEmergencyContact, bo.getEmergencyContact());
|
||||
lqw.eq(bo.getDeptId() != null, HrmEmergencyContact::getDeptId, bo.getDeptId());
|
||||
lqw.eq(bo.getGender() != null, HrmEmergencyContact::getGender, bo.getGender());
|
||||
return lqw;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,11 @@ public class HrmEmployeeServiceImpl implements IHrmEmployeeService {
|
||||
return baseMapper.selectVoById(empId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HrmEmployeeVo queryByUserId(Long userId) {
|
||||
return baseMapper.selectVoOne(Wrappers.<HrmEmployee>lambdaQuery().eq(HrmEmployee::getUserId, userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<HrmEmployeeVo> queryPageList(HrmEmployeeBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<HrmEmployee> lqw = buildQueryWrapper(bo);
|
||||
|
||||
@@ -99,6 +99,23 @@ public class HrmFlowCcServiceImpl implements IHrmFlowCcService {
|
||||
.eq(HrmFlowCc::getDelFlag, 0)
|
||||
) > 0;
|
||||
}
|
||||
/**
|
||||
* 标记未读
|
||||
*/
|
||||
@Override
|
||||
public Boolean markUnread(Long ccId, Long userId) {
|
||||
if (ccId == null || userId == null) {
|
||||
return false;
|
||||
}
|
||||
return baseMapper.update(
|
||||
null,
|
||||
Wrappers.<HrmFlowCc>lambdaUpdate()
|
||||
.set(HrmFlowCc::getReadFlag, 0)
|
||||
.eq(HrmFlowCc::getCcId, ccId)
|
||||
.eq(HrmFlowCc::getCcUserId, userId)
|
||||
.eq(HrmFlowCc::getDelFlag, 0)
|
||||
) > 0;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<HrmFlowCc> buildQueryWrapper(HrmFlowCcBo bo) {
|
||||
LambdaQueryWrapper<HrmFlowCc> lqw = Wrappers.lambdaQuery();
|
||||
|
||||
@@ -4,9 +4,11 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.service.UserService;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.hrm.domain.HrmFlowInstance;
|
||||
import com.ruoyi.hrm.domain.HrmFlowNode;
|
||||
import com.ruoyi.hrm.domain.HrmFlowTask;
|
||||
@@ -15,15 +17,20 @@ import com.ruoyi.hrm.domain.bo.HrmFlowStartBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmFlowInstanceBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmFlowInstanceVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmFlowTaskVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmTravelReqVo;
|
||||
import com.ruoyi.hrm.event.ApprovalRequestedEvent;
|
||||
import com.ruoyi.hrm.mapper.*;
|
||||
import com.ruoyi.hrm.service.IHrmFlowInstanceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@@ -37,6 +44,13 @@ public class HrmFlowInstanceServiceImpl implements IHrmFlowInstanceService {
|
||||
private final FlowAssigneeHelper assigneeHelper;
|
||||
private final UserService userService;
|
||||
private final HrmFlowCcMapper ccMapper;
|
||||
private final HrmTravelReqMapper travelReqMapper;
|
||||
private final HrmLeaveReqMapper leaveReqMapper;
|
||||
private final HrmSealReqMapper sealReqMapper;
|
||||
private final HrmReimburseReqMapper reimburseReqMapper;
|
||||
private final HrmAppropriationReqMapper appropriationReqMapper;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final ApplicationEventPublisher eventPublisher;
|
||||
|
||||
@Override
|
||||
public HrmFlowInstanceVo queryById(Long instId) {
|
||||
@@ -75,11 +89,17 @@ public class HrmFlowInstanceServiceImpl implements IHrmFlowInstanceService {
|
||||
task.setNodeId(0L);
|
||||
task.setAssigneeUserId(bo.getManualAssigneeUserId());
|
||||
task.setStatus("pending");
|
||||
task.setRemark("自选审批人一次性审批");
|
||||
// 关键:写入业务关联字段,便于审批中心联查业务数据
|
||||
task.setBizType(bo.getBizType());
|
||||
task.setBizId(bo.getBizId());
|
||||
taskMapper.insert(task);
|
||||
|
||||
// 发布事件 → ruoyi-oa 监听后推 IM 通知 + 快捷跳转
|
||||
eventPublisher.publishEvent(new ApprovalRequestedEvent(
|
||||
bo.getBizType(), bo.getBizId(), inst.getInstId(),
|
||||
bo.getManualAssigneeUserId(), bo.getStartUserId()));
|
||||
|
||||
return inst.getInstId();
|
||||
}
|
||||
|
||||
@@ -121,11 +141,17 @@ public class HrmFlowInstanceServiceImpl implements IHrmFlowInstanceService {
|
||||
task.setNodeId(firstNode.getNodeId());
|
||||
task.setAssigneeUserId(assignees.get(0));
|
||||
task.setStatus("pending");
|
||||
task.setRemark(firstNode.getRemark());
|
||||
// 关键:写入业务关联字段,便于审批中心联查业务数据
|
||||
task.setBizType(bo.getBizType());
|
||||
task.setBizId(bo.getBizId());
|
||||
taskMapper.insert(task);
|
||||
|
||||
// 发布事件 → ruoyi-oa 监听后推 IM 通知 + 快捷跳转
|
||||
eventPublisher.publishEvent(new ApprovalRequestedEvent(
|
||||
bo.getBizType(), bo.getBizId(), inst.getInstId(),
|
||||
assignees.get(0), bo.getStartUserId()));
|
||||
|
||||
return inst.getInstId();
|
||||
}
|
||||
|
||||
@@ -140,15 +166,85 @@ public class HrmFlowInstanceServiceImpl implements IHrmFlowInstanceService {
|
||||
public TableDataInfo<HrmFlowInstanceVo> queryMyInstancePageList(HrmFlowInstanceBo bo, PageQuery pageQuery) {
|
||||
// “我的申请”= 当前登录用户发起的流程实例
|
||||
// 这里不信任前端传 startUserId,统一以登录态为准
|
||||
Long userId = com.ruoyi.common.helper.LoginHelper.getUserId();
|
||||
Long userId = LoginHelper.getUserId();
|
||||
LambdaQueryWrapper<HrmFlowInstance> lqw = buildQueryWrapper(bo);
|
||||
lqw.eq(userId != null, HrmFlowInstance::getStartUserId, userId);
|
||||
// 默认按发起时间倒序(如果表里没createTime字段,这里可改成instId倒序)
|
||||
lqw.orderByDesc(HrmFlowInstance::getInstId);
|
||||
Page<HrmFlowInstanceVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
for (HrmFlowInstanceVo record : result.getRecords()) {
|
||||
|
||||
// 写入出差相关的时间,用于在页面中可以提前结束
|
||||
if (record.getBizType().equals("travel")){
|
||||
HrmTravelReqVo hrmTravelReqVo = travelReqMapper.selectVoById(record.getBizId());
|
||||
record.setActualEndTime(hrmTravelReqVo.getActualEndTime());
|
||||
}
|
||||
}
|
||||
for (HrmFlowInstanceVo vo : result.getRecords()) {
|
||||
if ("travel".equals(vo.getBizType())) {
|
||||
HrmTravelReqVo travel = travelReqMapper.selectVoById(vo.getBizId());
|
||||
if (travel != null) {
|
||||
vo.setActualEndTime(travel.getActualEndTime());
|
||||
// 只有流程已完成,才替换显示文字
|
||||
if ("complete".equals(vo.getStatus())) {
|
||||
if (travel.getActualEndTime() == null) {
|
||||
vo.setStatusName("出差中");
|
||||
} else {
|
||||
vo.setStatusName("已结束");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fillInstanceBizData(result.getRecords());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void fillInstanceBizData(List<HrmFlowInstanceVo> records) {
|
||||
if (records == null || records.isEmpty()) return;
|
||||
Map<String, List<Long>> bizIdsByType = records.stream()
|
||||
.filter(v -> v.getBizType() != null && v.getBizId() != null)
|
||||
.collect(Collectors.groupingBy(
|
||||
HrmFlowInstanceVo::getBizType,
|
||||
Collectors.mapping(HrmFlowInstanceVo::getBizId, Collectors.toList())
|
||||
));
|
||||
Map<String, Object> bizDataMap = new HashMap<>();
|
||||
bizIdsByType.forEach((bizType, bizIds) -> {
|
||||
if (bizIds.isEmpty()) return;
|
||||
switch (bizType) {
|
||||
case "leave":
|
||||
leaveReqMapper.selectBatchIds(bizIds).forEach(d ->
|
||||
bizDataMap.put("leave_" + d.getBizId(), objectMapper.convertValue(d, Map.class)));
|
||||
break;
|
||||
case "travel":
|
||||
travelReqMapper.selectBatchIds(bizIds).forEach(d ->
|
||||
bizDataMap.put("travel_" + d.getBizId(), objectMapper.convertValue(d, Map.class)));
|
||||
break;
|
||||
case "seal":
|
||||
sealReqMapper.selectBatchIds(bizIds).forEach(d ->
|
||||
bizDataMap.put("seal_" + d.getBizId(), objectMapper.convertValue(d, Map.class)));
|
||||
break;
|
||||
case "reimburse":
|
||||
reimburseReqMapper.selectBatchIds(bizIds).forEach(d ->
|
||||
bizDataMap.put("reimburse_" + d.getBizId(), objectMapper.convertValue(d, Map.class)));
|
||||
break;
|
||||
case "appropriation":
|
||||
appropriationReqMapper.selectBatchIds(bizIds).forEach(d ->
|
||||
bizDataMap.put("appropriation_" + d.getBizId(), objectMapper.convertValue(d, Map.class)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
records.forEach(vo -> {
|
||||
Object data = bizDataMap.get(vo.getBizType() + "_" + vo.getBizId());
|
||||
if (data != null) {
|
||||
vo.setBizData((Map<String, Object>) data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HrmFlowInstanceVo> queryList(HrmFlowInstanceBo bo) {
|
||||
LambdaQueryWrapper<HrmFlowInstance> lqw = buildQueryWrapper(bo);
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.hrm.domain.*;
|
||||
import com.ruoyi.hrm.domain.bo.HrmFlowTaskBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmSealStampBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmFlowActionTimelineVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmFlowTaskDetailVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmFlowTaskVo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmEmployeeVo;
|
||||
import com.ruoyi.hrm.mapper.*;
|
||||
@@ -40,7 +42,6 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
|
||||
private final FlowAssigneeHelper assigneeHelper;
|
||||
private final BizStatusSyncHelper bizStatusSyncHelper;
|
||||
|
||||
private final HrmFlowTaskMapper hrmFlowTaskMapper;
|
||||
// 注入五个业务Mapper
|
||||
private final HrmLeaveReqMapper leaveReqMapper;
|
||||
private final HrmTravelReqMapper travelReqMapper;
|
||||
@@ -185,12 +186,13 @@ private void fillBizData(List<HrmFlowTaskVo> tasks) {
|
||||
if (inst == null) {
|
||||
return false;
|
||||
}
|
||||
Long operatorUserId = actionUserId != null ? actionUserId : LoginHelper.getUserId();
|
||||
// 无模板一次性审批(tplId=0 或 nodeId=0):直接结束流程
|
||||
if (inst.getTplId() != null && inst.getTplId() == 0L) {
|
||||
// 记录动作
|
||||
saveAction(taskId, inst.getInstId(), "approve", remark, actionUserId,task.getBizType(), task.getBizId());
|
||||
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "approve", remark, operatorUserId);
|
||||
if (stampBo != null) {
|
||||
saveAction(taskId, inst.getInstId(), "stamp", "盖章", actionUserId,task.getBizType(), task.getBizId());
|
||||
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "stamp", "盖章", operatorUserId);
|
||||
}
|
||||
task.setStatus("approved");
|
||||
baseMapper.updateById(task);
|
||||
@@ -202,7 +204,7 @@ private void fillBizData(List<HrmFlowTaskVo> tasks) {
|
||||
sealReqService.updateStatus(inst.getBizId(), "approved");
|
||||
if (stampBo != null) {
|
||||
// 盖章动作也写入流转历史
|
||||
saveAction(taskId, inst.getInstId(), "stamp", "盖章", actionUserId,task.getBizType(), task.getBizId());
|
||||
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "stamp", "盖章", operatorUserId);
|
||||
sealReqService.stampWithJava(inst.getBizId(), stampBo);
|
||||
}
|
||||
}
|
||||
@@ -215,7 +217,7 @@ private void fillBizData(List<HrmFlowTaskVo> tasks) {
|
||||
return false;
|
||||
}
|
||||
// 记录动作
|
||||
saveAction(taskId, inst.getInstId(), "approve", remark, actionUserId,task.getBizType(),task.getBizId());
|
||||
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "approve", remark, operatorUserId);
|
||||
// 完成当前任务
|
||||
task.setStatus("approved");
|
||||
baseMapper.updateById(task);
|
||||
@@ -284,6 +286,7 @@ private void fillBizData(List<HrmFlowTaskVo> tasks) {
|
||||
sealReqService.stampWithJava(inst.getBizId(), stampBo);
|
||||
}
|
||||
}
|
||||
bizStatusSyncHelper.setBizApproved(inst.getBizType(), inst.getBizId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -299,7 +302,8 @@ private void fillBizData(List<HrmFlowTaskVo> tasks) {
|
||||
if (inst == null) {
|
||||
return false;
|
||||
}
|
||||
saveAction(taskId, inst.getInstId(), "reject", remark, actionUserId,task.getBizType(),task.getBizId());
|
||||
Long operatorUserId = actionUserId != null ? actionUserId : LoginHelper.getUserId();
|
||||
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "reject", remark, operatorUserId);
|
||||
task.setStatus("rejected");
|
||||
baseMapper.updateById(task);
|
||||
inst.setStatus("rejected");
|
||||
@@ -323,7 +327,8 @@ private void fillBizData(List<HrmFlowTaskVo> tasks) {
|
||||
if (inst == null) {
|
||||
return false;
|
||||
}
|
||||
saveAction(taskId, inst.getInstId(), "withdraw", remark, actionUserId, task.getBizType(), task.getBizId());
|
||||
Long operatorUserId = actionUserId != null ? actionUserId : LoginHelper.getUserId();
|
||||
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "withdraw", remark, operatorUserId);
|
||||
task.setStatus("withdraw");
|
||||
baseMapper.updateById(task);
|
||||
// 无模板一次性审批:撤回后业务回到 pending,并重新生成一个待办(仍然只允许一次审批)
|
||||
@@ -360,13 +365,13 @@ private void fillBizData(List<HrmFlowTaskVo> tasks) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void saveAction(Long taskId, Long instId, String action, String remark, Long userId, String bizType, Long bizId) {
|
||||
private void saveAction(Long taskId, Long instId, String bizType, Long bizId, Long assigneeUserId, String action, String remark, Long actionUserId) {
|
||||
HrmFlowAction log = new HrmFlowAction();
|
||||
log.setTaskId(taskId);
|
||||
log.setInstId(instId);
|
||||
log.setAction(action);
|
||||
log.setRemark(remark);
|
||||
log.setActionUserId(userId);
|
||||
log.setActionUserId(actionUserId);
|
||||
log.setCreateTime(new Date());
|
||||
log.setBizType(bizType);
|
||||
log.setBizId(bizId);
|
||||
@@ -388,7 +393,8 @@ private void fillBizData(List<HrmFlowTaskVo> tasks) {
|
||||
return false;
|
||||
}
|
||||
// 记录动作
|
||||
saveAction(taskId, inst.getInstId(), "transfer", remark, actionUserId, task.getBizType(), task.getBizId());
|
||||
Long operatorUserId = actionUserId != null ? actionUserId : LoginHelper.getUserId();
|
||||
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), newAssigneeUserId, "transfer", remark, operatorUserId);
|
||||
|
||||
// 更新办理人
|
||||
HrmFlowTask u = new HrmFlowTask();
|
||||
@@ -399,7 +405,6 @@ private void fillBizData(List<HrmFlowTaskVo> tasks) {
|
||||
|
||||
@Override
|
||||
public HrmFlowTaskVo queryTodoByBiz(String bizType, Long bizId, Long assigneeUserId) {
|
||||
// 只取"待办 pending"的一条(理论上同一 biz 同一时刻最多一条待办)
|
||||
LambdaQueryWrapper<HrmFlowTask> lqw = Wrappers.<HrmFlowTask>lambdaQuery()
|
||||
.eq(bizType != null, HrmFlowTask::getBizType, bizType)
|
||||
.eq(bizId != null, HrmFlowTask::getBizId, bizId)
|
||||
@@ -408,12 +413,118 @@ private void fillBizData(List<HrmFlowTaskVo> tasks) {
|
||||
.orderByDesc(HrmFlowTask::getTaskId)
|
||||
.last("limit 1");
|
||||
HrmFlowTaskVo hrmFlowTaskVo = baseMapper.selectVoOne(lqw);
|
||||
if (hrmFlowTaskVo != null) {
|
||||
if (hrmFlowTaskVo != null && hrmFlowTaskVo.getAssigneeUserId() != null) {
|
||||
hrmFlowTaskVo.setAssigneeNickName(userService.selectNickNameById(hrmFlowTaskVo.getAssigneeUserId()));
|
||||
}
|
||||
return hrmFlowTaskVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HrmFlowTaskDetailVo queryDetailByBiz(String bizType, Long bizId, Long assigneeUserId) {
|
||||
HrmFlowTaskDetailVo result = new HrmFlowTaskDetailVo();
|
||||
HrmFlowTaskVo currentTask = queryTodoByBiz(bizType, bizId, assigneeUserId);
|
||||
result.setCurrentTask(currentTask);
|
||||
|
||||
LambdaQueryWrapper<HrmFlowTask> historyQ = Wrappers.<HrmFlowTask>lambdaQuery()
|
||||
.eq(bizType != null, HrmFlowTask::getBizType, bizType)
|
||||
.eq(bizId != null, HrmFlowTask::getBizId, bizId)
|
||||
.orderByAsc(HrmFlowTask::getCreateTime);
|
||||
List<HrmFlowTaskVo> histories = baseMapper.selectVoList(historyQ);
|
||||
if (histories != null) {
|
||||
histories.forEach(task -> {
|
||||
if (task.getAssigneeUserId() != null) {
|
||||
task.setAssigneeNickName(userService.selectNickNameById(task.getAssigneeUserId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
result.setTaskHistory(histories == null ? Collections.emptyList() : histories);
|
||||
|
||||
HrmFlowInstance inst = instanceMapper.selectOne(Wrappers.<HrmFlowInstance>lambdaQuery()
|
||||
.eq(bizType != null, HrmFlowInstance::getBizType, bizType)
|
||||
.eq(bizId != null, HrmFlowInstance::getBizId, bizId)
|
||||
.orderByDesc(HrmFlowInstance::getInstId)
|
||||
.last("limit 1"));
|
||||
if (inst != null) {
|
||||
result.setFlowStatus(inst.getStatus());
|
||||
result.setCurrentNodeId(inst.getCurrentNodeId());
|
||||
HrmFlowNode node = inst.getCurrentNodeId() == null ? null : nodeMapper.selectById(inst.getCurrentNodeId());
|
||||
if (node != null) {
|
||||
result.setCurrentNodeName(node.getRemark());
|
||||
}
|
||||
result.setApproved(Boolean.valueOf("approved".equalsIgnoreCase(inst.getStatus())));
|
||||
}
|
||||
|
||||
result.setActionTimeline(buildActionTimeline(bizType, bizId));
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<HrmFlowActionTimelineVo> buildActionTimeline(String bizType, Long bizId) {
|
||||
LambdaQueryWrapper<HrmFlowAction> actionQ = Wrappers.<HrmFlowAction>lambdaQuery()
|
||||
.eq(bizType != null, HrmFlowAction::getBizType, bizType)
|
||||
.eq(bizId != null, HrmFlowAction::getBizId, bizId)
|
||||
.orderByAsc(HrmFlowAction::getCreateTime);
|
||||
List<HrmFlowAction> actions = actionMapper.selectList(actionQ);
|
||||
if (actions == null || actions.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Map<Long, HrmFlowTask> taskMap = new HashMap<>();
|
||||
List<Long> taskIds = actions.stream().map(HrmFlowAction::getTaskId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
if (!taskIds.isEmpty()) {
|
||||
baseMapper.selectBatchIds(taskIds).forEach(task -> taskMap.put(task.getTaskId(), task));
|
||||
}
|
||||
|
||||
List<HrmFlowActionTimelineVo> timelines = new ArrayList<HrmFlowActionTimelineVo>();
|
||||
for (HrmFlowAction action : actions) {
|
||||
HrmFlowActionTimelineVo vo = new HrmFlowActionTimelineVo();
|
||||
vo.setActionId(action.getActionId());
|
||||
vo.setTaskId(action.getTaskId());
|
||||
vo.setInstId(action.getInstId());
|
||||
vo.setActionUserId(action.getActionUserId());
|
||||
vo.setActionUserName(action.getActionUserId() == null ? null : userService.selectNickNameById(action.getActionUserId()));
|
||||
vo.setAction(action.getAction());
|
||||
vo.setActionText(actionText(action.getAction()));
|
||||
vo.setRemark(action.getRemark());
|
||||
vo.setBizType(action.getBizType());
|
||||
vo.setBizId(action.getBizId());
|
||||
HrmFlowTask task = taskMap.get(action.getTaskId());
|
||||
if (task != null) {
|
||||
vo.setNodeId(task.getNodeId());
|
||||
vo.setTaskStatus(task.getStatus());
|
||||
HrmFlowNode node = task.getNodeId() == null ? null : nodeMapper.selectById(task.getNodeId());
|
||||
if (node != null) {
|
||||
vo.setNodeName(node.getRemark());
|
||||
}
|
||||
}
|
||||
vo.setCreateTime(action.getCreateTime());
|
||||
timelines.add(vo);
|
||||
}
|
||||
return timelines;
|
||||
}
|
||||
|
||||
private String actionText(String action) {
|
||||
if (action == null) {
|
||||
return "-";
|
||||
}
|
||||
String lower = action.toLowerCase();
|
||||
if ("approve".equals(lower)) {
|
||||
return "通过";
|
||||
}
|
||||
if ("reject".equals(lower)) {
|
||||
return "驳回";
|
||||
}
|
||||
if ("withdraw".equals(lower)) {
|
||||
return "撤回";
|
||||
}
|
||||
if ("transfer".equals(lower)) {
|
||||
return "转办";
|
||||
}
|
||||
if ("stamp".equals(lower)) {
|
||||
return "盖章";
|
||||
}
|
||||
return action;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<HrmFlowTask> buildQueryWrapper(HrmFlowTaskBo bo) {
|
||||
LambdaQueryWrapper<HrmFlowTask> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getTaskId() != null, HrmFlowTask::getTaskId, bo.getTaskId());
|
||||
|
||||
@@ -0,0 +1,529 @@
|
||||
package com.ruoyi.hrm.service.impl;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.zxing.BinaryBitmap;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.MultiFormatReader;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
|
||||
import com.google.zxing.common.HybridBinarizer;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.hrm.domain.vo.HrmInvoiceOcrResultVo;
|
||||
import com.ruoyi.hrm.service.IHrmInvoiceOcrService;
|
||||
import com.ruoyi.oss.factory.OssFactory;
|
||||
import com.ruoyi.system.domain.vo.SysOssVo;
|
||||
import com.ruoyi.system.mapper.SysOssMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sourceforge.tess4j.Tesseract;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.rendering.ImageType;
|
||||
import org.apache.pdfbox.rendering.PDFRenderer;
|
||||
import org.apache.pdfbox.text.PDFTextStripper;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 单据识别服务实现:按附件类型分流。
|
||||
*
|
||||
* <p><b>图片单据</b>(jpg/png 等,可不是规范发票):直接调用小米 MiMo 多模态大模型识别,
|
||||
* 返回标题 + 金额(复用 application.yml 中 mimo.* 配置)。
|
||||
*
|
||||
* <p><b>PDF 电子发票</b>:本地三段式管线,无外部 API:
|
||||
* <ol>
|
||||
* <li>PDFBox 文本层抽取:原生电子发票直接搞定(毫秒级,几乎零算力)</li>
|
||||
* <li>ZXing 二维码识别:拍照/扫描发票 PDF,从二维码读结构化字段</li>
|
||||
* <li>Tesseract OCR(仅在前两步失败时触发):本地 chi_sim 字库,无网络</li>
|
||||
* </ol>
|
||||
*
|
||||
* Tesseract 字库路径默认 {jar 同级目录}/tessdata,可用 fad.ocr.tessdata-path 覆盖。
|
||||
* 系统需预装:apt install -y tesseract-ocr tesseract-ocr-chi-sim
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HrmInvoiceOcrServiceImpl implements IHrmInvoiceOcrService {
|
||||
|
||||
private final SysOssMapper sysOssMapper;
|
||||
private final ObjectMapper jsonMapper = new ObjectMapper();
|
||||
|
||||
/** 可通过 application.yml 覆盖;默认 jar 同级目录下的 tessdata */
|
||||
@Value("${fad.ocr.tessdata-path:}")
|
||||
private String tessdataPathConfig;
|
||||
|
||||
// === 小米 MiMo 多模态大模型(识别图片单据,复用 application.yml 里的 mimo.* 配置)===
|
||||
@Value("${mimo.base-url:https://api.xiaomimimo.com/v1}")
|
||||
private String mimoBaseUrl;
|
||||
@Value("${mimo.api-key:}")
|
||||
private String mimoApiKey;
|
||||
@Value("${mimo.model:mimo-v2.5}")
|
||||
private String mimoModel;
|
||||
@Value("${mimo.max-tokens:8192}")
|
||||
private Integer mimoMaxTokens;
|
||||
@Value("${mimo.timeout:180}")
|
||||
private Integer mimoTimeout;
|
||||
|
||||
/** 走多模态识别的图片后缀 */
|
||||
private static final Set<String> IMAGE_SUFFIXES =
|
||||
new HashSet<>(Arrays.asList("jpg", "jpeg", "png", "webp", "bmp", "gif"));
|
||||
|
||||
private String tessdataPath;
|
||||
|
||||
@PostConstruct
|
||||
void resolveTessdataPath() {
|
||||
if (StringUtils.isNotBlank(tessdataPathConfig)) {
|
||||
tessdataPath = tessdataPathConfig;
|
||||
} else {
|
||||
tessdataPath = Paths.get(jarDir(), "tessdata").toString();
|
||||
}
|
||||
log.info("[Invoice] tessdata path = {}", tessdataPath);
|
||||
}
|
||||
|
||||
/** 取 jar 所在目录;IDE 调试时 fall back 到工作目录 */
|
||||
private static String jarDir() {
|
||||
try {
|
||||
URL url = HrmInvoiceOcrServiceImpl.class
|
||||
.getProtectionDomain().getCodeSource().getLocation();
|
||||
File f = new File(url.toURI());
|
||||
return (f.isFile() ? f.getParentFile() : f).getAbsolutePath();
|
||||
} catch (Exception e) {
|
||||
return System.getProperty("user.dir");
|
||||
}
|
||||
}
|
||||
|
||||
// === 字段抽取正则 ===
|
||||
private static final Pattern P_TOTAL = Pattern.compile(
|
||||
"(?:价税合计|小写)[^0-9¥¥]{0,30}[¥¥]?\\s*([0-9,]+\\.[0-9]{2})");
|
||||
private static final Pattern P_DATE = Pattern.compile(
|
||||
"开票日期[:: ]*([0-9]{4}[年\\-/][0-9]{1,2}[月\\-/][0-9]{1,2}日?)");
|
||||
private static final Pattern P_TYPE = Pattern.compile(
|
||||
"(电子(?:普通)?发票|增值税电子(?:普通|专用)发票|电子发票([^)]+)|数电(?:普通)?发票|普通发票|专用发票)");
|
||||
private static final Pattern P_SELLER = Pattern.compile(
|
||||
"销\\s*售\\s*方[^名]*名\\s*称[:: ]*([^\\n\\r]+?)(?=\\s{2,}|纳税人|统一社会|地址|开户|$)");
|
||||
private static final Pattern P_LINE_AMOUNT = Pattern.compile(
|
||||
"([\\u4e00-\\u9fa5A-Za-z0-9()()\\-·.\\*\\s]{2,40}?)\\s+"
|
||||
+ "([0-9,]+\\.[0-9]{2})\\s+"
|
||||
+ "(\\d{1,2}%|免税|不征税|\\*)\\s+"
|
||||
+ "([0-9,]+\\.[0-9]{2})");
|
||||
|
||||
@Override
|
||||
public HrmInvoiceOcrResultVo recognizeByOssId(Long ossId) {
|
||||
SysOssVo oss = sysOssMapper.selectVoById(ossId);
|
||||
if (oss == null) {
|
||||
throw new ServiceException("附件不存在: " + ossId);
|
||||
}
|
||||
String suffix = StringUtils.defaultIfBlank(oss.getFileSuffix(), "").toLowerCase().replace(".", "");
|
||||
|
||||
byte[] fileBytes;
|
||||
try (InputStream in = OssFactory.instance().getObjectContent(oss.getUrl())) {
|
||||
fileBytes = IoUtil.readBytes(in);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("读取附件失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
// 图片单据:直接走小米多模态大模型识别(可识别非发票单据)
|
||||
if (IMAGE_SUFFIXES.contains(suffix)) {
|
||||
log.info("[Invoice] 图片单据走多模态识别, suffix={}", suffix);
|
||||
return recognizeImageByMiMo(fileBytes, suffix);
|
||||
}
|
||||
if (!"pdf".equals(suffix)) {
|
||||
throw new ServiceException("仅支持 PDF 电子发票或图片单据(jpg/png),当前文件类型: " + suffix);
|
||||
}
|
||||
|
||||
try (PDDocument doc = PDDocument.load(new ByteArrayInputStream(fileBytes))) {
|
||||
// 第一步:文本层
|
||||
String text = extractText(doc);
|
||||
if (StringUtils.isNotBlank(text) && looksLikeInvoice(text)) {
|
||||
log.debug("[Invoice] hit text layer");
|
||||
return buildFromText(text);
|
||||
}
|
||||
|
||||
// 第二步:二维码
|
||||
HrmInvoiceOcrResultVo qr = tryDecodeQrFromPdf(doc);
|
||||
if (qr != null) {
|
||||
log.info("[Invoice] hit QR code");
|
||||
return qr;
|
||||
}
|
||||
|
||||
// 第三步:本地 OCR
|
||||
log.info("[Invoice] fallback to local OCR");
|
||||
String ocrText = runTesseract(doc);
|
||||
if (StringUtils.isBlank(ocrText)) {
|
||||
throw new ServiceException("无法识别该 PDF,请上传开票平台下载的正规 PDF 电子发票。");
|
||||
}
|
||||
return buildFromText(ocrText);
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("[Invoice] 解析失败", e);
|
||||
throw new ServiceException("发票解析失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** 文本层抽取 */
|
||||
private String extractText(PDDocument doc) throws Exception {
|
||||
PDFTextStripper stripper = new PDFTextStripper();
|
||||
stripper.setSortByPosition(true);
|
||||
stripper.setLineSeparator("\n");
|
||||
return stripper.getText(doc);
|
||||
}
|
||||
|
||||
/** 是否长得像发票:要至少出现金额/日期/抬头其中一个关键字段 */
|
||||
private boolean looksLikeInvoice(String text) {
|
||||
return P_TOTAL.matcher(text).find()
|
||||
|| P_DATE.matcher(text).find()
|
||||
|| P_TYPE.matcher(text).find()
|
||||
|| text.contains("发票");
|
||||
}
|
||||
|
||||
/** 第二步:把每页渲染成图,再用 ZXing 扫二维码 */
|
||||
private HrmInvoiceOcrResultVo tryDecodeQrFromPdf(PDDocument doc) {
|
||||
try {
|
||||
PDFRenderer renderer = new PDFRenderer(doc);
|
||||
// 二维码 200dpi 已经够清晰,CPU 也轻
|
||||
int pages = doc.getNumberOfPages();
|
||||
for (int i = 0; i < pages; i++) {
|
||||
BufferedImage img = renderer.renderImageWithDPI(i, 200, ImageType.GRAY);
|
||||
String content = decodeQr(img);
|
||||
if (StringUtils.isNotBlank(content)) {
|
||||
HrmInvoiceOcrResultVo vo = parseInvoiceQr(content);
|
||||
if (vo != null) return vo;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.debug("[Invoice] QR decode failed: {}", e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** ZXing 解码一张图,返回二维码文本(无则 null) */
|
||||
private String decodeQr(BufferedImage img) {
|
||||
try {
|
||||
BinaryBitmap bitmap = new BinaryBitmap(
|
||||
new HybridBinarizer(new BufferedImageLuminanceSource(img)));
|
||||
Map<DecodeHintType, Object> hints = new EnumMap<>(DecodeHintType.class);
|
||||
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
|
||||
hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
|
||||
Result r = new MultiFormatReader().decode(bitmap, hints);
|
||||
return r != null ? r.getText() : null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析增值税发票二维码内容。格式(逗号分隔):
|
||||
* 01,版本号,发票代码,发票号码,金额(不含税),开票日期(YYYYMMDD),校验码后6位,...
|
||||
*/
|
||||
private HrmInvoiceOcrResultVo parseInvoiceQr(String raw) {
|
||||
if (raw == null) return null;
|
||||
String[] parts = raw.split(",");
|
||||
if (parts.length < 7 || !parts[0].startsWith("0")) return null;
|
||||
try {
|
||||
HrmInvoiceOcrResultVo vo = new HrmInvoiceOcrResultVo();
|
||||
// parts[4] 是不含税金额;纸质票二维码无价税合计,先填到 totalAmount 让前端可调
|
||||
BigDecimal amt = parseBigDecimal(parts[4]);
|
||||
vo.setTotalAmount(amt);
|
||||
String d = parts[5];
|
||||
if (d != null && d.length() == 8) {
|
||||
vo.setInvoiceDate(d.substring(0, 4) + "-" + d.substring(4, 6) + "-" + d.substring(6, 8));
|
||||
}
|
||||
vo.setInvoiceType("增值税发票(二维码识别)");
|
||||
List<HrmInvoiceOcrResultVo.Item> items = new ArrayList<>();
|
||||
HrmInvoiceOcrResultVo.Item it = new HrmInvoiceOcrResultVo.Item();
|
||||
it.setItemName("发票款项(金额请核对原票,二维码仅含不含税金额)");
|
||||
it.setAmount(amt);
|
||||
items.add(it);
|
||||
vo.setItems(items);
|
||||
return vo;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** 第三步:Tesseract 本地 OCR,整文本拼接交给 regex 解析 */
|
||||
private String runTesseract(PDDocument doc) {
|
||||
try {
|
||||
File td = new File(tessdataPath);
|
||||
if (!td.isDirectory()) {
|
||||
log.warn("[Invoice] tessdata 目录不存在: {},无法走 OCR 兜底", tessdataPath);
|
||||
throw new ServiceException(
|
||||
"本地 OCR 字库未配置。请在 jar 同级目录建 tessdata/ 并放入 chi_sim.traineddata,"
|
||||
+ "或通过 fad.ocr.tessdata-path 指定路径。");
|
||||
}
|
||||
Tesseract t = new Tesseract();
|
||||
t.setDatapath(tessdataPath);
|
||||
t.setLanguage("chi_sim");
|
||||
t.setPageSegMode(6); // 假设单块文本
|
||||
t.setOcrEngineMode(1); // LSTM only
|
||||
|
||||
PDFRenderer renderer = new PDFRenderer(doc);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int pages = doc.getNumberOfPages();
|
||||
for (int i = 0; i < pages; i++) {
|
||||
BufferedImage img = renderer.renderImageWithDPI(i, 300, ImageType.GRAY);
|
||||
sb.append(t.doOCR(img)).append('\n');
|
||||
}
|
||||
return sb.toString();
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
log.error("[Invoice] tesseract 失败: {}", e.getMessage());
|
||||
throw new ServiceException(
|
||||
"本地 OCR 失败:" + e.getMessage()
|
||||
+ "。请确认服务器已 apt install tesseract-ocr tesseract-ocr-chi-sim,"
|
||||
+ "且 jar 同级 tessdata/ 下有 chi_sim.traineddata。");
|
||||
}
|
||||
}
|
||||
|
||||
/** 文本 → VO 的统一抽取逻辑 */
|
||||
private HrmInvoiceOcrResultVo buildFromText(String text) {
|
||||
HrmInvoiceOcrResultVo result = new HrmInvoiceOcrResultVo();
|
||||
result.setInvoiceType(firstGroup(P_TYPE, text));
|
||||
result.setInvoiceDate(firstGroup(P_DATE, text));
|
||||
result.setSellerName(cleanSeller(firstGroup(P_SELLER, text)));
|
||||
result.setTotalAmount(parseBigDecimal(firstGroup(P_TOTAL, text)));
|
||||
|
||||
List<HrmInvoiceOcrResultVo.Item> items = parseLineItems(text);
|
||||
if (items.isEmpty() && result.getTotalAmount() != null) {
|
||||
HrmInvoiceOcrResultVo.Item item = new HrmInvoiceOcrResultVo.Item();
|
||||
item.setItemName(StringUtils.defaultIfBlank(result.getSellerName(), "发票款项"));
|
||||
item.setAmount(result.getTotalAmount());
|
||||
items.add(item);
|
||||
}
|
||||
result.setItems(items);
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<HrmInvoiceOcrResultVo.Item> parseLineItems(String text) {
|
||||
List<HrmInvoiceOcrResultVo.Item> items = new ArrayList<>();
|
||||
int begin = indexOfAny(text, "项目名称", "货物或应税劳务", "货物名称");
|
||||
int end = indexOfAny(text, "合\\s*计", "价税合计", "(大写)", "(大写)");
|
||||
String area = (begin >= 0 && end > begin) ? text.substring(begin, end) : text;
|
||||
for (String line : area.split("\\n")) {
|
||||
line = line.trim();
|
||||
if (line.length() < 6) continue;
|
||||
Matcher m = P_LINE_AMOUNT.matcher(line);
|
||||
if (!m.find()) continue;
|
||||
HrmInvoiceOcrResultVo.Item item = new HrmInvoiceOcrResultVo.Item();
|
||||
String name = m.group(1).trim().replaceAll("^\\*[^*]+\\*", "");
|
||||
BigDecimal preTax = parseBigDecimal(m.group(2));
|
||||
String rate = m.group(3);
|
||||
BigDecimal tax = parseBigDecimal(m.group(4));
|
||||
BigDecimal withTax = (preTax != null ? preTax : BigDecimal.ZERO)
|
||||
.add(tax != null ? tax : BigDecimal.ZERO);
|
||||
item.setItemName(name);
|
||||
item.setTaxRate(rate);
|
||||
item.setAmount(withTax);
|
||||
items.add(item);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private static String firstGroup(Pattern p, String s) {
|
||||
if (s == null) return null;
|
||||
Matcher m = p.matcher(s);
|
||||
return m.find() ? m.group(1).trim() : null;
|
||||
}
|
||||
|
||||
private static int indexOfAny(String text, String... patterns) {
|
||||
int min = -1;
|
||||
for (String p : patterns) {
|
||||
Matcher m = Pattern.compile(p).matcher(text);
|
||||
if (m.find()) {
|
||||
int idx = m.start();
|
||||
if (min < 0 || idx < min) min = idx;
|
||||
}
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
||||
private static String cleanSeller(String s) {
|
||||
if (s == null) return null;
|
||||
s = s.replaceAll("^[::\\s]+", "").trim();
|
||||
String[] tail = s.split("\\s{2,}");
|
||||
return tail.length > 0 ? tail[0].trim() : s;
|
||||
}
|
||||
|
||||
private static BigDecimal parseBigDecimal(String raw) {
|
||||
if (StringUtils.isBlank(raw)) return null;
|
||||
try {
|
||||
return new BigDecimal(raw.replace(",", "").replace("¥", "").replace("¥", "").trim());
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 图片单据:小米多模态识别 ====================
|
||||
|
||||
private static final String VISION_SYSTEM_PROMPT =
|
||||
"你是财务单据识别助手。用户上传的是报销/拨款单据图片,可能是增值税发票、收据、出租车/火车票、"
|
||||
+ "餐饮小票、合同、对账单等,不一定是规范发票。请仔细识别图片中的费用条目与金额。";
|
||||
|
||||
private static final String VISION_USER_PROMPT =
|
||||
"请识别这张单据,只输出严格的 JSON(不要任何解释文字、不要 markdown 代码块),格式:"
|
||||
+ "{\"items\":[{\"title\":\"简洁的费用标题,如 滴滴出行-市内交通 / 餐饮-海底捞 / XX酒店住宿\",\"amount\":数字}],"
|
||||
+ "\"totalAmount\":数字}。amount 与 totalAmount 均为纯数字(不带货币符号/逗号);"
|
||||
+ "识别不到金额则填 0;一般一张单据对应一条 items,若单据内含多笔明细可拆成多条。";
|
||||
|
||||
/** 图片 → 多模态识别 → 结构化结果 */
|
||||
private HrmInvoiceOcrResultVo recognizeImageByMiMo(byte[] bytes, String suffix) {
|
||||
if (StringUtils.isBlank(mimoApiKey)) {
|
||||
throw new ServiceException("未配置 AI 识别服务(mimo.api-key),无法识别图片单据");
|
||||
}
|
||||
String mime = "jpg".equals(suffix) ? "jpeg" : suffix;
|
||||
String dataUri = "data:image/" + mime + ";base64,"
|
||||
+ java.util.Base64.getEncoder().encodeToString(bytes);
|
||||
String content = callMiMoVision(dataUri);
|
||||
return parseVisionJson(content);
|
||||
}
|
||||
|
||||
/** 调用小米 MiMo /chat/completions(OpenAI 兼容,多模态、非流式),返回 message.content */
|
||||
private String callMiMoVision(String imageDataUri) {
|
||||
ObjectNode body = jsonMapper.createObjectNode();
|
||||
body.put("model", mimoModel);
|
||||
body.put("max_completion_tokens", mimoMaxTokens);
|
||||
body.put("max_tokens", mimoMaxTokens);
|
||||
body.put("temperature", 0.2);
|
||||
body.put("stream", false);
|
||||
ArrayNode messages = body.putArray("messages");
|
||||
messages.addObject().put("role", "system").put("content", VISION_SYSTEM_PROMPT);
|
||||
ObjectNode userMsg = messages.addObject();
|
||||
userMsg.put("role", "user");
|
||||
ArrayNode contentArr = userMsg.putArray("content");
|
||||
contentArr.addObject().put("type", "text").put("text", VISION_USER_PROMPT);
|
||||
ObjectNode img = contentArr.addObject();
|
||||
img.put("type", "image_url");
|
||||
img.putObject("image_url").put("url", imageDataUri);
|
||||
|
||||
HttpURLConnection conn = null;
|
||||
try {
|
||||
URL url = new URL(mimoBaseUrl + "/chat/completions");
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
conn.setConnectTimeout(10_000);
|
||||
conn.setReadTimeout((mimoTimeout == null ? 180 : mimoTimeout) * 1000);
|
||||
conn.setRequestProperty("Content-Type", "application/json");
|
||||
conn.setRequestProperty("api-key", mimoApiKey);
|
||||
conn.setRequestProperty("Authorization", "Bearer " + mimoApiKey);
|
||||
try (OutputStream os = conn.getOutputStream()) {
|
||||
os.write(jsonMapper.writeValueAsString(body).getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
int code = conn.getResponseCode();
|
||||
if (code >= 400) {
|
||||
String err = readStream(conn.getErrorStream());
|
||||
throw new ServiceException("AI 识别服务返回 " + code + ":" + StringUtils.substring(err, 0, 300));
|
||||
}
|
||||
JsonNode root = jsonMapper.readTree(readStream(conn.getInputStream()));
|
||||
JsonNode message = root.path("choices").path(0).path("message");
|
||||
String content = message.path("content").asText("");
|
||||
if (StringUtils.isBlank(content)) {
|
||||
String finish = root.path("choices").path(0).path("finish_reason").asText("");
|
||||
if ("length".equals(finish)) {
|
||||
throw new ServiceException("AI 识别输出被截断,请重试或提高 mimo.max-tokens");
|
||||
}
|
||||
throw new ServiceException("AI 未返回有效识别内容");
|
||||
}
|
||||
return content;
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("[Invoice] 调用 MiMo 多模态识别失败", e);
|
||||
throw new ServiceException("AI 识别服务调用失败:" + e.getMessage());
|
||||
} finally {
|
||||
if (conn != null) conn.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
/** 解析模型返回的 JSON(容错:去掉 markdown 代码块,截取首尾花括号) */
|
||||
private HrmInvoiceOcrResultVo parseVisionJson(String content) {
|
||||
HrmInvoiceOcrResultVo vo = new HrmInvoiceOcrResultVo();
|
||||
vo.setInvoiceType("AI图片识别");
|
||||
List<HrmInvoiceOcrResultVo.Item> items = new ArrayList<>();
|
||||
try {
|
||||
String jsonStr = extractJson(content);
|
||||
JsonNode root = jsonMapper.readTree(jsonStr);
|
||||
JsonNode arr = root.path("items");
|
||||
if (arr.isArray()) {
|
||||
for (JsonNode n : arr) {
|
||||
HrmInvoiceOcrResultVo.Item it = new HrmInvoiceOcrResultVo.Item();
|
||||
it.setItemName(StringUtils.trimToEmpty(n.path("title").asText("")));
|
||||
it.setAmount(parseBigDecimal(n.path("amount").asText(null)));
|
||||
items.add(it);
|
||||
}
|
||||
}
|
||||
JsonNode total = root.get("totalAmount");
|
||||
if (total != null && !total.isNull()) {
|
||||
vo.setTotalAmount(parseBigDecimal(total.asText(null)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("[Invoice] 解析 AI 识别 JSON 失败,原始内容: {}", StringUtils.substring(content, 0, 300));
|
||||
}
|
||||
if (items.isEmpty()) {
|
||||
HrmInvoiceOcrResultVo.Item it = new HrmInvoiceOcrResultVo.Item();
|
||||
it.setItemName("");
|
||||
it.setAmount(vo.getTotalAmount());
|
||||
items.add(it);
|
||||
}
|
||||
// 无总额时用明细汇总
|
||||
if (vo.getTotalAmount() == null) {
|
||||
BigDecimal sum = BigDecimal.ZERO;
|
||||
for (HrmInvoiceOcrResultVo.Item it : items) {
|
||||
if (it.getAmount() != null) sum = sum.add(it.getAmount());
|
||||
}
|
||||
vo.setTotalAmount(sum);
|
||||
}
|
||||
vo.setItems(items);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/** 从可能带 ```json 包裹或前后缀文字的字符串里截取 JSON 主体 */
|
||||
private static String extractJson(String raw) {
|
||||
if (raw == null) return "{}";
|
||||
String s = raw.trim();
|
||||
int begin = s.indexOf('{');
|
||||
int end = s.lastIndexOf('}');
|
||||
return (begin >= 0 && end > begin) ? s.substring(begin, end + 1) : s;
|
||||
}
|
||||
|
||||
private static String readStream(InputStream in) {
|
||||
if (in == null) return "";
|
||||
try (BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String l;
|
||||
while ((l = r.readLine()) != null) sb.append(l).append('\n');
|
||||
return sb.toString();
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.hrm.domain.HrmFlowTemplate;
|
||||
import com.ruoyi.hrm.domain.HrmInvoiceItem;
|
||||
import com.ruoyi.hrm.domain.HrmReimburseReq;
|
||||
import com.ruoyi.hrm.domain.bo.HrmFlowStartBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmInvoiceItemBo;
|
||||
import com.ruoyi.hrm.domain.bo.HrmReimburseReqBo;
|
||||
import com.ruoyi.hrm.domain.vo.HrmReimburseReqVo;
|
||||
import com.ruoyi.hrm.mapper.HrmFlowTemplateMapper;
|
||||
import com.ruoyi.hrm.mapper.HrmInvoiceItemMapper;
|
||||
import com.ruoyi.hrm.mapper.HrmReimburseReqMapper;
|
||||
import com.ruoyi.hrm.service.IHrmFlowInstanceService;
|
||||
import com.ruoyi.hrm.service.IHrmReimburseReqService;
|
||||
@@ -30,10 +33,18 @@ public class HrmReimburseReqServiceImpl implements IHrmReimburseReqService {
|
||||
private final HrmReimburseReqMapper baseMapper;
|
||||
private final HrmFlowTemplateMapper flowTemplateMapper;
|
||||
private final IHrmFlowInstanceService flowInstanceService;
|
||||
private final HrmInvoiceItemMapper invoiceItemMapper;
|
||||
|
||||
@Override
|
||||
public HrmReimburseReqVo queryById(Long bizId) {
|
||||
return baseMapper.selectVoWithProjectById(bizId);
|
||||
HrmReimburseReqVo vo = baseMapper.selectVoWithProjectById(bizId);
|
||||
if (vo != null) {
|
||||
vo.setInvoiceItems(invoiceItemMapper.selectList(Wrappers.<HrmInvoiceItem>lambdaQuery()
|
||||
.eq(HrmInvoiceItem::getBizType, "reimburse")
|
||||
.eq(HrmInvoiceItem::getBizId, bizId)
|
||||
.orderByAsc(HrmInvoiceItem::getSortNo)));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,6 +72,12 @@ public class HrmReimburseReqServiceImpl implements IHrmReimburseReqService {
|
||||
boolean ok = baseMapper.insert(add) > 0;
|
||||
|
||||
HrmReimburseReqVo bean = BeanUtil.toBean(add, HrmReimburseReqVo.class);
|
||||
|
||||
// 保存发票条目
|
||||
if (ok && bo.getInvoiceItems() != null && !bo.getInvoiceItems().isEmpty()) {
|
||||
saveInvoiceItems("reimburse", add.getBizId(), bo.getInvoiceItems());
|
||||
}
|
||||
|
||||
if (ok && "pending".equalsIgnoreCase(add.getStatus())) {
|
||||
Long startUserId = LoginHelper.getUserId();
|
||||
|
||||
@@ -105,7 +122,11 @@ public class HrmReimburseReqServiceImpl implements IHrmReimburseReqService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(HrmReimburseReqBo bo) {
|
||||
HrmReimburseReq update = BeanUtil.toBean(bo, HrmReimburseReq.class);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
boolean updated = baseMapper.updateById(update) > 0;
|
||||
if (updated && bo.getInvoiceItems() != null) {
|
||||
saveInvoiceItems("reimburse", bo.getBizId(), bo.getInvoiceItems());
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -124,6 +145,25 @@ public class HrmReimburseReqServiceImpl implements IHrmReimburseReqService {
|
||||
return lqw;
|
||||
}
|
||||
|
||||
private void saveInvoiceItems(String bizType, Long bizId, List<HrmInvoiceItemBo> boList) {
|
||||
// 先清除旧数据,再插入新数据(更新场景兼容)
|
||||
invoiceItemMapper.delete(Wrappers.<HrmInvoiceItem>lambdaQuery()
|
||||
.eq(HrmInvoiceItem::getBizType, bizType)
|
||||
.eq(HrmInvoiceItem::getBizId, bizId));
|
||||
for (int i = 0; i < boList.size(); i++) {
|
||||
HrmInvoiceItemBo bo = boList.get(i);
|
||||
HrmInvoiceItem item = new HrmInvoiceItem();
|
||||
item.setBizType(bizType);
|
||||
item.setBizId(bizId);
|
||||
item.setOssId(bo.getOssId());
|
||||
item.setSortNo(bo.getSortNo() != null ? bo.getSortNo() : i);
|
||||
item.setItemName(bo.getItemName());
|
||||
item.setReason(bo.getReason());
|
||||
item.setAmount(bo.getAmount());
|
||||
invoiceItemMapper.insert(item);
|
||||
}
|
||||
}
|
||||
|
||||
private String defaultStatus(String status) {
|
||||
return status == null ? "draft" : status;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ import com.ruoyi.hrm.service.IHrmSealReqService;
|
||||
import com.ruoyi.oss.core.OssClient;
|
||||
import com.ruoyi.oss.entity.UploadResult;
|
||||
import com.ruoyi.oss.factory.OssFactory;
|
||||
import com.ruoyi.system.domain.vo.SysOssVo;
|
||||
import com.ruoyi.system.mapper.SysOssMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
@@ -28,7 +30,6 @@ import org.apache.pdfbox.pdmodel.PDPage;
|
||||
import org.apache.pdfbox.pdmodel.PDPageContentStream;
|
||||
import org.apache.pdfbox.pdmodel.common.PDRectangle;
|
||||
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -48,10 +49,59 @@ public class HrmSealReqServiceImpl implements IHrmSealReqService {
|
||||
private final HrmSealReqMapper baseMapper;
|
||||
private final StampProperties stampProperties;
|
||||
private final IHrmFlowInstanceService flowInstanceService;
|
||||
private final SysOssMapper sysOssMapper;
|
||||
|
||||
@Override
|
||||
public HrmSealReqVo queryById(Long bizId) {
|
||||
return baseMapper.selectVoWithProjectById(bizId);
|
||||
HrmSealReqVo vo = baseMapper.selectVoWithProjectById(bizId);
|
||||
if (vo != null) {
|
||||
vo.setPdfPageTotal(queryPdfPageTotal(bizId));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer queryPdfPageTotal(Long bizId) {
|
||||
HrmSealReqVo vo = baseMapper.selectVoWithProjectById(bizId);
|
||||
String applyFileIds = vo != null ? vo.getApplyFileIds() : null;
|
||||
if (applyFileIds == null || applyFileIds.trim().isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
String firstFileId = applyFileIds.split(",")[0].trim();
|
||||
if (firstFileId.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
String fileUrl = resolveSealPdfUrl(firstFileId);
|
||||
if (fileUrl == null || fileUrl.trim().isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
try (InputStream inputStream = getObject(fileUrl); PDDocument document = PDDocument.load(inputStream)) {
|
||||
return document.getNumberOfPages();
|
||||
} catch (Exception e) {
|
||||
log.warn("查询用印PDF页数失败 bizId={}, fileId={}, fileUrl={}", bizId, firstFileId, fileUrl, e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveObjectKey(String fileRef) {
|
||||
if (fileRef == null) {
|
||||
return null;
|
||||
}
|
||||
String ref = fileRef.trim();
|
||||
if (ref.isEmpty()) {
|
||||
return ref;
|
||||
}
|
||||
if (ref.startsWith("http://") || ref.startsWith("https://")) {
|
||||
int idx = ref.indexOf("/files/");
|
||||
if (idx >= 0) {
|
||||
return ref.substring(idx + "/files/".length());
|
||||
}
|
||||
idx = ref.indexOf("/files%2F");
|
||||
if (idx >= 0) {
|
||||
return ref.substring(idx + "/files%2F".length());
|
||||
}
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,6 +121,9 @@ public class HrmSealReqServiceImpl implements IHrmSealReqService {
|
||||
return baseMapper.selectVoWithProjectList(bo);
|
||||
}
|
||||
|
||||
/** 用印申请固定审批人:陆永强(信息化部,userId=1858417253738815490) */
|
||||
private static final Long SEAL_FIXED_APPROVER_USER_ID = 1858417253738815490L;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public HrmSealReqVo insertByBo(HrmSealReqBo bo) {
|
||||
@@ -79,22 +132,18 @@ public class HrmSealReqServiceImpl implements IHrmSealReqService {
|
||||
validEntityBeforeSave(add);
|
||||
boolean ok = baseMapper.insert(add) > 0;
|
||||
|
||||
// 只要传入了 tplId 或 manualAssigneeUserId,就代表需要启动流程
|
||||
Long tplId = bo.getTplId() != null ? bo.getTplId() : bo.getFlowTplId();
|
||||
boolean shouldStartFlow = tplId != null || bo.getManualAssigneeUserId() != null;
|
||||
|
||||
HrmSealReqVo bean = BeanUtil.toBean(add, HrmSealReqVo.class);
|
||||
if (ok && shouldStartFlow) {
|
||||
if (ok) {
|
||||
// 用印申请审批人写死成陆永强,忽略前端传的 tplId / manualAssigneeUserId
|
||||
HrmFlowStartBo start = new HrmFlowStartBo();
|
||||
start.setTplId(tplId);
|
||||
start.setManualAssigneeUserId(bo.getManualAssigneeUserId());
|
||||
start.setTplId(null);
|
||||
start.setManualAssigneeUserId(SEAL_FIXED_APPROVER_USER_ID);
|
||||
start.setBizType("seal");
|
||||
start.setBizId(add.getBizId());
|
||||
start.setStartUserId(LoginHelper.getUserId());
|
||||
start.setContentJson(bo.getContentJson());
|
||||
|
||||
Long instId = flowInstanceService.startInstance(start);
|
||||
// 更新状态为流转中
|
||||
updateStatus(add.getBizId(), "running");
|
||||
bean.setInstId(instId);
|
||||
}
|
||||
@@ -269,6 +318,17 @@ public class HrmSealReqServiceImpl implements IHrmSealReqService {
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveSealPdfUrl(String ossIdText) {
|
||||
try {
|
||||
Long ossId = Long.valueOf(ossIdText);
|
||||
SysOssVo sysOss = sysOssMapper.selectVoById(ossId);
|
||||
return sysOss != null ? sysOss.getUrl() : null;
|
||||
} catch (Exception e) {
|
||||
log.warn("解析用印PDF文件地址失败 ossIdText={}", ossIdText, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private InputStream getObject(String url) {
|
||||
OssClient storage = OssFactory.instance();
|
||||
return storage.getObjectContent(url);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.hrm.mapper.HrmEmergencyContactMapper">
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.hrm.domain.HrmEmergencyContact">
|
||||
<id column="contact_id" property="contactId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="dept_id" property="deptId"/>
|
||||
<result column="real_name" property="realName"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="id_card" property="idCard"/>
|
||||
<result column="gender" property="gender"/>
|
||||
<result column="age" property="age"/>
|
||||
<result column="company_name" property="companyName"/>
|
||||
<result column="hire_date" property="hireDate"/>
|
||||
<result column="emergency_contact" property="emergencyContact"/>
|
||||
<result column="relationship" property="relationship"/>
|
||||
<result column="emergency_phone1" property="emergencyPhone1"/>
|
||||
<result column="emergency_phone2" property="emergencyPhone2"/>
|
||||
<result column="emergency_address" property="emergencyAddress"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
47
fad-rolling-mill/migration_layer1.js
Normal file
47
fad-rolling-mill/migration_layer1.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const mysql = require('mysql2/promise');
|
||||
|
||||
async function run() {
|
||||
const conn = await mysql.createConnection({
|
||||
host: '49.232.154.205',
|
||||
port: 13306,
|
||||
user: 'root',
|
||||
password: 'Root@12345',
|
||||
database: 'fad_oa_dev'
|
||||
});
|
||||
|
||||
console.log('Connected. Running migration...\n');
|
||||
|
||||
// 1. Add manager_id to fad_rm_project
|
||||
await conn.execute(`
|
||||
ALTER TABLE fad_rm_project
|
||||
ADD COLUMN manager_id BIGINT DEFAULT NULL COMMENT '项目经理用户ID,关联sys_user.user_id'
|
||||
AFTER manager
|
||||
`);
|
||||
console.log('✓ Added manager_id to fad_rm_project');
|
||||
|
||||
// 2. Create fad_rm_project_member table
|
||||
await conn.execute(`
|
||||
CREATE TABLE IF NOT EXISTS fad_rm_project_member (
|
||||
member_id BIGINT NOT NULL AUTO_INCREMENT COMMENT '成员ID',
|
||||
project_id BIGINT NOT NULL COMMENT '项目ID',
|
||||
user_id BIGINT NOT NULL COMMENT '用户ID',
|
||||
role VARCHAR(50) DEFAULT 'member' COMMENT '角色: manager/member/viewer',
|
||||
create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
|
||||
create_time DATETIME DEFAULT NULL COMMENT '创建时间',
|
||||
update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
|
||||
update_time DATETIME DEFAULT NULL COMMENT '更新时间',
|
||||
del_flag INT DEFAULT 0 COMMENT '删除标志',
|
||||
PRIMARY KEY (member_id),
|
||||
UNIQUE KEY uk_project_user (project_id, user_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目成员表'
|
||||
`);
|
||||
console.log('✓ Created fad_rm_project_member table');
|
||||
|
||||
await conn.end();
|
||||
console.log('\nMigration complete!');
|
||||
}
|
||||
|
||||
run().catch(err => {
|
||||
console.error('Migration failed:', err.message);
|
||||
process.exit(1);
|
||||
});
|
||||
40
fad-rolling-mill/pom.xml
Normal file
40
fad-rolling-mill/pom.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-flowable-plus</artifactId>
|
||||
<version>0.8.3</version>
|
||||
</parent>
|
||||
<artifactId>fad-rolling-mill</artifactId>
|
||||
<name>fad-rolling-mill</name>
|
||||
<description>连轧机/可逆轧机设备总包项目管理系统</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-annotation</artifactId>
|
||||
<version>3.5.9</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.35</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
132
fad-rolling-mill/seed_data.js
Normal file
132
fad-rolling-mill/seed_data.js
Normal file
@@ -0,0 +1,132 @@
|
||||
const mysql = require('mysql2/promise');
|
||||
|
||||
async function run() {
|
||||
const conn = await mysql.createConnection({
|
||||
host: '49.232.154.205', port: 13306, user: 'root', password: 'Root@12345',
|
||||
database: 'fad_oa_dev',
|
||||
supportBigNumbers: true,
|
||||
bigNumberStrings: true
|
||||
});
|
||||
|
||||
// 获取真实项目ID(避免JS Number精度丢失)
|
||||
const [projs] = await conn.execute('SELECT project_id, project_name FROM fad_rm_project ORDER BY project_id');
|
||||
const PROJ_A = projs[0].project_id; // 1380mm六辊可逆轧机设备总包项目
|
||||
const PROJ_B = projs[1].project_id; // 测试项目A
|
||||
console.log('项目A ID:', PROJ_A, projs[0].project_name);
|
||||
console.log('项目B ID:', PROJ_B, projs[1].project_name);
|
||||
console.log('');
|
||||
|
||||
// 清除两项目现有数据
|
||||
const tables = ['fad_rm_budget','fad_rm_tech_plan_item','fad_rm_layout_file','fad_rm_tech_review_item','fad_rm_drawing_design','fad_rm_drawing_review','fad_rm_procurement_progress','fad_rm_mfg_device','fad_rm_drawing_compare','fad_rm_doc_lib','fad_rm_site_mod','fad_rm_shipping_checklist','fad_rm_manual','fad_rm_install_tool','fad_rm_install_feedback','fad_rm_acceptance_checklist','fad_rm_commissioning_checklist'];
|
||||
for (const t of tables) {
|
||||
await conn.execute('DELETE FROM ' + t + ' WHERE project_id IN (?,?)', [PROJ_A, PROJ_B]);
|
||||
}
|
||||
console.log('已清除两项目旧数据\n');
|
||||
|
||||
//==================== 项目A:6 done + 5 progress + 6 pending ====================
|
||||
console.log('--- 项目A:1380mm六辊可逆轧机设备总包项目 ---');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_budget (project_id,category,item,budget_amount,spent_amount,status) VALUES (?,?,?,?,?,?)", [PROJ_A,'电气','主电机','500000','480000','approved']);
|
||||
await conn.execute("INSERT INTO fad_rm_budget (project_id,category,item,budget_amount,spent_amount,status) VALUES (?,?,?,?,?,?)", [PROJ_A,'机械','轧机机架','800000','790000','approved']);
|
||||
await conn.execute("INSERT INTO fad_rm_budget (project_id,category,item,budget_amount,spent_amount,status) VALUES (?,?,?,?,?,?)", [PROJ_A,'液压','液压站','300000','290000','approved']);
|
||||
console.log(' budget: 3条 (全部approved → done)');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_tech_plan_item (project_id,item_name,description,owner,status) VALUES (?,?,?,?,?)", [PROJ_A,'1380mm六辊轧机技术方案','主传动系统方案设计','张工','approved']);
|
||||
await conn.execute("INSERT INTO fad_rm_tech_plan_item (project_id,item_name,description,owner,status) VALUES (?,?,?,?,?)", [PROJ_A,'AGC液压系统方案','厚度自动控制系统','李工','pending']);
|
||||
console.log(' tech_plan: 2条 → progress');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_layout_file (project_id,file_name,file_type,status) VALUES (?,?,?,?)", [PROJ_A,'车间总布局图','dwg','approved']);
|
||||
await conn.execute("INSERT INTO fad_rm_layout_file (project_id,file_name,file_type,status) VALUES (?,?,?,?)", [PROJ_A,'设备基础图','pdf','pending']);
|
||||
console.log(' layout: 2条 → progress');
|
||||
|
||||
console.log(' tech_review: 0条 → pending');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_drawing_design (project_id,drawing_name,drawing_no,drawer,status) VALUES (?,?,?,?,?)", [PROJ_A,'轧机机架装配图','DR-001','王工','approved']);
|
||||
await conn.execute("INSERT INTO fad_rm_drawing_design (project_id,drawing_name,drawing_no,drawer,status) VALUES (?,?,?,?,?)", [PROJ_A,'主传动系统图','DR-002','王工','approved']);
|
||||
console.log(' drawing_design: 2条 (全部approved → done)');
|
||||
|
||||
console.log(' drawing_review: 0条 → pending');
|
||||
console.log(' procurement: 0条 → pending');
|
||||
console.log(' manufacturing: 0条 → pending');
|
||||
console.log(' drawing_compare: 0条 → pending');
|
||||
console.log(' doc_lib: 0条 → pending');
|
||||
console.log(' site_mod: 0条 → pending');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_shipping_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)", [PROJ_A,'主电机','1','1']);
|
||||
await conn.execute("INSERT INTO fad_rm_shipping_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)", [PROJ_A,'轧机机架','1','2']);
|
||||
await conn.execute("INSERT INTO fad_rm_shipping_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)", [PROJ_A,'液压站','1','3']);
|
||||
console.log(' shipping: 3条 (全部已勾选 → done)');
|
||||
|
||||
console.log(' manuals: 0条 → pending');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_install_tool (project_id,name,spec,qty,unit,status,category) VALUES (?,?,?,?,?,?,?)", [PROJ_A,'千斤顶','50T','4','台','已到位','起重工具']);
|
||||
await conn.execute("INSERT INTO fad_rm_install_tool (project_id,name,spec,qty,unit,status,category) VALUES (?,?,?,?,?,?,?)", [PROJ_A,'扭力扳手','200N·m','2','把','待确认','安装工具']);
|
||||
await conn.execute("INSERT INTO fad_rm_install_tool (project_id,name,spec,qty,unit,status,category) VALUES (?,?,?,?,?,?,?)", [PROJ_A,'水平仪','0.02mm/m','1','台','待确认','测量工具']);
|
||||
console.log(' install_tool: 3条 → progress');
|
||||
|
||||
console.log(' install_feedback: 0条 → pending');
|
||||
console.log(' acceptance: 0条 → pending');
|
||||
console.log(' commissioning: 0条 → pending');
|
||||
|
||||
//==================== 项目B:3 done + 8 progress + 6 pending ====================
|
||||
console.log('\n--- 项目B:测试项目A ---');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_budget (project_id,category,item,budget_amount,spent_amount,status) VALUES (?,?,?,?,?,?)", [PROJ_B,'电气','传感器','50000','30000','approved']);
|
||||
await conn.execute("INSERT INTO fad_rm_budget (project_id,category,item,budget_amount,spent_amount,status) VALUES (?,?,?,?,?,?)", [PROJ_B,'机械','支架','80000','0','draft']);
|
||||
console.log(' budget: 2条 (1 approved → progress)');
|
||||
|
||||
console.log(' tech_plan: 0条 → pending');
|
||||
console.log(' layout: 0条 → pending');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_tech_review_item (project_id,review_type,item_name,conclusion,reviewer) VALUES (?,?,?,?,?)", [PROJ_B,'电气','PLC控制柜方案','approved','赵工']);
|
||||
await conn.execute("INSERT INTO fad_rm_tech_review_item (project_id,review_type,item_name,conclusion,reviewer) VALUES (?,?,?,?,?)", [PROJ_B,'机械','底座安装方案','pending','钱工']);
|
||||
console.log(' tech_review: 2条 → progress');
|
||||
|
||||
console.log(' drawing_design: 0条 → pending');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_drawing_review (project_id,drawing_name,drawing_no,reviewer,status) VALUES (?,?,?,?,?)", [PROJ_B,'底座基础图','BASE-001','孙工','approved']);
|
||||
console.log(' drawing_review: 1条 (approved → done)');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_procurement_progress (project_id,item_name,supplier_name,amount,current_stage) VALUES (?,?,?,?,?)", [PROJ_B,'电机','上海电机厂','120000','1']);
|
||||
await conn.execute("INSERT INTO fad_rm_procurement_progress (project_id,item_name,supplier_name,amount,current_stage) VALUES (?,?,?,?,?)", [PROJ_B,'减速机','南京减速机厂','80000','2']);
|
||||
console.log(' procurement: 2条 → progress');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_mfg_device (project_id,device_name,spec,supplier_name,delivery_date) VALUES (?,?,?,?,?)", [PROJ_B,'主电机','500kW','上海电机厂','2026-08-15']);
|
||||
await conn.execute("INSERT INTO fad_rm_mfg_device (project_id,device_name,spec,supplier_name,delivery_date) VALUES (?,?,?,?,?)", [PROJ_B,'减速机','ZLY560','南京减速机厂','2026-09-01']);
|
||||
console.log(' manufacturing: 2条 → progress');
|
||||
|
||||
console.log(' drawing_compare: 0条 → pending');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_doc_lib (project_id,doc_name,category,version,uploader,description) VALUES (?,?,?,?,?,?)", [PROJ_B,'技术规格书','技术文档','V1.0','周工','电机技术参数']);
|
||||
await conn.execute("INSERT INTO fad_rm_doc_lib (project_id,doc_name,category,version,uploader,description) VALUES (?,?,?,?,?,?)", [PROJ_B,'检测报告','质检报告','V1.0','吴工','出厂检测报告']);
|
||||
console.log(' doc_lib: 2条 → progress');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_site_mod (project_id,device_name,location,mod_reason,status) VALUES (?,?,?,?,?)", [PROJ_B,'底座','基础坑','基础尺寸偏差20mm','pending']);
|
||||
console.log(' site_mod: 1条 → progress');
|
||||
|
||||
console.log(' shipping: 0条 → pending');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_manual (project_id,manual_name,doc_type,version,description) VALUES (?,?,?,?,?)", [PROJ_B,'操作手册','说明书','V1.0','主电机操作说明']);
|
||||
await conn.execute("INSERT INTO fad_rm_manual (project_id,manual_name,doc_type,version,description) VALUES (?,?,?,?,?)", [PROJ_B,'维护手册','维护手册','V1.0','日常维护指南']);
|
||||
console.log(' manuals: 2条 → progress');
|
||||
|
||||
console.log(' install_tool: 0条 → pending');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_install_feedback (project_id,title,location,issue_desc,status) VALUES (?,?,?,?,?)", [PROJ_B,'地脚螺栓孔偏位','基础坑','地脚螺栓孔位偏差5mm','pending']);
|
||||
await conn.execute("INSERT INTO fad_rm_install_feedback (project_id,title,location,issue_desc,status) VALUES (?,?,?,?,?)", [PROJ_B,'电缆预留不足','电气室','进线电缆预留长度不够','solved']);
|
||||
console.log(' install_feedback: 2条 → progress');
|
||||
|
||||
await conn.execute("INSERT INTO fad_rm_acceptance_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)", [PROJ_B,'设备外观检查','1','1']);
|
||||
await conn.execute("INSERT INTO fad_rm_acceptance_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)", [PROJ_B,'安装精度检查','1','2']);
|
||||
await conn.execute("INSERT INTO fad_rm_acceptance_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)", [PROJ_B,'电气接线检查','1','3']);
|
||||
console.log(' acceptance: 3条 (全部已勾选 → done)');
|
||||
|
||||
console.log(' commissioning: 0条 → pending');
|
||||
|
||||
await conn.end();
|
||||
console.log('\n=== 测试数据插入完成 ===');
|
||||
console.log('项目A: 3 done (budget, drawing_design, shipping) + 3 progress (tech_plan, layout, install_tool) + 11 pending');
|
||||
console.log('项目B: 2 done (drawing_review, acceptance) + 8 progress + 7 pending');
|
||||
}
|
||||
|
||||
run().catch(e => { console.error(e); process.exit(1); });
|
||||
585
fad-rolling-mill/seed_test_a.js
Normal file
585
fad-rolling-mill/seed_test_a.js
Normal file
@@ -0,0 +1,585 @@
|
||||
const mysql = require('mysql2/promise');
|
||||
|
||||
async function run() {
|
||||
const conn = await mysql.createConnection({
|
||||
host: '49.232.154.205', port: 13306, user: 'root', password: 'Root@12345',
|
||||
database: 'fad_oa_dev',
|
||||
supportBigNumbers: true,
|
||||
bigNumberStrings: true
|
||||
});
|
||||
|
||||
// 获取测试项目A的ID
|
||||
const [projs] = await conn.execute(
|
||||
"SELECT project_id, project_name FROM fad_rm_project WHERE project_name LIKE '%测试%' ORDER BY project_id LIMIT 1"
|
||||
);
|
||||
if (projs.length === 0) {
|
||||
console.error('未找到测试项目');
|
||||
await conn.end();
|
||||
return;
|
||||
}
|
||||
const PID = projs[0].project_id;
|
||||
console.log('测试项目A ID:', PID, projs[0].project_name);
|
||||
|
||||
// 清除该项目所有旧数据
|
||||
// 注:fad_rm_mfg_stage 通过 device_id 关联,fad_rm_site_mod_media 通过 mod_id 关联,单独处理
|
||||
const tables = [
|
||||
'fad_rm_budget','fad_rm_tech_plan_item','fad_rm_layout_file','fad_rm_tech_review_item',
|
||||
'fad_rm_drawing_design','fad_rm_drawing_review','fad_rm_procurement_quote',
|
||||
'fad_rm_procurement_contract','fad_rm_procurement_progress','fad_rm_mfg_device',
|
||||
'fad_rm_drawing_compare','fad_rm_doc_lib','fad_rm_site_mod',
|
||||
'fad_rm_shipping_checklist','fad_rm_shipping_item',
|
||||
'fad_rm_manual','fad_rm_install_tool','fad_rm_install_personnel',
|
||||
'fad_rm_install_precision','fad_rm_install_progress','fad_rm_install_daily',
|
||||
'fad_rm_install_handover','fad_rm_install_feedback','fad_rm_acceptance_item',
|
||||
'fad_rm_acceptance_checklist','fad_rm_commissioning_checklist',
|
||||
'fad_rm_commissioning_clause','fad_rm_commissioning_record'
|
||||
];
|
||||
for (const t of tables) {
|
||||
await conn.execute('DELETE FROM ' + t + ' WHERE project_id = ?', [PID]);
|
||||
}
|
||||
// 制造阶段通过 device_id 关联
|
||||
await conn.execute(
|
||||
'DELETE FROM fad_rm_mfg_stage WHERE device_id IN (SELECT device_id FROM fad_rm_mfg_device WHERE project_id = ?)',
|
||||
[PID]
|
||||
);
|
||||
// 现场修改多媒体通过 mod_id 关联
|
||||
await conn.execute('DELETE FROM fad_rm_site_mod_media WHERE mod_id IN (SELECT mod_id FROM fad_rm_site_mod WHERE project_id = ?)', [PID]);
|
||||
console.log('已清除测试项目A旧数据\n');
|
||||
|
||||
// =====================================================================
|
||||
// 1. 项目预算 fad_rm_budget
|
||||
// =====================================================================
|
||||
console.log('--- 1. 项目预算 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_budget (project_id,category,item,budget_amount,spent_amount,status) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '电气设备', '传感器模组', 50000, 30000, 'approved']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_budget (project_id,category,item,budget_amount,spent_amount,status) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '机械设备', '底座支架加工', 80000, 0, 'draft']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_budget (project_id,category,item,budget_amount,spent_amount,status) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '液压设备', '液压缸总成', 120000, 50000, 'approved']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_budget (project_id,category,item,budget_amount,spent_amount,status) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '安装费用', '现场安装调试费', 60000, 0, 'draft']
|
||||
);
|
||||
console.log(' 4条预算 √');
|
||||
|
||||
// =====================================================================
|
||||
// 2. 技术方案 fad_rm_tech_plan_item
|
||||
// =====================================================================
|
||||
console.log('--- 2. 技术方案 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_tech_plan_item (project_id,item_name,description,owner,status) VALUES (?,?,?,?,?)",
|
||||
[PID, 'PLC控制方案设计', '西门子S7-1500系列PLC控制方案', '赵工', 'done']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_tech_plan_item (project_id,item_name,description,owner,status) VALUES (?,?,?,?,?)",
|
||||
[PID, '液压系统方案', '液压站及管路布局设计', '钱工', 'progress']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_tech_plan_item (project_id,item_name,description,owner,status) VALUES (?,?,?,?,?)",
|
||||
[PID, '电气布线方案', '主电机及辅机电气管线走向', '孙工', 'pending']
|
||||
);
|
||||
console.log(' 3条方案 √');
|
||||
|
||||
// =====================================================================
|
||||
// 3. 布局图 fad_rm_layout_file
|
||||
// =====================================================================
|
||||
console.log('--- 3. 布局图 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_layout_file (project_id,file_name,file_type,upload_date,status,version,file_url) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, '设备基础布局图', 'DWG', '2026-06-01', 'approved', 'V1.0', '/upload/rm/layout/PID/base_layout.dwg']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_layout_file (project_id,file_name,file_type,upload_date,status,version,file_url) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, '电气室布局图', 'PDF', '2026-06-05', 'pending', 'V0.9', '/upload/rm/layout/PID/electrical_room.pdf']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_layout_file (project_id,file_name,file_type,upload_date,status,version,file_url) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, '液压站平面图', 'DWG', '2026-06-10', 'pending', 'V1.0', '/upload/rm/layout/PID/hydraulic_plan.dwg']
|
||||
);
|
||||
console.log(' 3个布局图 √');
|
||||
|
||||
// =====================================================================
|
||||
// 4. 技术审查 fad_rm_tech_review_item
|
||||
// =====================================================================
|
||||
console.log('--- 4. 技术审查 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_tech_review_item (project_id,review_type,item_name,conclusion,reviewer,review_date,review_opinion) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, 'electrical', 'PLC控制柜方案', 'pass', '赵工', '2026-06-08', '方案符合要求,同意通过']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_tech_review_item (project_id,review_type,item_name,conclusion,reviewer,review_date,review_opinion) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, 'mechanical', '底座安装方案', 'pending', '钱工', null, '待补充强度计算书']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_tech_review_item (project_id,review_type,item_name,conclusion,reviewer,review_date,review_opinion) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, 'hydraulic', '液压管路设计审查', 'pass', '孙工', '2026-06-12', '管路走向合理,密封选型正确']
|
||||
);
|
||||
console.log(' 3条审查 √');
|
||||
|
||||
// =====================================================================
|
||||
// 5. 图纸设计 fad_rm_drawing_design
|
||||
// =====================================================================
|
||||
console.log('--- 5. 图纸设计 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_drawing_design (project_id,drawing_name,drawing_no,version,drawing_type,drawer,start_date,end_date,file_url,status) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '底座基础图', 'BASE-001', 'V1.0', '零件图', '王工', '2026-05-20', '2026-06-01', '/upload/rm/dwg/PID/base_001.dwg', 'completed']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_drawing_design (project_id,drawing_name,drawing_no,version,drawing_type,drawer,start_date,end_date,file_url,status) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '电气原理图', 'ELEC-001', 'V0.8', '电气原理图', '周工', '2026-06-01', null, '/upload/rm/dwg/PID/elec_001.dwg', 'in_progress']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_drawing_design (project_id,drawing_name,drawing_no,version,drawing_type,drawer,start_date,end_date,file_url,status) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '液压系统图', 'HYD-001', 'V1.0', '液压原理图', '吴工', '2026-05-25', '2026-06-10', '/upload/rm/dwg/PID/hyd_001.dwg', 'completed']
|
||||
);
|
||||
console.log(' 3张图纸 √');
|
||||
|
||||
// =====================================================================
|
||||
// 6. 图纸审查 fad_rm_drawing_review
|
||||
// =====================================================================
|
||||
console.log('--- 6. 图纸审查 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_drawing_review (project_id,drawing_name,drawing_no,version,file_url,status,reviewer,review_date,review_opinion) VALUES (?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '底座基础图', 'BASE-001', 'V1.0', '/upload/rm/dwg/PID/base_001.dwg', 'approved', '孙工', '2026-06-05', '尺寸标注完整,同意通过']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_drawing_review (project_id,drawing_name,drawing_no,version,file_url,status,reviewer,review_date,review_opinion) VALUES (?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '电气原理图', 'ELEC-001', 'V0.8', '/upload/rm/dwg/PID/elec_001.dwg', 'pending', '李工', null, null]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_drawing_review (project_id,drawing_name,drawing_no,version,file_url,status,reviewer,review_date,review_opinion) VALUES (?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '液压系统图', 'HYD-001', 'V1.0', '/upload/rm/dwg/PID/hyd_001.dwg', 'approved', '赵工', '2026-06-12', '液压原理正确,同意通过']
|
||||
);
|
||||
console.log(' 3条审查 √');
|
||||
|
||||
// =====================================================================
|
||||
// 7. 采购管理
|
||||
// =====================================================================
|
||||
console.log('--- 7. 采购管理 ---');
|
||||
|
||||
// 7a. 供应商报价
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_procurement_quote (project_id,supplier_name,item_name,spec,qty,unit,unit_price,total_price,delivery_days,warranty_months,score_price,score_delivery,score_warranty,score_total,score_rank,status) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '上海电机厂', '主电机', '500kW', 1, '台', 120000, 120000, 45, 24, 8.5, 7.0, 9.0, 8.2, 1, '2']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_procurement_quote (project_id,supplier_name,item_name,spec,qty,unit,unit_price,total_price,delivery_days,warranty_months,score_price,score_delivery,score_warranty,score_total,score_rank,status) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '南京减速机厂', '减速机', 'ZLY560', 1, '台', 80000, 80000, 60, 18, 7.5, 6.5, 8.0, 7.3, 2, '1']
|
||||
);
|
||||
|
||||
// 7b. 采购合同
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_procurement_contract (project_id,contract_no,contract_name,supplier_name,total_amount,sign_date,file_url,status,clauses,penalty_clause) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, 'CG-2026-001', '主电机采购合同', '上海电机厂', 120000, '2026-06-01', '/upload/rm/contract/PID/motor_contract.pdf', 'signed', '1. 供方提供500kW主电机1台\n2. 交货期45天\n3. 质保期24个月', '逾期交货按合同总价0.5%/天罚款']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_procurement_contract (project_id,contract_no,contract_name,supplier_name,total_amount,sign_date,file_url,status,clauses,penalty_clause) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, 'CG-2026-002', '减速机采购合同', '南京减速机厂', 80000, '2026-06-05', '/upload/rm/contract/PID/reducer_contract.pdf', 'draft', '1. 供方提供ZLY560减速机1台\n2. 交货期60天', '']
|
||||
);
|
||||
|
||||
// 7c. 采购进度
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_procurement_progress (project_id,item_name,supplier_name,contract_no,amount,order_date,current_stage,expect_date,actual_date,stages) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '主电机', '上海电机厂', 'CG-2026-001', 120000, '2026-06-01', '5', '2026-07-15', null, '{"0":"done","1":"done","2":"done","3":"done","4":"done","5":"progress"}']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_procurement_progress (project_id,item_name,supplier_name,contract_no,amount,order_date,current_stage,expect_date,actual_date,stages) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '减速机', '南京减速机厂', 'CG-2026-002', 80000, '2026-06-05', '2', '2026-08-01', null, '{"0":"done","1":"done","2":"progress"}']
|
||||
);
|
||||
console.log(' 报价2条 + 合同2份 + 进度2条 √');
|
||||
|
||||
// =====================================================================
|
||||
// 8. 制造进度
|
||||
// =====================================================================
|
||||
console.log('--- 8. 制造进度 ---');
|
||||
// 设备1: 主电机
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_mfg_device (project_id,device_name,spec,supplier_name,contract_no,order_date,delivery_date,penalty_rate) VALUES (?,?,?,?,?,?,?,?)",
|
||||
[PID, '主电机', '500kW', '上海电机厂', 'CG-2026-001', '2026-06-01', '2026-07-15', 500]
|
||||
);
|
||||
const [dev1] = await conn.execute('SELECT LAST_INSERT_ID() as id');
|
||||
const DEV1_ID = dev1[0].id;
|
||||
// 主电机制造阶段
|
||||
const stages1 = [
|
||||
['0', '原材料采购', '2', '2026-06-01', '2026-06-10', '2026-06-01', '2026-06-09', 1],
|
||||
['1', '机加工', '2', '2026-06-11', '2026-06-20', '2026-06-11', '2026-06-19', 2],
|
||||
['2', '绕组焊接', '2', '2026-06-21', '2026-06-28', '2026-06-21', '2026-06-27', 3],
|
||||
['3', '组装', '1', '2026-06-29', '2026-07-05', '2026-06-29', null, 4],
|
||||
['4', '喷漆', '0', '2026-07-06', '2026-07-08', null, null, 5],
|
||||
['5', '验收', '0', '2026-07-09', '2026-07-12', null, null, 6],
|
||||
['6', '包装', '0', '2026-07-13', '2026-07-13', null, null, 7],
|
||||
['7', '发货', '0', '2026-07-14', '2026-07-15', null, null, 8],
|
||||
];
|
||||
for (const st of stages1) {
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_mfg_stage (device_id,stage_key,stage_name,status,plan_start_date,plan_end_date,actual_start,actual_end,sort_order) VALUES (?,?,?,?,?,?,?,?,?)",
|
||||
[DEV1_ID, st[0], st[1], st[2], st[3], st[4], st[5], st[6], st[7]]
|
||||
);
|
||||
}
|
||||
|
||||
// 设备2: 减速机
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_mfg_device (project_id,device_name,spec,supplier_name,contract_no,order_date,delivery_date,penalty_rate) VALUES (?,?,?,?,?,?,?,?)",
|
||||
[PID, '减速机', 'ZLY560', '南京减速机厂', 'CG-2026-002', '2026-06-05', '2026-08-01', 300]
|
||||
);
|
||||
const [dev2] = await conn.execute('SELECT LAST_INSERT_ID() as id');
|
||||
const DEV2_ID = dev2[0].id;
|
||||
const stages2 = [
|
||||
['0', '原材料采购', '2', '2026-06-05', '2026-06-15', '2026-06-05', '2026-06-14', 1],
|
||||
['1', '机加工', '2', '2026-06-16', '2026-06-30', '2026-06-16', '2026-06-28', 2],
|
||||
['2', '焊接', '1', '2026-07-01', '2026-07-10', '2026-07-01', null, 3],
|
||||
['3', '组装', '0', '2026-07-11', '2026-07-18', null, null, 4],
|
||||
['4', '喷漆', '0', '2026-07-19', '2026-07-20', null, null, 5],
|
||||
['5', '验收', '0', '2026-07-21', '2026-07-25', null, null, 6],
|
||||
['6', '包装', '0', '2026-07-26', '2026-07-27', null, null, 7],
|
||||
['7', '发货', '0', '2026-07-28', '2026-08-01', null, null, 8],
|
||||
];
|
||||
for (const st of stages2) {
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_mfg_stage (device_id,stage_key,stage_name,status,plan_start_date,plan_end_date,actual_start,actual_end,sort_order) VALUES (?,?,?,?,?,?,?,?,?)",
|
||||
[DEV2_ID, st[0], st[1], st[2], st[3], st[4], st[5], st[6], st[7]]
|
||||
);
|
||||
}
|
||||
console.log(' 2台设备 + 16个阶段 √');
|
||||
|
||||
// =====================================================================
|
||||
// 9. 图纸优化比较 fad_rm_drawing_compare
|
||||
// =====================================================================
|
||||
console.log('--- 9. 图纸优化比较 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_drawing_compare (project_id,drawing_name,old_version,new_version,optimizer,compare_date,status,before_desc,after_desc,old_file_url,new_file_url,diff_notes) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '底座基础图', 'V1.0', 'V1.1', '王工', '2026-06-15', 'approved', '原始设计地脚螺栓孔距为800mm,现场反馈偏大',
|
||||
'优化为760mm,与设备实际安装孔距匹配', '/upload/rm/dwg/PID/base_001_v1.0.dwg', '/upload/rm/dwg/PID/base_001_v1.1.dwg',
|
||||
'孔距调整:800→760mm;增加4个M24螺纹孔']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_drawing_compare (project_id,drawing_name,old_version,new_version,optimizer,compare_date,status,before_desc,after_desc,old_file_url,new_file_url,diff_notes) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '电气原理图', 'V1.0', 'V1.1', '周工', '2026-06-16', 'pending', '原设计主电机回路未设置软启动器',
|
||||
'增加软启动器及旁路接触器', '/upload/rm/dwg/PID/elec_001_v1.0.dwg', '/upload/rm/dwg/PID/elec_001_v1.1.dwg',
|
||||
'新增软启动器回路;调整热继电器整定值']
|
||||
);
|
||||
console.log(' 2条优化记录 √');
|
||||
|
||||
// =====================================================================
|
||||
// 10. 资料库 fad_rm_doc_lib
|
||||
// =====================================================================
|
||||
console.log('--- 10. 资料库 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_doc_lib (project_id,doc_name,category,file_url) VALUES (?,?,?,?)",
|
||||
[PID, '电机技术规格书', '技术文档', '/upload/rm/doc/PID/motor_spec.pdf']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_doc_lib (project_id,doc_name,category,file_url) VALUES (?,?,?,?)",
|
||||
[PID, '出厂检测报告', '质检报告', '/upload/rm/doc/PID/inspection_report.pdf']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_doc_lib (project_id,doc_name,category,file_url) VALUES (?,?,?,?)",
|
||||
[PID, '安装手册', '技术文档', '/upload/rm/doc/PID/install_manual.pdf']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_doc_lib (project_id,doc_name,category,file_url) VALUES (?,?,?,?)",
|
||||
[PID, '验收报告模板', '质检报告', '/upload/rm/doc/PID/acceptance_template.pdf']
|
||||
);
|
||||
console.log(' 4份资料 √');
|
||||
|
||||
// =====================================================================
|
||||
// 11. 现场修改 fad_rm_site_mod + media
|
||||
// =====================================================================
|
||||
console.log('--- 11. 现场修改 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_site_mod (project_id,device_name,location,mod_reason,solution,mod_person,mod_date,status,prevent_action,drawing_updated) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '底座', '基础坑', '地脚螺栓孔位偏差20mm', '现场扩孔处理,增加垫片调整', '李工', '2026-06-10', 'done',
|
||||
'加强来料检验,增加出厂前预装工序', '1']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_site_mod (project_id,device_name,location,mod_reason,solution,mod_person,mod_date,status,prevent_action,drawing_updated) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '电机', '电机基础', '电机底座与基础安装孔距不匹配', '重新加工电机底座安装板', '王工', '2026-06-12', 'pending',
|
||||
'要求供应商提供实物尺寸确认后再出图', '0']
|
||||
);
|
||||
// 现场修改多媒体
|
||||
const [modRows] = await conn.execute(
|
||||
"SELECT mod_id FROM fad_rm_site_mod WHERE project_id = ? ORDER BY mod_id LIMIT 1", [PID]
|
||||
);
|
||||
if (modRows.length > 0) {
|
||||
const MOD_ID = modRows[0].mod_id;
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_site_mod_media (mod_id,media_type,file_name,file_url,file_size) VALUES (?,?,?,?,?)",
|
||||
[MOD_ID, 'image', '地脚螺栓偏差.jpg', '/upload/rm/site/PID/bolt_deviation.jpg', 204800]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_site_mod_media (mod_id,media_type,file_name,file_url,file_size) VALUES (?,?,?,?,?)",
|
||||
[MOD_ID, 'image', '扩孔处理后.jpg', '/upload/rm/site/PID/after_repair.jpg', 153600]
|
||||
);
|
||||
}
|
||||
console.log(' 2条修改记录 + 2张现场照片 √');
|
||||
|
||||
// =====================================================================
|
||||
// 12. 发货清单
|
||||
// =====================================================================
|
||||
console.log('--- 12. 发货清单 ---');
|
||||
|
||||
// 12a. 发货前CheckList
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_shipping_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '主电机已装箱固定', '1', 1]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_shipping_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '减速机已打包防锈', '1', 2]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_shipping_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '随机备件清点齐全', '0', 3]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_shipping_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '技术资料已随货', '0', 4]
|
||||
);
|
||||
|
||||
// 12b. 发货设备项
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_shipping_item (project_id,device_name,spec,qty,packed,photos,note,destination,ship_date,status) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '主电机', '500kW', 2, '1', '["motor_packed_1.jpg","motor_packed_2.jpg"]', '注意防潮', '江苏张家港项目现场', '2026-07-20', '0']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_shipping_item (project_id,device_name,spec,qty,packed,photos,note,destination,ship_date,status) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '减速机', 'ZLY560', 1, '0', '[]', '轻拿轻放', '江苏张家港项目现场', null, '0']
|
||||
);
|
||||
console.log(' 4条CheckList + 2项设备 √');
|
||||
|
||||
// =====================================================================
|
||||
// 13. 说明书 fad_rm_manual
|
||||
// =====================================================================
|
||||
console.log('--- 13. 说明书 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_manual (project_id,manual_name,doc_type,version,upload_date,file_url,description) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, '主电机操作手册', '说明书', 'V1.0', '2026-06-01', '/upload/rm/manual/PID/motor_manual.pdf', '500kW主电机操作与维护说明']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_manual (project_id,manual_name,doc_type,version,upload_date,file_url,description) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, '减速机维护手册', '维护手册', 'V1.0', '2026-06-05', '/upload/rm/manual/PID/reducer_maintenance.pdf', 'ZLY560减速机日常维护指南']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_manual (project_id,manual_name,doc_type,version,upload_date,file_url,description) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, '随机备件清单', '备件清单', 'V1.0', '2026-06-10', '/upload/rm/manual/PID/spare_parts.pdf', '随机备件明细及订购信息']
|
||||
);
|
||||
console.log(' 3份说明书 √');
|
||||
|
||||
// =====================================================================
|
||||
// 14. 安装准备(6张子表)
|
||||
// =====================================================================
|
||||
console.log('--- 14. 安装准备 ---');
|
||||
|
||||
// 14a. 安装工具
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_tool (project_id,name,name_en,spec,qty,unit,unit_price,total_price,priority,arrival_date,purpose,responsible,status,category) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '千斤顶', 'Jack', '50T', 4, '台', 1200, 4800, '高', '2026-06-01', '设备就位顶升', '刘工', '已到位', '起重吊装']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_tool (project_id,name,name_en,spec,qty,unit,unit_price,total_price,priority,arrival_date,purpose,responsible,status,category) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '扭力扳手', 'Torque Wrench', '200N·m', 2, '把', 850, 1700, '中', '2026-06-05', '螺栓紧固', '刘工', '已到位', '机械安装']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_tool (project_id,name,name_en,spec,qty,unit,unit_price,total_price,priority,arrival_date,purpose,responsible,status,category) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '水平仪', 'Level Meter', '0.02mm/m', 1, '台', 3500, 3500, '高', '2026-06-10', '设备水平度检测', '陈工', '已到位', '测量仪器']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_tool (project_id,name,name_en,spec,qty,unit,unit_price,total_price,priority,arrival_date,purpose,responsible,status,category) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '激光对中仪', 'Laser Aligner', '0.001mm', 1, '台', 28000, 28000, '高', '2026-06-15', '联轴器对中', '陈工', '待确认', '测量仪器']
|
||||
);
|
||||
|
||||
// 14b. 安装人员
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_personnel (project_id,name,name_en,position,position_en,plan_in,plan_out,days,daily_rate,total_wages,duty,qualification,phone) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '刘建国', 'Liu JG', '安装队长', 'Installation Foreman', '2026-06-15', '2026-08-30', 76, 500, 38000, '现场安装总协调', '10年以上安装经验', '13800001111']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_personnel (project_id,name,name_en,position,position_en,plan_in,plan_out,days,daily_rate,total_wages,duty,qualification,phone) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '陈伟', 'Chen W', '机械安装工', 'Mechanical Fitter', '2026-06-15', '2026-08-30', 76, 350, 26600, '机械设备安装', '中级钳工', '13800002222']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_personnel (project_id,name,name_en,position,position_en,plan_in,plan_out,days,daily_rate,total_wages,duty,qualification,phone) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '张明', 'Zhang M', '电气安装工', 'Electrician', '2026-06-20', '2026-08-15', 56, 400, 22400, '电气设备安装接线', '中级电工', '13800003333']
|
||||
);
|
||||
|
||||
// 14c. 安装精度标准
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_precision (project_id,system_name,item_name,name_en,target_value,unit,importance,tool,method_desc,standard_ref,requirement,is_qualified) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '轧辊系统', '辊缝平行度', 'Roll Gap Parallelism', '≤0.02', 'mm/m', '★★★', '精密水平仪', '使用水平仪在辊面两端测量',
|
||||
'GB/T 1239.2', '0.02mm/m以内', '1']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_precision (project_id,system_name,item_name,name_en,target_value,unit,importance,tool,method_desc,standard_ref,requirement,is_qualified) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '主机框架', '机架垂直度', 'Frame Verticality', '≤0.05', 'mm/m', '★★★', '经纬仪', '使用经纬仪测量机架四角立柱',
|
||||
'GB 50231', '0.05mm/m以内', '1']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_precision (project_id,system_name,item_name,name_en,target_value,unit,importance,tool,method_desc,standard_ref,requirement,is_qualified) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, 'AGC系统', '液压缸垂直度', 'Cylinder Verticality', '≤0.10', 'mm/m', '★★', '框式水平仪', '使用框式水平仪在缸体外壁测量',
|
||||
'JB/T 7929', '0.10mm/m以内', '0']
|
||||
);
|
||||
|
||||
// 14d. 安装进度计划
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_progress (project_id,item_name,plan_start,plan_end,actual_start,actual_end,status,delay_reason,images,videos) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '基础验收', '2026-06-15', '2026-06-20', '2026-06-15', '2026-06-19', 'done', null,
|
||||
'["foundation_1.jpg","foundation_2.jpg"]', '["foundation_check.mp4"]']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_progress (project_id,item_name,plan_start,plan_end,actual_start,actual_end,status,delay_reason,images,videos) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '底座安装', '2026-06-21', '2026-06-28', '2026-06-21', null, 'progress', null,
|
||||
'["base_install_1.jpg"]', '[]']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_progress (project_id,item_name,plan_start,plan_end,actual_start,actual_end,status,delay_reason,images,videos) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '主电机安装', '2026-06-29', '2026-07-10', null, null, 'pending', null, '[]', '[]']
|
||||
);
|
||||
|
||||
// 14e. 施工日志
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_daily (project_id,log_date,weather,temperature,work_content,photo_urls) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '2026-06-15', '晴', '28°C', '基础验收:检查基础尺寸、标高、地脚螺栓位置,完成验收记录',
|
||||
'["daily_0615_1.jpg","daily_0615_2.jpg"]']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_daily (project_id,log_date,weather,temperature,work_content,photo_urls) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '2026-06-16', '多云', '26°C', '基础清理:清除基础表面杂物,打磨地脚螺栓孔',
|
||||
'["daily_0616_1.jpg"]']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_daily (project_id,log_date,weather,temperature,work_content,photo_urls) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '2026-06-21', '晴', '30°C', '底座安装:底座吊装就位,初找水平',
|
||||
'["daily_0621_1.jpg","daily_0621_2.jpg","daily_0621_3.jpg"]']
|
||||
);
|
||||
|
||||
// 14f. 工序交接
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_handover (project_id,transfer_from,transfer_to,content,handover_date,sign_photo_url) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '土建施工队', '安装施工队', '设备基础及地脚螺栓验收交接,基础尺寸符合图纸要求', '2026-06-14', '/upload/rm/handover/PID/handover_001.jpg']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_handover (project_id,transfer_from,transfer_to,content,handover_date,sign_photo_url) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '安装施工队', '电气施工队', '电机基础已安装完成,移交电气施工队进行接线', '2026-06-28', null]
|
||||
);
|
||||
console.log(' 工具4件 + 人员3人 + 精度3项 + 进度3项 + 日志3条 + 交接2条 √');
|
||||
|
||||
// =====================================================================
|
||||
// 15. 安装问题反馈 fad_rm_install_feedback
|
||||
// =====================================================================
|
||||
console.log('--- 15. 安装问题反馈 ---');
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_feedback (project_id,device_name,title,location,issue_desc,proposer,issue_date,feedback_date,status,resolution,solution,prevent_action) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '底座', '地脚螺栓孔偏位', '基础坑', 'A列2号地脚螺栓孔位偏差5mm,无法安装', '刘建国', '2026-06-22', null,
|
||||
'pending', null, '现场扩孔至设计尺寸', '加强预埋件定位精度控制']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_feedback (project_id,device_name,title,location,issue_desc,proposer,issue_date,feedback_date,status,resolution,solution,prevent_action) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '电缆', '进线电缆预留不足', '电气室', '主电机进线电缆预留长度不够,需增加中间接线盒', '张明', '2026-06-23', '2026-06-25',
|
||||
'resolved', '已增加中间接线盒,电缆已接续完成', '增加一个中间接线盒过渡', '后续设计阶段预留足够电缆长度余量']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_install_feedback (project_id,device_name,title,location,issue_desc,proposer,issue_date,feedback_date,status,resolution,solution,prevent_action) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[PID, '液压站', '液压管接头渗油', '液压站', '液压站出口管接头处轻微渗油,需更换密封圈', '刘建国', '2026-06-24', '2026-06-26',
|
||||
'resolved', '已更换密封圈,打压测试无渗漏', '更换O型密封圈并重新紧固', '来料检验增加密封圈材质检测']
|
||||
);
|
||||
console.log(' 3条反馈 √');
|
||||
|
||||
// =====================================================================
|
||||
// 16. 安装验收
|
||||
// =====================================================================
|
||||
console.log('--- 16. 安装验收 ---');
|
||||
|
||||
// 16a. 验收条目
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_acceptance_item (project_id,item_name,standard,result,inspector,inspect_date) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '设备外观检查', '无锈蚀、无变形、无损伤', '1', '赵工', '2026-06-25']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_acceptance_item (project_id,item_name,standard,result,inspector,inspect_date) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '安装精度检查', '水平度≤0.05mm/m,垂直度≤0.05mm/m', '1', '赵工', '2026-06-25']
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_acceptance_item (project_id,item_name,standard,result,inspector,inspect_date) VALUES (?,?,?,?,?,?)",
|
||||
[PID, '电气接线检查', '接线正确,绝缘电阻≥1MΩ', '0', null, null]
|
||||
);
|
||||
|
||||
// 16b. 验收CheckList
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_acceptance_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '设备外观检查', '1', 1]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_acceptance_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '安装精度检查', '1', 2]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_acceptance_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '电气接线检查', '1', 3]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_acceptance_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '空载试运行', '0', 4]
|
||||
);
|
||||
console.log(' 验收条目3条 + CheckList4项 √');
|
||||
|
||||
// =====================================================================
|
||||
// 17. 热负荷试车
|
||||
// =====================================================================
|
||||
console.log('--- 17. 热负荷试车 ---');
|
||||
|
||||
// 17a. 试车CheckList
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_commissioning_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '冷却水系统已投入', '0', 1]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_commissioning_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '润滑系统已运行正常', '0', 2]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_commissioning_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '电气保护整定值已确认', '0', 3]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_commissioning_checklist (project_id,item_text,is_checked,sort_order) VALUES (?,?,?,?)",
|
||||
[PID, '紧急停止按钮功能测试通过', '0', 4]
|
||||
);
|
||||
|
||||
// 17b. 试车条款
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_commissioning_clause (project_id,clause_content,sort_order) VALUES (?,?,?)",
|
||||
[PID, '轧机在额定转速下连续运行2小时,轴承温升不超过40°C', 1]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_commissioning_clause (project_id,clause_content,sort_order) VALUES (?,?,?)",
|
||||
[PID, '轧制力控制系统响应时间不超过50ms', 2]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_commissioning_clause (project_id,clause_content,sort_order) VALUES (?,?,?)",
|
||||
[PID, '厚度控制精度达到±0.05mm', 3]
|
||||
);
|
||||
|
||||
// 17c. 试车记录
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_commissioning_record (project_id,record_date,record_type,param_name,param_value,result,issue_desc) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, '2026-06-26', '0', '电机空载电流', '120A', '1', null]
|
||||
);
|
||||
await conn.execute(
|
||||
"INSERT INTO fad_rm_commissioning_record (project_id,record_date,record_type,param_name,param_value,result,issue_desc) VALUES (?,?,?,?,?,?,?)",
|
||||
[PID, '2026-06-26', '0', '轴承温升', '35°C', '1', null]
|
||||
);
|
||||
console.log(' CheckList4项 + 条款3条 + 记录2条 √');
|
||||
|
||||
await conn.end();
|
||||
console.log('\n=======================================');
|
||||
console.log('测试项目A — 全部17阶段数据插入完成!');
|
||||
console.log('=======================================');
|
||||
}
|
||||
|
||||
run().catch(e => { console.error('插入失败:', e); process.exit(1); });
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmAcceptanceChecklistBo;
|
||||
import com.ruoyi.rm.domain.vo.RmAcceptanceChecklistVo;
|
||||
import com.ruoyi.rm.service.IRmAcceptanceChecklistService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/acceptanceChecklist")
|
||||
public class RmAcceptanceChecklistController extends BaseController {
|
||||
|
||||
private final IRmAcceptanceChecklistService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmAcceptanceChecklistVo> list(RmAcceptanceChecklistBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{checkId}")
|
||||
public R<RmAcceptanceChecklistVo> getInfo(@PathVariable @NotNull Long checkId) {
|
||||
return R.ok(service.queryById(checkId));
|
||||
}
|
||||
|
||||
@Log(title = "验收检查清单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmAcceptanceChecklistBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "验收检查清单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmAcceptanceChecklistBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "验收检查清单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{checkIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] checkIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(checkIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmAcceptanceChecklistVo>> all(RmAcceptanceChecklistBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmAcceptanceItemBo;
|
||||
import com.ruoyi.rm.domain.vo.RmAcceptanceItemVo;
|
||||
import com.ruoyi.rm.service.IRmAcceptanceItemService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/acceptanceItem")
|
||||
public class RmAcceptanceItemController extends BaseController {
|
||||
|
||||
private final IRmAcceptanceItemService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmAcceptanceItemVo> list(RmAcceptanceItemBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{acceptItemId}")
|
||||
public R<RmAcceptanceItemVo> getInfo(@PathVariable @NotNull Long acceptItemId) {
|
||||
return R.ok(service.queryById(acceptItemId));
|
||||
}
|
||||
|
||||
@Log(title = "安装验收项", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmAcceptanceItemBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装验收项", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmAcceptanceItemBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装验收项", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{acceptItemIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] acceptItemIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(acceptItemIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmAcceptanceItemVo>> all(RmAcceptanceItemBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmBudgetBo;
|
||||
import com.ruoyi.rm.domain.vo.RmBudgetVo;
|
||||
import com.ruoyi.rm.service.IRmBudgetService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/budget")
|
||||
public class RmBudgetController extends BaseController {
|
||||
|
||||
private final IRmBudgetService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmBudgetVo> list(RmBudgetBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{budgetId}")
|
||||
public R<RmBudgetVo> getInfo(@PathVariable @NotNull Long budgetId) {
|
||||
return R.ok(service.queryById(budgetId));
|
||||
}
|
||||
|
||||
@Log(title = "项目预算", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmBudgetBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "项目预算", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmBudgetBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "项目预算", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{budgetIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] budgetIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(budgetIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<List<RmBudgetVo>> all(RmBudgetBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmColorCardBo;
|
||||
import com.ruoyi.rm.domain.vo.RmColorCardVo;
|
||||
import com.ruoyi.rm.service.IRmColorCardService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/colorCard")
|
||||
public class RmColorCardController extends BaseController {
|
||||
|
||||
private final IRmColorCardService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmColorCardVo> list(RmColorCardBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{colorCardId}")
|
||||
public R<RmColorCardVo> getInfo(@PathVariable @NotNull Long colorCardId) {
|
||||
return R.ok(service.queryById(colorCardId));
|
||||
}
|
||||
|
||||
@Log(title = "色卡管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmColorCardBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "色卡管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmColorCardBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "色卡管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{colorCardIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] colorCardIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(colorCardIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmColorCardVo>> all(RmColorCardBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmCommissioningChecklistBo;
|
||||
import com.ruoyi.rm.domain.vo.RmCommissioningChecklistVo;
|
||||
import com.ruoyi.rm.service.IRmCommissioningChecklistService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/commissioningChecklist")
|
||||
public class RmCommissioningChecklistController extends BaseController {
|
||||
|
||||
private final IRmCommissioningChecklistService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmCommissioningChecklistVo> list(RmCommissioningChecklistBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{checkId}")
|
||||
public R<RmCommissioningChecklistVo> getInfo(@PathVariable @NotNull Long checkId) {
|
||||
return R.ok(service.queryById(checkId));
|
||||
}
|
||||
|
||||
@Log(title = "热负荷试车CheckList", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmCommissioningChecklistBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "热负荷试车CheckList", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmCommissioningChecklistBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "热负荷试车CheckList", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{checkIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] checkIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(checkIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmCommissioningChecklistVo>> all(RmCommissioningChecklistBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmCommissioningClauseBo;
|
||||
import com.ruoyi.rm.domain.vo.RmCommissioningClauseVo;
|
||||
import com.ruoyi.rm.service.IRmCommissioningClauseService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/commissioningClause")
|
||||
public class RmCommissioningClauseController extends BaseController {
|
||||
|
||||
private final IRmCommissioningClauseService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmCommissioningClauseVo> list(RmCommissioningClauseBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{clauseId}")
|
||||
public R<RmCommissioningClauseVo> getInfo(@PathVariable @NotNull Long clauseId) {
|
||||
return R.ok(service.queryById(clauseId));
|
||||
}
|
||||
|
||||
@Log(title = "热负荷试车条款", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmCommissioningClauseBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "热负荷试车条款", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmCommissioningClauseBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "热负荷试车条款", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{clauseIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] clauseIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(clauseIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmCommissioningClauseVo>> all(RmCommissioningClauseBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.core.validate.QueryGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.rm.domain.vo.RmCommissioningVo;
|
||||
import com.ruoyi.rm.domain.bo.RmCommissioningBo;
|
||||
import com.ruoyi.rm.service.IRmCommissioningService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/commissioning")
|
||||
public class RmCommissioningController extends BaseController {
|
||||
|
||||
private final IRmCommissioningService iRmCommissioningService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmCommissioningVo> list(RmCommissioningBo bo, PageQuery pageQuery) {
|
||||
return iRmCommissioningService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<List<RmCommissioningVo>> all(RmCommissioningBo bo) {
|
||||
return R.ok(iRmCommissioningService.queryList(bo));
|
||||
}
|
||||
|
||||
@GetMapping("/byProject/{projectId}")
|
||||
public R<RmCommissioningVo> getByProjectId(@PathVariable Long projectId) {
|
||||
return R.ok(iRmCommissioningService.queryByProjectId(projectId));
|
||||
}
|
||||
|
||||
@GetMapping("/{commissioningId}")
|
||||
public R<RmCommissioningVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long commissioningId) {
|
||||
return R.ok(iRmCommissioningService.queryById(commissioningId));
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
@RepeatSubmit()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody RmCommissioningBo bo) {
|
||||
return toAjax(iRmCommissioningService.insertByBo(bo));
|
||||
}
|
||||
|
||||
@PutMapping()
|
||||
@RepeatSubmit()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody RmCommissioningBo bo) {
|
||||
return toAjax(iRmCommissioningService.updateByBo(bo));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{commissioningIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] commissioningIds) {
|
||||
return toAjax(iRmCommissioningService.deleteWithValidByIds(Arrays.asList(commissioningIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.rm.service.IRmDashboardService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/dashboard")
|
||||
public class RmDashboardController extends BaseController {
|
||||
|
||||
private final IRmDashboardService dashboardService;
|
||||
|
||||
@GetMapping("/stageStatus/{projectId}")
|
||||
public R<Map<String, Object>> stageStatus(@PathVariable @NotNull Long projectId) {
|
||||
return R.ok(dashboardService.getStageStatus(projectId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmDocLibBo;
|
||||
import com.ruoyi.rm.domain.vo.RmDocLibVo;
|
||||
import com.ruoyi.rm.service.IRmDocLibService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/docLib")
|
||||
public class RmDocLibController extends BaseController {
|
||||
|
||||
private final IRmDocLibService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmDocLibVo> list(RmDocLibBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{docId}")
|
||||
public R<RmDocLibVo> getInfo(@PathVariable @NotNull Long docId) {
|
||||
return R.ok(service.queryById(docId));
|
||||
}
|
||||
|
||||
@Log(title = "图纸资料库", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmDocLibBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "图纸资料库", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmDocLibBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "图纸资料库", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{docIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] docIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(docIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmDocLibVo>> all(RmDocLibBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmDrawingCompareBo;
|
||||
import com.ruoyi.rm.domain.vo.RmDrawingCompareVo;
|
||||
import com.ruoyi.rm.service.IRmDrawingCompareService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/drawingCompare")
|
||||
public class RmDrawingCompareController extends BaseController {
|
||||
|
||||
private final IRmDrawingCompareService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmDrawingCompareVo> list(RmDrawingCompareBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{compareId}")
|
||||
public R<RmDrawingCompareVo> getInfo(@PathVariable @NotNull Long compareId) {
|
||||
return R.ok(service.queryById(compareId));
|
||||
}
|
||||
|
||||
@Log(title = "图纸优化比较", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmDrawingCompareBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "图纸优化比较", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmDrawingCompareBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "图纸优化比较", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{compareIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] compareIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(compareIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmDrawingCompareVo>> all(RmDrawingCompareBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmDrawingDesignBo;
|
||||
import com.ruoyi.rm.domain.vo.RmDrawingDesignVo;
|
||||
import com.ruoyi.rm.service.IRmDrawingDesignService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/drawingDesign")
|
||||
public class RmDrawingDesignController extends BaseController {
|
||||
|
||||
private final IRmDrawingDesignService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmDrawingDesignVo> list(RmDrawingDesignBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{drawingId}")
|
||||
public R<RmDrawingDesignVo> getInfo(@PathVariable @NotNull Long drawingId) {
|
||||
return R.ok(service.queryById(drawingId));
|
||||
}
|
||||
|
||||
@Log(title = "图纸详细设计", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmDrawingDesignBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "图纸详细设计", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmDrawingDesignBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "图纸详细设计", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{drawingIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] drawingIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(drawingIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmDrawingDesignVo>> all(RmDrawingDesignBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmDrawingReviewBo;
|
||||
import com.ruoyi.rm.domain.vo.RmDrawingReviewVo;
|
||||
import com.ruoyi.rm.service.IRmDrawingReviewService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/drawingReview")
|
||||
public class RmDrawingReviewController extends BaseController {
|
||||
|
||||
private final IRmDrawingReviewService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmDrawingReviewVo> list(RmDrawingReviewBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{reviewId}")
|
||||
public R<RmDrawingReviewVo> getInfo(@PathVariable @NotNull Long reviewId) {
|
||||
return R.ok(service.queryById(reviewId));
|
||||
}
|
||||
|
||||
@Log(title = "图纸审查", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmDrawingReviewBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "图纸审查", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmDrawingReviewBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "图纸审查", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{reviewIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] reviewIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(reviewIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmDrawingReviewVo>> all(RmDrawingReviewBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.rm.domain.bo.RmFileReviewBo;
|
||||
import com.ruoyi.rm.domain.vo.RmFileReviewVo;
|
||||
import com.ruoyi.rm.service.IRmFileReviewService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/fileReview")
|
||||
public class RmFileReviewController extends BaseController {
|
||||
|
||||
private final IRmFileReviewService fileReviewService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public R<List<RmFileReviewVo>> list(String fileModule, Long fileId) {
|
||||
return R.ok(fileReviewService.queryByFile(fileModule, fileId));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public R<RmFileReviewVo> add(@RequestBody RmFileReviewBo bo) {
|
||||
return R.ok(fileReviewService.addReview(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmInstallFeedbackBo;
|
||||
import com.ruoyi.rm.domain.vo.RmInstallFeedbackVo;
|
||||
import com.ruoyi.rm.service.IRmInstallFeedbackService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/installFeedback")
|
||||
public class RmInstallFeedbackController extends BaseController {
|
||||
|
||||
private final IRmInstallFeedbackService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmInstallFeedbackVo> list(RmInstallFeedbackBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{feedbackId}")
|
||||
public R<RmInstallFeedbackVo> getInfo(@PathVariable @NotNull Long feedbackId) {
|
||||
return R.ok(service.queryById(feedbackId));
|
||||
}
|
||||
|
||||
@Log(title = "安装问题反馈", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmInstallFeedbackBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装问题反馈", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmInstallFeedbackBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装问题反馈", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{feedbackIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] feedbackIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(feedbackIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmInstallFeedbackVo>> all(RmInstallFeedbackBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmInstallPersonnelBo;
|
||||
import com.ruoyi.rm.domain.vo.RmInstallPersonnelVo;
|
||||
import com.ruoyi.rm.service.IRmInstallPersonnelService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/installPersonnel")
|
||||
public class RmInstallPersonnelController extends BaseController {
|
||||
|
||||
private final IRmInstallPersonnelService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmInstallPersonnelVo> list(RmInstallPersonnelBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{personnelId}")
|
||||
public R<RmInstallPersonnelVo> getInfo(@PathVariable @NotNull Long personnelId) {
|
||||
return R.ok(service.queryById(personnelId));
|
||||
}
|
||||
|
||||
@Log(title = "安装人员", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmInstallPersonnelBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装人员", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmInstallPersonnelBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装人员", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{personnelIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] personnelIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(personnelIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmInstallPersonnelVo>> all(RmInstallPersonnelBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmInstallPrecisionBo;
|
||||
import com.ruoyi.rm.domain.vo.RmInstallPrecisionVo;
|
||||
import com.ruoyi.rm.service.IRmInstallPrecisionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/installPrecision")
|
||||
public class RmInstallPrecisionController extends BaseController {
|
||||
|
||||
private final IRmInstallPrecisionService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmInstallPrecisionVo> list(RmInstallPrecisionBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{precisionId}")
|
||||
public R<RmInstallPrecisionVo> getInfo(@PathVariable @NotNull Long precisionId) {
|
||||
return R.ok(service.queryById(precisionId));
|
||||
}
|
||||
|
||||
@Log(title = "安装精度", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmInstallPrecisionBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装精度", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmInstallPrecisionBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装精度", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{precisionIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] precisionIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(precisionIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmInstallPrecisionVo>> all(RmInstallPrecisionBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmInstallProgressBo;
|
||||
import com.ruoyi.rm.domain.vo.RmInstallProgressVo;
|
||||
import com.ruoyi.rm.service.IRmInstallProgressService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/installProgress")
|
||||
public class RmInstallProgressController extends BaseController {
|
||||
|
||||
private final IRmInstallProgressService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmInstallProgressVo> list(RmInstallProgressBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{progressId}")
|
||||
public R<RmInstallProgressVo> getInfo(@PathVariable @NotNull Long progressId) {
|
||||
return R.ok(service.queryById(progressId));
|
||||
}
|
||||
|
||||
@Log(title = "安装进度", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmInstallProgressBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装进度", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmInstallProgressBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装进度", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{progressIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] progressIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(progressIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmInstallProgressVo>> all(RmInstallProgressBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmInstallToolBo;
|
||||
import com.ruoyi.rm.domain.vo.RmInstallToolVo;
|
||||
import com.ruoyi.rm.service.IRmInstallToolService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/installTool")
|
||||
public class RmInstallToolController extends BaseController {
|
||||
|
||||
private final IRmInstallToolService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmInstallToolVo> list(RmInstallToolBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{toolId}")
|
||||
public R<RmInstallToolVo> getInfo(@PathVariable @NotNull Long toolId) {
|
||||
return R.ok(service.queryById(toolId));
|
||||
}
|
||||
|
||||
@Log(title = "安装工具", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmInstallToolBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装工具", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmInstallToolBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "安装工具", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{toolIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] toolIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(toolIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmInstallToolVo>> all(RmInstallToolBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmLayoutFileBo;
|
||||
import com.ruoyi.rm.domain.vo.RmLayoutFileVo;
|
||||
import com.ruoyi.rm.service.IRmLayoutFileService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/layout")
|
||||
public class RmLayoutFileController extends BaseController {
|
||||
|
||||
private final IRmLayoutFileService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmLayoutFileVo> list(RmLayoutFileBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{layoutFileId}")
|
||||
public R<RmLayoutFileVo> getInfo(@PathVariable @NotNull Long layoutFileId) {
|
||||
return R.ok(service.queryById(layoutFileId));
|
||||
}
|
||||
|
||||
@Log(title = "布局图确定", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmLayoutFileBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "布局图确定", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmLayoutFileBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "布局图确定", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{layoutFileIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] layoutFileIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(layoutFileIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmLayoutFileVo>> all(RmLayoutFileBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmManualBo;
|
||||
import com.ruoyi.rm.domain.vo.RmManualVo;
|
||||
import com.ruoyi.rm.service.IRmManualService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/manual")
|
||||
public class RmManualController extends BaseController {
|
||||
|
||||
private final IRmManualService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmManualVo> list(RmManualBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{manualId}")
|
||||
public R<RmManualVo> getInfo(@PathVariable @NotNull Long manualId) {
|
||||
return R.ok(service.queryById(manualId));
|
||||
}
|
||||
|
||||
@Log(title = "设备说明书", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmManualBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "设备说明书", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmManualBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "设备说明书", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{manualIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] manualIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(manualIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmManualVo>> all(RmManualBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmMfgDeviceBo;
|
||||
import com.ruoyi.rm.domain.vo.RmMfgDeviceVo;
|
||||
import com.ruoyi.rm.service.IRmMfgDeviceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/mfgDevice")
|
||||
public class RmMfgDeviceController extends BaseController {
|
||||
|
||||
private final IRmMfgDeviceService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmMfgDeviceVo> list(RmMfgDeviceBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{deviceId}")
|
||||
public R<RmMfgDeviceVo> getInfo(@PathVariable @NotNull Long deviceId) {
|
||||
return R.ok(service.queryById(deviceId));
|
||||
}
|
||||
|
||||
@Log(title = "设备制造", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmMfgDeviceBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "设备制造", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmMfgDeviceBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "设备制造", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deviceIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] deviceIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(deviceIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmMfgDeviceVo>> all(RmMfgDeviceBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmMfgStageBo;
|
||||
import com.ruoyi.rm.domain.vo.RmMfgStageVo;
|
||||
import com.ruoyi.rm.service.IRmMfgStageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/mfgStage")
|
||||
public class RmMfgStageController extends BaseController {
|
||||
|
||||
private final IRmMfgStageService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmMfgStageVo> list(RmMfgStageBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{stageId}")
|
||||
public R<RmMfgStageVo> getInfo(@PathVariable @NotNull Long stageId) {
|
||||
return R.ok(service.queryById(stageId));
|
||||
}
|
||||
|
||||
@Log(title = "制造阶段", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmMfgStageBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "制造阶段", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmMfgStageBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "制造阶段", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{stageIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] stageIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(stageIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmMfgStageVo>> all(RmMfgStageBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmProcurementContractBo;
|
||||
import com.ruoyi.rm.domain.vo.RmProcurementContractVo;
|
||||
import com.ruoyi.rm.service.IRmProcurementContractService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/contract")
|
||||
public class RmProcurementContractController extends BaseController {
|
||||
|
||||
private final IRmProcurementContractService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmProcurementContractVo> list(RmProcurementContractBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{contractId}")
|
||||
public R<RmProcurementContractVo> getInfo(@PathVariable @NotNull Long contractId) {
|
||||
return R.ok(service.queryById(contractId));
|
||||
}
|
||||
|
||||
@Log(title = "合同管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmProcurementContractBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "合同管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmProcurementContractBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "合同管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{contractIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] contractIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(contractIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmProcurementContractVo>> all(RmProcurementContractBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmProcurementProgressBo;
|
||||
import com.ruoyi.rm.domain.vo.RmProcurementProgressVo;
|
||||
import com.ruoyi.rm.service.IRmProcurementProgressService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/procProgress")
|
||||
public class RmProcurementProgressController extends BaseController {
|
||||
|
||||
private final IRmProcurementProgressService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmProcurementProgressVo> list(RmProcurementProgressBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{progressId}")
|
||||
public R<RmProcurementProgressVo> getInfo(@PathVariable @NotNull Long progressId) {
|
||||
return R.ok(service.queryById(progressId));
|
||||
}
|
||||
|
||||
@Log(title = "采购进度", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmProcurementProgressBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "采购进度", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmProcurementProgressBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "采购进度", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{progressIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] progressIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(progressIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmProcurementProgressVo>> all(RmProcurementProgressBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmProcurementQuoteBo;
|
||||
import com.ruoyi.rm.domain.vo.RmProcurementQuoteVo;
|
||||
import com.ruoyi.rm.service.IRmProcurementQuoteService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/quote")
|
||||
public class RmProcurementQuoteController extends BaseController {
|
||||
|
||||
private final IRmProcurementQuoteService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmProcurementQuoteVo> list(RmProcurementQuoteBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{quoteId}")
|
||||
public R<RmProcurementQuoteVo> getInfo(@PathVariable @NotNull Long quoteId) {
|
||||
return R.ok(service.queryById(quoteId));
|
||||
}
|
||||
|
||||
@Log(title = "报价管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmProcurementQuoteBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "报价管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmProcurementQuoteBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "报价管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{quoteIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] quoteIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(quoteIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmProcurementQuoteVo>> all(RmProcurementQuoteBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmProjectBo;
|
||||
import com.ruoyi.rm.domain.vo.RmProjectVo;
|
||||
import com.ruoyi.rm.service.IRmProjectService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/project")
|
||||
public class RmProjectController extends BaseController {
|
||||
|
||||
private final IRmProjectService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmProjectVo> list(RmProjectBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{projectId}")
|
||||
public R<RmProjectVo> getInfo(@PathVariable @NotNull Long projectId) {
|
||||
return R.ok(service.queryById(projectId));
|
||||
}
|
||||
|
||||
@Log(title = "轧机项目管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmProjectBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "轧机项目管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmProjectBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "轧机项目管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{projectIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] projectIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(projectIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<List<RmProjectVo>> all(RmProjectBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmProjectMemberBo;
|
||||
import com.ruoyi.rm.domain.vo.RmProjectMemberVo;
|
||||
import com.ruoyi.rm.service.IRmProjectMemberService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/projectMember")
|
||||
public class RmProjectMemberController extends BaseController {
|
||||
|
||||
private final IRmProjectMemberService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmProjectMemberVo> list(RmProjectMemberBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{memberId}")
|
||||
public R<RmProjectMemberVo> getInfo(@PathVariable @NotNull Long memberId) {
|
||||
return R.ok(service.queryById(memberId));
|
||||
}
|
||||
|
||||
@Log(title = "项目成员", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmProjectMemberBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "项目成员", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmProjectMemberBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "项目成员", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{memberIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] memberIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(memberIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<List<RmProjectMemberVo>> all(RmProjectMemberBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmShippingChecklistBo;
|
||||
import com.ruoyi.rm.domain.vo.RmShippingChecklistVo;
|
||||
import com.ruoyi.rm.service.IRmShippingChecklistService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/shippingChecklist")
|
||||
public class RmShippingChecklistController extends BaseController {
|
||||
|
||||
private final IRmShippingChecklistService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmShippingChecklistVo> list(RmShippingChecklistBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{checklistId}")
|
||||
public R<RmShippingChecklistVo> getInfo(@PathVariable @NotNull Long checklistId) {
|
||||
return R.ok(service.queryById(checklistId));
|
||||
}
|
||||
|
||||
@Log(title = "发货前检查清单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmShippingChecklistBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "发货前检查清单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmShippingChecklistBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "发货前检查清单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{checklistIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] checklistIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(checklistIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmShippingChecklistVo>> all(RmShippingChecklistBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmShippingItemBo;
|
||||
import com.ruoyi.rm.domain.vo.RmShippingItemVo;
|
||||
import com.ruoyi.rm.service.IRmShippingItemService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/shippingItem")
|
||||
public class RmShippingItemController extends BaseController {
|
||||
|
||||
private final IRmShippingItemService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmShippingItemVo> list(RmShippingItemBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{itemId}")
|
||||
public R<RmShippingItemVo> getInfo(@PathVariable @NotNull Long itemId) {
|
||||
return R.ok(service.queryById(itemId));
|
||||
}
|
||||
|
||||
@Log(title = "发货设备项", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmShippingItemBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "发货设备项", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmShippingItemBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "发货设备项", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{itemIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] itemIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(itemIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmShippingItemVo>> all(RmShippingItemBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmSiteModBo;
|
||||
import com.ruoyi.rm.domain.vo.RmSiteModVo;
|
||||
import com.ruoyi.rm.service.IRmSiteModService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/siteMod")
|
||||
public class RmSiteModController extends BaseController {
|
||||
|
||||
private final IRmSiteModService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmSiteModVo> list(RmSiteModBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{modId}")
|
||||
public R<RmSiteModVo> getInfo(@PathVariable @NotNull Long modId) {
|
||||
return R.ok(service.queryById(modId));
|
||||
}
|
||||
|
||||
@Log(title = "现场修改", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmSiteModBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "现场修改", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmSiteModBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "现场修改", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{modIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] modIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(modIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmSiteModVo>> all(RmSiteModBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmSiteModMediaBo;
|
||||
import com.ruoyi.rm.domain.vo.RmSiteModMediaVo;
|
||||
import com.ruoyi.rm.service.IRmSiteModMediaService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/siteModMedia")
|
||||
public class RmSiteModMediaController extends BaseController {
|
||||
|
||||
private final IRmSiteModMediaService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmSiteModMediaVo> list(RmSiteModMediaBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{mediaId}")
|
||||
public R<RmSiteModMediaVo> getInfo(@PathVariable @NotNull Long mediaId) {
|
||||
return R.ok(service.queryById(mediaId));
|
||||
}
|
||||
|
||||
@Log(title = "现场修改多媒体", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmSiteModMediaBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "现场修改多媒体", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{mediaIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] mediaIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(mediaIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmSiteModMediaVo>> all(RmSiteModMediaBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.rm.domain.bo.RmStageConfirmBo;
|
||||
import com.ruoyi.rm.domain.vo.RmStageConfirmVo;
|
||||
import com.ruoyi.rm.service.IRmStageConfirmService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/stageConfirm")
|
||||
public class RmStageConfirmController extends BaseController {
|
||||
|
||||
private final IRmStageConfirmService stageConfirmService;
|
||||
|
||||
@GetMapping("/{projectId}")
|
||||
public R<List<RmStageConfirmVo>> list(@PathVariable @NotNull Long projectId) {
|
||||
return R.ok(stageConfirmService.queryByProjectId(projectId));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public R<Void> confirm(@RequestBody @Validated RmStageConfirmBo bo) {
|
||||
return toAjax(stageConfirmService.confirmStage(bo));
|
||||
}
|
||||
|
||||
@PostMapping("/override")
|
||||
public R<Void> override(@RequestBody @Validated RmStageConfirmBo bo) {
|
||||
bo.setConfirmType("override");
|
||||
return toAjax(stageConfirmService.confirmStage(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmStageImageBo;
|
||||
import com.ruoyi.rm.domain.vo.RmStageImageVo;
|
||||
import com.ruoyi.rm.service.IRmStageImageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/stageImage")
|
||||
public class RmStageImageController extends BaseController {
|
||||
|
||||
private final IRmStageImageService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmStageImageVo> list(RmStageImageBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{imageId}")
|
||||
public R<RmStageImageVo> getInfo(@PathVariable @NotNull Long imageId) {
|
||||
return R.ok(service.queryById(imageId));
|
||||
}
|
||||
|
||||
@Log(title = "阶段图片", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmStageImageBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "阶段图片", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmStageImageBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "阶段图片", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{imageIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] imageIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(imageIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<List<RmStageImageVo>> all(RmStageImageBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.rm.domain.bo.RmStageUserPermBo;
|
||||
import com.ruoyi.rm.domain.vo.RmStageUserPermVo;
|
||||
import com.ruoyi.rm.service.IRmStageUserPermService;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/stageUserPerm")
|
||||
public class RmStageUserPermController extends BaseController {
|
||||
|
||||
private final IRmStageUserPermService stageUserPermService;
|
||||
private final SysUserMapper sysUserMapper;
|
||||
private final SysUserRoleMapper sysUserRoleMapper;
|
||||
|
||||
@GetMapping("/list")
|
||||
public R<List<RmStageUserPermVo>> list(RmStageUserPermBo bo) {
|
||||
return R.ok(stageUserPermService.queryList(bo));
|
||||
}
|
||||
|
||||
@PostMapping("/batchSave")
|
||||
public R<Void> batchSave(@RequestBody List<RmStageUserPermBo> list) {
|
||||
stageUserPermService.batchSave(list);
|
||||
return R.ok("保存成功");
|
||||
}
|
||||
|
||||
@GetMapping("/users")
|
||||
public R<List<Map<String, Object>>> listUsers() {
|
||||
List<SysUser> users = sysUserMapper.selectList(
|
||||
Wrappers.<SysUser>lambdaQuery()
|
||||
.eq(SysUser::getStatus, "0")
|
||||
.orderByAsc(SysUser::getUserId));
|
||||
|
||||
// Build userId -> roleIds map
|
||||
List<SysUserRole> allUserRoles = sysUserRoleMapper.selectList(Wrappers.emptyWrapper());
|
||||
Map<Long, List<Long>> userRoleMap = allUserRoles.stream()
|
||||
.collect(Collectors.groupingBy(SysUserRole::getUserId,
|
||||
Collectors.mapping(SysUserRole::getRoleId, Collectors.toList())));
|
||||
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (SysUser user : users) {
|
||||
Map<String, Object> item = new LinkedHashMap<>();
|
||||
item.put("userId", user.getUserId());
|
||||
item.put("nickName", user.getNickName());
|
||||
item.put("roleIds", userRoleMap.getOrDefault(user.getUserId(), Collections.emptyList()));
|
||||
result.add(item);
|
||||
}
|
||||
return R.ok(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmTechPlanItemBo;
|
||||
import com.ruoyi.rm.domain.vo.RmTechPlanItemVo;
|
||||
import com.ruoyi.rm.service.IRmTechPlanItemService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/techPlan")
|
||||
public class RmTechPlanItemController extends BaseController {
|
||||
|
||||
private final IRmTechPlanItemService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmTechPlanItemVo> list(RmTechPlanItemBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{planItemId}")
|
||||
public R<RmTechPlanItemVo> getInfo(@PathVariable @NotNull Long planItemId) {
|
||||
return R.ok(service.queryById(planItemId));
|
||||
}
|
||||
|
||||
@Log(title = "技术方案确定", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmTechPlanItemBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "技术方案确定", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmTechPlanItemBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "技术方案确定", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{planItemIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] planItemIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(planItemIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmTechPlanItemVo>> all(RmTechPlanItemBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.rm.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.rm.domain.bo.RmTechReviewItemBo;
|
||||
import com.ruoyi.rm.domain.vo.RmTechReviewItemVo;
|
||||
import com.ruoyi.rm.service.IRmTechReviewItemService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rm/techReview")
|
||||
public class RmTechReviewItemController extends BaseController {
|
||||
|
||||
private final IRmTechReviewItemService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<RmTechReviewItemVo> list(RmTechReviewItemBo bo, PageQuery pageQuery) {
|
||||
return service.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{reviewItemId}")
|
||||
public R<RmTechReviewItemVo> getInfo(@PathVariable @NotNull Long reviewItemId) {
|
||||
return R.ok(service.queryById(reviewItemId));
|
||||
}
|
||||
|
||||
@Log(title = "技术审查", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody RmTechReviewItemBo bo) {
|
||||
return toAjax(service.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "技术审查", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody RmTechReviewItemBo bo) {
|
||||
return toAjax(service.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "技术审查", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{reviewItemIds}")
|
||||
public R<Void> remove(@PathVariable @NotEmpty Long[] reviewItemIds) {
|
||||
return toAjax(service.deleteWithValidByIds(Arrays.asList(reviewItemIds), true));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public R<java.util.List<RmTechReviewItemVo>> all(RmTechReviewItemBo bo) {
|
||||
return R.ok(service.queryList(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.rm.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RmAcceptanceChecklistBo extends BaseEntity {
|
||||
private Long checkId;
|
||||
private Long projectId;
|
||||
private String itemText;
|
||||
private String isChecked;
|
||||
private Integer sortOrder;
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ruoyi.rm.domain.bo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RmAcceptanceItemBo extends BaseEntity {
|
||||
private Long acceptItemId;
|
||||
private Long projectId;
|
||||
private String itemName;
|
||||
private String requirement;
|
||||
private String actualValue;
|
||||
private String result;
|
||||
private String notes;
|
||||
private String inspector;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date inspectDate;
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.rm.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RmBudgetBo extends BaseEntity {
|
||||
|
||||
private Long budgetId;
|
||||
private Long projectId;
|
||||
private String category;
|
||||
private String item;
|
||||
private BigDecimal budgetAmount;
|
||||
private BigDecimal spentAmount;
|
||||
private String status;
|
||||
private String archiveBatch;
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.rm.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RmColorCardBo extends BaseEntity {
|
||||
|
||||
private Long colorCardId;
|
||||
private Long projectId;
|
||||
private String colorName;
|
||||
private String hexValue;
|
||||
private String standard;
|
||||
private String standardLabel;
|
||||
private String category;
|
||||
private String usageDesc;
|
||||
private String description;
|
||||
private Integer sortOrder;
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.rm.domain.bo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RmCommissioningBo extends BaseEntity {
|
||||
private Long commissioningId;
|
||||
private Long projectId;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date commissioningDate;
|
||||
private String confirmer;
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.rm.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RmCommissioningChecklistBo extends BaseEntity {
|
||||
private Long checkId;
|
||||
private Long projectId;
|
||||
private String itemText;
|
||||
private String isChecked;
|
||||
private Integer sortOrder;
|
||||
private String remark;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user