From bb051d32db49a300aeac4bd56579044a4fa41f55 Mon Sep 17 00:00:00 2001 From: JilingLee <18850011309@139.com> Date: Mon, 25 Sep 2023 11:02:54 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=8F=91=E7=A5=A8xml=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=EF=BC=8Cxml=E4=B8=AD=E6=96=87=E4=B9=B1=E7=A0=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao-module-accounting-biz/pom.xml | 6 ++ .../admin/invoices/InvoicesController.java | 13 +++ .../admin/invoices/vo/InvoicesPageReqVO.java | 3 + .../passwords/PasswordsServiceImpl.java | 32 +++++-- .../yudao/module/setting/tools/JsonToXml.java | 92 +++++++++++++++++++ 5 files changed, 136 insertions(+), 10 deletions(-) create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/tools/JsonToXml.java diff --git a/yudao-module-accounting/yudao-module-accounting-biz/pom.xml b/yudao-module-accounting/yudao-module-accounting-biz/pom.xml index 43394b44..3ccef5c1 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/pom.xml +++ b/yudao-module-accounting/yudao-module-accounting-biz/pom.xml @@ -90,6 +90,12 @@ 1.7.3-snapshot compile + + cn.iocoder.boot + yudao-module-setting-biz + 1.7.3-snapshot + compile + diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java index fd3483fb..1f24e784 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.Converter; import cn.iocoder.yudao.module.accounting.enums.AccountingStatusEnum; import cn.iocoder.yudao.module.bs.utils.BaiduOcrHandler; import cn.iocoder.yudao.module.infra.service.file.FileService; +import cn.iocoder.yudao.module.setting.service.passwords.PasswordsService; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONObject; import liquibase.pro.packaged.A; @@ -60,6 +61,8 @@ public class InvoicesController { private InvoicesService invoicesService; @Resource private FileService fileService; + @Resource + private PasswordsService passwordsService; @PostMapping("/create") @Operation(summary = "创建发票") @@ -111,6 +114,16 @@ public class InvoicesController { return success(InvoicesConvert.INSTANCE.convertPage(pageResult)); } + @GetMapping("/downloadXml") + @Operation(summary = "获得发票分页Xml") + @PreAuthorize("@ss.hasPermission('accounting:invoices:query')") + public void downloadXml(@Valid InvoicesPageReqVO pageVO,HttpServletResponse response) throws IOException { + PageResult pageResult = invoicesService.getInvoicesPage(pageVO); + PageResult invoicesRespVOPageResult = InvoicesConvert.INSTANCE.convertPage(pageResult); + String jsonString = JSONObject.toJSONString(invoicesRespVOPageResult); + passwordsService.jsonToXmlConverter(response,pageVO.getInputPassword(),jsonString); + } + @GetMapping("/export-excel") @Operation(summary = "导出发票 Excel") @PreAuthorize("@ss.hasPermission('accounting:invoices:export')") diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/vo/InvoicesPageReqVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/vo/InvoicesPageReqVO.java index eea59a1d..b045df54 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/vo/InvoicesPageReqVO.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/vo/InvoicesPageReqVO.java @@ -208,4 +208,7 @@ public class InvoicesPageReqVO extends PageParam { @Schema(description = "发票地址") private String fileUrl; + + @Schema(description = "密码") + String inputPassword; } diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/passwords/PasswordsServiceImpl.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/passwords/PasswordsServiceImpl.java index 31109172..b478d09f 100644 --- a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/passwords/PasswordsServiceImpl.java +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/passwords/PasswordsServiceImpl.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.setting.service.passwords; +import cn.iocoder.yudao.module.setting.tools.JsonToXml; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import me.zhyd.oauth.log.Log; import org.apache.http.HttpResponse; @@ -15,8 +16,10 @@ import javax.servlet.http.HttpServletResponse; import org.springframework.validation.annotation.Validated; import java.io.IOException; +import java.io.OutputStream; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.security.MessageDigest; import java.util.*; @@ -56,8 +59,6 @@ public class PasswordsServiceImpl implements PasswordsService { wrapper.orderByDesc("create_time").last("LIMIT 1"); PasswordsDO passwordsDO = passwordsMapper.selectOne(wrapper); String passwordValueMD5 = passwordsDO.getPasswordValue(); - // 获取PrintWriter对象 - PrintWriter out = httpResponse.getWriter(); httpResponse.setCharacterEncoding("UTF-8"); httpResponse.setContentType("application/json"); if (passwordValueMD5 == null) { @@ -65,25 +66,34 @@ public class PasswordsServiceImpl implements PasswordsService { json2.put("code", "500"); json2.put("msg", "password is null!"); httpResponse.setStatus(500); + PrintWriter out = httpResponse.getWriter(); // 获取PrintWriter对象 out.println(json2.toString()); out.flush(); return null; // 返回XML字符串 } else { boolean passwordValid = this.isPasswordValid(inputPassword, passwordValueMD5); - if (passwordValid) {//将json字符串转化为JSONObject对象 - JSONObject jsonObject = new JSONObject(json); - //将JSONObject对象转化为xml字符串 - String xml = XML.toString(jsonObject); - httpResponse.setStatus(200); // 设置响应状态码为200 - httpResponse.setHeader("Content-Type", ContentType.APPLICATION_XML.toString()); - out.println(xml); - return xml; // 返回XML字符串 + if (passwordValid) { + //1.设置文件下载的response响应格式 + String fileType = "xml"; //文件类型 + httpResponse.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("元数据." + fileType, "UTF-8")); + httpResponse.setContentType("multipart/form-data"); + httpResponse.setCharacterEncoding("UTF-8"); + String jsonToXml = JsonToXml.jsonToXml(json); + //3.将内容转为byte[]格式 + byte[] data2 = jsonToXml.getBytes("UTF-8"); + //4.将内容写入响应流 + OutputStream out2 = httpResponse.getOutputStream(); + out2.write(data2); + out2.flush(); + out2.close(); + return jsonToXml; } else { JSONObject json2 = new JSONObject(); json2.put("code", "500"); json2.put("msg", "passwordError!"); httpResponse.setStatus(500); + PrintWriter out = httpResponse.getWriter(); // 获取PrintWriter对象 out.println(json2.toString()); out.flush(); return null; @@ -91,6 +101,8 @@ public class PasswordsServiceImpl implements PasswordsService { } } + + @Override public Long createPasswords(PasswordsCreateReqVO createReqVO) { // 插入 diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/tools/JsonToXml.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/tools/JsonToXml.java new file mode 100644 index 00000000..2a1042bb --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/tools/JsonToXml.java @@ -0,0 +1,92 @@ +package cn.iocoder.yudao.module.setting.tools; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +/** + * @author ysd + * @date 2021年08月03日 9:33 + */ +public class JsonToXml { + /** + * Json to xml string. + * + * @param json the json + * @return the string + */ + public static String jsonToXml(String json){ + try { + StringBuffer buffer = new StringBuffer(); + buffer.append(""); + JSONObject jObj = JSON.parseObject(json); + jsonToXmlstr(jObj,buffer); + return buffer.toString(); + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + } + + + /** + * Json to xmlstr string. + * + * @param jObj the j obj + * @param buffer the buffer + * @return the string + */ + public static String jsonToXmlstr(JSONObject jObj, StringBuffer buffer) { + Set> se = jObj.entrySet(); + for (Iterator> it = se.iterator(); it.hasNext(); ) { + Map.Entry en = it.next(); + if (en.getValue() instanceof JSONObject) { + buffer.append("<" + en.getKey() + ">"); + JSONObject jo = (JSONObject) en.getValue(); + jsonToXmlstr(jo, buffer); + buffer.append(""); + } else if (en.getValue() instanceof JSONArray) { + JSONArray jarray = (JSONArray) en.getValue(); + for (int i = 0; i < jarray.size(); i++) { + buffer.append("<" + en.getKey() + ">"); + JSONObject jsonobject = jarray.getJSONObject(i); + jsonToXmlstr(jsonobject, buffer); + buffer.append(""); + } + } else if (en.getValue().getClass().getName().equals("java.lang.String")) { + buffer.append("<" + en.getKey() + ">" + encodeXmlString((String) en.getValue())); + buffer.append(""); + } + } + return buffer.toString(); + } + + public static String encodeXmlString(String input) { + StringBuilder out = new StringBuilder(); + for (int i = 0; i < input.length(); i++) { + char c = input.charAt(i); + if (c <= 0xD7FF || c >= 0xE000) { + out.append(c); + } else { + out.append("&#x").append(Integer.toHexString(c)).append(";"); + } + } + return out.toString(); + } + + /** + * The entry point of application. + * + * @param args the input arguments + */ + public static void main(String[] args) { + + String xmlstr = jsonToXml("{\"class\": {\"student\": [{\"age\": \"18\",\"gender\": \"男\",\"name\": \"张三\",\"qk\": [{\"q1\": \"001\",\"q2\": \"002\",\"q3\": \"003\"},{\"q1\": \"001\",\"q2\": \"002\",\"q3\": \"003\"}]},{\"age\": \"17\",\"gender\": \"男\",\"name\": \"李四\",\"qk\": {\"q1\": \"005\",\"q2\": \"006\",\"q3\": \"007\"}},{\"age\": \"19\",\"gender\": \"女\",\"name\": \"王五\",\"qk\": {\"q1\": \"008\",\"q2\": \"009\",\"q3\": \"010\"}}]}}"); + System.out.println(xmlstr); + } + +} From 228f2f91e0c31fca513443fa0c96a36e6999d223 Mon Sep 17 00:00:00 2001 From: JilingLee <18850011309@139.com> Date: Mon, 25 Sep 2023 14:36:19 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=85=B6=E4=BB=96=E4=BC=9A=E8=AE=A1?= =?UTF-8?q?=E8=B5=84=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/accounting20230925JilingLee.sql | 58 ++++ .../accounting/enums/ErrorCodeConstants.java | 1 + .../admin/other/OtherController.java | 122 +++++++ .../admin/other/vo/OtherBaseVO.java | 50 +++ .../admin/other/vo/OtherCreateReqVO.java | 14 + .../admin/other/vo/OtherExcelVO.java | 89 +++++ .../admin/other/vo/OtherExportReqVO.java | 80 +++++ .../admin/other/vo/OtherPageReqVO.java | 82 +++++ .../admin/other/vo/OtherRespVO.java | 46 +++ .../admin/other/vo/OtherUpdateReqVO.java | 18 + .../convert/other/OtherConvert.java | 34 ++ .../dal/dataobject/other/OtherDO.java | 129 ++++++++ .../dal/mysql/other/OtherMapper.java | 72 ++++ .../service/other/OtherService.java | 70 ++++ .../service/other/OtherServiceImpl.java | 82 +++++ .../resources/mapper/other/OtherMapper.xml | 12 + .../service/other/OtherServiceImplTest.java | 311 ++++++++++++++++++ 17 files changed, 1270 insertions(+) create mode 100644 sql/accounting20230925JilingLee.sql create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/OtherController.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherBaseVO.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherCreateReqVO.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherExcelVO.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherExportReqVO.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherPageReqVO.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherRespVO.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherUpdateReqVO.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/convert/other/OtherConvert.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/dal/dataobject/other/OtherDO.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/dal/mysql/other/OtherMapper.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/other/OtherService.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImpl.java create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/resources/mapper/other/OtherMapper.xml create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImplTest.java diff --git a/sql/accounting20230925JilingLee.sql b/sql/accounting20230925JilingLee.sql new file mode 100644 index 00000000..b2846338 --- /dev/null +++ b/sql/accounting20230925JilingLee.sql @@ -0,0 +1,58 @@ +-- ---------------------------- +-- 其他会计资料 structure for accounting_other +-- ---------------------------- +DROP TABLE IF EXISTS `accounting_other`; +CREATE TABLE `accounting_other` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表名', + `flow_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'OA/ERP流程编号', + `source` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件来源', + `year` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度', + `period` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会计期间', + `business_type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务类型', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '制单人', + `creator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `company_id` bigint(20) NULL DEFAULT NULL COMMENT '业务实体id', + `company` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务实体', + `suffix` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件后缀', + `file_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件地址', + `file_ap` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绝对路径', + `flow_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流程号', + `note` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '摘要', + `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '所属部门id', + `dept_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门', + `record_id` bigint(20) NULL DEFAULT NULL COMMENT '归档id', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', + `deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除', + `archive_state` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '归档状态', + `tenant_id` bigint(20) NOT NULL COMMENT '租户编号 一个集团/总公司对应一个租户', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1', + `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2', + `attr3` int(11) NULL DEFAULT NULL COMMENT '预留字段3', + `attr4` int(11) NULL DEFAULT NULL COMMENT '预留字段4', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '其他资料' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; + +-- 其他会计资料菜单 +SELECT `id` INTO @menuId FROM `system_menu` WHERE `name`='会计档案'; +INSERT INTO `lyr-one`.`system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('其他资料管理', '', 2, 0, @menuId, 'other', '', 'accounting/other/index', 'Other', 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0'); +SET @menuId2 = LAST_INSERT_ID(); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '其他资料查询', 'accounting:other:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '其他资料创建', 'accounting:other:create', 3, 2, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '其他资料更新', 'accounting:other:update', 3, 3, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '其他资料删除', 'accounting:other:delete', 3, 4, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '其他资料导出', 'accounting:other:export', 3, 5, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0'); + +-- 其他会计资料类型字典 +INSERT INTO `lyr-one`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (NULL, '会计其他资料', 'accounting_other_type', 0, NULL, '', '2023-09-25 13:29:05', '', '2023-09-25 13:29:05', b'0', '1970-01-01 00:00:00'); +INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '存款余额调节表', 'bank_reconciliation', 'accounting_other_type', 0, 'default', '', NULL, '', '2023-09-25 13:30:08', '', '2023-09-25 13:30:08', b'0'); +INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '银行对账单', 'bank_statement', 'accounting_other_type', 0, 'default', '', NULL, '', '2023-09-25 13:31:05', '', '2023-09-25 13:31:05', b'0'); +INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '纳税申报表', 'tax_return', 'accounting_other_type', 0, 'default', '', NULL, '', '2023-09-25 13:31:41', '', '2023-09-25 13:31:41', b'0'); +INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '认证抵扣', 'certification_credit', 'accounting_other_type', 0, 'default', '', NULL, '', '2023-09-25 13:32:30', '', '2023-09-25 13:32:30', b'0'); +INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '其他资料', 'other_details', 'accounting_other_type', 0, 'default', '', NULL, '', '2023-09-25 13:32:57', '', '2023-09-25 13:32:57', b'0'); diff --git a/yudao-module-accounting/yudao-module-accounting-api/src/main/java/cn/iocoder/yudao/module/accounting/enums/ErrorCodeConstants.java b/yudao-module-accounting/yudao-module-accounting-api/src/main/java/cn/iocoder/yudao/module/accounting/enums/ErrorCodeConstants.java index e8383996..1ffd1f2e 100644 --- a/yudao-module-accounting/yudao-module-accounting-api/src/main/java/cn/iocoder/yudao/module/accounting/enums/ErrorCodeConstants.java +++ b/yudao-module-accounting/yudao-module-accounting-api/src/main/java/cn/iocoder/yudao/module/accounting/enums/ErrorCodeConstants.java @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; public interface ErrorCodeConstants { ErrorCode VOUCHER_NOT_EXISTS = new ErrorCode(200100, "会计凭证不存在"); ErrorCode VOUCHER_DETAILS_NOT_EXISTS = new ErrorCode(300100, "凭证详情不存在"); + ErrorCode OTHER_NOT_EXISTS = new ErrorCode(600100, "其他资料不存在"); ErrorCode ACCOUNTING_BOOK_NOT_EXISTS = new ErrorCode(400100, "会计账簿不存在"); diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/OtherController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/OtherController.java new file mode 100644 index 00000000..439a7fdb --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/OtherController.java @@ -0,0 +1,122 @@ +package cn.iocoder.yudao.module.accounting.controller.admin.other; + +import cn.hutool.core.io.IoUtil; +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; +import cn.iocoder.yudao.module.infra.service.file.FileService; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*; +import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO; +import cn.iocoder.yudao.module.accounting.convert.other.OtherConvert; +import cn.iocoder.yudao.module.accounting.service.other.OtherService; +import org.springframework.web.multipart.MultipartFile; + +@Tag(name = "管理后台 - 其他资料") +@RestController +@RequestMapping("/accounting/other") +@Validated +public class OtherController { + + @Resource + private OtherService otherService; + @Resource + private FileService fileService; + + @PostMapping("/create") + @Operation(summary = "创建其他资料") + @PreAuthorize("@ss.hasPermission('accounting:other:create')") + public CommonResult createOther(@Valid @RequestBody OtherCreateReqVO createReqVO) { + return success(otherService.createOther(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新其他资料") + @PreAuthorize("@ss.hasPermission('accounting:other:update')") + public CommonResult updateOther(@Valid @RequestBody OtherUpdateReqVO updateReqVO) { + otherService.updateOther(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除其他资料") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('accounting:other:delete')") + public CommonResult deleteOther(@RequestParam("id") Long id) { + otherService.deleteOther(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得其他资料") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('accounting:other:query')") + public CommonResult getOther(@RequestParam("id") Long id) { + OtherDO other = otherService.getOther(id); + return success(OtherConvert.INSTANCE.convert(other)); + } + + @GetMapping("/upload") + @Operation(summary = "上传其他资料") + @Parameter(name = "multipartFile", description = "文件", required = true) + @PreAuthorize("@ss.hasPermission('accounting:other:create')") + public CommonResult upload(@RequestParam("multipartFile") MultipartFile multipartFile) throws IOException { + String fileUrl = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream())); + FilePageReqVO pageReqVO = new FilePageReqVO(); + String lastSegment = fileUrl.substring(fileUrl.lastIndexOf("/") + 1); + pageReqVO.setPath(lastSegment); + PageResult filePage = fileService.getFilePage(pageReqVO); + return success(filePage.getList().get(0)); + } + + @GetMapping("/list") + @Operation(summary = "获得其他资料列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('accounting:other:query')") + public CommonResult> getOtherList(@RequestParam("ids") Collection ids) { + List list = otherService.getOtherList(ids); + return success(OtherConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得其他资料分页") + @PreAuthorize("@ss.hasPermission('accounting:other:query')") + public CommonResult> getOtherPage(@Valid OtherPageReqVO pageVO) { + PageResult pageResult = otherService.getOtherPage(pageVO); + return success(OtherConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出其他资料 Excel") + @PreAuthorize("@ss.hasPermission('accounting:other:export')") + @OperateLog(type = EXPORT) + public void exportOtherExcel(@Valid OtherExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = otherService.getOtherList(exportReqVO); + // 导出 Excel + List datas = OtherConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "其他资料.xls", "数据", OtherExcelVO.class, datas); + } + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherBaseVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherBaseVO.java new file mode 100644 index 00000000..18c5ac92 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherBaseVO.java @@ -0,0 +1,50 @@ +package cn.iocoder.yudao.module.accounting.controller.admin.other.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import javax.validation.constraints.*; + +/** + * 其他资料 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class OtherBaseVO { + + @Schema(description = "表名", example = "赵六") + private String name; + + @Schema(description = "OA/ERP流程编号") + private String flowCode; + + @Schema(description = "文件来源") + private String source; + + @Schema(description = "年度") + private String year; + + @Schema(description = "会计期间") + private String period; + + @Schema(description = "业务类型", example = "1") + private String businessType; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体id", example = "22433") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "摘要") + private String note; + + @Schema(description = "备注", example = "你猜") + private String remark; + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherCreateReqVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherCreateReqVO.java new file mode 100644 index 00000000..c7abe9a5 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.accounting.controller.admin.other.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 其他资料创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class OtherCreateReqVO extends OtherBaseVO { + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherExcelVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherExcelVO.java new file mode 100644 index 00000000..4a128875 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherExcelVO.java @@ -0,0 +1,89 @@ +package cn.iocoder.yudao.module.accounting.controller.admin.other.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; + + +/** + * 其他资料 Excel VO + * + * @author 芋道源码 + */ +@Data +public class OtherExcelVO { + + @ExcelProperty("主键") + private Long id; + + @ExcelProperty("表名") + private String name; + + @ExcelProperty("OA/ERP流程编号") + private String flowCode; + + @ExcelProperty("文件来源") + private String source; + + @ExcelProperty("年度") + private String year; + + @ExcelProperty("会计期间") + private String period; + + @ExcelProperty(value = "业务类型", converter = DictConvert.class) + @DictFormat("accounting_other_type") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 + private String businessType; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @ExcelProperty("制单人") + private String createBy; + + @ExcelProperty("业务实体id") + private Long companyId; + + @ExcelProperty("业务实体") + private String company; + + @ExcelProperty("文件后缀") + private String suffix; + + @ExcelProperty("文件地址") + private String fileUrl; + + @ExcelProperty("绝对路径") + private String fileAp; + + @ExcelProperty("流程号") + private String flowId; + + @ExcelProperty("摘要") + private String note; + + @ExcelProperty("所属部门id") + private Long deptId; + + @ExcelProperty("所属部门") + private String deptName; + + @ExcelProperty("归档id") + private Long recordId; + + @ExcelProperty("用户id") + private Long userId; + + @ExcelProperty("归档状态") + private String archiveState; + + @ExcelProperty("备注") + private String remark; + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherExportReqVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherExportReqVO.java new file mode 100644 index 00000000..c9dd115a --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherExportReqVO.java @@ -0,0 +1,80 @@ +package cn.iocoder.yudao.module.accounting.controller.admin.other.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 其他资料 Excel 导出 Request VO,参数和 OtherPageReqVO 是一致的") +@Data +public class OtherExportReqVO { + + @Schema(description = "表名", example = "赵六") + private String name; + + @Schema(description = "OA/ERP流程编号") + private String flowCode; + + @Schema(description = "文件来源") + private String source; + + @Schema(description = "年度") + private String year; + + @Schema(description = "会计期间") + private String period; + + @Schema(description = "业务类型", example = "1") + private String businessType; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体id", example = "22433") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "文件后缀") + private String suffix; + + @Schema(description = "文件地址", example = "https://www.iocoder.cn") + private String fileUrl; + + @Schema(description = "绝对路径") + private String fileAp; + + @Schema(description = "流程号", example = "29101") + private String flowId; + + @Schema(description = "摘要") + private String note; + + @Schema(description = "所属部门id", example = "29666") + private Long deptId; + + @Schema(description = "所属部门", example = "王五") + private String deptName; + + @Schema(description = "归档id", example = "15741") + private Long recordId; + + @Schema(description = "用户id", example = "24359") + private Long userId; + + @Schema(description = "归档状态") + private String archiveState; + + @Schema(description = "备注", example = "你猜") + private String remark; + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherPageReqVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherPageReqVO.java new file mode 100644 index 00000000..a3915745 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherPageReqVO.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.accounting.controller.admin.other.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 其他资料分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class OtherPageReqVO extends PageParam { + + @Schema(description = "表名", example = "赵六") + private String name; + + @Schema(description = "OA/ERP流程编号") + private String flowCode; + + @Schema(description = "文件来源") + private String source; + + @Schema(description = "年度") + private String year; + + @Schema(description = "会计期间") + private String period; + + @Schema(description = "业务类型", example = "1") + private String businessType; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体id", example = "22433") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "文件后缀") + private String suffix; + + @Schema(description = "文件地址", example = "https://www.iocoder.cn") + private String fileUrl; + + @Schema(description = "绝对路径") + private String fileAp; + + @Schema(description = "流程号", example = "29101") + private String flowId; + + @Schema(description = "摘要") + private String note; + + @Schema(description = "所属部门id", example = "29666") + private Long deptId; + + @Schema(description = "所属部门", example = "王五") + private String deptName; + + @Schema(description = "归档id", example = "15741") + private Long recordId; + + @Schema(description = "用户id", example = "24359") + private Long userId; + + @Schema(description = "归档状态") + private String archiveState; + + @Schema(description = "备注", example = "你猜") + private String remark; + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherRespVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherRespVO.java new file mode 100644 index 00000000..48e3b62a --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherRespVO.java @@ -0,0 +1,46 @@ +package cn.iocoder.yudao.module.accounting.controller.admin.other.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 其他资料 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class OtherRespVO extends OtherBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24570") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + + @Schema(description = "文件后缀") + private String suffix; + + @Schema(description = "文件地址", example = "https://www.iocoder.cn") + private String fileUrl; + + @Schema(description = "绝对路径") + private String fileAp; + + @Schema(description = "流程号", example = "29101") + private String flowId; + + @Schema(description = "所属部门id", example = "29666") + private Long deptId; + + @Schema(description = "所属部门", example = "王五") + private String deptName; + + @Schema(description = "归档id", example = "15741") + private Long recordId; + + @Schema(description = "用户id", example = "24359") + private Long userId; + + @Schema(description = "归档状态") + private String archiveState; + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherUpdateReqVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherUpdateReqVO.java new file mode 100644 index 00000000..91777684 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.accounting.controller.admin.other.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 其他资料更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class OtherUpdateReqVO extends OtherBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24570") + @NotNull(message = "主键不能为空") + private Long id; + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/convert/other/OtherConvert.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/convert/other/OtherConvert.java new file mode 100644 index 00000000..12d9c66e --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/convert/other/OtherConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.accounting.convert.other; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*; +import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO; + +/** + * 其他资料 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface OtherConvert { + + OtherConvert INSTANCE = Mappers.getMapper(OtherConvert.class); + + OtherDO convert(OtherCreateReqVO bean); + + OtherDO convert(OtherUpdateReqVO bean); + + OtherRespVO convert(OtherDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/dal/dataobject/other/OtherDO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/dal/dataobject/other/OtherDO.java new file mode 100644 index 00000000..f0202961 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/dal/dataobject/other/OtherDO.java @@ -0,0 +1,129 @@ +package cn.iocoder.yudao.module.accounting.dal.dataobject.other; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 其他资料 DO + * + * @author 芋道源码 + */ +@TableName("accounting_other") +@KeySequence("accounting_other_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class OtherDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 表名 + */ + private String name; + /** + * OA/ERP流程编号 + */ + private String flowCode; + /** + * 文件来源 + */ + private String source; + /** + * 年度 + */ + private String year; + /** + * 会计期间 + */ + private String period; + /** + * 业务类型 + * + * 枚举 {@link TODO accounting_other_type 对应的类} + */ + private String businessType; + /** + * 制单人 + */ + private String createBy; + /** + * 业务实体id + */ + private Long companyId; + /** + * 业务实体 + */ + private String company; + /** + * 文件后缀 + */ + private String suffix; + /** + * 文件地址 + */ + private String fileUrl; + /** + * 绝对路径 + */ + private String fileAp; + /** + * 流程号 + */ + private String flowId; + /** + * 摘要 + */ + private String note; + /** + * 所属部门id + */ + private Long deptId; + /** + * 所属部门 + */ + private String deptName; + /** + * 归档id + */ + private Long recordId; + /** + * 用户id + */ + private Long userId; + /** + * 归档状态 + */ + private String archiveState; + /** + * 备注 + */ + private String remark; + /** + * 预留字段1 + */ + private String attr1; + /** + * 预留字段2 + */ + private String attr2; + /** + * 预留字段3 + */ + private Integer attr3; + /** + * 预留字段4 + */ + private Integer attr4; + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/dal/mysql/other/OtherMapper.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/dal/mysql/other/OtherMapper.java new file mode 100644 index 00000000..37d742cd --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/dal/mysql/other/OtherMapper.java @@ -0,0 +1,72 @@ +package cn.iocoder.yudao.module.accounting.dal.mysql.other; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*; + +/** + * 其他资料 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface OtherMapper extends BaseMapperX { + + default PageResult selectPage(OtherPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(OtherDO::getName, reqVO.getName()) + .eqIfPresent(OtherDO::getFlowCode, reqVO.getFlowCode()) + .eqIfPresent(OtherDO::getSource, reqVO.getSource()) + .eqIfPresent(OtherDO::getYear, reqVO.getYear()) + .eqIfPresent(OtherDO::getPeriod, reqVO.getPeriod()) + .eqIfPresent(OtherDO::getBusinessType, reqVO.getBusinessType()) + .betweenIfPresent(OtherDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(OtherDO::getCreateBy, reqVO.getCreateBy()) + .eqIfPresent(OtherDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(OtherDO::getCompany, reqVO.getCompany()) + .eqIfPresent(OtherDO::getSuffix, reqVO.getSuffix()) + .eqIfPresent(OtherDO::getFileUrl, reqVO.getFileUrl()) + .eqIfPresent(OtherDO::getFileAp, reqVO.getFileAp()) + .eqIfPresent(OtherDO::getFlowId, reqVO.getFlowId()) + .eqIfPresent(OtherDO::getNote, reqVO.getNote()) + .eqIfPresent(OtherDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(OtherDO::getDeptName, reqVO.getDeptName()) + .eqIfPresent(OtherDO::getRecordId, reqVO.getRecordId()) + .eqIfPresent(OtherDO::getUserId, reqVO.getUserId()) + .eqIfPresent(OtherDO::getArchiveState, reqVO.getArchiveState()) + .eqIfPresent(OtherDO::getRemark, reqVO.getRemark()) + .orderByDesc(OtherDO::getId)); + } + + default List selectList(OtherExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(OtherDO::getName, reqVO.getName()) + .eqIfPresent(OtherDO::getFlowCode, reqVO.getFlowCode()) + .eqIfPresent(OtherDO::getSource, reqVO.getSource()) + .eqIfPresent(OtherDO::getYear, reqVO.getYear()) + .eqIfPresent(OtherDO::getPeriod, reqVO.getPeriod()) + .eqIfPresent(OtherDO::getBusinessType, reqVO.getBusinessType()) + .betweenIfPresent(OtherDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(OtherDO::getCreateBy, reqVO.getCreateBy()) + .eqIfPresent(OtherDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(OtherDO::getCompany, reqVO.getCompany()) + .eqIfPresent(OtherDO::getSuffix, reqVO.getSuffix()) + .eqIfPresent(OtherDO::getFileUrl, reqVO.getFileUrl()) + .eqIfPresent(OtherDO::getFileAp, reqVO.getFileAp()) + .eqIfPresent(OtherDO::getFlowId, reqVO.getFlowId()) + .eqIfPresent(OtherDO::getNote, reqVO.getNote()) + .eqIfPresent(OtherDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(OtherDO::getDeptName, reqVO.getDeptName()) + .eqIfPresent(OtherDO::getRecordId, reqVO.getRecordId()) + .eqIfPresent(OtherDO::getUserId, reqVO.getUserId()) + .eqIfPresent(OtherDO::getArchiveState, reqVO.getArchiveState()) + .eqIfPresent(OtherDO::getRemark, reqVO.getRemark()) + .orderByDesc(OtherDO::getId)); + } + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/other/OtherService.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/other/OtherService.java new file mode 100644 index 00000000..6c8a48d0 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/other/OtherService.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.accounting.service.other; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*; +import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 其他资料 Service 接口 + * + * @author 芋道源码 + */ +public interface OtherService { + + /** + * 创建其他资料 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createOther(@Valid OtherCreateReqVO createReqVO); + + /** + * 更新其他资料 + * + * @param updateReqVO 更新信息 + */ + void updateOther(@Valid OtherUpdateReqVO updateReqVO); + + /** + * 删除其他资料 + * + * @param id 编号 + */ + void deleteOther(Long id); + + /** + * 获得其他资料 + * + * @param id 编号 + * @return 其他资料 + */ + OtherDO getOther(Long id); + + /** + * 获得其他资料列表 + * + * @param ids 编号 + * @return 其他资料列表 + */ + List getOtherList(Collection ids); + + /** + * 获得其他资料分页 + * + * @param pageReqVO 分页查询 + * @return 其他资料分页 + */ + PageResult getOtherPage(OtherPageReqVO pageReqVO); + + /** + * 获得其他资料列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 其他资料列表 + */ + List getOtherList(OtherExportReqVO exportReqVO); + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImpl.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImpl.java new file mode 100644 index 00000000..bee72e29 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.accounting.service.other; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*; +import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.accounting.convert.other.OtherConvert; +import cn.iocoder.yudao.module.accounting.dal.mysql.other.OtherMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.*; + +/** + * 其他资料 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class OtherServiceImpl implements OtherService { + + @Resource + private OtherMapper otherMapper; + + @Override + public Long createOther(OtherCreateReqVO createReqVO) { + // 插入 + OtherDO other = OtherConvert.INSTANCE.convert(createReqVO); + otherMapper.insert(other); + // 返回 + return other.getId(); + } + + @Override + public void updateOther(OtherUpdateReqVO updateReqVO) { + // 校验存在 + validateOtherExists(updateReqVO.getId()); + // 更新 + OtherDO updateObj = OtherConvert.INSTANCE.convert(updateReqVO); + otherMapper.updateById(updateObj); + } + + @Override + public void deleteOther(Long id) { + // 校验存在 + validateOtherExists(id); + // 删除 + otherMapper.deleteById(id); + } + + private void validateOtherExists(Long id) { + if (otherMapper.selectById(id) == null) { + throw exception(OTHER_NOT_EXISTS); + } + } + + @Override + public OtherDO getOther(Long id) { + return otherMapper.selectById(id); + } + + @Override + public List getOtherList(Collection ids) { + return otherMapper.selectBatchIds(ids); + } + + @Override + public PageResult getOtherPage(OtherPageReqVO pageReqVO) { + return otherMapper.selectPage(pageReqVO); + } + + @Override + public List getOtherList(OtherExportReqVO exportReqVO) { + return otherMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/resources/mapper/other/OtherMapper.xml b/yudao-module-accounting/yudao-module-accounting-biz/src/main/resources/mapper/other/OtherMapper.xml new file mode 100644 index 00000000..f317e5ae --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/resources/mapper/other/OtherMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImplTest.java b/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImplTest.java new file mode 100644 index 00000000..9a980b82 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImplTest.java @@ -0,0 +1,311 @@ +package cn.iocoder.yudao.module.accounting.service.other; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.mock.mockito.MockBean; + +import javax.annotation.Resource; + +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; + +import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*; +import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO; +import cn.iocoder.yudao.module.accounting.dal.mysql.other.OtherMapper; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import javax.annotation.Resource; +import org.springframework.context.annotation.Import; +import java.util.*; +import java.time.LocalDateTime; + +import static cn.hutool.core.util.RandomUtil.*; +import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.*; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +/** + * {@link OtherServiceImpl} 的单元测试类 + * + * @author 芋道源码 + */ +@Import(OtherServiceImpl.class) +public class OtherServiceImplTest extends BaseDbUnitTest { + + @Resource + private OtherServiceImpl otherService; + + @Resource + private OtherMapper otherMapper; + + @Test + public void testCreateOther_success() { + // 准备参数 + OtherCreateReqVO reqVO = randomPojo(OtherCreateReqVO.class); + + // 调用 + Long otherId = otherService.createOther(reqVO); + // 断言 + assertNotNull(otherId); + // 校验记录的属性是否正确 + OtherDO other = otherMapper.selectById(otherId); + assertPojoEquals(reqVO, other); + } + + @Test + public void testUpdateOther_success() { + // mock 数据 + OtherDO dbOther = randomPojo(OtherDO.class); + otherMapper.insert(dbOther);// @Sql: 先插入出一条存在的数据 + // 准备参数 + OtherUpdateReqVO reqVO = randomPojo(OtherUpdateReqVO.class, o -> { + o.setId(dbOther.getId()); // 设置更新的 ID + }); + + // 调用 + otherService.updateOther(reqVO); + // 校验是否更新正确 + OtherDO other = otherMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, other); + } + + @Test + public void testUpdateOther_notExists() { + // 准备参数 + OtherUpdateReqVO reqVO = randomPojo(OtherUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> otherService.updateOther(reqVO), OTHER_NOT_EXISTS); + } + + @Test + public void testDeleteOther_success() { + // mock 数据 + OtherDO dbOther = randomPojo(OtherDO.class); + otherMapper.insert(dbOther);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbOther.getId(); + + // 调用 + otherService.deleteOther(id); + // 校验数据不存在了 + assertNull(otherMapper.selectById(id)); + } + + @Test + public void testDeleteOther_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> otherService.deleteOther(id), OTHER_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetOtherPage() { + // mock 数据 + OtherDO dbOther = randomPojo(OtherDO.class, o -> { // 等会查询到 + o.setName(null); + o.setFlowCode(null); + o.setSource(null); + o.setYear(null); + o.setPeriod(null); + o.setBusinessType(null); + o.setCreateTime(null); + o.setCreateBy(null); + o.setCompanyId(null); + o.setCompany(null); + o.setSuffix(null); + o.setFileUrl(null); + o.setFileAp(null); + o.setFlowId(null); + o.setNote(null); + o.setDeptId(null); + o.setDeptName(null); + o.setRecordId(null); + o.setUserId(null); + o.setArchiveState(null); + o.setRemark(null); + }); + otherMapper.insert(dbOther); + // 测试 name 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setName(null))); + // 测试 flowCode 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowCode(null))); + // 测试 source 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSource(null))); + // 测试 year 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setYear(null))); + // 测试 period 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setPeriod(null))); + // 测试 businessType 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setBusinessType(null))); + // 测试 createTime 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateTime(null))); + // 测试 createBy 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateBy(null))); + // 测试 companyId 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompanyId(null))); + // 测试 company 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompany(null))); + // 测试 suffix 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSuffix(null))); + // 测试 fileUrl 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileUrl(null))); + // 测试 fileAp 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileAp(null))); + // 测试 flowId 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowId(null))); + // 测试 note 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setNote(null))); + // 测试 deptId 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptId(null))); + // 测试 deptName 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptName(null))); + // 测试 recordId 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRecordId(null))); + // 测试 userId 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setUserId(null))); + // 测试 archiveState 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setArchiveState(null))); + // 测试 remark 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRemark(null))); + // 准备参数 + OtherPageReqVO reqVO = new OtherPageReqVO(); + reqVO.setName(null); + reqVO.setFlowCode(null); + reqVO.setSource(null); + reqVO.setYear(null); + reqVO.setPeriod(null); + reqVO.setBusinessType(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setCreateBy(null); + reqVO.setCompanyId(null); + reqVO.setCompany(null); + reqVO.setSuffix(null); + reqVO.setFileUrl(null); + reqVO.setFileAp(null); + reqVO.setFlowId(null); + reqVO.setNote(null); + reqVO.setDeptId(null); + reqVO.setDeptName(null); + reqVO.setRecordId(null); + reqVO.setUserId(null); + reqVO.setArchiveState(null); + reqVO.setRemark(null); + + // 调用 + PageResult pageResult = otherService.getOtherPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbOther, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetOtherList() { + // mock 数据 + OtherDO dbOther = randomPojo(OtherDO.class, o -> { // 等会查询到 + o.setName(null); + o.setFlowCode(null); + o.setSource(null); + o.setYear(null); + o.setPeriod(null); + o.setBusinessType(null); + o.setCreateTime(null); + o.setCreateBy(null); + o.setCompanyId(null); + o.setCompany(null); + o.setSuffix(null); + o.setFileUrl(null); + o.setFileAp(null); + o.setFlowId(null); + o.setNote(null); + o.setDeptId(null); + o.setDeptName(null); + o.setRecordId(null); + o.setUserId(null); + o.setArchiveState(null); + o.setRemark(null); + }); + otherMapper.insert(dbOther); + // 测试 name 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setName(null))); + // 测试 flowCode 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowCode(null))); + // 测试 source 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSource(null))); + // 测试 year 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setYear(null))); + // 测试 period 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setPeriod(null))); + // 测试 businessType 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setBusinessType(null))); + // 测试 createTime 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateTime(null))); + // 测试 createBy 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateBy(null))); + // 测试 companyId 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompanyId(null))); + // 测试 company 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompany(null))); + // 测试 suffix 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSuffix(null))); + // 测试 fileUrl 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileUrl(null))); + // 测试 fileAp 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileAp(null))); + // 测试 flowId 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowId(null))); + // 测试 note 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setNote(null))); + // 测试 deptId 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptId(null))); + // 测试 deptName 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptName(null))); + // 测试 recordId 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRecordId(null))); + // 测试 userId 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setUserId(null))); + // 测试 archiveState 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setArchiveState(null))); + // 测试 remark 不匹配 + otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRemark(null))); + // 准备参数 + OtherExportReqVO reqVO = new OtherExportReqVO(); + reqVO.setName(null); + reqVO.setFlowCode(null); + reqVO.setSource(null); + reqVO.setYear(null); + reqVO.setPeriod(null); + reqVO.setBusinessType(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setCreateBy(null); + reqVO.setCompanyId(null); + reqVO.setCompany(null); + reqVO.setSuffix(null); + reqVO.setFileUrl(null); + reqVO.setFileAp(null); + reqVO.setFlowId(null); + reqVO.setNote(null); + reqVO.setDeptId(null); + reqVO.setDeptName(null); + reqVO.setRecordId(null); + reqVO.setUserId(null); + reqVO.setArchiveState(null); + reqVO.setRemark(null); + + // 调用 + List list = otherService.getOtherList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbOther, list.get(0)); + } + +} From 2761659f714fc49eff3d00c67d2b1861a9a58010 Mon Sep 17 00:00:00 2001 From: JilingLee <18850011309@139.com> Date: Mon, 25 Sep 2023 14:47:18 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=90=88=E5=90=8C=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=EF=BC=8C=E5=91=98=E5=B7=A5=E6=A1=A3=E6=A1=88=E9=94=99=E8=AF=AF?= =?UTF-8?q?sql=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/contracts20230922zK.sql | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/sql/contracts20230922zK.sql b/sql/contracts20230922zK.sql index 6dfd1719..9e7b7943 100644 --- a/sql/contracts20230922zK.sql +++ b/sql/contracts20230922zK.sql @@ -103,17 +103,20 @@ CREATE TABLE `ea_electronic_employee` ( ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='员工档案'; -- 合同档案菜单权限 -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2415', '合同档案', '', '2', '0', '2383', 'electronic-contracts', 'clipboard', 'ea/electronicContracts/index', 'ElectronicContracts', '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 15:45:07', b'0'); -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2416', '合同档案查询', 'ea:electronic-contracts:query', '3', '1', '2415', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2417', '合同档案创建', 'ea:electronic-contracts:create', '3', '2', '2415', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2418', '合同档案更新', 'ea:electronic-contracts:update', '3', '3', '2415', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2419', '合同档案删除', 'ea:electronic-contracts:delete', '3', '4', '2415', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2420', '合同档案导出', 'ea:electronic-contracts:export', '3', '5', '2415', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); +SELECT `id` INTO @menuId FROM `system_menu` WHERE `name`='电子档案'; +INSERT INTO `lyr-one`.`system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('合同档案', '', '2', '0', @menuId, 'electronic-contracts', 'clipboard', 'ea/electronicContracts/index', 'ElectronicContracts', '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 15:45:07', b'0'); +SET @menuId2 = LAST_INSERT_ID();SET @menuId2 = LAST_INSERT_ID(); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '合同档案查询', 'ea:electronic-contracts:query', '3', '1', @menuId2, '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '合同档案创建', 'ea:electronic-contracts:create', '3', '2', @menuId2, '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '合同档案更新', 'ea:electronic-contracts:update', '3', '3', @menuId2, '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '合同档案删除', 'ea:electronic-contracts:delete', '3', '4', @menuId2, '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '合同档案导出', 'ea:electronic-contracts:export', '3', '5', @menuId2, '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); -- 员工档案菜单权限 -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2439', '员工档案', '', '2', '0', '2383', 'electronic-employee', 'clipboard', 'ea/electronicEmployee/index', 'ElectronicEmployee', '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2440', '员工档案查询', 'ea:electronic-employee:query', '3', '1', '2439', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2441', '员工档案创建', 'ea:electronic-employee:create', '3', '2', '2439', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2442', '员工档案更新', 'ea:electronic-employee:update', '3', '3', '2439', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2443', '员工档案删除', 'ea:electronic-employee:delete', '3', '4', '2439', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); -INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2444', '员工档案导出', 'ea:electronic-employee:export', '3', '5', '2439', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('员工档案', '', '2', '0', @menuId, 'electronic-employee', 'clipboard', 'ea/electronicEmployee/index', 'ElectronicEmployee', '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +SET @menuId3 = LAST_INSERT_ID(); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '员工档案查询', 'ea:electronic-employee:query', '3', '1', @menuId3, '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '员工档案创建', 'ea:electronic-employee:create', '3', '2', @menuId3, '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '员工档案更新', 'ea:electronic-employee:update', '3', '3', @menuId3, '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '员工档案删除', 'ea:electronic-employee:delete', '3', '4', @menuId3, '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '员工档案导出', 'ea:electronic-employee:export', '3', '5', @menuId3, '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); From 209c441a3edcb1a613f0c6903a4390fabd0fc59e Mon Sep 17 00:00:00 2001 From: JilingLee <18850011309@139.com> Date: Tue, 26 Sep 2023 11:52:37 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=9B=9B=E6=80=A7=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/setting20230926JilingLee.sql | 86 +++++++ .../admin/invoices/InvoicesController.java | 9 +- .../service/invoices/InvoicesService.java | 8 + .../service/invoices/InvoicesServiceImpl.java | 14 ++ .../setting/enums/ErrorCodeConstants.java | 1 + .../admin/detection/DetectionController.java | 102 ++++++++ .../admin/detection/vo/DetectionBaseVO.java | 47 ++++ .../detection/vo/DetectionCreateReqVO.java | 14 ++ .../admin/detection/vo/DetectionExcelVO.java | 55 +++++ .../detection/vo/DetectionExportReqVO.java | 50 ++++ .../detection/vo/DetectionPageReqVO.java | 52 ++++ .../admin/detection/vo/DetectionRespVO.java | 19 ++ .../detection/vo/DetectionUpdateReqVO.java | 18 ++ .../convert/detection/DetectionConvert.java | 34 +++ .../dal/dataobject/detection/DetectionDO.java | 107 ++++++++ .../dal/mysql/detection/DetectionMapper.java | 52 ++++ .../service/detection/DetectionService.java | 70 ++++++ .../detection/DetectionServiceImpl.java | 82 +++++++ .../mapper/detection/DetectionMapper.xml | 12 + .../detection/DetectionServiceImplTest.java | 231 ++++++++++++++++++ 20 files changed, 1062 insertions(+), 1 deletion(-) create mode 100644 sql/setting20230926JilingLee.sql create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/DetectionController.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionBaseVO.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionCreateReqVO.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionExcelVO.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionExportReqVO.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionPageReqVO.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionRespVO.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionUpdateReqVO.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/convert/detection/DetectionConvert.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/dataobject/detection/DetectionDO.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/detection/DetectionMapper.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/detection/DetectionService.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImpl.java create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/main/resources/mapper/detection/DetectionMapper.xml create mode 100644 yudao-module-setting/yudao-module-setting-biz/src/test/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImplTest.java diff --git a/sql/setting20230926JilingLee.sql b/sql/setting20230926JilingLee.sql new file mode 100644 index 00000000..e6b943e6 --- /dev/null +++ b/sql/setting20230926JilingLee.sql @@ -0,0 +1,86 @@ +-- ---------------------------- +-- 四性检测 structure for setting_detection +-- ---------------------------- +DROP TABLE IF EXISTS `setting_detection`; +CREATE TABLE `setting_detection` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `one_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '一级分类', + `two_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '二级分类', + `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检测编号', + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检测项目', + `purpose` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检测目的', + `objects` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '归档对象', + `methods` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '依据和方法', + `enable_flag` bit(1) NULL DEFAULT NULL COMMENT '是否启用,0-禁用,1-启用', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1', + `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2', + `attr3` int(11) NULL DEFAULT NULL COMMENT '预留字段3', + `attr4` int(11) NULL DEFAULT NULL COMMENT '预留字段4', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '制单人', + `updater` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '所属部门ID', + `dept_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门名称', + `company_id` bigint(20) NULL DEFAULT NULL COMMENT '业务实体ID', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID', + `deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除,0-未删除,1-已删除', + `company` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务实体名称', + `tenant_id` bigint(20) NOT NULL COMMENT '租户编号,一个集团/总公司对应一个租户', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 37 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '四性检测维护' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of setting_detection +-- ---------------------------- +INSERT INTO `setting_detection` VALUES (1, '真实性检测', '电子文件元数据准确性', 'GD-1-1', '固化信息有效性', '保证电子文件来源真实', '归档文件', '对归档电子文件中的数字摘要、电子签名、电子印章、时间戳等技术措施等固化信息等有效性进行验证', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-01 00:00:00', 'Create_by', 'Updater', '2022-01-01 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (2, '真实性检测', '电子文件内容真实性', 'GD-1-10', '内容数据的电子属性一致性检测', '保证电子文件内容数据电子属性的一致性', '归档电子文件内容数据', '捕获电子文件内容数据的电子属性信息(计算机文件名、文件大小、文件格式、创建时间等),与电子属性信息中记录的数据进行比对', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-02 00:00:00', 'Create_by', 'Updater', '2022-01-02 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (3, '真实性检测', '元数据与内容关联一致性', 'GD-1-11', '元数据是否关联内容数据检测', '保证电子文件元数据与内容数据的关联', '元数据关联的电子文件内容数据', '依据元数据中记录的文件存储路径检测电子文件内容数据是否存在', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-03 00:00:00', 'Create_by', 'Updater', '2022-01-03 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (4, '真实性检测', '归档信息包真实性', 'GD-1-12', '说明文件和目录文件规范性检测', '保证归档信息包信息组织结构和内容符合归档要求', '电子文件文件夹名称', '依据国家有关规定,检测说明文件和目录文件信息组织是否符合规范', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-04 00:00:00', 'Create_by', 'Updater', '2022-01-04 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (5, '真实性检测', '归档信息包真实性', 'GD-1-13', '信息包目录结构规范性检测', '保证归档信息包信息组织结构和内容符合归档要求', '归档信息包目录结构', '依据国家有关规定检测归档信息包内的文件夹结构是否符合规范', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-05 00:00:00', 'Create_by', 'Updater', '2022-01-05 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (6, '真实性检测', '归档信息包真实性', 'GD-1-14', '信息包一致性检测', '保证信息包在归档前后完全一致', '归档信息包', '采用数字摘要比对等方式对归档信息包的一致性进行检测。归档前计算归档信息包的数字摘要,接收时重新计算数字摘要并和归档前的数字摘要进行比对', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-06 00:00:00', 'Create_by', 'Updater', '2022-01-06 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (7, '真实性检测', '电子文件元数据准确性', 'GD-1-2', '元数据项数据长度检测', '检测元数据项数据长度是否符合要求', '归档电子文件元数据', '依据DA/T 46-2009中的元数据项或自定义的元数据项进行检测: a) 对数据库中电子文件元数据项进行数据项长度检测; b) 对归档信息包中元数据项进行长度检测。', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-07 00:00:00', 'Create_by', 'Updater', '2022-01-07 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (8, '真实性检测', '电子文件元数据准确性', 'GD-1-3', '元数据项数据类型、格式检测', '检测元数据项数据类型、格式是否符合要求', '归档电子文件元数据', '依据DA/T 46-2009中的元数据项或自定义的元数据项进行检测: a) 对数据库中电子文件元数据项进行数据类型和格式的检测; b) 对归档信息包中元数据项进行数据类型和格式的检测。', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-08 00:00:00', 'Create_by', 'Updater', '2022-01-08 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (9, '真实性检测', '电子文件元数据准确性', 'GD-1-4', '设定值域的元数据项值域符合度检测', '检测设定值域的元数据项的数据是否符合值域要求', '归档电子文件元数据', '依据DA/T 46-2009中的元数据项或自定义的元数据项进行检测: a) 对数据库中电子文件元数据项进行值域范围的检测; b) 对归档信息包中元数据项进行值域范围的检测。', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-09 00:00:00', 'Create_by', 'Updater', '2022-01-09 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (10, '真实性检测', '电子文件元数据准确性', 'GD-1-5', '元数据项数 据值合理性 检测', '检测元数 据项数据值是否在合理范围 内', '归档电子文件元数据', '依据DA/T 18-1999中的著录项目、DA/T 46-2009中的元数据项或 自定义的元数据项进行检测:\na) 对数据库中电子文件元数据项进行数据值是否在合理范围内 的检测;\nb) 对归档信息包中元数据项进行数据值是否在合理范围内的检 测。', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-01 00:00:00', 'Create_by', 'Updater', '2022-01-01 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (11, '真实性检测', '电子文件元数据准确性', 'GD-1-6', '元数据项数 据包含特殊 字符检测', '检测元数据项数据中是否包含特殊字符', '归档电子文件元数据', '依据GB 18030-2005中的双字节非汉字符号或自定义的特殊字符 进行检测:\na) 对数据库中电子文件元数据项进行数据值是否包含特殊字符 的检测;\nb) 对归档信息包中元数据项进行数据值是否包含特殊字符的检 测。', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-02 00:00:00', 'Create_by', 'Updater', '2022-01-02 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (12, '真实性检测', '电子文件元数据准确性', 'GD-1-7', '档号规范性检测', '检测归档电子文件 编制的归档号/档号 是否符合 规范', '归档号/档号', '依据DA/T 13-1994和用户自定义的归档号/档号编制规则进行检 测:\na) 对数据库中的归档号/档号进行检测;\nb) 对归档信息包中的归档号/档号进行检测。', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-03 00:00:00', 'Create_by', 'Updater', '2022-01-03 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (13, '真实性检测', '电子文件元数据准确性', 'GD-1-8', '元数据项数据重复性检 测', '避免业务 部门重复 归档电子 文件', '用户自定义重复性 检测元数据项,比如档号、 文号、题名等', '依据用户自定义的元数据项(如:档号、文号、题名)进行数据库\n记录和归档信息包的数据重复性检测', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-04 00:00:00', 'Create_by', 'Updater', '2022-01-04 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (14, '完整性检测', '电子文件数据总量', 'GD-2-1', '总件数相符性检测', '保证归档电子文件数量 和实际接收数量相符', '电子文件总件数', '统计电子文件总件数,并和GB/T 18894-2016表A.1《电子 文件归档登记表》中登记的归档电子文件数量比对', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-05 00:00:00', 'Create_by', 'Updater', '2022-01-05 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (15, '完整性检测', '归档信息包完整性', 'GD-2-11', '信息包内容 数据完整性检测', '保证归档信息包中内容 数据齐全、完整', '归档信息包中的数据', '依据归档信息包元数据中记录的文件数量检测归档信息\n包中实际包含的电子文件数量,比对两者是否相符', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-06 00:00:00', 'Create_by', 'Updater', '2022-01-06 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (16, '完整性检测', '元数据完整性', 'GD-2-2', '总字节数相符性检测', '保证归档电子文件字节 数和实际接 收字节数相 符', '电子文件总字节数', '统计电子文件总字节数,并和GB/T 18894-2016表A.1《电 子文件归档登记表》中登记的归档电子文件总字节数比对', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-07 00:00:00', 'Create_by', 'Updater', '2022-01-07 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (17, '完整性检测', '电子文件内容完整性', 'GD-2-3', '元数据项完整性检测', '保证电子文件元数据项的完整性', '电子文件元数据', '依据DA/T 46-2009中的元数据项或自定义的元数据项进行 检测,判断电子文件元数据项是否存在缺项情况', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-08 00:00:00', 'Create_by', 'Updater', '2022-01-08 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (18, '完整性检测', '电子文件内容完整性', 'GD-2-4', '元数据必填著录项目检测', '保证电子文件元数据必填项的完整性', '电子文件元数据', '依据DA/T46-2009中的元数据项或自定义的元数据项进行 检测,判断元数据必填项是否为空', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-09 00:00:00', 'Create_by', 'Updater', '2022-01-09 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (19, '完整性检测', '电子文件内容完整性', 'GD-2-5', '过程信息完整性检测', '保证电子文件过程信息的完整性', '电子文件元数据中的处理过程信息', '逐一检查归档电子文件元数据中包含的处理过程信息是否 完整', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-01 00:00:00', 'Create_by', 'Updater', '2022-01-01 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (20, '完整性检测', '电子文件内容完整性', 'GD-2-6', '连续性元数据项检测', '保证电子文件元数据的 连续性', '具有连续 编号性质的元数据项', '依据DA/T 22-2015以及用户自定义的具有连续编号性质的 元数据项(归档号、件内顺序号等)和起始号规则进行检测。 具有连续编号性质的元数据项是否按顺序编号,是否从指 定的起始号开始编号', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-02 00:00:00', 'Create_by', 'Updater', '2022-01-02 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (21, '完整性检测', '电子文件内容完整性', 'GD-2-7', '内容数据完整性检测', '保证电子文件内容数据 完整', '电子文内容数据', '打开电子文件内容数据进行人工检测', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-03 00:00:00', 'Create_by', 'Updater', '2022-01-03 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (22, '完整性检测', '电子文件内容完整性', 'GD-2-8', '附件数据完整性检测', '保证电子文件内容数据中附件内容 不丢失、不遗 漏', '电子文件内容数据 中的附件 部分', '打开电子文件附件数据进行人工检测', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-04 00:00:00', 'Create_by', 'Updater', '2022-01-04 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (23, '完整性检测', '归档信息包完整性', 'GD-2-9', '归档范围检测', '保证归档信息包符合归档范围的要求', '归档信息包', '依据单位归档范围和保管期限表对归档信息包中的元数据 \n和内容数据进行检测,判断其是否存在遗漏或错误情况', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-05 00:00:00', 'Create_by', 'Updater', '2022-01-05 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (24, '可用性检测', '元数据可用性', 'GD-3-1', '保证电子文 件元数据可正常读取', '归档信息包中的元数据', '数据库中的元数据', '检测归档信息包中存放元数据的XML文件是否可以正常解 析、\n读取数据', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-06 00:00:00', 'Create_by', 'Updater', '2022-01-06 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (25, '可用性检测', '元数据可用性', 'GD-3-2', '目标数据库 的元数据可访问性检测', '保证电子文件元数据可 正常访问', '电子文件内容数据', '检测是否可以正常连接数据库,是否可以正常访问元数据表\n中的记录', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-07 00:00:00', 'Create_by', 'Updater', '2022-01-07 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (26, '可用性检测', '电子文件内容可用性', 'GD-3-3', '内容数据格式检测', '保证电子文 件内容数据 格式符合归档要求', '电子文件内容数据', '依据电子文件归档要求对电子文件内容数据格式进行检 测,\n判断其是否符合GB/T 18894-2016、GB/T 33190-2016 等标准要求', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-08 00:00:00', 'Create_by', 'Updater', '2022-01-08 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (27, '可用性检测', '电子文件内容可用性', 'GD-3-4', '内容数据的可读性检测', '保证特定格 式的电子文件内容数据可读', '电子文件内容数据', '人工打开文件进行检测', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-09 00:00:00', 'Create_by', 'Updater', '2022-01-09 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (28, '可用性检测', '电子文件软硬件环境', 'GD-3-6', '软硬件环境合 规性检测', '保证电子文 件环境信息 符合归档要求', '电子文件元数据中的电子属 性信息', '对电子属性信息中记录的软硬件环境信息进行检测,\n判断其是否符合归档要求', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-01 00:00:00', 'Create_by', 'Updater', '2022-01-01 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (29, '可用性检测', '归档信息包可用性', 'GD-3-8', '信息包中包含 的内容数据格 式合规性检测', '确保归档信 息包中的电 子文件可 读、可用', '归档信息 包中的电子文件内容数据', '对归档信息包是否包含非公开压缩算法、是否加密、\n是否 包含不符合归档要求的文件格式等进行检测', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-02 00:00:00', 'Create_by', 'Updater', '2022-01-02 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (30, '安全性检测', '归档信息包病毒', 'GD-4-1', '系统环境中是否安装杀毒软件检测', '检测系统环 境是否安装 杀毒软件', '系统环境', '检测操作系统是否安装国内通用杀毒软件', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-03 00:00:00', 'Create_by', 'Updater', '2022-01-03 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (31, '安全性检测', '病毒感染检测', 'GD-4-2', '病毒感染检测', '保证归档信息包没有感 染病毒', '归档信息包', '调用国内通用杀毒软件接口,检测归档信息包是否感染病 毒', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-04 00:00:00', 'Create_by', 'Updater', '2022-01-04 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (32, '安全性检测', '归档载体安全性', 'GD-4-3', '载体中多余文 件检测', '检测载体中 是否包含多余文件', '归档载体', '对载体进行读取操作,判断载体内是否含有非归档文件', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-05 00:00:00', 'Create_by', 'Updater', '2022-01-05 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (33, '安全性检测', '归档载体安全性', 'GD-4-4', '载体读取速度 检测', '检测载体读 取速度是否 正常', '归档载体', '对载体进行读取操作,和常规的读取速度进行比对判断载 体是否安全可靠', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-06 00:00:00', 'Create_by', 'Updater', '2022-01-06 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (34, '安全性检测', '归档载体安全性', 'GD-4-5', '载体外观检测', '载体外观检测判断载体外 观是否正常', '归档载体', '人工判断载体外观是否正常', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-07 00:00:00', 'Create_by', 'Updater', '2022-01-07 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (35, '安全性检测', '归档载体安全性', 'GD-4-6', '光盘合格性检测', '检测归档光盘是否合格', '归档光盘', '依据DA/T 38-2008的要求对光盘的PIE、POF、BLER等指标\n进行检测,判断光盘是否合格', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-08 00:00:00', 'Create_by', 'Updater', '2022-01-08 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); +INSERT INTO `setting_detection` VALUES (36, '安全性检测', '归档过程安全性', 'GD-4-7', '操作过程安全 性检测', '判断归档过 程是否安全、 可控', '系统环境', '按照国家安全保密要求从技术和管理等方面采取措施,确 保归档信息包在归档和保存过程安全、可控', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-09 00:00:00', 'Create_by', 'Updater', '2022-01-09 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1); + +SET FOREIGN_KEY_CHECKS = 1; + +-- 四性检测菜单 +SELECT `id` INTO @menuId FROM system_menu WHERE name='档案设置'; +INSERT INTO `lyr-one`.`system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('四性检测维护管理', '', 2, 0, @menuId, 'detection', '', 'setting/detection/index', 'Detection', 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0'); +SET @menuId2 = LAST_INSERT_ID(); + +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '四性检测维护查询', 'setting:detection:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '四性检测维护创建', 'setting:detection:create', 3, 2, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '四性检测维护更新', 'setting:detection:update', 3, 3, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '四性检测维护删除', 'setting:detection:delete', 3, 4, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '四性检测维护导出', 'setting:detection:export', 3, 5, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0'); diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java index 1f24e784..687a9b7c 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java @@ -113,6 +113,13 @@ public class InvoicesController { PageResult pageResult = invoicesService.getInvoicesPage(pageVO); return success(InvoicesConvert.INSTANCE.convertPage(pageResult)); } + @GetMapping("/pageTime") + @Operation(summary = "获得发票分页") + @PreAuthorize("@ss.hasPermission('accounting:invoices:query')") + public CommonResult> getInvoicesPageTime(Long months) { + PageResult pageResult = invoicesService.getInvoicesPageTime(months); + return success(InvoicesConvert.INSTANCE.convertPage(pageResult)); + } @GetMapping("/downloadXml") @Operation(summary = "获得发票分页Xml") @@ -229,7 +236,7 @@ public class InvoicesController { ExcelUtils.write(response, "发票.xls", "数据", InvoicesExcelVO.class, new ArrayList()); } - @GetMapping("/inTemplate") + @PostMapping("/inTemplate") @Operation(summary = "导入发票 Excel模板") @PreAuthorize("@ss.hasPermission('accounting:invoices:export')") @OperateLog(type = IMPORT) diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesService.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesService.java index 70dd9ed7..9cc1cb57 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesService.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesService.java @@ -59,6 +59,14 @@ public interface InvoicesService { */ PageResult getInvoicesPage(InvoicesPageReqVO pageReqVO); + /** + * 获得发票分页时间段 + * + * @param months 分页查询 + * @return 发票分页 + */ + PageResult getInvoicesPageTime(Long months); + /** * 获得发票列表, 用于 Excel 导出 * diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesServiceImpl.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesServiceImpl.java index 493d0c78..b2fe6e95 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesServiceImpl.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesServiceImpl.java @@ -1,9 +1,11 @@ package cn.iocoder.yudao.module.accounting.service.invoices; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; +import java.time.LocalDateTime; import java.util.*; import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.*; import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.InvoicesDO; @@ -74,6 +76,18 @@ public class InvoicesServiceImpl implements InvoicesService { return invoicesMapper.selectPage(pageReqVO); } + @Override + public PageResult getInvoicesPageTime(Long months) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.ge("invoice_date", LocalDateTime.now().minusMonths(months)); + List invoicesDOS = invoicesMapper.selectList(wrapper); + PageResult pageResult = new PageResult<>(); + pageResult.setList(invoicesDOS); + long size =(long) invoicesDOS.size(); + pageResult.setTotal(size); + return pageResult; + } + @Override public List getInvoicesList(InvoicesExportReqVO exportReqVO) { return invoicesMapper.selectList(exportReqVO); diff --git a/yudao-module-setting/yudao-module-setting-api/src/main/java/cn/iocoder/yudao/module/setting/enums/ErrorCodeConstants.java b/yudao-module-setting/yudao-module-setting-api/src/main/java/cn/iocoder/yudao/module/setting/enums/ErrorCodeConstants.java index f3b0abfd..0fae73a9 100644 --- a/yudao-module-setting/yudao-module-setting-api/src/main/java/cn/iocoder/yudao/module/setting/enums/ErrorCodeConstants.java +++ b/yudao-module-setting/yudao-module-setting-api/src/main/java/cn/iocoder/yudao/module/setting/enums/ErrorCodeConstants.java @@ -6,6 +6,7 @@ public interface ErrorCodeConstants { ErrorCode DEPOT_CABINET_NOT_EXISTS = new ErrorCode(300100, "档案柜管理不存在"); ErrorCode DEPOT_NOT_EXISTS = new ErrorCode(400100, "库房管理不存在"); ErrorCode PASSWORDS_NOT_EXISTS = new ErrorCode(500100, "数据密码不存在"); + ErrorCode DETECTION_NOT_EXISTS = new ErrorCode(600100, "四性检测维护不存在"); ErrorCode FILE_CATEGORY_NOT_EXISTS = new ErrorCode(400200, "档案分类不存在"); diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/DetectionController.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/DetectionController.java new file mode 100644 index 00000000..e307a83b --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/DetectionController.java @@ -0,0 +1,102 @@ +package cn.iocoder.yudao.module.setting.controller.admin.detection; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.setting.controller.admin.detection.vo.*; +import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO; +import cn.iocoder.yudao.module.setting.convert.detection.DetectionConvert; +import cn.iocoder.yudao.module.setting.service.detection.DetectionService; + +@Tag(name = "管理后台 - 四性检测维护") +@RestController +@RequestMapping("/setting/detection") +@Validated +public class DetectionController { + + @Resource + private DetectionService detectionService; + + @PostMapping("/create") + @Operation(summary = "创建四性检测维护") + @PreAuthorize("@ss.hasPermission('setting:detection:create')") + public CommonResult createDetection(@Valid @RequestBody DetectionCreateReqVO createReqVO) { + return success(detectionService.createDetection(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新四性检测维护") + @PreAuthorize("@ss.hasPermission('setting:detection:update')") + public CommonResult updateDetection(@Valid @RequestBody DetectionUpdateReqVO updateReqVO) { + detectionService.updateDetection(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除四性检测维护") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('setting:detection:delete')") + public CommonResult deleteDetection(@RequestParam("id") Long id) { + detectionService.deleteDetection(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得四性检测维护") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('setting:detection:query')") + public CommonResult getDetection(@RequestParam("id") Long id) { + DetectionDO detection = detectionService.getDetection(id); + return success(DetectionConvert.INSTANCE.convert(detection)); + } + + @GetMapping("/list") + @Operation(summary = "获得四性检测维护列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('setting:detection:query')") + public CommonResult> getDetectionList(@RequestParam("ids") Collection ids) { + List list = detectionService.getDetectionList(ids); + return success(DetectionConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得四性检测维护分页") + @PreAuthorize("@ss.hasPermission('setting:detection:query')") + public CommonResult> getDetectionPage(@Valid DetectionPageReqVO pageVO) { + PageResult pageResult = detectionService.getDetectionPage(pageVO); + return success(DetectionConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出四性检测维护 Excel") + @PreAuthorize("@ss.hasPermission('setting:detection:export')") + @OperateLog(type = EXPORT) + public void exportDetectionExcel(@Valid DetectionExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = detectionService.getDetectionList(exportReqVO); + // 导出 Excel + List datas = DetectionConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "四性检测维护.xls", "数据", DetectionExcelVO.class, datas); + } + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionBaseVO.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionBaseVO.java new file mode 100644 index 00000000..a201dfa9 --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionBaseVO.java @@ -0,0 +1,47 @@ +package cn.iocoder.yudao.module.setting.controller.admin.detection.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import javax.validation.constraints.*; + +/** + * 四性检测维护 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class DetectionBaseVO { + + @Schema(description = "一级分类", example = "1") + private String oneType; + + @Schema(description = "二级分类", example = "2") + private String twoType; + + @Schema(description = "检测编号") + private String code; + + @Schema(description = "检测项目", example = "芋艿") + private String name; + + @Schema(description = "检测目的") + private String purpose; + + @Schema(description = "归档对象") + private String objects; + + @Schema(description = "依据和方法") + private String methods; + + @Schema(description = "是否启用,0-禁用,1-启用") + private Boolean enableFlag; + + @Schema(description = "备注", example = "你说的对") + private String remark; + + @Schema(description = "制单人") + private String createBy; + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionCreateReqVO.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionCreateReqVO.java new file mode 100644 index 00000000..01ff57de --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.setting.controller.admin.detection.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 四性检测维护创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DetectionCreateReqVO extends DetectionBaseVO { + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionExcelVO.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionExcelVO.java new file mode 100644 index 00000000..084bed70 --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionExcelVO.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.setting.controller.admin.detection.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 四性检测维护 Excel VO + * + * @author devin1 + */ +@Data +public class DetectionExcelVO { + + @ExcelProperty("主键ID") + private Long id; + + @ExcelProperty("一级分类") + private String oneType; + + @ExcelProperty("二级分类") + private String twoType; + + @ExcelProperty("检测编号") + private String code; + + @ExcelProperty("检测项目") + private String name; + + @ExcelProperty("检测目的") + private String purpose; + + @ExcelProperty("归档对象") + private String objects; + + @ExcelProperty("依据和方法") + private String methods; + + @ExcelProperty("是否启用,0-禁用,1-启用") + private Boolean enableFlag; + + @ExcelProperty("备注") + private String remark; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @ExcelProperty("制单人") + private String createBy; + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionExportReqVO.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionExportReqVO.java new file mode 100644 index 00000000..b1090ddd --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionExportReqVO.java @@ -0,0 +1,50 @@ +package cn.iocoder.yudao.module.setting.controller.admin.detection.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 四性检测维护 Excel 导出 Request VO,参数和 DetectionPageReqVO 是一致的") +@Data +public class DetectionExportReqVO { + + @Schema(description = "一级分类", example = "1") + private String oneType; + + @Schema(description = "二级分类", example = "2") + private String twoType; + + @Schema(description = "检测编号") + private String code; + + @Schema(description = "检测项目", example = "芋艿") + private String name; + + @Schema(description = "检测目的") + private String purpose; + + @Schema(description = "归档对象") + private String objects; + + @Schema(description = "依据和方法") + private String methods; + + @Schema(description = "是否启用,0-禁用,1-启用") + private Boolean enableFlag; + + @Schema(description = "备注", example = "你说的对") + private String remark; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "制单人") + private String createBy; + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionPageReqVO.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionPageReqVO.java new file mode 100644 index 00000000..880517cd --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionPageReqVO.java @@ -0,0 +1,52 @@ +package cn.iocoder.yudao.module.setting.controller.admin.detection.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 四性检测维护分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DetectionPageReqVO extends PageParam { + + @Schema(description = "一级分类", example = "1") + private String oneType; + + @Schema(description = "二级分类", example = "2") + private String twoType; + + @Schema(description = "检测编号") + private String code; + + @Schema(description = "检测项目", example = "芋艿") + private String name; + + @Schema(description = "检测目的") + private String purpose; + + @Schema(description = "归档对象") + private String objects; + + @Schema(description = "依据和方法") + private String methods; + + @Schema(description = "是否启用,0-禁用,1-启用") + private Boolean enableFlag; + + @Schema(description = "备注", example = "你说的对") + private String remark; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "制单人") + private String createBy; + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionRespVO.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionRespVO.java new file mode 100644 index 00000000..98920c1e --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.setting.controller.admin.detection.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 四性检测维护 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DetectionRespVO extends DetectionBaseVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26127") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionUpdateReqVO.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionUpdateReqVO.java new file mode 100644 index 00000000..c8f72717 --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/detection/vo/DetectionUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.setting.controller.admin.detection.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 四性检测维护更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DetectionUpdateReqVO extends DetectionBaseVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26127") + @NotNull(message = "主键ID不能为空") + private Long id; + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/convert/detection/DetectionConvert.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/convert/detection/DetectionConvert.java new file mode 100644 index 00000000..e9567803 --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/convert/detection/DetectionConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.setting.convert.detection; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.setting.controller.admin.detection.vo.*; +import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO; + +/** + * 四性检测维护 Convert + * + * @author devin1 + */ +@Mapper +public interface DetectionConvert { + + DetectionConvert INSTANCE = Mappers.getMapper(DetectionConvert.class); + + DetectionDO convert(DetectionCreateReqVO bean); + + DetectionDO convert(DetectionUpdateReqVO bean); + + DetectionRespVO convert(DetectionDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/dataobject/detection/DetectionDO.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/dataobject/detection/DetectionDO.java new file mode 100644 index 00000000..d5e293fb --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/dataobject/detection/DetectionDO.java @@ -0,0 +1,107 @@ +package cn.iocoder.yudao.module.setting.dal.dataobject.detection; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 四性检测维护 DO + * + * @author devin1 + */ +@TableName("setting_detection") +@KeySequence("setting_detection_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DetectionDO extends BaseDO { + + /** + * 主键ID + */ + @TableId + private Long id; + /** + * 一级分类 + */ + private String oneType; + /** + * 二级分类 + */ + private String twoType; + /** + * 检测编号 + */ + private String code; + /** + * 检测项目 + */ + private String name; + /** + * 检测目的 + */ + private String purpose; + /** + * 归档对象 + */ + private String objects; + /** + * 依据和方法 + */ + private String methods; + /** + * 是否启用,0-禁用,1-启用 + */ + private Boolean enableFlag; + /** + * 备注 + */ + private String remark; + /** + * 预留字段1 + */ + private String attr1; + /** + * 预留字段2 + */ + private String attr2; + /** + * 预留字段3 + */ + private Integer attr3; + /** + * 预留字段4 + */ + private Integer attr4; + /** + * 制单人 + */ + private String createBy; + /** + * 所属部门ID + */ + private Long deptId; + /** + * 所属部门名称 + */ + private String deptName; + /** + * 业务实体ID + */ + private Long companyId; + /** + * 用户ID + */ + private Long userId; + /** + * 业务实体名称 + */ + private String company; + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/detection/DetectionMapper.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/detection/DetectionMapper.java new file mode 100644 index 00000000..977871a5 --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/detection/DetectionMapper.java @@ -0,0 +1,52 @@ +package cn.iocoder.yudao.module.setting.dal.mysql.detection; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.setting.controller.admin.detection.vo.*; + +/** + * 四性检测维护 Mapper + * + * @author devin1 + */ +@Mapper +public interface DetectionMapper extends BaseMapperX { + + default PageResult selectPage(DetectionPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(DetectionDO::getOneType, reqVO.getOneType()) + .eqIfPresent(DetectionDO::getTwoType, reqVO.getTwoType()) + .eqIfPresent(DetectionDO::getCode, reqVO.getCode()) + .likeIfPresent(DetectionDO::getName, reqVO.getName()) + .likeIfPresent(DetectionDO::getPurpose, reqVO.getPurpose()) + .likeIfPresent(DetectionDO::getObjects, reqVO.getObjects()) + .likeIfPresent(DetectionDO::getMethods, reqVO.getMethods()) + .eqIfPresent(DetectionDO::getEnableFlag, reqVO.getEnableFlag()) + .eqIfPresent(DetectionDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(DetectionDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(DetectionDO::getCreateBy, reqVO.getCreateBy()) + .orderByDesc(DetectionDO::getId)); + } + + default List selectList(DetectionExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(DetectionDO::getOneType, reqVO.getOneType()) + .eqIfPresent(DetectionDO::getTwoType, reqVO.getTwoType()) + .eqIfPresent(DetectionDO::getCode, reqVO.getCode()) + .likeIfPresent(DetectionDO::getName, reqVO.getName()) + .likeIfPresent(DetectionDO::getPurpose, reqVO.getPurpose()) + .likeIfPresent(DetectionDO::getObjects, reqVO.getObjects()) + .likeIfPresent(DetectionDO::getMethods, reqVO.getMethods()) + .eqIfPresent(DetectionDO::getEnableFlag, reqVO.getEnableFlag()) + .eqIfPresent(DetectionDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(DetectionDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(DetectionDO::getCreateBy, reqVO.getCreateBy()) + .orderByDesc(DetectionDO::getId)); + } + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/detection/DetectionService.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/detection/DetectionService.java new file mode 100644 index 00000000..a10c9f7e --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/detection/DetectionService.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.setting.service.detection; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.setting.controller.admin.detection.vo.*; +import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 四性检测维护 Service 接口 + * + * @author devin1 + */ +public interface DetectionService { + + /** + * 创建四性检测维护 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createDetection(@Valid DetectionCreateReqVO createReqVO); + + /** + * 更新四性检测维护 + * + * @param updateReqVO 更新信息 + */ + void updateDetection(@Valid DetectionUpdateReqVO updateReqVO); + + /** + * 删除四性检测维护 + * + * @param id 编号 + */ + void deleteDetection(Long id); + + /** + * 获得四性检测维护 + * + * @param id 编号 + * @return 四性检测维护 + */ + DetectionDO getDetection(Long id); + + /** + * 获得四性检测维护列表 + * + * @param ids 编号 + * @return 四性检测维护列表 + */ + List getDetectionList(Collection ids); + + /** + * 获得四性检测维护分页 + * + * @param pageReqVO 分页查询 + * @return 四性检测维护分页 + */ + PageResult getDetectionPage(DetectionPageReqVO pageReqVO); + + /** + * 获得四性检测维护列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 四性检测维护列表 + */ + List getDetectionList(DetectionExportReqVO exportReqVO); + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImpl.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImpl.java new file mode 100644 index 00000000..9a605cd9 --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.setting.service.detection; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import cn.iocoder.yudao.module.setting.controller.admin.detection.vo.*; +import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.setting.convert.detection.DetectionConvert; +import cn.iocoder.yudao.module.setting.dal.mysql.detection.DetectionMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.setting.enums.ErrorCodeConstants.*; + +/** + * 四性检测维护 Service 实现类 + * + * @author devin1 + */ +@Service +@Validated +public class DetectionServiceImpl implements DetectionService { + + @Resource + private DetectionMapper detectionMapper; + + @Override + public Long createDetection(DetectionCreateReqVO createReqVO) { + // 插入 + DetectionDO detection = DetectionConvert.INSTANCE.convert(createReqVO); + detectionMapper.insert(detection); + // 返回 + return detection.getId(); + } + + @Override + public void updateDetection(DetectionUpdateReqVO updateReqVO) { + // 校验存在 + validateDetectionExists(updateReqVO.getId()); + // 更新 + DetectionDO updateObj = DetectionConvert.INSTANCE.convert(updateReqVO); + detectionMapper.updateById(updateObj); + } + + @Override + public void deleteDetection(Long id) { + // 校验存在 + validateDetectionExists(id); + // 删除 + detectionMapper.deleteById(id); + } + + private void validateDetectionExists(Long id) { + if (detectionMapper.selectById(id) == null) { + throw exception(DETECTION_NOT_EXISTS); + } + } + + @Override + public DetectionDO getDetection(Long id) { + return detectionMapper.selectById(id); + } + + @Override + public List getDetectionList(Collection ids) { + return detectionMapper.selectBatchIds(ids); + } + + @Override + public PageResult getDetectionPage(DetectionPageReqVO pageReqVO) { + return detectionMapper.selectPage(pageReqVO); + } + + @Override + public List getDetectionList(DetectionExportReqVO exportReqVO) { + return detectionMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/resources/mapper/detection/DetectionMapper.xml b/yudao-module-setting/yudao-module-setting-biz/src/main/resources/mapper/detection/DetectionMapper.xml new file mode 100644 index 00000000..69f892e3 --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/resources/mapper/detection/DetectionMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-setting/yudao-module-setting-biz/src/test/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImplTest.java b/yudao-module-setting/yudao-module-setting-biz/src/test/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImplTest.java new file mode 100644 index 00000000..d44a380a --- /dev/null +++ b/yudao-module-setting/yudao-module-setting-biz/src/test/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImplTest.java @@ -0,0 +1,231 @@ +package cn.iocoder.yudao.module.setting.service.detection; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.mock.mockito.MockBean; + +import javax.annotation.Resource; + +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; + +import cn.iocoder.yudao.module.setting.controller.admin.detection.vo.*; +import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO; +import cn.iocoder.yudao.module.setting.dal.mysql.detection.DetectionMapper; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import javax.annotation.Resource; +import org.springframework.context.annotation.Import; +import java.util.*; +import java.time.LocalDateTime; + +import static cn.hutool.core.util.RandomUtil.*; +import static cn.iocoder.yudao.module.setting.enums.ErrorCodeConstants.*; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +/** + * {@link DetectionServiceImpl} 的单元测试类 + * + * @author devin1 + */ +@Import(DetectionServiceImpl.class) +public class DetectionServiceImplTest extends BaseDbUnitTest { + + @Resource + private DetectionServiceImpl detectionService; + + @Resource + private DetectionMapper detectionMapper; + + @Test + public void testCreateDetection_success() { + // 准备参数 + DetectionCreateReqVO reqVO = randomPojo(DetectionCreateReqVO.class); + + // 调用 + Long detectionId = detectionService.createDetection(reqVO); + // 断言 + assertNotNull(detectionId); + // 校验记录的属性是否正确 + DetectionDO detection = detectionMapper.selectById(detectionId); + assertPojoEquals(reqVO, detection); + } + + @Test + public void testUpdateDetection_success() { + // mock 数据 + DetectionDO dbDetection = randomPojo(DetectionDO.class); + detectionMapper.insert(dbDetection);// @Sql: 先插入出一条存在的数据 + // 准备参数 + DetectionUpdateReqVO reqVO = randomPojo(DetectionUpdateReqVO.class, o -> { + o.setId(dbDetection.getId()); // 设置更新的 ID + }); + + // 调用 + detectionService.updateDetection(reqVO); + // 校验是否更新正确 + DetectionDO detection = detectionMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, detection); + } + + @Test + public void testUpdateDetection_notExists() { + // 准备参数 + DetectionUpdateReqVO reqVO = randomPojo(DetectionUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> detectionService.updateDetection(reqVO), DETECTION_NOT_EXISTS); + } + + @Test + public void testDeleteDetection_success() { + // mock 数据 + DetectionDO dbDetection = randomPojo(DetectionDO.class); + detectionMapper.insert(dbDetection);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbDetection.getId(); + + // 调用 + detectionService.deleteDetection(id); + // 校验数据不存在了 + assertNull(detectionMapper.selectById(id)); + } + + @Test + public void testDeleteDetection_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> detectionService.deleteDetection(id), DETECTION_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetDetectionPage() { + // mock 数据 + DetectionDO dbDetection = randomPojo(DetectionDO.class, o -> { // 等会查询到 + o.setOneType(null); + o.setTwoType(null); + o.setCode(null); + o.setName(null); + o.setPurpose(null); + o.setObjects(null); + o.setMethods(null); + o.setEnableFlag(null); + o.setRemark(null); + o.setCreateTime(null); + o.setCreateBy(null); + }); + detectionMapper.insert(dbDetection); + // 测试 oneType 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setOneType(null))); + // 测试 twoType 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setTwoType(null))); + // 测试 code 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCode(null))); + // 测试 name 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setName(null))); + // 测试 purpose 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setPurpose(null))); + // 测试 objects 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setObjects(null))); + // 测试 methods 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setMethods(null))); + // 测试 enableFlag 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setEnableFlag(null))); + // 测试 remark 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setRemark(null))); + // 测试 createTime 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateTime(null))); + // 测试 createBy 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateBy(null))); + // 准备参数 + DetectionPageReqVO reqVO = new DetectionPageReqVO(); + reqVO.setOneType(null); + reqVO.setTwoType(null); + reqVO.setCode(null); + reqVO.setName(null); + reqVO.setPurpose(null); + reqVO.setObjects(null); + reqVO.setMethods(null); + reqVO.setEnableFlag(null); + reqVO.setRemark(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setCreateBy(null); + + // 调用 + PageResult pageResult = detectionService.getDetectionPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbDetection, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetDetectionList() { + // mock 数据 + DetectionDO dbDetection = randomPojo(DetectionDO.class, o -> { // 等会查询到 + o.setOneType(null); + o.setTwoType(null); + o.setCode(null); + o.setName(null); + o.setPurpose(null); + o.setObjects(null); + o.setMethods(null); + o.setEnableFlag(null); + o.setRemark(null); + o.setCreateTime(null); + o.setCreateBy(null); + }); + detectionMapper.insert(dbDetection); + // 测试 oneType 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setOneType(null))); + // 测试 twoType 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setTwoType(null))); + // 测试 code 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCode(null))); + // 测试 name 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setName(null))); + // 测试 purpose 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setPurpose(null))); + // 测试 objects 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setObjects(null))); + // 测试 methods 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setMethods(null))); + // 测试 enableFlag 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setEnableFlag(null))); + // 测试 remark 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setRemark(null))); + // 测试 createTime 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateTime(null))); + // 测试 createBy 不匹配 + detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateBy(null))); + // 准备参数 + DetectionExportReqVO reqVO = new DetectionExportReqVO(); + reqVO.setOneType(null); + reqVO.setTwoType(null); + reqVO.setCode(null); + reqVO.setName(null); + reqVO.setPurpose(null); + reqVO.setObjects(null); + reqVO.setMethods(null); + reqVO.setEnableFlag(null); + reqVO.setRemark(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setCreateBy(null); + + // 调用 + List list = detectionService.getDetectionList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbDetection, list.get(0)); + } + +} From 5f1f752dc94cd6db0373c6044ac82426fa2c98b5 Mon Sep 17 00:00:00 2001 From: JiilingLee <462362@qq.com> Date: Sat, 7 Oct 2023 10:57:32 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BC=9A=E8=AE=A1=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E8=B5=84=E6=96=99=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accounting/controller/admin/other/OtherController.java | 2 +- .../accounting/controller/admin/other/vo/OtherBaseVO.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/OtherController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/OtherController.java index 439a7fdb..8407fc3d 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/OtherController.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/OtherController.java @@ -77,7 +77,7 @@ public class OtherController { return success(OtherConvert.INSTANCE.convert(other)); } - @GetMapping("/upload") + @PostMapping("/upload") @Operation(summary = "上传其他资料") @Parameter(name = "multipartFile", description = "文件", required = true) @PreAuthorize("@ss.hasPermission('accounting:other:create')") diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherBaseVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherBaseVO.java index 18c5ac92..dc99f20b 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherBaseVO.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/other/vo/OtherBaseVO.java @@ -47,4 +47,7 @@ public class OtherBaseVO { @Schema(description = "备注", example = "你猜") private String remark; + @Schema(description = "文件地址") + private String fileUrl; + }