From 5ca4ab349909030e77354832287f2d6a2c80e119 Mon Sep 17 00:00:00 2001 From: “djh” <“3298565835@qq.com”> Date: 星期二, 01 七月 2025 16:58:21 +0800 Subject: [PATCH] Merge branch 'master' of https://sinanoaq.cn:8888/r/multi_system --- multi-admin/src/main/resources/application.yml | 6 multi-admin/src/test/java/com/gkhy/exam/admin/ExcelTest.java | 2 multi-system/src/main/java/com/gkhy/exam/system/domain/StandardizedQuality.java | 66 ++++ multi-system/src/main/java/com/gkhy/exam/system/service/StandardizedTemplateService.java | 29 ++ multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java | 4 multi-common/src/main/java/com/gkhy/exam/common/domain/entity/SysUser.java | 8 multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/TemplateController.java | 132 +++++++++ multi-system/src/main/resources/mapper/system/StandardizedQualityMapper.xml | 65 ++++ multi-system/src/main/java/com/gkhy/exam/system/domain/StandardizedTemplate.java | 73 +++++ multi-system/src/main/resources/mapper/system/StandardizedTemplateMapper.xml | 69 ++++ pom.xml | 31 ++ multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/WordExportController.java | 62 ++++ multi-admin/src/main/resources/application-prod.yml | 14 multi-common/src/main/java/com/gkhy/exam/common/config/FFmpegConfig.java | 4 multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysCommonServiceImpl.java | 2 multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java | 193 +++++++++++++ multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysDeptController.java | 10 multi-system/src/main/java/com/gkhy/exam/system/mapper/StandardizedTemplateMapper.java | 15 + multi-common/pom.xml | 24 + multi-system/src/main/java/com/gkhy/exam/system/domain/vo/SysDeptSaveDTOReq.java | 2 multi-system/src/main/java/com/gkhy/exam/system/mapper/StandardizedQualityMapper.java | 15 + 21 files changed, 804 insertions(+), 22 deletions(-) diff --git a/multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysDeptController.java b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysDeptController.java index 646990a..fa76240 100644 --- a/multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysDeptController.java +++ b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysDeptController.java @@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil; import com.gkhy.exam.common.api.CommonResult; import com.gkhy.exam.common.constant.UserConstant; +import com.gkhy.exam.common.domain.TreeSelect; import com.gkhy.exam.common.domain.entity.SysDept; import com.gkhy.exam.system.domain.SysFunctionalDistribution; import com.gkhy.exam.system.domain.vo.DeptVo; @@ -54,6 +55,15 @@ } + @GetMapping("/treeList") + @ApiOperation(value = "获取部门列表树状") + public CommonResult treeList(SysDept dept) + { + List<TreeSelect> treeSelects = deptService.selectDeptTreeList(dept); + return CommonResult.success(treeSelects); + } + + /** diff --git a/multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/WordExportController.java b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/WordExportController.java new file mode 100644 index 0000000..5b5087b --- /dev/null +++ b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/WordExportController.java @@ -0,0 +1,62 @@ +//package com.gkhy.exam.admin.controller.system; +// +// +//import org.apache.poi.poifs.filesystem.DirectoryEntry; +//import org.apache.poi.poifs.filesystem.DocumentEntry; +//import org.apache.poi.poifs.filesystem.POIFSFileSystem; +//import org.springframework.core.io.ClassPathResource; +//import org.springframework.http.HttpHeaders; +//import org.springframework.http.MediaType; +//import org.springframework.http.ResponseEntity; +//import org.springframework.web.bind.annotation.*; +// +//import javax.servlet.ServletOutputStream; +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import java.io.*; +//import java.util.Map; +// +//@RestController +//public class WordExportController { +// @ResponseBody +// @RequestMapping(value = "download") +// public int download(HttpServletResponse response, HttpServletRequest request)throws Exception { +// String content = "<h1>标题头</h1><h2>第二个标题</h2><a href=\"www.baidu.com\">百度搜索</a>"; +// StringBuffer sbf = new StringBuffer(); +// sbf.append("<html><body>"); +// sbf.append(content); +// sbf.append("</body></html"); +// exportWord(request,response,String.valueOf(sbf),"word1"); +// return 1; +// } +// +// +// /** +// * +// * @param request +// * @param response +// * @param content 富文本内容 +// * @param fileName 生成word名字 +// * @throws Exception +// */ +// public static void exportWord(HttpServletRequest request, HttpServletResponse response, String content, String fileName) throws Exception { +// byte b[] = content.getBytes("GBK"); //这里是必须要设置编码的,不然导出中文就会乱码。 +// ByteArrayInputStream bais = new ByteArrayInputStream(b);//将字节数组包装到流中 +// POIFSFileSystem poifs = new POIFSFileSystem(); +// DirectoryEntry directory = poifs.getRoot(); +// DocumentEntry documentEntry = directory.createDocument("WordDocument", bais); //该步骤不可省略,否则会出现乱码。 +// //输出文件 +// request.setCharacterEncoding("utf-8"); +// response.setContentType("application/msword");//导出word格式 +// response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes("GB2312"),"iso8859-1") + ".doc"); +// ServletOutputStream ostream = response.getOutputStream(); +// poifs.writeFilesystem(ostream); +// bais.close(); +// ostream.close(); +// poifs.close(); +// } +// +// +// +// +//} diff --git a/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/TemplateController.java b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/TemplateController.java new file mode 100644 index 0000000..ab88a35 --- /dev/null +++ b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/TemplateController.java @@ -0,0 +1,132 @@ +package com.gkhy.exam.admin.controller.web; + +import com.gkhy.exam.common.api.CommonResult; +import com.gkhy.exam.system.domain.CompanyIndustryTemplate; +import com.gkhy.exam.system.domain.StandardizedQuality; +import com.gkhy.exam.system.domain.StandardizedTemplate; +import com.gkhy.exam.system.service.StandardizedTemplateService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +@Api(tags = "标准化体系模板") +@RestController +@RequestMapping("/template") +public class TemplateController { + + + @Autowired + private StandardizedTemplateService standardizedTemplateService; + + /** + * 行业模版 + * @param companyId + * @return + */ + @ApiOperation(value = "标准化模版(分页)") + @ApiImplicitParams({ + @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "int", required = false, value = "公司iD"), + @ApiImplicitParam(paramType = "query", name = "templateType", dataType = "int", required = true, value = "类型1体系标准2技术标准3应用标准4程序文件5作业指导书6记录及表单7技术类8生产类9其他知识产权"), + @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = true, value = "页码"), + @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = true, value = "每页数量") + }) + @GetMapping("/standardizedTemplate/list") + public CommonResult selectStandardizedTemplateList(Integer companyId, @RequestParam("templateType") Integer templateType){ + return CommonResult.success(standardizedTemplateService.selectStandardizedTemplateList(companyId, templateType)); + } + + /** + * 行业模版新增 + * @param standardizedTemplate + * @return + */ + @ApiOperation(value = "标准化模版新增") + @PostMapping("/standardizedTemplate/insert") + public CommonResult insertStandardizedTemplate(@Validated @RequestBody StandardizedTemplate standardizedTemplate){ + return standardizedTemplateService.insertStandardizedTemplate(standardizedTemplate); + } + + /** + * 企业花名册修改 + * @param standardizedTemplate + * @return + */ + @ApiOperation(value = "标准化模版修改") + @PostMapping("/standardizedTemplate/update") + public CommonResult updateCompanyIndustryTemplate(@Validated @RequestBody StandardizedTemplate standardizedTemplate){ + return standardizedTemplateService.updateStandardizedTemplate(standardizedTemplate); + } + + /** + * 行业模版删除 + * @param standardizedTemplateId + * @return + */ + @ApiOperation(value = "标准化模版删除") + @GetMapping("/standardizedTemplate/deleted") + public CommonResult deletedStandardizedTemplate(@RequestParam("standardizedTemplateId") Integer standardizedTemplateId){ + return standardizedTemplateService.deletedStandardizedTemplate(standardizedTemplateId); + } + + /** + * 行业模版 + * @param companyId + * @return + */ + @ApiOperation(value = "获取质量手册") + @ApiImplicitParams({ + @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "int", required = true, value = "公司iD"), + }) + @GetMapping("/standardizedQuality/info") + public CommonResult selectStandardizedQuality(Integer companyId){ + return CommonResult.success(standardizedTemplateService.selectStandardizedQuality(companyId)); + } + + /** + * 行业模版新增 + * @param standardizedQuality + * @return + */ + @ApiOperation(value = "质量手册新增") + @PostMapping("/standardizedQuality/insert") + public CommonResult insertStandardizedQuality(@Validated @RequestBody StandardizedQuality standardizedQuality){ + return standardizedTemplateService.insertStandardizedQuality(standardizedQuality); + } + + /** + * 企业花名册修改 + * @param standardizedQuality + * @return + */ + @ApiOperation(value = "质量手册修改") + @PostMapping("/standardizedQuality/update") + public CommonResult updateStandardizedQuality(@Validated @RequestBody StandardizedQuality standardizedQuality){ + return standardizedTemplateService.updateStandardizedQuality(standardizedQuality); + } + + /** + * 行业模版删除 + * @param standardizedQualityId + * @return + */ + @ApiOperation(value = "质量手册删除") + @GetMapping("/standardizedQuality/deleted") + public CommonResult deletedStandardizedQuality(@RequestParam("standardizedQualityId") Integer standardizedQualityId){ + return standardizedTemplateService.deletedStandardizedQuality(standardizedQualityId); + } + + /** + * 获取质量手册数据 + * @param companyId + * @return + */ + @ApiOperation(value = "获取质量手册数据") + @GetMapping("/standardizedQuality/dataInfo") + public CommonResult standardizedQualityDataInfo(@RequestParam("companyId") Integer companyId){ + return standardizedTemplateService.getStandardizedQualityByCompanyId(companyId); + } +} diff --git a/multi-admin/src/main/resources/application-prod.yml b/multi-admin/src/main/resources/application-prod.yml index 906b0f9..15ea241 100644 --- a/multi-admin/src/main/resources/application-prod.yml +++ b/multi-admin/src/main/resources/application-prod.yml @@ -5,7 +5,7 @@ druid: # 主库数据源 master: - url: jdbc:mysql://127.0.0.1:23306/train_exam?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=Asia/Beijing&useSSL=false&allowPublicKeyRetrieval=true&allowMultiQueries=true + url: jdbc:mysql://127.0.0.1:7006/multi_system?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&allowMultiQueries=true username: root password: 2farwL3yPXfbH2AP # 从库数据源 @@ -41,10 +41,10 @@ login-password: druid #redis 配置 redis: - database: 0 + database: 5 host: 127.0.0.1 port: 6379 - password: + password: akj78avauba789a # mybatis-plus相关配置 @@ -80,7 +80,7 @@ enabled: false minio: - endpoint: http://127.0.0.1:9000/ #Minio服务所在地址 - bucketName: trainexam #存储桶名称 - accessKey: nblxqRZXDvQ59HBH49rF #访问的key - secretKey: TR0IFphXPo0IObQCYgcJ0JOik21s40ey2MIMU8Rh #访问的秘钥 + endpoint: http://106.15.95.149:9001/ #Minio服务所在地址 + bucketName: multiSystem #存储桶名称 + accessKey: U9JW4xOeeUQOSR4f #访问的key + secretKey: iaqQV6twR9yDZiFAf2UYr5xZfESanZs3 #访问的秘钥 diff --git a/multi-admin/src/main/resources/application.yml b/multi-admin/src/main/resources/application.yml index c85e7f5..f2ad82e 100644 --- a/multi-admin/src/main/resources/application.yml +++ b/multi-admin/src/main/resources/application.yml @@ -1,8 +1,8 @@ spring: application: - name: train_exam + name: multi_system profiles: - active: dev + active: prod servlet: multipart: enabled: true @@ -15,7 +15,7 @@ matching-strategy: ant_path_matcher server: - port: 8082 + port: 8056 servlet: context-path: /api tomcat: diff --git a/multi-admin/src/test/java/com/gkhy/exam/admin/ExcelTest.java b/multi-admin/src/test/java/com/gkhy/exam/admin/ExcelTest.java index 48611ef..350eb34 100644 --- a/multi-admin/src/test/java/com/gkhy/exam/admin/ExcelTest.java +++ b/multi-admin/src/test/java/com/gkhy/exam/admin/ExcelTest.java @@ -19,6 +19,6 @@ @Test public void importTest(){ - commonService.importStudent(); + // commonService.importStudent(); } } diff --git a/multi-common/pom.xml b/multi-common/pom.xml index e8e530d..e0ae02c 100644 --- a/multi-common/pom.xml +++ b/multi-common/pom.xml @@ -152,6 +152,30 @@ <artifactId>easyexcel</artifactId> </dependency> +<!-- <dependency>--> +<!-- <groupId>com.deepoove</groupId>--> +<!-- <artifactId>poi-tl</artifactId>--> +<!-- </dependency>--> + +<!-- <!– 如果需要解析HTML –>--> +<!-- <dependency>--> +<!-- <groupId>org.jsoup</groupId>--> +<!-- <artifactId>jsoup</artifactId>--> +<!-- </dependency>--> +<!-- <dependency>--> +<!-- <groupId>com.itextpdf</groupId>--> +<!-- <artifactId>itextpdf</artifactId>--> +<!-- </dependency>--> +<!-- <dependency>--> +<!-- <groupId>org.bouncycastle</groupId>--> +<!-- <artifactId>bcprov-jdk15on</artifactId>--> +<!-- </dependency>--> +<!-- <!– 支持中文 –>--> +<!-- <dependency>--> +<!-- <groupId>com.itextpdf</groupId>--> +<!-- <artifactId>itext-asian</artifactId>--> +<!-- </dependency>--> + </dependencies> </project> \ No newline at end of file diff --git a/multi-common/src/main/java/com/gkhy/exam/common/config/FFmpegConfig.java b/multi-common/src/main/java/com/gkhy/exam/common/config/FFmpegConfig.java index 0eecf2d..4f42299 100644 --- a/multi-common/src/main/java/com/gkhy/exam/common/config/FFmpegConfig.java +++ b/multi-common/src/main/java/com/gkhy/exam/common/config/FFmpegConfig.java @@ -20,8 +20,8 @@ @Bean public FFmpeg fFmpeg() { String path = System.getProperty("user.dir"); - if(path.endsWith("exam-admin")){ - path=path.replace("\\exam-admin",""); + if(path.endsWith("multi-admin")){ + path=path.replace("\\multi-admin",""); } if (isLinux()){ path+="/ffmpeg/ffmpeg-linux/ffmpeg"; diff --git a/multi-common/src/main/java/com/gkhy/exam/common/domain/entity/SysUser.java b/multi-common/src/main/java/com/gkhy/exam/common/domain/entity/SysUser.java index 49d1825..cbbeca4 100644 --- a/multi-common/src/main/java/com/gkhy/exam/common/domain/entity/SysUser.java +++ b/multi-common/src/main/java/com/gkhy/exam/common/domain/entity/SysUser.java @@ -56,10 +56,10 @@ @TableField("user_type") private Integer userType; - @NotBlank(message = "手机号码不能为空") - @Length(min = 11, max = 11, message = "手机号只能为11位") - @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$",message = "手机号码有误!") - @ApiModelProperty(value = "手机号码",required = true) +// @NotBlank(message = "手机号码不能为空") +// @Length(min = 11, max = 11, message = "手机号只能为11位") +// @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$",message = "手机号码有误!") + @ApiModelProperty(value = "手机号码",required = false) @TableField("phone") private String phone; diff --git a/multi-system/src/main/java/com/gkhy/exam/system/domain/StandardizedQuality.java b/multi-system/src/main/java/com/gkhy/exam/system/domain/StandardizedQuality.java new file mode 100644 index 0000000..30d6089 --- /dev/null +++ b/multi-system/src/main/java/com/gkhy/exam/system/domain/StandardizedQuality.java @@ -0,0 +1,66 @@ +package com.gkhy.exam.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +@TableName("standardized_quality") +@ApiModel(value = "standardized_quality",description = "质量体系手册") +public class StandardizedQuality implements Serializable { + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @NotNull(message = "企业Id不可为空") + @ApiModelProperty(value = "企业ID") + @TableField("company_id") + private Integer companyId; + + @ApiModelProperty(value = "企业名称") + @TableField("company_name") + private String companyName; + + @ApiModelProperty(value = "模板名称") + @TableField("quality_name") + @NotBlank(message = "模板名称不可为空") + private String qualityName; + + @ApiModelProperty(value = "文件路径") + @TableField("file_path") + private String filePath; + + @ApiModelProperty(value = "文件格式") + @TableField("format") + private String format; + + @ApiModelProperty(value = "是否删除") + @TableField("del_flag") + private Integer delFlag; + + @TableField("create_by") + private String createBy; + + @TableField("create_time") + private LocalDateTime createTime; + + @TableField("update_by") + private String updateBy; + + @TableField("update_time") + private LocalDateTime updateTime; + + +} diff --git a/multi-system/src/main/java/com/gkhy/exam/system/domain/StandardizedTemplate.java b/multi-system/src/main/java/com/gkhy/exam/system/domain/StandardizedTemplate.java new file mode 100644 index 0000000..94d9a11 --- /dev/null +++ b/multi-system/src/main/java/com/gkhy/exam/system/domain/StandardizedTemplate.java @@ -0,0 +1,73 @@ +package com.gkhy.exam.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Getter +@Setter +@TableName("standardized_template") +@ApiModel(value = "standardized_template",description = "标准化系统模板") +public class StandardizedTemplate implements Serializable { + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @NotNull(message = "企业Id不可为空") + @ApiModelProperty(value = "企业ID") + @TableField("company_id") + private Integer companyId; + + @ApiModelProperty(value = "企业名称") + @TableField("company_name") + private String companyName; + + @ApiModelProperty(value = "模板名称") + @TableField("template_name") + @NotBlank(message = "模板名称不可为空") + private String templateName; + + @ApiModelProperty(value = "类型1体系标准2技术标准3应用标准4程序文件5作业指导书6记录及表单7技术类8生产类9其他知识产权") + @TableField("template_type") + @NotNull(message = "类型不可为空") + private Integer templateType; + + @ApiModelProperty(value = "文件路径") + @TableField("file_path") + @NotBlank(message = "文件路径不可为空") + private String filePath; + + @ApiModelProperty(value = "文件格式") + @TableField("format") + @NotBlank(message = "文件格式不可为空") + private String format; + + @ApiModelProperty(value = "是否删除") + @TableField("del_flag") + private Integer delFlag; + + @TableField("create_by") + private String createBy; + + @TableField("create_time") + private LocalDateTime createTime; + + @TableField("update_by") + private String updateBy; + + @TableField("update_time") + private LocalDateTime updateTime; + + +} diff --git a/multi-system/src/main/java/com/gkhy/exam/system/domain/vo/SysDeptSaveDTOReq.java b/multi-system/src/main/java/com/gkhy/exam/system/domain/vo/SysDeptSaveDTOReq.java index 28b884f..d19f1fe 100644 --- a/multi-system/src/main/java/com/gkhy/exam/system/domain/vo/SysDeptSaveDTOReq.java +++ b/multi-system/src/main/java/com/gkhy/exam/system/domain/vo/SysDeptSaveDTOReq.java @@ -30,7 +30,7 @@ /** 负责人 */ @ApiModelProperty("负责人") - @NotNull(message = "负责人不能为空") + //@NotNull(message = "负责人不能为空") private Long leaderUserId; @ApiModelProperty("公司id") diff --git a/multi-system/src/main/java/com/gkhy/exam/system/mapper/StandardizedQualityMapper.java b/multi-system/src/main/java/com/gkhy/exam/system/mapper/StandardizedQualityMapper.java new file mode 100644 index 0000000..82ca984 --- /dev/null +++ b/multi-system/src/main/java/com/gkhy/exam/system/mapper/StandardizedQualityMapper.java @@ -0,0 +1,15 @@ +package com.gkhy.exam.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.exam.system.domain.StandardizedQuality; +import com.gkhy.exam.system.domain.StandardizedTemplate; +import org.mapstruct.Mapper; + +import java.util.List; + +@Mapper +public interface StandardizedQualityMapper extends BaseMapper<StandardizedQuality> { + List<StandardizedQuality> selectStandardizedQualityList(Integer companyId, Integer templateType); + + int updateStandardizedQualityById(StandardizedQuality template); +} diff --git a/multi-system/src/main/java/com/gkhy/exam/system/mapper/StandardizedTemplateMapper.java b/multi-system/src/main/java/com/gkhy/exam/system/mapper/StandardizedTemplateMapper.java new file mode 100644 index 0000000..bde9f38 --- /dev/null +++ b/multi-system/src/main/java/com/gkhy/exam/system/mapper/StandardizedTemplateMapper.java @@ -0,0 +1,15 @@ +package com.gkhy.exam.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.exam.system.domain.CompanyIndustryTemplate; +import com.gkhy.exam.system.domain.StandardizedTemplate; +import org.mapstruct.Mapper; + +import java.util.List; + +@Mapper +public interface StandardizedTemplateMapper extends BaseMapper<StandardizedTemplate> { + List<StandardizedTemplate> selectStandardizedTemplateList(Integer companyId, Integer templateType); + + int updateStandardizedTemplateById(StandardizedTemplate template); +} diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/StandardizedTemplateService.java b/multi-system/src/main/java/com/gkhy/exam/system/service/StandardizedTemplateService.java new file mode 100644 index 0000000..0550419 --- /dev/null +++ b/multi-system/src/main/java/com/gkhy/exam/system/service/StandardizedTemplateService.java @@ -0,0 +1,29 @@ +package com.gkhy.exam.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.exam.common.api.CommonPage; +import com.gkhy.exam.common.api.CommonResult; +import com.gkhy.exam.system.domain.CompanyIndustryTemplate; +import com.gkhy.exam.system.domain.StandardizedQuality; +import com.gkhy.exam.system.domain.StandardizedTemplate; + +public interface StandardizedTemplateService extends IService<StandardizedTemplate> { + CommonPage selectStandardizedTemplateList(Integer companyId,Integer templateType); + + CommonResult insertStandardizedTemplate(StandardizedTemplate standardizedTemplate); + + CommonResult updateStandardizedTemplate(StandardizedTemplate standardizedTemplate); + + CommonResult deletedStandardizedTemplate(Integer id); + + + CommonResult selectStandardizedQuality(Integer companyId); + + CommonResult insertStandardizedQuality(StandardizedQuality standardizedQuality); + + CommonResult updateStandardizedQuality(StandardizedQuality standardizedQuality); + + CommonResult deletedStandardizedQuality(Integer id); + + CommonResult getStandardizedQualityByCompanyId(Integer id); +} diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java new file mode 100644 index 0000000..d6ceab9 --- /dev/null +++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java @@ -0,0 +1,193 @@ +package com.gkhy.exam.system.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.exam.common.api.CommonPage; +import com.gkhy.exam.common.api.CommonResult; +import com.gkhy.exam.common.domain.TreeSelect; +import com.gkhy.exam.common.domain.entity.SysDept; +import com.gkhy.exam.common.domain.model.LoginUserDetails; +import com.gkhy.exam.common.exception.ApiException; +import com.gkhy.exam.common.utils.PageUtils; +import com.gkhy.exam.common.utils.SecurityUtils; +import com.gkhy.exam.system.domain.*; +import com.gkhy.exam.system.mapper.*; +import com.gkhy.exam.system.service.CompanyIndustryTemplateService; +import com.gkhy.exam.system.service.ISysDeptService; +import com.gkhy.exam.system.service.StandardizedTemplateService; +import com.gkhy.exam.system.service.SysCompanyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class StandardizedTemplateServiceImpl extends ServiceImpl<StandardizedTemplateMapper, StandardizedTemplate> implements StandardizedTemplateService { + + @Autowired + private StandardizedTemplateMapper standardizedTemplateMapper; + @Autowired + private SysCompanyService sysCompanyService; + + @Autowired + private StandardizedQualityMapper standardizedQualityMapper; + + @Autowired + private SysFunctionalDistributionMapper sysFunctionalDistributionMapper; + + @Autowired + private ISysDeptService iSysDeptService; + + @Autowired + private CompanySummaryMapper companySummaryMapper; + @Autowired + private CompanyQualityPolicyMapper companyQualityPolicyMapper; + @Override + public CommonPage selectStandardizedTemplateList(Integer companyId, Integer templateType) { + boolean admin = SecurityUtils.adminUser(); + if (!admin){ + if (companyId==null){ + companyId = SecurityUtils.getCompanyId().intValue(); + } + } + PageUtils.startPage(); + List<StandardizedTemplate> companyIndustryTemplates = standardizedTemplateMapper.selectStandardizedTemplateList(companyId, templateType); + return CommonPage.restPage(companyIndustryTemplates); + } + + @Override + public CommonResult insertStandardizedTemplate(StandardizedTemplate standardizedTemplate) { + LoginUserDetails loginUser = SecurityUtils.getLoginUser(); + + SysCompany sysCompany = sysCompanyService.selectCompanyById(standardizedTemplate.getCompanyId().longValue()); + standardizedTemplate.setCompanyName(sysCompany.getName()); + standardizedTemplate.setCreateBy(loginUser.getUsername()); + standardizedTemplate.setCreateTime(LocalDateTime.now()); + int insert = standardizedTemplateMapper.insert(standardizedTemplate); + if (insert>0){ + return CommonResult.success(); + } + return CommonResult.failed(); + } + + @Override + public CommonResult updateStandardizedTemplate(StandardizedTemplate standardizedTemplate) { + LoginUserDetails loginUser = SecurityUtils.getLoginUser(); + SysCompany sysCompany = sysCompanyService.selectCompanyById(standardizedTemplate.getCompanyId().longValue()); + standardizedTemplate.setCompanyName(sysCompany.getName()); + standardizedTemplate.setUpdateBy(loginUser.getUsername()); + standardizedTemplate.setUpdateTime(LocalDateTime.now()); + int update = standardizedTemplateMapper.updateStandardizedTemplateById(standardizedTemplate); + if (update>0){ + return CommonResult.success(); + } + return CommonResult.failed(); + } + + @Override + public CommonResult deletedStandardizedTemplate(Integer standardizedTemplateId) { + StandardizedTemplate standardizedTemplate = new StandardizedTemplate(); + LoginUserDetails loginUser = SecurityUtils.getLoginUser(); + standardizedTemplate.setUpdateBy(loginUser.getUsername()); + standardizedTemplate.setUpdateTime(LocalDateTime.now()); + standardizedTemplate.setDelFlag(1); + standardizedTemplate.setId(standardizedTemplateId); + int i = standardizedTemplateMapper.updateById(standardizedTemplate); + if (i>0){ + return CommonResult.success(); + } + return CommonResult.failed(); + } + + @Override + public CommonResult selectStandardizedQuality(Integer companyId) { + boolean admin = SecurityUtils.adminUser(); + LambdaQueryWrapper<StandardizedQuality> lambdaQueryWrapper = Wrappers.<StandardizedQuality>lambdaQuery(); + if (!admin){ + if (companyId==null){ + lambdaQueryWrapper.eq(StandardizedQuality::getCompanyId, SecurityUtils.getCompanyId().intValue()); + } + } + lambdaQueryWrapper.eq(StandardizedQuality::getDelFlag, 0); + return CommonResult.success(standardizedQualityMapper.selectList(lambdaQueryWrapper)); + } + + @Override + public CommonResult insertStandardizedQuality(StandardizedQuality standardizedQuality) { + LambdaQueryWrapper<StandardizedQuality> eq = new LambdaQueryWrapper<StandardizedQuality>().eq(StandardizedQuality::getCompanyId, standardizedQuality.getCompanyId()); + standardizedQualityMapper.delete(eq); + LoginUserDetails loginUser = SecurityUtils.getLoginUser(); + + SysCompany sysCompany = sysCompanyService.selectCompanyById(standardizedQuality.getCompanyId().longValue()); + standardizedQuality.setCompanyName(sysCompany.getName()); + standardizedQuality.setCreateBy(loginUser.getUsername()); + standardizedQuality.setCreateTime(LocalDateTime.now()); + int insert = standardizedQualityMapper.insert(standardizedQuality); + if (insert>0){ + return CommonResult.success(); + } + return CommonResult.failed(); + } + + @Override + public CommonResult updateStandardizedQuality(StandardizedQuality standardizedQuality) { + LoginUserDetails loginUser = SecurityUtils.getLoginUser(); + SysCompany sysCompany = sysCompanyService.selectCompanyById(standardizedQuality.getCompanyId().longValue()); + standardizedQuality.setCompanyName(sysCompany.getName()); + standardizedQuality.setUpdateBy(loginUser.getUsername()); + standardizedQuality.setUpdateTime(LocalDateTime.now()); + int update = standardizedQualityMapper.updateStandardizedQualityById(standardizedQuality); + if (update>0){ + return CommonResult.success(); + } + return CommonResult.failed(); + } + + @Override + public CommonResult deletedStandardizedQuality(Integer id) { + LambdaQueryWrapper<StandardizedQuality> lambdaQueryWrapper = Wrappers.<StandardizedQuality>lambdaQuery() + .eq(StandardizedQuality::getId, id) + .eq(StandardizedQuality::getDelFlag, 0); + StandardizedQuality standardizedQuality = new StandardizedQuality(); + standardizedQuality.setDelFlag(1); + standardizedQuality.setUpdateBy(SecurityUtils.getUsername()); + standardizedQuality.setUpdateTime(LocalDateTime.now()); + standardizedQualityMapper.update(standardizedQuality, lambdaQueryWrapper); + return CommonResult.success(); + } + + @Override + public CommonResult getStandardizedQualityByCompanyId(Integer companyId) { + Map<String, Object> map = new HashMap<>(); + //程序文件 + List<StandardizedTemplate> companyIndustryTemplates = standardizedTemplateMapper.selectStandardizedTemplateList(companyId, 4); + //职能分配 + List<SysFunctionalDistribution> sysFunctionalDistributions = sysFunctionalDistributionMapper.selectListVo(companyId.longValue()); + //部门 + SysDept sysDept = new SysDept(); + sysDept.setCompanyId(companyId.longValue()); + List<TreeSelect> treeSelects = iSysDeptService.selectDeptTreeList(sysDept); + + //公司概况 + List<CompanySummary> companySummaries = companySummaryMapper.selectCompanySummaryList(companyId); + + //质量方针 + List<CompanyQualityPolicy> companyQualityPolicies = companyQualityPolicyMapper.selectCompanyQualityPolicyList(companyId); + //质量方针 + map.put("companyQualityPolicies", companyQualityPolicies); + //公司概况 + map.put("companySummaries", companySummaries); + //部门 + map.put("treeSelects", treeSelects); + //职能分配 + map.put("sysFunctionalDistributions", sysFunctionalDistributions); + //程序文件 + map.put("companyIndustryTemplates", companyIndustryTemplates); + return CommonResult.success(map); + } +} diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysCommonServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysCommonServiceImpl.java index 9d8f52d..f1b227c 100644 --- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysCommonServiceImpl.java +++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysCommonServiceImpl.java @@ -262,7 +262,7 @@ @Override @Transactional(rollbackFor = RuntimeException.class) public void importStudent() { - String path="/home/java/train_exam/back/安全教育学员模板.xlsx"; + String path="/home/java/multi_system/back/安全教育学员模板.xlsx"; // String path="F:/kzy/乱七八糟/安全教育学员模板.xlsx"; List<StudentExcelData> studentExcelDataList=EasyExcel.read(path, StudentExcelData.class,new StudentExcelDataListener()).sheet().doReadSync(); List<ExStudent> students=new ArrayList<>(); diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java index acf7d43..4f5bd1a 100644 --- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java +++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java @@ -325,9 +325,7 @@ @Override public List<SysFunctionalDistribution> getFunctionalDistributionList(Long companyId) { - if (companyId != null){ - companyId = SecurityUtils.getCompanyId(); - } + return sysFunctionalDistributionMapper.selectListVo(companyId); } diff --git a/multi-system/src/main/resources/mapper/system/StandardizedQualityMapper.xml b/multi-system/src/main/resources/mapper/system/StandardizedQualityMapper.xml new file mode 100644 index 0000000..4da9f84 --- /dev/null +++ b/multi-system/src/main/resources/mapper/system/StandardizedQualityMapper.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.exam.system.mapper.StandardizedQualityMapper"> + <update id="updateStandardizedQualityById" parameterType="com.gkhy.exam.system.domain.StandardizedQuality"> + UPDATE standardized_quality + <set> + <if test="companyId != null and companyId != ''" > + company_id = #{companyId}, + </if> + <if test="companyName != null and companyName != ''" > + company_name = #{companyName}, + </if> + <if test="qualityName != null and qualityName !=''" > + quality_name = #{qualityName}, + </if> + <if test="filePath != null and filePath !=''" > + file_path = #{filePath}, + </if> + <if test="format != null and format !=''" > + format = #{format}, + </if> + <if test="delFlag != null and delFlag != ''" > + del_flag = #{delFlag}, + </if> + <if test="createBy != null" > + create_by = #{createBy}, + </if> + <if test="createTime != null" > + create_time = #{createTime}, + </if> + <if test="updateBy != null" > + update_by = #{updateBy}, + </if> + <if test="updateTime != null" > + update_time = #{updateTime} + </if> + </set> + where id = #{id} + </update> + + <select id="selectStandardizedQualityList" resultType="com.gkhy.exam.system.domain.StandardizedQuality"> + SELECT + `id`, + `company_id`, + `company_name`, + `quality_name`, + `file_path`, + `format`, + `del_flag`, + `create_by`, + `create_time`, + `update_by`, + `update_time` + FROM + standardized_quality + WHERE + del_flag = 0 + + <if test="companyId!=null and companyId!=''"> + and company_id = #{companyId} + </if> + ORDER BY + create_time DESC + </select> +</mapper> diff --git a/multi-system/src/main/resources/mapper/system/StandardizedTemplateMapper.xml b/multi-system/src/main/resources/mapper/system/StandardizedTemplateMapper.xml new file mode 100644 index 0000000..9608bfd --- /dev/null +++ b/multi-system/src/main/resources/mapper/system/StandardizedTemplateMapper.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.exam.system.mapper.StandardizedTemplateMapper"> + <update id="updateStandardizedTemplateById" parameterType="com.gkhy.exam.system.domain.StandardizedTemplate"> + UPDATE standardized_template + <set> + <if test="companyId != null and companyId != ''" > + company_id = #{companyId}, + </if> + <if test="companyName != null and companyName != ''" > + company_name = #{companyName}, + </if> + <if test="templateName != null and templateName !=''" > + template_name = #{templateName}, + </if> + <if test="templateType != null " > + template_type = #{templateType}, + </if> + <if test="filePath != null and filePath !=''" > + file_path = #{filePath}, + </if> + <if test="format != null and format !=''" > + format = #{format}, + </if> + <if test="delFlag != null and delFlag != ''" > + del_flag = #{delFlag}, + </if> + <if test="createBy != null" > + create_by = #{createBy}, + </if> + <if test="createTime != null" > + create_time = #{createTime}, + </if> + <if test="updateBy != null" > + update_by = #{updateBy}, + </if> + <if test="updateTime != null" > + update_time = #{updateTime} + </if> + </set> + where id = #{id} + </update> + + <select id="selectStandardizedTemplateList" resultType="com.gkhy.exam.system.domain.StandardizedTemplate"> + SELECT + `id`, + `company_id`, + `company_name`, + `template_name`, + `template_type`, + `file_path`, + `format`, + `del_flag`, + `create_by`, + `create_time`, + `update_by`, + `update_time` + FROM + standardized_template + WHERE + del_flag = 0 and template_type = #{templateType} + + <if test="companyId!=null and companyId!=''"> + and company_id = #{companyId} + </if> + ORDER BY + create_time DESC + </select> +</mapper> diff --git a/pom.xml b/pom.xml index 46276a7..1d4fdfb 100644 --- a/pom.xml +++ b/pom.xml @@ -204,6 +204,37 @@ <artifactId>easyexcel</artifactId> <version>${easyexcel.version}</version> </dependency> +<!-- <dependency>--> +<!-- <groupId>com.deepoove</groupId>--> +<!-- <artifactId>poi-tl</artifactId>--> +<!-- <version>1.10.0</version>--> +<!-- </dependency>--> + +<!-- <!– 如果需要解析HTML –>--> +<!-- <dependency>--> +<!-- <groupId>org.jsoup</groupId>--> +<!-- <artifactId>jsoup</artifactId>--> +<!-- <version>1.15.3</version>--> +<!-- </dependency>--> + +<!-- <dependency>--> +<!-- <groupId>com.itextpdf</groupId>--> +<!-- <artifactId>itextpdf</artifactId>--> +<!-- <version>5.5.13.3</version>--> +<!-- </dependency>--> +<!-- <dependency>--> +<!-- <groupId>org.bouncycastle</groupId>--> +<!-- <artifactId>bcprov-jdk15on</artifactId>--> +<!-- <version>1.68</version>--> +<!-- </dependency>--> +<!-- <!– 支持中文 –>--> +<!-- <dependency>--> +<!-- <groupId>com.itextpdf</groupId>--> +<!-- <artifactId>itext-asian</artifactId>--> +<!-- <version>5.2.0</version>--> +<!-- </dependency>--> + + </dependencies> </dependencyManagement> -- Gitblit v1.9.2