Compare commits

...

No commits in common. 'main' and 'develop' have entirely different histories.

28
.gitignore vendored

@ -0,0 +1,28 @@
.DS_Store
node_modules/
dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
**/*.log
tests/**/coverage/
tests/e2e/reports
selenium-debug.log
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.local
target/
# Created by .ignore support plugin (hsz.mobi)
*.iml
*.iws
# out
**/out/
package-lock.json
yarn.lock

@ -0,0 +1,73 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ -0,0 +1,3 @@
# tobacco
烟草

@ -0,0 +1,12 @@
@echo off
echo.
echo [信息] 清理工程target生成路径。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean
pause

@ -0,0 +1,12 @@
@echo off
echo.
echo [信息] 打包Web工程生成war/jar包文件。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean package -Dmaven.test.skip=true
pause

@ -0,0 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Web工程。
echo.
cd %~dp0
cd ../ruoyi-admin/target
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -jar %JAVA_OPTS% ruoyi-admin.jar
cd bin
pause

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>tobacco</artifactId>
<groupId>com.bs</groupId>
<version>3.8.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>bs-admin</artifactId>
<description>
web服务入口
</description>
<dependencies>
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>2.19.0</version>
</dependency>
<!--JAVA使用javacv实现图片合成短视频相关JAR包-->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv-platform</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.16</version>
</dependency>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<!-- swagger3-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
</dependency>
<!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.bs</groupId>
<artifactId>bs-framework</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.bs</groupId>
<artifactId>bs-quartz</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.bs</groupId>
<artifactId>bs-generator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
<configuration>
<fork>true</fork> <!-- 如果没有该配置devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>

@ -0,0 +1,21 @@
package com.bs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
*
*
* @author bs
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class BsApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(BsApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 烟草启动成功 ლ(´ڡ`ლ)゙ ");
}
}

@ -0,0 +1,18 @@
package com.bs;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* web
*
* @author bs
*/
public class BsServletInitializer extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{
return application.sources(BsApplication.class);
}
}

@ -0,0 +1,219 @@
package com.bs.cm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-03-04
*/
@Api(tags = "附近信息")
@RestController
@RequestMapping("/cm/attach")
public class CmAttachController extends BaseController {
@Resource
private ICmAttachService cmAttachService;
/**
*
*/
@ApiOperation("分页查询附近信息列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CmAttach cmAttach) {
startPage();
LambdaQueryWrapper<CmAttach> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,cmAttach);
List<CmAttach> list = cmAttachService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询附近信息列表")
@GetMapping("/list")
public AjaxResult list(CmAttach cmAttach) {
LambdaQueryWrapper<CmAttach> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,cmAttach);
List<CmAttach> list = cmAttachService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出附近信息列表")
@Log(title = "附近信息导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CmAttach cmAttach) {
LambdaQueryWrapper<CmAttach> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,cmAttach);
List<CmAttach> list = cmAttachService.list(queryWrapper);
ExcelUtil<CmAttach> util = new ExcelUtil<CmAttach>(CmAttach. class);
util.exportExcel(response, list, "附近信息数据");
}
/**
*
*/
@ApiOperation("获取附近信息详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(cmAttachService.getById(id));
}
/**
*
*/
@ApiOperation("新增附近信息")
@Log(title = "附近信息新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CmAttach cmAttach) {
return toAjax(cmAttachService.save(cmAttach));
}
/**
*
*/
@ApiOperation("修改附近信息")
@Log(title = "附近信息修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CmAttach cmAttach) {
return toAjax(cmAttachService.updateById(cmAttach));
}
/**
*
*/
@ApiOperation("删除附近信息")
@Log(title = "附近信息删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(cmAttachService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CmAttach> queryWrapper,CmAttach cmAttach){
//用户id
if(null != cmAttach.getId()){
queryWrapper.eq(CmAttach::getId,cmAttach.getId());
}
//文件组id
if(StringUtils.isNotEmpty(cmAttach.getFileId())){
queryWrapper.eq(CmAttach::getFileId,cmAttach.getFileId());
}
//文件排序
if(null != cmAttach.getFileSort()){
queryWrapper.eq(CmAttach::getFileSort,cmAttach.getFileSort());
}
//文件名称(编译后)
if(StringUtils.isNotEmpty(cmAttach.getAttachName())){
queryWrapper.eq(CmAttach::getAttachName,cmAttach.getAttachName());
}
//文件类型
if(StringUtils.isNotEmpty(cmAttach.getAttachFileType())){
queryWrapper.eq(CmAttach::getAttachFileType,cmAttach.getAttachFileType());
}
//文件编码类型
if(StringUtils.isNotEmpty(cmAttach.getAttachContentType())){
queryWrapper.eq(CmAttach::getAttachContentType,cmAttach.getAttachContentType());
}
//文件大小
if(null != cmAttach.getAttachFileSize()){
queryWrapper.eq(CmAttach::getAttachFileSize,cmAttach.getAttachFileSize());
}
//文件路径
if(StringUtils.isNotEmpty(cmAttach.getAttachFileUrl())){
queryWrapper.eq(CmAttach::getAttachFileUrl,cmAttach.getAttachFileUrl());
}
//文件名(原始)
if(StringUtils.isNotEmpty(cmAttach.getOldName())){
queryWrapper.eq(CmAttach::getOldName,cmAttach.getOldName());
}
//文件版本号
if(StringUtils.isNotEmpty(cmAttach.getVersionNo())){
queryWrapper.eq(CmAttach::getVersionNo,cmAttach.getVersionNo());
}
//创建部门
if(null != cmAttach.getCreateDept()){
queryWrapper.eq(CmAttach::getCreateDept,cmAttach.getCreateDept());
}
//创建人
if(null != cmAttach.getCreateBy()){
queryWrapper.eq(CmAttach::getCreateBy,cmAttach.getCreateBy());
}
//创建时间
if(null != cmAttach.getCreateTime()){
queryWrapper.eq(CmAttach::getCreateTime,cmAttach.getCreateTime());
}
//修改人
if(null != cmAttach.getUpdateBy()){
queryWrapper.eq(CmAttach::getUpdateBy,cmAttach.getUpdateBy());
}
//修改时间
if(null != cmAttach.getUpdateTime()){
queryWrapper.eq(CmAttach::getUpdateTime,cmAttach.getUpdateTime());
}
//备注
if(StringUtils.isNotEmpty(cmAttach.getRemark())){
queryWrapper.eq(CmAttach::getRemark,cmAttach.getRemark());
}
//删除标志0代表存在 2代表删除
if(StringUtils.isNotEmpty(cmAttach.getDelFlag())){
queryWrapper.eq(CmAttach::getDelFlag,cmAttach.getDelFlag());
}
//${column.columnComment}
if(StringUtils.isNotEmpty(cmAttach.getTenantId())){
queryWrapper.eq(CmAttach::getTenantId,cmAttach.getTenantId());
}
}
}

@ -0,0 +1,95 @@
package com.bs.cm.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
/**
* cm_attach
*
* @author bs
* @date 2025-03-04
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("cm_attach")
@Data
public class CmAttach extends BaseEntity{
private static final long serialVersionUID = 1L;
/** 用户id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "用户id")
private Long id;
/** 文件组id */
@Excel(name = "文件组id")
@ApiModelProperty(value = "文件组id")
private String fileId;
/** 文件排序 */
@Excel(name = "文件排序")
@ApiModelProperty(value = "文件排序")
private Long fileSort;
/** 文件名称(编译后) */
@Excel(name = "文件名称", readConverterExp = "编=译后")
@ApiModelProperty(value = "文件名称(编译后)")
private String attachName;
/** 文件类型 */
@Excel(name = "文件类型")
@ApiModelProperty(value = "文件类型")
private String attachFileType;
/** 文件编码类型 */
@Excel(name = "文件编码类型")
@ApiModelProperty(value = "文件编码类型")
private String attachContentType;
/** 文件大小 */
@Excel(name = "文件大小")
@ApiModelProperty(value = "文件大小")
private Long attachFileSize;
/** 文件路径 */
@Excel(name = "文件路径")
@ApiModelProperty(value = "文件路径")
private String attachFileUrl;
/** 文件名(原始) */
@Excel(name = "文件名", readConverterExp = "原=始")
@ApiModelProperty(value = "文件名(原始)")
private String oldName;
/** 文件版本号 */
@Excel(name = "文件版本号")
@ApiModelProperty(value = "文件版本号")
private String versionNo;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remark;
}

@ -0,0 +1,14 @@
package com.bs.cm.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.cm.domain.CmAttach;
/**
* Mapper
*
* @author bs
* @date 2025-03-04
*/
public interface CmAttachMapper extends BaseMapperX<CmAttach> {
}

@ -0,0 +1,14 @@
package com.bs.cm.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.cm.domain.CmAttach;
/**
* Service
*
* @author bs
* @date 2025-03-04
*/
public interface ICmAttachService extends MPJBaseService<CmAttach>{
}

@ -0,0 +1,19 @@
package com.bs.cm.service.impl;
import com.bs.cm.mapper.CmAttachMapper;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-03-04
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CmAttachServiceImpl extends MPJBaseServiceImpl<CmAttachMapper, CmAttach> implements ICmAttachService {
}

@ -0,0 +1,90 @@
package com.bs.cm.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* cm_attach
*
* @author bs
* @date 2025-03-04
*/
@Data
public class CmAttachVO extends BaseEntity{
/** 用户id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "用户id")
private Long id;
/** 文件组id */
@Excel(name = "文件组id")
@ApiModelProperty(value = "文件组id")
private String fileId;
/** 文件排序 */
@Excel(name = "文件排序")
@ApiModelProperty(value = "文件排序")
private Long fileSort;
/** 文件名称(编译后) */
@Excel(name = "文件名称", readConverterExp = "编=译后")
@ApiModelProperty(value = "文件名称(编译后)")
private String attachName;
/** 文件类型 */
@Excel(name = "文件类型")
@ApiModelProperty(value = "文件类型")
private String attachFileType;
/** 文件编码类型 */
@Excel(name = "文件编码类型")
@ApiModelProperty(value = "文件编码类型")
private String attachContentType;
/** 文件大小 */
@Excel(name = "文件大小")
@ApiModelProperty(value = "文件大小")
private Long attachFileSize;
/** 文件路径 */
@Excel(name = "文件路径")
@ApiModelProperty(value = "文件路径")
private String attachFileUrl;
/** 文件名(原始) */
@Excel(name = "文件名", readConverterExp = "原=始")
@ApiModelProperty(value = "文件名(原始)")
private String oldName;
/** 文件版本号 */
@Excel(name = "文件版本号")
@ApiModelProperty(value = "文件版本号")
private String versionNo;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remark;
private String angle;
}

@ -0,0 +1,228 @@
package com.bs.ct.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.bs.common.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.ct.domain.CtGalleryCata;
import com.bs.ct.service.ICtGalleryCataService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "图库目录")
@RestController
@RequestMapping("/gallery/cata")
public class CtGalleryCataController extends BaseController {
@Resource
private ICtGalleryCataService ctGalleryCataService;
/**
*
*/
@ApiOperation("分页查询图库目录列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtGalleryCata ctGalleryCata) {
startPage();
LambdaQueryWrapper<CtGalleryCata> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryCata);
List<CtGalleryCata> list = ctGalleryCataService.list(queryWrapper);
List<CtGalleryCata> ctGalleryCatas = buildTree(list);
return getDataTable(ctGalleryCatas);
}
/**
*
*/
@ApiOperation("查询图库目录列表")
@GetMapping("/list")
public AjaxResult list(CtGalleryCata ctGalleryCata) {
LambdaQueryWrapper<CtGalleryCata> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryCata);
List<CtGalleryCata> list = ctGalleryCataService.list(queryWrapper);
List<CtGalleryCata> ctGalleryCatas = buildTree(list);
return success(ctGalleryCatas);
}
public List<CtGalleryCata> buildTree(List<CtGalleryCata> list) {
Map<Long, CtGalleryCata> map = new HashMap<>();
List<CtGalleryCata> tree = new ArrayList<>();
// 先将所有节点放入 map 中
for (CtGalleryCata node : list) {
map.put(node.getId(), node);
}
// 构建树结构
for (CtGalleryCata node : list) {
Long parentId = node.getParentId();
if (parentId == null ||!map.containsKey(parentId)) {
tree.add(node);
} else {
CtGalleryCata parent = map.get(parentId);
// 假设 CtGalleryCata 类中有一个 children 属性来存储子节点
// 你需要在 CtGalleryCata 类中添加相应的属性和方法
// 这里简单模拟添加子节点
List<CtGalleryCata> children = parent.getChildren();
if (children == null) {
children = new ArrayList<>();
parent.setChildren(children);
}
children.add(node);
}
}
return tree;
}
/**
*
*/
@ApiOperation("导出图库目录列表")
@Log(title = "图库目录导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtGalleryCata ctGalleryCata) {
LambdaQueryWrapper<CtGalleryCata> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryCata);
List<CtGalleryCata> list = ctGalleryCataService.list(queryWrapper);
ExcelUtil<CtGalleryCata> util = new ExcelUtil<CtGalleryCata>(CtGalleryCata. class);
util.exportExcel(response, list, "图库目录数据");
}
/**
*
*/
@ApiOperation("获取图库目录详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctGalleryCataService.getById(id));
}
/**
*
*/
@ApiOperation("新增图库目录")
@Log(title = "图库目录新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtGalleryCata ctGalleryCata) {
return toAjax(ctGalleryCataService.save(ctGalleryCata));
}
/**
*
*/
@ApiOperation("修改图库目录")
@Log(title = "图库目录修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtGalleryCata ctGalleryCata) {
return toAjax(ctGalleryCataService.updateById(ctGalleryCata));
}
/**
*
*/
@ApiOperation("删除图库目录")
@Log(title = "图库目录删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctGalleryCataService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtGalleryCata> queryWrapper,CtGalleryCata ctGalleryCata){
//id
if(Validator.isNotEmpty(ctGalleryCata.getId())){
queryWrapper.eq(CtGalleryCata::getId,ctGalleryCata.getId());
}
//目录名称
if(Validator.isNotEmpty(ctGalleryCata.getCataName())){
queryWrapper.eq(CtGalleryCata::getCataName,ctGalleryCata.getCataName());
}
//父级id
if(Validator.isNotEmpty(ctGalleryCata.getParentId())){
queryWrapper.eq(CtGalleryCata::getParentId,ctGalleryCata.getParentId());
}
//类型
if(Validator.isNotEmpty(ctGalleryCata.getType())){
queryWrapper.eq(CtGalleryCata::getType,ctGalleryCata.getType());
}
// 查询私人目录
if ("private".equals(ctGalleryCata.getType())) {
queryWrapper.eq(CtGalleryCata::getCreateBy, SecurityUtils.getUserId());
}
//备注
if(Validator.isNotEmpty(ctGalleryCata.getRemarks())){
queryWrapper.eq(CtGalleryCata::getRemarks,ctGalleryCata.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctGalleryCata.getDelFlag())){
queryWrapper.eq(CtGalleryCata::getDelFlag,ctGalleryCata.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctGalleryCata.getCreateDept())){
queryWrapper.eq(CtGalleryCata::getCreateDept,ctGalleryCata.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctGalleryCata.getCreateBy())){
queryWrapper.eq(CtGalleryCata::getCreateBy,ctGalleryCata.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctGalleryCata.getCreateTime())){
queryWrapper.eq(CtGalleryCata::getCreateTime,ctGalleryCata.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctGalleryCata.getUpdateBy())){
queryWrapper.eq(CtGalleryCata::getUpdateBy,ctGalleryCata.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctGalleryCata.getUpdateTime())){
queryWrapper.eq(CtGalleryCata::getUpdateTime,ctGalleryCata.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctGalleryCata.getTenantId())){
queryWrapper.eq(CtGalleryCata::getTenantId,ctGalleryCata.getTenantId());
}
}
}

@ -0,0 +1,322 @@
package com.bs.ct.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.bs.common.utils.SecurityUtils;
import com.bs.common.utils.StringUtils;
import com.bs.ct.domain.CtGalleryShareUser;
import com.bs.ct.service.ICtGalleryShareUserService;
import com.bs.system.service.ISysDeptService;
import com.bs.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.ct.domain.CtGalleryCataShare;
import com.bs.ct.service.ICtGalleryCataShareService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "图库目录共享")
@RestController
@RequestMapping("/gallery/cata/share")
public class CtGalleryCataShareController extends BaseController {
@Resource
private ICtGalleryCataShareService ctGalleryCataShareService;
@Resource
private ICtGalleryShareUserService ctGalleryShareUserService;
@Resource
private ISysUserService sysUserService;
@Resource
private ISysDeptService sysDeptService;
/**
*
*/
@ApiOperation("分页查询图库目录共享列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtGalleryCataShare ctGalleryCataShare) {
startPage();
LambdaQueryWrapper<CtGalleryCataShare> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryCataShare);
List<CtGalleryCataShare> list = ctGalleryCataShareService.list(queryWrapper);
if ("mine".equals(ctGalleryCataShare.getQueryType())) {
list = getShareUser(list);
}
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询图库目录共享列表")
@GetMapping("/list")
public AjaxResult list(CtGalleryCataShare ctGalleryCataShare) {
LambdaQueryWrapper<CtGalleryCataShare> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryCataShare);
List<CtGalleryCataShare> list = ctGalleryCataShareService.list(queryWrapper);
if ("mine".equals(ctGalleryCataShare.getQueryType())) {
list = getShareUser(list);
}
return success(list);
}
private List<CtGalleryCataShare> getShareUser(List<CtGalleryCataShare> list) {
List<Long> ids = new ArrayList<>();
Map<Long, List<CtGalleryShareUser>> dataMap = new HashMap<>();
if (null != list && list.size() > 0) {
for (CtGalleryCataShare share : list) {
ids.add(share.getId());
}
List<CtGalleryShareUser> lsUser = ctGalleryShareUserService.list(new LambdaQueryWrapper<CtGalleryShareUser>().in(CtGalleryShareUser::getShareId, ids));
if (null != lsUser && lsUser.size() > 0) {
for (CtGalleryShareUser user : lsUser) {
List<CtGalleryShareUser> lsShareUser = dataMap.get(user.getShareId());
if (null == lsShareUser) {
lsShareUser = new ArrayList<>();
}
if (null != user.getUserId()) {
if ("user".equals(user.getUserType())) {
user.setUser(sysUserService.selectUserById(user.getUserId()));
} else if ("dept".equals(user.getUserType())) {
user.setDept(sysDeptService.selectDeptById(user.getUserId()));
}
}
lsShareUser.add(user);
dataMap.put(user.getShareId(), lsShareUser);
}
}
for (CtGalleryCataShare share : list) {
share.setLsUsers(dataMap.get(share.getId()));
}
}
return list;
}
/**
*
*/
@ApiOperation("导出图库目录共享列表")
@Log(title = "图库目录共享导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtGalleryCataShare ctGalleryCataShare) {
LambdaQueryWrapper<CtGalleryCataShare> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryCataShare);
List<CtGalleryCataShare> list = ctGalleryCataShareService.list(queryWrapper);
ExcelUtil<CtGalleryCataShare> util = new ExcelUtil<CtGalleryCataShare>(CtGalleryCataShare. class);
util.exportExcel(response, list, "图库目录共享数据");
}
/**
*
*/
@ApiOperation("获取图库目录共享详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctGalleryCataShareService.getById(id));
}
/**
*
*/
@ApiOperation("新增图库目录共享")
@Log(title = "图库目录共享新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtGalleryCataShare ctGalleryCataShare) {
if (null != ctGalleryCataShare) {
if (StringUtils.isEmpty(ctGalleryCataShare.getType())) {
return warn("请选择需要共享的类型");
}
if (null == ctGalleryCataShare.getCataIds() || ctGalleryCataShare.getCataIds().size() == 0) {
return warn("请选择需要共享的图片/目录");
}
if (StringUtils.isEmpty(ctGalleryCataShare.getUserType())) {
return warn("请选择需要共享的用户类型");
}
if (null == ctGalleryCataShare.getUserIds() || ctGalleryCataShare.getUserIds().size() == 0) {
return warn("请选择需要共享的部门/人员");
}
for (Long cataId : ctGalleryCataShare.getCataIds()) {
for (Long userId : ctGalleryCataShare.getUserIds()) {
// 判断是否有重复共享
LambdaQueryWrapper<CtGalleryCataShare> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(CtGalleryCataShare::getType, ctGalleryCataShare.getType());
queryWrapper.eq(CtGalleryCataShare::getCataId, cataId);
List<CtGalleryCataShare> lsData = ctGalleryCataShareService.list(queryWrapper);
Long shareId = -1L;
if (null != lsData && lsData.size() > 0) {
shareId = lsData.get(0).getId();
} else {
// 未共享,则生成共享数据
CtGalleryCataShare share = new CtGalleryCataShare();
share.setType(ctGalleryCataShare.getType());
share.setCataId(cataId);
share.setCataName(ctGalleryCataShare.getCataName());
ctGalleryCataShareService.save(share);
shareId = share.getId();
}
if (shareId > 0) {
//queryWrapper.inSql(CtGalleryCataShare::getId, "select share_id from ct_gallery_share_user where type='" + ctGalleryCataShare.getUserType() + "' and user_id =" + userId);
// 如果有数据,则先删除旧数据
LambdaQueryWrapper<CtGalleryShareUser> userWrapper = new LambdaQueryWrapper();
userWrapper.eq(CtGalleryShareUser::getShareId, shareId);
userWrapper.eq(CtGalleryShareUser::getUserId, userId);
userWrapper.eq(CtGalleryShareUser::getUserType, ctGalleryCataShare.getUserType());
ctGalleryShareUserService.remove(userWrapper);
// 插入新数据
CtGalleryShareUser user = new CtGalleryShareUser();
user.setUserType(ctGalleryCataShare.getUserType());
user.setUserId(userId);
user.setShareId(shareId);
user.setBeginDate(ctGalleryCataShare.getBeginDate());
user.setEndDate(ctGalleryCataShare.getEndDate());
ctGalleryShareUserService.save(user);
}
}
}
} else {
return error("请选择需要共享的图片/目录");
}
return toAjax(ctGalleryCataShareService.save(ctGalleryCataShare));
}
/**
*
*/
@ApiOperation("修改图库目录共享")
@Log(title = "图库目录共享修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtGalleryCataShare ctGalleryCataShare) {
return toAjax(ctGalleryCataShareService.updateById(ctGalleryCataShare));
}
/**
*
*/
@ApiOperation("删除图库目录共享")
@Log(title = "图库目录共享删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
LambdaQueryWrapper<CtGalleryShareUser> userWrapper = new LambdaQueryWrapper();
userWrapper.in(CtGalleryShareUser::getShareId, ids);
ctGalleryShareUserService.remove(userWrapper);
return toAjax(ctGalleryCataShareService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtGalleryCataShare> queryWrapper,CtGalleryCataShare ctGalleryCataShare){
queryWrapper.orderByAsc(CtGalleryCataShare::getType);
if ("mine".equals(ctGalleryCataShare.getQueryType())) {
// 查询自己共享给别人的数据
queryWrapper.eq(CtGalleryCataShare::getCreateBy, SecurityUtils.getUserId());
} else if ("other".equals(ctGalleryCataShare.getQueryType())) {
// 查询他人共享给本用户的数据
queryWrapper.inSql(CtGalleryCataShare::getId, "select share_id from ct_gallery_share_user where del_flag = 0 and ( (user_type = 'user' and user_id = " + SecurityUtils.getUserId() +") or (user_type = 'dept' and user_id = " + SecurityUtils.getDeptId() + ") and ifnull(end_date,date(sysdate())) >= date(sysdate()) )");
}
//id
if(Validator.isNotEmpty(ctGalleryCataShare.getId())){
queryWrapper.eq(CtGalleryCataShare::getId,ctGalleryCataShare.getId());
}
//共享类型目录共享、图片共享
if(Validator.isNotEmpty(ctGalleryCataShare.getType())){
queryWrapper.eq(CtGalleryCataShare::getType,ctGalleryCataShare.getType());
}
if(Validator.isNotEmpty(ctGalleryCataShare.getCataName())) {
queryWrapper.like(CtGalleryCataShare::getCataName, ctGalleryCataShare.getCataName());
}
//目录id
if(Validator.isNotEmpty(ctGalleryCataShare.getCataId())){
queryWrapper.eq(CtGalleryCataShare::getCataId,ctGalleryCataShare.getCataId());
}
//共享用户
if(Validator.isNotEmpty(ctGalleryCataShare.getUserId())){
queryWrapper.eq(CtGalleryCataShare::getUserId,ctGalleryCataShare.getUserId());
}
//开始时间
if(Validator.isNotEmpty(ctGalleryCataShare.getBeginDate())){
queryWrapper.eq(CtGalleryCataShare::getBeginDate,ctGalleryCataShare.getBeginDate());
}
//结束时间
if(Validator.isNotEmpty(ctGalleryCataShare.getEndDate())){
queryWrapper.eq(CtGalleryCataShare::getEndDate,ctGalleryCataShare.getEndDate());
}
//备注
if(Validator.isNotEmpty(ctGalleryCataShare.getRemarks())){
queryWrapper.eq(CtGalleryCataShare::getRemarks,ctGalleryCataShare.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctGalleryCataShare.getDelFlag())){
queryWrapper.eq(CtGalleryCataShare::getDelFlag,ctGalleryCataShare.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctGalleryCataShare.getCreateDept())){
queryWrapper.eq(CtGalleryCataShare::getCreateDept,ctGalleryCataShare.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctGalleryCataShare.getCreateBy())){
queryWrapper.eq(CtGalleryCataShare::getCreateBy,ctGalleryCataShare.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctGalleryCataShare.getCreateTime())){
queryWrapper.eq(CtGalleryCataShare::getCreateTime,ctGalleryCataShare.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctGalleryCataShare.getUpdateBy())){
queryWrapper.eq(CtGalleryCataShare::getUpdateBy,ctGalleryCataShare.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctGalleryCataShare.getUpdateTime())){
queryWrapper.eq(CtGalleryCataShare::getUpdateTime,ctGalleryCataShare.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctGalleryCataShare.getTenantId())){
queryWrapper.eq(CtGalleryCataShare::getTenantId,ctGalleryCataShare.getTenantId());
}
}
}

@ -0,0 +1,689 @@
package com.bs.ct.controller;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.common.config.BsConfig;
import com.bs.common.core.domain.entity.SysDept;
import com.bs.common.core.domain.model.LoginUser;
import com.bs.common.utils.StringUtils;
import com.bs.common.utils.file.FileUploadUtils;
import com.bs.common.utils.file.FileUtils;
import com.bs.ct.domain.*;
import com.bs.ct.service.*;
import com.bs.ct.utils.ExifUtils;
import com.bs.ct.utils.OperateImageUtils;
import com.bs.ct.utils.UUIDUtils;
import com.bs.framework.config.ServerConfig;
import com.bs.system.service.ISysDeptService;
import com.drew.imaging.ImageMetadataReader;
import com.drew.imaging.ImageProcessingException;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.metadata.Tag;
import com.drew.metadata.exif.ExifSubIFDDirectory;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import static com.bs.common.config.BsConfig.getProfile;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "图库图片")
@RestController
@RequestMapping("/gallery/images")
public class CtGalleryImagesController extends BaseController {
@Value("${bs.profile}")
private String profile;
@Resource
private ICtGalleryImagesService ctGalleryImagesService;
@Autowired
private ServerConfig serverConfig;
@Autowired
private ICmAttachService cmAttachService;
@Resource
private ICtTaskTagService ctTaskTagService;
@Resource
private ICtGalleryImagesTagService ctGalleryImagesTagService;
@Resource
private ICtTagService ctTagService;
@Autowired
private ISysDeptService deptService;
@Resource
private ICtTaskBranchService ctTaskBranchService;
@Resource
private ICtTaskInfoService ctTaskInfoService;
@Resource
private ICtImagesFeedbackRefService ctImagesFeedbackRefService;
@Resource
private ICtGalleryCataService ctGalleryCataService;
@Resource
private ICtTaskFeedbackService ctTaskFeedbackService;
/**
*
*/
@ApiOperation("分页查询图库图片列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtGalleryImages ctGalleryImages) {
Integer pageNum = ctGalleryImages.getPageNum() != null ? ctGalleryImages.getPageNum() : 1;
Integer pageSize = ctGalleryImages.getPageSize() != null ? ctGalleryImages.getPageSize() : 10;
LambdaQueryWrapper<CtGalleryImages> queryWrapper = new LambdaQueryWrapper();
if (Validator.isEmpty(ctGalleryImages.getImageTitle())) {
condition(queryWrapper,ctGalleryImages);
}
List<CtGalleryImages> list = ctGalleryImagesService.list(queryWrapper);
setAll(list);
setFile(list);
if (Validator.isNotEmpty(ctGalleryImages.getImageTitle())) {
list = filterByImageTitle(list,ctGalleryImages.getImageTitle());
}
Integer start = (pageNum - 1) * pageSize;
List<CtGalleryImages> result = list.stream()
.skip(start) // 跳过前4条数据
.limit(pageSize) // 最多取6条数据
.collect(Collectors.toList());
TableDataInfo data = getDataTable(result);
data.setTotal(list.size());
return data;
}
// 过滤方法
public static List<CtGalleryImages> filterByImageTitle(List<CtGalleryImages> list, String filterText) {
return list.stream()
.filter(image -> {
boolean matchImageName = image.getImageName() != null && image.getImageName().contains(filterText);
boolean matchImageTitle = image.getImageTitle() != null && image.getImageTitle().contains(filterText);
boolean matchKeyWords = image.getKeyWords() != null && image.getKeyWords().contains(filterText);
boolean matchCataName = image.getCataName() != null && image.getCataName().contains(filterText);
boolean matchTagNames = image.getTagNames() != null && image.getTagNames().stream().anyMatch(tag -> tag.contains(filterText));
boolean matchTaskTitles = image.getTaskTitles() != null && image.getTaskTitles().stream().anyMatch(task -> task.contains(filterText));
return matchImageName || matchImageTitle || matchKeyWords || matchCataName || matchTagNames || matchTaskTitles;
})
.collect(Collectors.toList());
}
private void setAll(List<CtGalleryImages> list) {
List<CtGalleryCata> ctGalleryCatas = ctGalleryCataService.list();
List<CtGalleryImagesTag> imagesTags = ctGalleryImagesTagService.list();
HashMap<Long, String> longStringHashMap = ctGalleryCatas.stream()
.collect(Collectors.toMap(
CtGalleryCata::getId,
CtGalleryCata::getCataName,
(existing, replacement) -> existing,
HashMap::new
));
Map<Long, List<String>> imageStringHashMap = imagesTags.stream()
.collect(Collectors.groupingBy(
CtGalleryImagesTag::getImageId,
Collectors.mapping(
CtGalleryImagesTag::getTagName,
Collectors.toList()
)
));
//查询相关任务名称
List<CtImagesFeedbackRef> imagesFeedbackRefs = ctImagesFeedbackRefService.list();
Map<Long, List<Long>> refMap = imagesFeedbackRefs.stream()
.collect(Collectors.groupingBy(
CtImagesFeedbackRef::getImageId, // 分组键imageId
Collectors.mapping(
CtImagesFeedbackRef::getFeedbackId, // 提取值feedbackId
Collectors.toList() // 收集为列表
)
));
List<CtTaskFeedback> ctTaskFeedbacks = ctTaskFeedbackService.list();
HashMap<Long, Long> feedbackIdsMap = ctTaskFeedbacks.stream()
.collect(Collectors.toMap(
CtTaskFeedback::getId, // 键id
CtTaskFeedback::getTaskId, // 值taskId
(existing, replacement) -> existing, // 处理键冲突:保留现有值
() -> new HashMap<>() // 指定 Map 实现类(可选)
));
List<CtTaskInfo> ctTaskInfos = ctTaskInfoService.list();
HashMap<Long, String> infoMap = new HashMap<>();
if (null != ctTaskInfos) {
infoMap = ctTaskInfos.stream()
.filter(ctTaskInfo -> ctTaskInfo.getTaskTitle() != null) // 过滤掉taskTitle为空的项
.collect(Collectors.toMap(
CtTaskInfo::getId,
CtTaskInfo::getTaskTitle,
(existing, replacement) -> existing,
HashMap::new
));
}
for (CtGalleryImages ctGalleryImage : list) {
Long cataId = ctGalleryImage.getCataId();
String cataName = longStringHashMap.get(cataId);
ctGalleryImage.setCataName(cataName);
List<String> tagNames = imageStringHashMap.get(ctGalleryImage.getId());
ctGalleryImage.setTagNames(tagNames);
List<Long> feedList = refMap.get(ctGalleryImage.getId());
List<String> taskTitles = new ArrayList<>();
if (null != feedList && feedList.size() > 0) {
for (Long feedId : feedList) {
Long taskInfoId = feedbackIdsMap.get(feedId);
if (null != infoMap && infoMap.size() > 0) {
String taskTitleName = infoMap.get(taskInfoId);
taskTitles.add(taskTitleName);
}
}
ctGalleryImage.setTaskTitles(taskTitles);
}
}
}
private void setFile(List<CtGalleryImages> list) {
for (CtGalleryImages ctGalleryImages : list) {
List<CtGalleryImagesTag> galleryImagesTags = ctGalleryImagesTagService.list(new LambdaQueryWrapper<CtGalleryImagesTag>()
.eq(CtGalleryImagesTag::getImageId, ctGalleryImages.getId()));
ctGalleryImages.setImagesTags(galleryImagesTags);
List<CmAttach> cmAttachList = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().eq(CmAttach::getFileId,ctGalleryImages.getFileId()));
ctGalleryImages.setFile(cmAttachList);
}
}
/**
*
*/
@ApiOperation("查询图库图片列表")
@GetMapping("/list")
public AjaxResult list(CtGalleryImages ctGalleryImages) {
LambdaQueryWrapper<CtGalleryImages> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryImages);
if (null != ctGalleryImages.getFeedbackId()) {
List<CtImagesFeedbackRef> ctImagesFeedbackRefs = ctImagesFeedbackRefService.list(new LambdaQueryWrapper<CtImagesFeedbackRef>()
.eq(CtImagesFeedbackRef::getFeedbackId, ctGalleryImages.getFeedbackId()));
List<Long> imageIds = ctImagesFeedbackRefs.stream()
.map(CtImagesFeedbackRef::getImageId)
.collect(Collectors.toList());
if (null != imageIds && imageIds.size() > 0) {
List<CtGalleryImages> galleryImages = ctGalleryImagesService.list(new LambdaQueryWrapper<CtGalleryImages>()
.in(CtGalleryImages::getId, imageIds));
return success(galleryImages);
} else {
return null;
}
}
List<CtGalleryImages> list = ctGalleryImagesService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("生成图片")
@Log(title = "生成图片", businessType = BusinessType.UPDATE)
@PostMapping("/generateImage")
public AjaxResult generateImage(@RequestBody CtGalleryImages ctGalleryImages) {
List<Long> imagesIds = ctGalleryImages.getIds();
String imageType = ctGalleryImages.getImageType(); // 假设 CtGalleryImages 有一个 imageType 字段用于指定生成图片的类型
List<CtGalleryImages> list = ctGalleryImagesService.list(new LambdaQueryWrapper<CtGalleryImages>()
.in(CtGalleryImages::getId, imagesIds));
BufferedImage[] imgs = new BufferedImage[list.size()];
Map<Integer, File> imgMap = new HashMap<>();
int index = 0;
for (CtGalleryImages galleryImages : list) {
String attachUrl = galleryImages.getImagePath().replace("/profile", "");
String filePath = profile + attachUrl;
try {
imgs[index] = OperateImageUtils.getBufferedImage(filePath);
imgMap.put(index, new File(filePath));
index = index + 1 ;
} catch (IOException e) {
e.printStackTrace();
return AjaxResult.error("读取图片失败: " + filePath);
}
}
BufferedImage destImg = null;
String outputFileName = null;
String mp4SavePath = "";
try {
switch (imageType) {
case "nineGrid":
if (imgs.length >= 9) {
destImg = OperateImageUtils.mergeImageToGrid(3, 3, imgs);
outputFileName = UUIDUtils.generatorUUID() + "nineGrid.jpg";
} else {
return AjaxResult.error("生成九宫格图片需要至少9张图片");
}
break;
case "fourGrid":
if (imgs.length >= 4) {
BufferedImage[] fourImgs = new BufferedImage[4];
System.arraycopy(imgs, 0, fourImgs, 0, 4);
destImg = OperateImageUtils.mergeImageToGrid(2, 2, fourImgs);
outputFileName = UUIDUtils.generatorUUID() + "fourGrid.jpg";
} else {
return AjaxResult.error("生成四宫格图片需要至少4张图片");
}
break;
case "horizontalMerge":
if (imgs.length >= 2) {
destImg = OperateImageUtils.mergeImage(true, imgs);
outputFileName = UUIDUtils.generatorUUID() + "horizontalMerge.jpg";
} else {
return AjaxResult.error("水平合并需要至少2张图片");
}
break;
case "verticalMerge":
if (imgs.length >= 2) {
destImg = OperateImageUtils.mergeImage(false, imgs);
outputFileName = UUIDUtils.generatorUUID() + "verticalMerge.jpg";
} else {
return AjaxResult.error("垂直合并需要至少2张图片");
}
break;
case "video":
int width = imgs[0].getWidth();
int height = imgs[0].getHeight();
mp4SavePath = UUIDUtils.generatorUUID() + "output.mp4";
OperateImageUtils.createMp4(profile, mp4SavePath, imgMap, width, height);
break;
default:
return AjaxResult.error("不支持的生成类型: " + imageType);
}
} catch (IOException e) {
e.printStackTrace();
}
if (destImg != null) {
OperateImageUtils.saveImage(destImg, profile , outputFileName, "jpg");
return AjaxResult.success("图片生成成功", outputFileName);
}
if (StringUtils.isNotEmpty(mp4SavePath)) {
return AjaxResult.success("视频生成成功", mp4SavePath);
}
return AjaxResult.error("图片/视频生成失败");
}
//
/**
*
*/
@PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file, String fileId, Long cataId, String imageTitle, Date photoTime, Date uploadTime,
String isOpen, String keyWords, String remarks, Long tagId, ArrayList<Long> ctTags, Long feedbackId
) throws Exception
{
try
{
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
CtGalleryImages ctGalleryImages = new CtGalleryImages();
ctGalleryImages.setCataId(cataId);
ctGalleryImages.setImageTitle(imageTitle);
ctGalleryImages.setPhotoTime(photoTime);
ctGalleryImages.setUploadTime(uploadTime);
ctGalleryImages.setIsOpen(isOpen);
ctGalleryImages.setKeyWords(keyWords);
ctGalleryImages.setRemarks(remarks);
ctGalleryImages.setFileId(newId);
// 上传文件路径
String filePath = BsConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String realName = fileName.replace("profile", "");
String exifInfo = ExifUtils.getExifInfo(getProfile() + realName).toString();
ctGalleryImages.setExifInfo(exifInfo);
String url = serverConfig.getUrl() + fileName;
String newFileName = FileUtils.getName(fileName);
String originalFilename = file.getOriginalFilename();
CmAttach cmAttach = new CmAttach();
cmAttach.setFileId(String.valueOf(newId));
cmAttach.setFileSort(1L);
cmAttach.setAttachName(newFileName);
cmAttach.setAttachContentType(file.getContentType());
cmAttach.setAttachFileSize(file.getSize());
cmAttach.setAttachFileUrl(fileName);
cmAttach.setOldName(originalFilename);
cmAttach.setVersionNo("1");
cmAttach.setRemark("");
boolean save = cmAttachService.save(cmAttach);
if (save) {
Long id = cmAttach.getId();
AjaxResult ajax = AjaxResult.success();
ajax.put("cmAttach", cmAttach);
CtTaskTag taskTag = null;
if (null != tagId) {
taskTag = ctTaskTagService.getById(tagId);
ctGalleryImages.setCataId(taskTag.getSaveDir());
}
ctGalleryImages.setImageName(originalFilename);
ctGalleryImages.setImagePath(fileName);
ctGalleryImages.setImageSize(BigDecimal.valueOf(file.getSize()));
ctGalleryImages.setFileId(newId);
boolean saveImage = ctGalleryImagesService.save(ctGalleryImages);
if (saveImage) {
ajax.put("imageId",ctGalleryImages.getId());
if (null != taskTag) {
CtGalleryImagesTag ctGalleryImagesTag = new CtGalleryImagesTag();
ctGalleryImagesTag.setImageId(ctGalleryImages.getId());
ctGalleryImagesTag.setTagType(taskTag.getTagType());
ctGalleryImagesTag.setTagName(taskTag.getTagName());
ctGalleryImagesTagService.save(ctGalleryImagesTag);
}
if (null != ctTags) {
for (Long ctTagId : ctTags) {
CtTag ctTag = ctTagService.getById(ctTagId);
CtGalleryImagesTag ctGalleryImagesTag = new CtGalleryImagesTag();
ctGalleryImagesTag.setImageId(ctGalleryImages.getId());
ctGalleryImagesTag.setTagType(ctTag.getTagType());
ctGalleryImagesTag.setTagName(ctTag.getTagName());
ctGalleryImagesTag.setIsPhoto(ctTag.getIsPhoto());
ctGalleryImagesTag.setTagDesc(ctTag.getTagDesc());
ctGalleryImagesTag.setPhotoNum(ctTag.getPhotoNum());
ctGalleryImagesTag.setSaveDir(ctTag.getSaveDir());
ctGalleryImagesTag.setFileId(ctTag.getFileId());
ctGalleryImagesTagService.save(ctGalleryImagesTag);
}
}
}
return ajax;
}
return null;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@ApiOperation("添加图片标签")
@Log(title = "添加图片标签", businessType = BusinessType.UPDATE)
@PostMapping("/saveByTag")
public AjaxResult saveByTag(@RequestBody CtGalleryImages ctGalleryImages) {
ctGalleryImages.getTaskTagId();
CtTaskTag ctTaskTag = ctTaskTagService.getById(ctGalleryImages.getTaskTagId());
List<Long> ids = ctGalleryImages.getIds();
for (Long id : ids) {
CtGalleryImagesTag ctGalleryImagesTag = new CtGalleryImagesTag();
ctGalleryImagesTag.setImageId(id);
ctGalleryImagesTag.setTagType(ctTaskTag.getTagType());
ctGalleryImagesTag.setTagName(ctTaskTag.getTagName());
List<CtGalleryImagesTag> ctGalleryImagesTags = ctGalleryImagesTagService.list(new LambdaQueryWrapper<CtGalleryImagesTag>()
.eq(CtGalleryImagesTag::getImageId, id)
.eq(CtGalleryImagesTag::getTagType, ctTaskTag.getTagType())
.eq(CtGalleryImagesTag::getTagName, ctTaskTag.getTagName()));
if (null == ctGalleryImagesTags || ctGalleryImagesTags.size() == 0) {
ctGalleryImagesTagService.save(ctGalleryImagesTag);
}
}
return toAjax(true);
}
/**
*
*/
@ApiOperation("生成任务")
@Log(title = "生成任务", businessType = BusinessType.UPDATE)
@PostMapping("/generateTasks")
public AjaxResult generateTasks(@RequestBody CtGalleryImages ctGalleryImages) {
List<Long> imagesIds = ctGalleryImages.getIds();
List<CtGalleryImagesTag> list = ctGalleryImagesTagService.list(new LambdaQueryWrapper<CtGalleryImagesTag>()
.in(CtGalleryImagesTag::getImageId, imagesIds));
CtTaskInfo ctTaskInfo = new CtTaskInfo();
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
ctTaskInfo.setId(newId);
//设置发起单位与部门
LoginUser loginUser = getLoginUser();
Long deptId = loginUser.getDeptId();
if (null != deptId) {
ctTaskInfo.setDeptId(deptId);
SysDept sysDept = deptService.selectDeptById(deptId);
Long parentId = sysDept.getParentId();
SysDept parentDept = deptService.selectDeptById(parentId);
if (null != parentDept) {
ctTaskInfo.setBranchCode(String.valueOf(parentDept.getDeptId()));
ctTaskInfo.setBranchName(parentDept.getDeptName());
}
CtTaskBranch branch = new CtTaskBranch();
branch.setBranchCode(String.valueOf(deptId));
branch.setBranchName(sysDept.getDeptName());
branch.setTaskId(ctTaskInfo.getId());
branch.setType("机构");
ctTaskBranchService.saveOrUpdate(branch);
CtTaskBranch taskBranch = new CtTaskBranch();
taskBranch.setBranchCode(String.valueOf(deptId));
taskBranch.setUserName(loginUser.getUsername());
taskBranch.setUserId(String.valueOf(loginUser.getUserId()));
taskBranch.setTaskStatus("0");
taskBranch.setTaskId(ctTaskInfo.getId());
taskBranch.setType("人员");
ctTaskBranchService.saveOrUpdate(taskBranch);
}
if ("1".equals(ctTaskInfo.getStatus())) {
ctTaskInfo.setTaskDate(new Date());
}
boolean save = ctTaskInfoService.save(ctTaskInfo);
if (save) {
List<CtTaskTag> tasgs = ctTaskInfo.getTags();
if (null != tasgs && tasgs.size() > 0) {
if (null != list && list.size() > 0) {
for (CtGalleryImagesTag image : list) {
CtTaskTag taskTag = new CtTaskTag();
taskTag.setTaskId(ctTaskInfo.getId());
taskTag.setTagName(image.getTagName());
taskTag.setTagType(image.getTagType());
taskTag.setIsPhoto(image.getIsPhoto());
taskTag.setTagDesc(image.getTagDesc());
taskTag.setPhotoNum(image.getPhotoNum());
taskTag.setSaveDir(image.getSaveDir());
taskTag.setFileId(image.getFileId());
ctTaskTagService.save(taskTag);
}
}
}
}
return success(ctTaskInfo);
}
/**
*
*/
@ApiOperation("导出图库图片列表")
@Log(title = "图库图片导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtGalleryImages ctGalleryImages) {
LambdaQueryWrapper<CtGalleryImages> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryImages);
List<CtGalleryImages> list = ctGalleryImagesService.list(queryWrapper);
ExcelUtil<CtGalleryImages> util = new ExcelUtil<CtGalleryImages>(CtGalleryImages. class);
util.exportExcel(response, list, "图库图片数据");
}
/**
*
*/
@ApiOperation("获取图库图片详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctGalleryImagesService.getById(id));
}
/**
*
*/
@ApiOperation("新增图库图片")
@Log(title = "图库图片新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtGalleryImages ctGalleryImages) {
return toAjax(ctGalleryImagesService.save(ctGalleryImages));
}
/**
*
*/
@ApiOperation("修改图库图片")
@Log(title = "图库图片修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtGalleryImages ctGalleryImages) {
return toAjax(ctGalleryImagesService.updateById(ctGalleryImages));
}
/**
*
*/
@ApiOperation("删除图库图片")
@Log(title = "图库图片删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctGalleryImagesService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtGalleryImages> queryWrapper,CtGalleryImages ctGalleryImages){
//id
if(Validator.isNotEmpty(ctGalleryImages.getId())){
queryWrapper.eq(CtGalleryImages::getId,ctGalleryImages.getId());
}
//目录id
if(Validator.isNotEmpty(ctGalleryImages.getCataId())){
queryWrapper.eq(CtGalleryImages::getCataId,ctGalleryImages.getCataId());
}
//图片名称
if(Validator.isNotEmpty(ctGalleryImages.getImageName())){
queryWrapper.eq(CtGalleryImages::getImageName,ctGalleryImages.getImageName());
}
//图片标题
if(Validator.isNotEmpty(ctGalleryImages.getImageTitle())){
queryWrapper.eq(CtGalleryImages::getImageTitle,ctGalleryImages.getImageTitle());
}
//图片路径
if(Validator.isNotEmpty(ctGalleryImages.getImagePath())){
queryWrapper.eq(CtGalleryImages::getImagePath,ctGalleryImages.getImagePath());
}
//图片大小
if(Validator.isNotEmpty(ctGalleryImages.getImageSize())){
queryWrapper.eq(CtGalleryImages::getImageSize,ctGalleryImages.getImageSize());
}
//图片拍摄时间
if(Validator.isNotEmpty(ctGalleryImages.getPhotoTime())){
queryWrapper.eq(CtGalleryImages::getPhotoTime,ctGalleryImages.getPhotoTime());
}
//图片上传时间
if(Validator.isNotEmpty(ctGalleryImages.getUploadTime())){
queryWrapper.eq(CtGalleryImages::getUploadTime,ctGalleryImages.getUploadTime());
}
//是否公开
if(Validator.isNotEmpty(ctGalleryImages.getIsOpen())){
queryWrapper.eq(CtGalleryImages::getIsOpen,ctGalleryImages.getIsOpen());
}
//图片关键字
if(Validator.isNotEmpty(ctGalleryImages.getKeyWords())){
queryWrapper.eq(CtGalleryImages::getKeyWords,ctGalleryImages.getKeyWords());
}
//附件id
if(Validator.isNotEmpty(ctGalleryImages.getFileId())){
queryWrapper.eq(CtGalleryImages::getFileId,ctGalleryImages.getFileId());
}
//备注
if(Validator.isNotEmpty(ctGalleryImages.getRemarks())){
queryWrapper.eq(CtGalleryImages::getRemarks,ctGalleryImages.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctGalleryImages.getDelFlag())){
queryWrapper.eq(CtGalleryImages::getDelFlag,ctGalleryImages.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctGalleryImages.getCreateDept())){
queryWrapper.eq(CtGalleryImages::getCreateDept,ctGalleryImages.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctGalleryImages.getCreateBy())){
queryWrapper.eq(CtGalleryImages::getCreateBy,ctGalleryImages.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctGalleryImages.getCreateTime())){
queryWrapper.eq(CtGalleryImages::getCreateTime,ctGalleryImages.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctGalleryImages.getUpdateBy())){
queryWrapper.eq(CtGalleryImages::getUpdateBy,ctGalleryImages.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctGalleryImages.getUpdateTime())){
queryWrapper.eq(CtGalleryImages::getUpdateTime,ctGalleryImages.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctGalleryImages.getTenantId())){
queryWrapper.eq(CtGalleryImages::getTenantId,ctGalleryImages.getTenantId());
}
}
public static void main(String[] args) {
try {
System.out.println(ExifUtils.getExifInfo("d:\\1.jpg").toString());
/*File imageFile = new File("d:\\1.jpg");
Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
for (Directory directory : metadata.getDirectories()) {
for (Tag tag : directory.getTags()) {
System.out.println(tag.getTagName() + " = " + tag.getDescription());
}
}*/
} catch (ImageProcessingException e) {
// 处理异常
} catch (IOException e) {
// 处理IO异常
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -0,0 +1,184 @@
package com.bs.ct.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.ct.domain.CtGalleryImagesTag;
import com.bs.ct.service.ICtGalleryImagesTagService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "图库图片标签")
@RestController
@RequestMapping("/gallery/images/tag")
public class CtGalleryImagesTagController extends BaseController {
@Resource
private ICtGalleryImagesTagService ctGalleryImagesTagService;
/**
*
*/
@ApiOperation("分页查询图库图片标签列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtGalleryImagesTag ctGalleryImagesTag) {
startPage();
LambdaQueryWrapper<CtGalleryImagesTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryImagesTag);
List<CtGalleryImagesTag> list = ctGalleryImagesTagService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询图库图片标签列表")
@GetMapping("/list")
public AjaxResult list(CtGalleryImagesTag ctGalleryImagesTag) {
LambdaQueryWrapper<CtGalleryImagesTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryImagesTag);
List<CtGalleryImagesTag> list = ctGalleryImagesTagService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出图库图片标签列表")
@Log(title = "图库图片标签导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtGalleryImagesTag ctGalleryImagesTag) {
LambdaQueryWrapper<CtGalleryImagesTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryImagesTag);
List<CtGalleryImagesTag> list = ctGalleryImagesTagService.list(queryWrapper);
ExcelUtil<CtGalleryImagesTag> util = new ExcelUtil<CtGalleryImagesTag>(CtGalleryImagesTag. class);
util.exportExcel(response, list, "图库图片标签数据");
}
/**
*
*/
@ApiOperation("获取图库图片标签详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctGalleryImagesTagService.getById(id));
}
/**
*
*/
@ApiOperation("新增图库图片标签")
@Log(title = "图库图片标签新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtGalleryImagesTag ctGalleryImagesTag) {
return toAjax(ctGalleryImagesTagService.save(ctGalleryImagesTag));
}
/**
*
*/
@ApiOperation("修改图库图片标签")
@Log(title = "图库图片标签修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtGalleryImagesTag ctGalleryImagesTag) {
return toAjax(ctGalleryImagesTagService.updateById(ctGalleryImagesTag));
}
/**
*
*/
@ApiOperation("删除图库图片标签")
@Log(title = "图库图片标签删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctGalleryImagesTagService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtGalleryImagesTag> queryWrapper,CtGalleryImagesTag ctGalleryImagesTag){
//id
if(Validator.isNotEmpty(ctGalleryImagesTag.getId())){
queryWrapper.eq(CtGalleryImagesTag::getId,ctGalleryImagesTag.getId());
}
//图片id
if(Validator.isNotEmpty(ctGalleryImagesTag.getImageId())){
queryWrapper.eq(CtGalleryImagesTag::getImageId,ctGalleryImagesTag.getImageId());
}
//标签名称
if(Validator.isNotEmpty(ctGalleryImagesTag.getTagName())){
queryWrapper.eq(CtGalleryImagesTag::getTagName,ctGalleryImagesTag.getTagName());
}
//备注
if(Validator.isNotEmpty(ctGalleryImagesTag.getRemarks())){
queryWrapper.eq(CtGalleryImagesTag::getRemarks,ctGalleryImagesTag.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctGalleryImagesTag.getDelFlag())){
queryWrapper.eq(CtGalleryImagesTag::getDelFlag,ctGalleryImagesTag.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctGalleryImagesTag.getCreateDept())){
queryWrapper.eq(CtGalleryImagesTag::getCreateDept,ctGalleryImagesTag.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctGalleryImagesTag.getCreateBy())){
queryWrapper.eq(CtGalleryImagesTag::getCreateBy,ctGalleryImagesTag.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctGalleryImagesTag.getCreateTime())){
queryWrapper.eq(CtGalleryImagesTag::getCreateTime,ctGalleryImagesTag.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctGalleryImagesTag.getUpdateBy())){
queryWrapper.eq(CtGalleryImagesTag::getUpdateBy,ctGalleryImagesTag.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctGalleryImagesTag.getUpdateTime())){
queryWrapper.eq(CtGalleryImagesTag::getUpdateTime,ctGalleryImagesTag.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctGalleryImagesTag.getTenantId())){
queryWrapper.eq(CtGalleryImagesTag::getTenantId,ctGalleryImagesTag.getTenantId());
}
}
}

@ -0,0 +1,179 @@
package com.bs.ct.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import com.bs.ct.domain.CtGalleryShareUser;
import com.bs.ct.service.ICtGalleryShareUserService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-06-14
*/
@Api(tags = "图库目录共享用户")
@RestController
@RequestMapping("/gallery/share/user")
public class CtGalleryShareUserController extends BaseController {
@Resource
private ICtGalleryShareUserService ctGalleryShareUserService;
/**
*
*/
@ApiOperation("分页查询图库目录共享用户列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtGalleryShareUser ctGalleryShareUser) {
startPage();
LambdaQueryWrapper<CtGalleryShareUser> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryShareUser);
List<CtGalleryShareUser> list = ctGalleryShareUserService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询图库目录共享用户列表")
@GetMapping("/list")
public AjaxResult list(CtGalleryShareUser ctGalleryShareUser) {
LambdaQueryWrapper<CtGalleryShareUser> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryShareUser);
List<CtGalleryShareUser> list = ctGalleryShareUserService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出图库目录共享用户列表")
@Log(title = "图库目录共享用户导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtGalleryShareUser ctGalleryShareUser) {
LambdaQueryWrapper<CtGalleryShareUser> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryShareUser);
List<CtGalleryShareUser> list = ctGalleryShareUserService.list(queryWrapper);
ExcelUtil<CtGalleryShareUser> util = new ExcelUtil<CtGalleryShareUser>(CtGalleryShareUser. class);
util.exportExcel(response, list, "图库目录共享用户数据");
}
/**
*
*/
@ApiOperation("获取图库目录共享用户详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctGalleryShareUserService.getById(id));
}
/**
*
*/
@ApiOperation("新增图库目录共享用户")
@Log(title = "图库目录共享用户新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtGalleryShareUser ctGalleryShareUser) {
return toAjax(ctGalleryShareUserService.save(ctGalleryShareUser));
}
/**
*
*/
@ApiOperation("修改图库目录共享用户")
@Log(title = "图库目录共享用户修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtGalleryShareUser ctGalleryShareUser) {
return toAjax(ctGalleryShareUserService.updateById(ctGalleryShareUser));
}
/**
*
*/
@ApiOperation("删除图库目录共享用户")
@Log(title = "图库目录共享用户删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctGalleryShareUserService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtGalleryShareUser> queryWrapper,CtGalleryShareUser ctGalleryShareUser){
//id
if(null != ctGalleryShareUser.getId()){
queryWrapper.eq(CtGalleryShareUser::getId,ctGalleryShareUser.getId());
}
//共享id
if(null != ctGalleryShareUser.getShareId()){
queryWrapper.eq(CtGalleryShareUser::getShareId,ctGalleryShareUser.getShareId());
}
//共享用户
if(null != ctGalleryShareUser.getUserId()){
queryWrapper.eq(CtGalleryShareUser::getUserId,ctGalleryShareUser.getUserId());
}
//删除标志0代表存在 2代表删除
if(StringUtils.isNotEmpty(ctGalleryShareUser.getDelFlag())){
queryWrapper.eq(CtGalleryShareUser::getDelFlag,ctGalleryShareUser.getDelFlag());
}
//创建部门
if(null != ctGalleryShareUser.getCreateDept()){
queryWrapper.eq(CtGalleryShareUser::getCreateDept,ctGalleryShareUser.getCreateDept());
}
//创建人
if(null != ctGalleryShareUser.getCreateBy()){
queryWrapper.eq(CtGalleryShareUser::getCreateBy,ctGalleryShareUser.getCreateBy());
}
//创建时间
if(null != ctGalleryShareUser.getCreateTime()){
queryWrapper.eq(CtGalleryShareUser::getCreateTime,ctGalleryShareUser.getCreateTime());
}
//修改人
if(null != ctGalleryShareUser.getUpdateBy()){
queryWrapper.eq(CtGalleryShareUser::getUpdateBy,ctGalleryShareUser.getUpdateBy());
}
//修改时间
if(null != ctGalleryShareUser.getUpdateTime()){
queryWrapper.eq(CtGalleryShareUser::getUpdateTime,ctGalleryShareUser.getUpdateTime());
}
//租户ID
if(StringUtils.isNotEmpty(ctGalleryShareUser.getTenantId())){
queryWrapper.eq(CtGalleryShareUser::getTenantId,ctGalleryShareUser.getTenantId());
}
}
}

@ -0,0 +1,166 @@
package com.bs.ct.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bs.ct.service.ICtGalleryImagesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import com.bs.ct.domain.CtImagesFeedbackRef;
import com.bs.ct.service.ICtImagesFeedbackRefService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-04-20
*/
@Api(tags = "图片任务反馈关联")
@RestController
@RequestMapping("/images/ref")
public class CtImagesFeedbackRefController extends BaseController {
@Resource
private ICtImagesFeedbackRefService ctImagesFeedbackRefService;
@Resource
private ICtGalleryImagesService ctGalleryImagesService;
/**
*
*/
@ApiOperation("分页查询图片任务反馈关联列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtImagesFeedbackRef ctImagesFeedbackRef) {
startPage();
LambdaQueryWrapper<CtImagesFeedbackRef> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctImagesFeedbackRef);
List<CtImagesFeedbackRef> list = ctImagesFeedbackRefService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询图片任务反馈关联列表")
@GetMapping("/list")
public AjaxResult list(CtImagesFeedbackRef ctImagesFeedbackRef) {
LambdaQueryWrapper<CtImagesFeedbackRef> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctImagesFeedbackRef);
List<CtImagesFeedbackRef> list = ctImagesFeedbackRefService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出图片任务反馈关联列表")
@Log(title = "图片任务反馈关联导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtImagesFeedbackRef ctImagesFeedbackRef) {
LambdaQueryWrapper<CtImagesFeedbackRef> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctImagesFeedbackRef);
List<CtImagesFeedbackRef> list = ctImagesFeedbackRefService.list(queryWrapper);
ExcelUtil<CtImagesFeedbackRef> util = new ExcelUtil<CtImagesFeedbackRef>(CtImagesFeedbackRef. class);
util.exportExcel(response, list, "图片任务反馈关联数据");
}
/**
*
*/
@ApiOperation("获取图片任务反馈关联详细信息")
@GetMapping(value = "/{imageId}")
public AjaxResult getInfo(@PathVariable("imageId") Long imageId) {
return success(ctImagesFeedbackRefService.getById(imageId));
}
/**
*
*/
@ApiOperation("新增图片任务反馈关联")
@Log(title = "图片任务反馈关联新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtImagesFeedbackRef ctImagesFeedbackRef) {
return toAjax(ctImagesFeedbackRefService.save(ctImagesFeedbackRef));
}
/**
*
*/
@ApiOperation("修改图片任务反馈关联")
@Log(title = "图片任务反馈关联修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtImagesFeedbackRef ctImagesFeedbackRef) {
return toAjax(ctImagesFeedbackRefService.updateById(ctImagesFeedbackRef));
}
/**
*
*/
@ApiOperation("删除图片任务反馈关联")
@Log(title = "图片任务反馈关联删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{imageIds}")
public AjaxResult remove(@PathVariable List<Long> imageIds) {
return toAjax(ctImagesFeedbackRefService.removeBatchByIds(imageIds));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtImagesFeedbackRef> queryWrapper,CtImagesFeedbackRef ctImagesFeedbackRef){
//图片id
if(null != (ctImagesFeedbackRef.getImageId())){
queryWrapper.eq(CtImagesFeedbackRef::getImageId,ctImagesFeedbackRef.getImageId());
}
//任务反馈id
if(null != (ctImagesFeedbackRef.getFeedbackId())){
queryWrapper.eq(CtImagesFeedbackRef::getFeedbackId,ctImagesFeedbackRef.getFeedbackId());
}
//创建人
if(null != (ctImagesFeedbackRef.getCreateBy())){
queryWrapper.eq(CtImagesFeedbackRef::getCreateBy,ctImagesFeedbackRef.getCreateBy());
}
//创建时间
if(null != (ctImagesFeedbackRef.getCreateTime())){
queryWrapper.eq(CtImagesFeedbackRef::getCreateTime,ctImagesFeedbackRef.getCreateTime());
}
//修改人
if(null != (ctImagesFeedbackRef.getUpdateBy())){
queryWrapper.eq(CtImagesFeedbackRef::getUpdateBy,ctImagesFeedbackRef.getUpdateBy());
}
//修改时间
if(null != (ctImagesFeedbackRef.getUpdateTime())){
queryWrapper.eq(CtImagesFeedbackRef::getUpdateTime,ctImagesFeedbackRef.getUpdateTime());
}
//租户ID
if(StringUtils.isNotEmpty(ctImagesFeedbackRef.getTenantId())){
queryWrapper.eq(CtImagesFeedbackRef::getTenantId,ctImagesFeedbackRef.getTenantId());
}
}
}

@ -0,0 +1,239 @@
package com.bs.ct.controller;
import java.util.List;
import java.util.Random;
import javax.servlet.http.HttpServletResponse;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.common.exception.ServiceException;
import com.bs.ct.domain.CtTaskInfo;
import com.bs.ct.domain.CtTaskTemplateTag;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.ct.domain.CtTag;
import com.bs.ct.service.ICtTagService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "标签信息")
@RestController
@RequestMapping("/system/tag")
public class CtTagController extends BaseController {
@Resource
private ICtTagService ctTagService;
@Resource
private ICmAttachService cmAttachService;
/**
*
*/
@ApiOperation("分页查询标签信息列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtTag ctTag) {
startPage();
LambdaQueryWrapper<CtTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTag);
List<CtTag> list = ctTagService.list(queryWrapper);
for (CtTag tag : list) {
List<CmAttach> cmAttaches = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().eq(CmAttach::getFileId, tag.getFileId()));
if (null != cmAttaches && cmAttaches.size() > 0) {
tag.setFiles(cmAttaches);
}
}
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询标签信息列表")
@GetMapping("/list")
public AjaxResult list(CtTag ctTag) {
LambdaQueryWrapper<CtTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTag);
List<CtTag> list = ctTagService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出标签信息列表")
@Log(title = "标签信息导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtTag ctTag) {
LambdaQueryWrapper<CtTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTag);
List<CtTag> list = ctTagService.list(queryWrapper);
ExcelUtil<CtTag> util = new ExcelUtil<CtTag>(CtTag. class);
util.exportExcel(response, list, "标签信息数据");
}
/**
*
*/
@ApiOperation("获取标签信息详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
CtTag ctTag = ctTagService.getById(id);
List<CmAttach> cmAttaches = cmAttachService.list(new LambdaQueryWrapper<CmAttach>()
.eq(CmAttach::getFileId, ctTag.getFileId()));
ctTag.setFiles(cmAttaches);
return success(ctTag);
}
/**
*
*/
@ApiOperation("新增标签信息")
@Log(title = "标签信息新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtTag ctTag) {
List<CtTag> ctTags = ctTagService.list(new LambdaQueryWrapper<CtTag>().eq(CtTag::getTagName, ctTag.getTagName()));
if (null != ctTags && ctTags.size() > 0) {
throw new ServiceException("该标签名称已经存在");
}
updateFile(ctTag);
return toAjax(ctTagService.save(ctTag));
}
private void updateFile(CtTag ctTag) {
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
List<CmAttach> file = ctTag.getFiles();
if (null != file) {
for (CmAttach cmAttach : file) {
cmAttach.setFileId(String.valueOf(newId));
}
cmAttachService.updateBatchById(file);
ctTag.setFileId(newId);
}
}
/**
*
*/
@ApiOperation("修改标签信息")
@Log(title = "标签信息修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtTag ctTag) {
updateFile(ctTag);
return toAjax(ctTagService.updateById(ctTag));
}
/**
*
*/
@ApiOperation("删除标签信息")
@Log(title = "标签信息删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctTagService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtTag> queryWrapper,CtTag ctTag){
//id
if(Validator.isNotEmpty(ctTag.getId())){
queryWrapper.eq(CtTag::getId,ctTag.getId());
}
//标签名称
if(Validator.isNotEmpty(ctTag.getTagName())){
queryWrapper.like(CtTag::getTagName,ctTag.getTagName());
}
//标签说明
if(Validator.isNotEmpty(ctTag.getTagDesc())){
queryWrapper.eq(CtTag::getTagDesc,ctTag.getTagDesc());
}
//是否需要拍照
if(Validator.isNotEmpty(ctTag.getIsPhoto())){
queryWrapper.eq(CtTag::getIsPhoto,ctTag.getIsPhoto());
}
//拍照数量要求
if(Validator.isNotEmpty(ctTag.getPhotoNum())){
queryWrapper.eq(CtTag::getPhotoNum,ctTag.getPhotoNum());
}
//照片存放目录
if(Validator.isNotEmpty(ctTag.getSaveDir())){
queryWrapper.eq(CtTag::getSaveDir,ctTag.getSaveDir());
}
//附件id
if(Validator.isNotEmpty(ctTag.getFileId())){
queryWrapper.eq(CtTag::getFileId,ctTag.getFileId());
}
//备注
if(Validator.isNotEmpty(ctTag.getRemarks())){
queryWrapper.eq(CtTag::getRemarks,ctTag.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctTag.getDelFlag())){
queryWrapper.eq(CtTag::getDelFlag,ctTag.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctTag.getCreateDept())){
queryWrapper.eq(CtTag::getCreateDept,ctTag.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctTag.getCreateBy())){
queryWrapper.eq(CtTag::getCreateBy,ctTag.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctTag.getCreateTime())){
queryWrapper.eq(CtTag::getCreateTime,ctTag.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctTag.getUpdateBy())){
queryWrapper.eq(CtTag::getUpdateBy,ctTag.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctTag.getUpdateTime())){
queryWrapper.eq(CtTag::getUpdateTime,ctTag.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctTag.getTenantId())){
queryWrapper.eq(CtTag::getTenantId,ctTag.getTenantId());
}
}
}

@ -0,0 +1,592 @@
package com.bs.ct.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.common.core.domain.entity.SysDept;
import com.bs.common.core.domain.entity.SysUser;
import com.bs.common.exception.UtilException;
import com.bs.ct.domain.CtTaskFeedback;
import com.bs.ct.domain.CtTaskInfo;
import com.bs.ct.domain.CtTaskTag;
import com.bs.ct.service.ICtTaskFeedbackService;
import com.bs.ct.service.ICtTaskInfoService;
import com.bs.ct.service.ICtTaskTagService;
import com.bs.ct.vo.CtTaskBranchVO;
import com.bs.ct.vo.MyTaskVO;
import com.bs.system.service.ISysDeptService;
import com.bs.system.service.ISysUserService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.ct.domain.CtTaskBranch;
import com.bs.ct.service.ICtTaskBranchService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "任务机构信息")
@RestController
@RequestMapping("/task/branch")
public class CtTaskBranchController extends BaseController {
@Resource
private ICtTaskBranchService ctTaskBranchService;
@Autowired
private ISysUserService userService;
@Resource
private ICtTaskInfoService ctTaskInfoService;
@Autowired
private ISysDeptService deptService;
@Autowired
private ICtTaskFeedbackService ctTaskFeedbackService;
@Resource
private ICmAttachService cmAttachService;
@Resource
private ICtTaskTagService ctTaskTagService;
/**
*
*/
@ApiOperation("分页查询任务机构信息列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtTaskBranch ctTaskBranch) {
startPage();
LambdaQueryWrapper<CtTaskBranch> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskBranch);
List<CtTaskBranch> list = ctTaskBranchService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("分页查询任务机构信息列表")
@GetMapping("/pageListByBranch")
public TableDataInfo pageListByBranch(CtTaskBranch ctTaskBranch) {
Integer pageNum = ctTaskBranch.getPageNum() != null ? ctTaskBranch.getPageNum() : 1;
Integer pageSize = ctTaskBranch.getPageSize() != null ? ctTaskBranch.getPageSize() : 10;
List<Long> ownerDeptIds = deptService.getOwnerDeptIds();
if (ownerDeptIds.isEmpty()) {
ownerDeptIds.add(0L);
}
Long userId = getUserId();
LambdaQueryWrapper<CtTaskBranch> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskBranch);
if ((!ownerDeptIds.isEmpty() && ownerDeptIds.size() > 0) && 1 != userId && "1".equals(ctTaskBranch.getIsTask())) {
queryWrapper.in(CtTaskBranch::getBranchCode,ownerDeptIds);
}
queryWrapper.orderByDesc(CtTaskBranch::getCreateTime);
String inSqlCondition = "SELECT id FROM ct_task_info WHERE del_flag = '0'";
queryWrapper.inSql(CtTaskBranch::getTaskId, inSqlCondition);
List<CtTaskBranch> list = ctTaskBranchService.list(queryWrapper);
setAll(list);
//过滤
List<CtTaskBranch> ctTaskBranches = filterCtTaskBranchList(list,ctTaskBranch);
Integer start = (pageNum - 1) * pageSize;
List<CtTaskBranch> result = ctTaskBranches.stream()
.skip(start) // 跳过前4条数据
.limit(pageSize) // 最多取6条数据
.collect(Collectors.toList());
setTag(result);
TableDataInfo data = getDataTable(result);
data.setTotal(ctTaskBranches.size());
return data;
}
private List<CtTaskBranch> filterCtTaskBranchList(List<CtTaskBranch> list, CtTaskBranch filterParams) {
List<CtTaskBranch> filteredList = new ArrayList<>(list);
if (filterParams.getTaskType() != null && !filterParams.getTaskType().isEmpty()) {
filteredList = filteredList.stream()
.filter(item -> filterParams.getTaskType().equals(item.getTaskType()))
.collect(Collectors.toList());
}
if (filterParams.getTaskTitle() != null && !filterParams.getTaskTitle().isEmpty()) {
filteredList = filteredList.stream()
.filter(item -> item.getTaskTitle() != null && item.getTaskTitle().contains(filterParams.getTaskTitle()))
.collect(Collectors.toList());
}
if (filterParams.getTaskContent() != null && !filterParams.getTaskContent().isEmpty()) {
filteredList = filteredList.stream()
.filter(item -> item.getTaskContent() != null && item.getTaskContent().contains(filterParams.getTaskContent()))
.collect(Collectors.toList());
}
if (filterParams.getTaskStatus() != null && !filterParams.getTaskStatus().isEmpty()) {
filteredList = filteredList.stream()
.filter(item -> item.getTaskStatus() != null && item.getTaskStatus().contains(filterParams.getTaskStatus()))
.collect(Collectors.toList());
}
// 修改为使用 startDate 和 endDate 过滤
Date paramStartDate = filterParams.getStartDate();
Date paramEndDate = filterParams.getEndDate();
if (paramStartDate != null && paramEndDate != null) {
filteredList = filteredList.stream()
.filter(item -> {
Date itemStartDate = item.getStartDate();
Date itemEndDate = item.getEndDate();
return itemStartDate != null && itemEndDate != null
&&!itemStartDate.before(paramStartDate)
&&!itemEndDate.after(paramEndDate);
})
.collect(Collectors.toList());
}
return filteredList;
}
/**
*
*/
@ApiOperation("导出任务交办列表")
@Log(title = "任务交办导出", businessType = BusinessType.EXPORT)
@PostMapping("/exportByAssigned")
public void exportByAssigned(HttpServletResponse response, CtTaskBranch ctTaskBranch) {
List<Long> ownerDeptIds = deptService.getOwnerDeptIds();
if (ownerDeptIds.isEmpty()) {
ownerDeptIds.add(0L);
}
Long userId = getUserId();
LambdaQueryWrapper<CtTaskBranch> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskBranch);
if ((!ownerDeptIds.isEmpty() && ownerDeptIds.size() > 0) && 1 != userId && "1".equals(ctTaskBranch.getIsTask())) {
queryWrapper.in(CtTaskBranch::getBranchCode,ownerDeptIds);
}
queryWrapper.orderByDesc(CtTaskBranch::getCreateTime);
String inSqlCondition = "SELECT id FROM ct_task_info WHERE del_flag = '0'";
queryWrapper.inSql(CtTaskBranch::getTaskId, inSqlCondition);
List<CtTaskBranch> list = ctTaskBranchService.list(queryWrapper);
setAll(list);
List<CtTaskBranch> ctTaskBranches = filterCtTaskBranchList(list,ctTaskBranch);
List<CtTaskBranchVO> ctTaskBranchVOs = new ArrayList<>();
for (CtTaskBranch branch : ctTaskBranches) {
CtTaskBranchVO ctTaskBranchVO = new CtTaskBranchVO();
BeanUtils.copyProperties(branch,ctTaskBranchVO);
ctTaskBranchVOs.add(ctTaskBranchVO);
}
ExcelUtil<CtTaskBranchVO> util = new ExcelUtil<CtTaskBranchVO>(CtTaskBranchVO. class);
util.exportExcel(response, ctTaskBranchVOs, "任务交办数据");
}
/**
*
*/
@ApiOperation("分页查询任务机构信息列表")
@GetMapping("/pageListByUser")
public TableDataInfo pageListByUser(CtTaskBranch ctTaskBranch) {
Integer pageNum = ctTaskBranch.getPageNum() != null ? ctTaskBranch.getPageNum() : 1;
Integer pageSize = ctTaskBranch.getPageSize() != null ? ctTaskBranch.getPageSize() : 10;
String userId = String.valueOf(getUserId());
LambdaQueryWrapper<CtTaskBranch> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskBranch);
queryWrapper.orderByDesc(CtTaskBranch::getCreateTime);
String inSqlCondition = "SELECT id FROM ct_task_info WHERE del_flag = '0'";
String inSqlConditionByUserId = "SELECT task_id FROM ct_task_branch WHERE del_flag = '0' and type = '人员' and user_id =" + userId;
queryWrapper.inSql(CtTaskBranch::getTaskId, inSqlCondition);
queryWrapper.inSql(CtTaskBranch::getId, inSqlConditionByUserId);
List<CtTaskBranch> list = ctTaskBranchService.list(queryWrapper);
setAll(list);
List<CtTaskBranch> ctTaskBranches = filterCtTaskBranchList(list,ctTaskBranch);
Integer start = (pageNum - 1) * pageSize;
List<CtTaskBranch> result = ctTaskBranches.stream()
.skip(start) // 跳过前4条数据
.limit(pageSize) // 最多取6条数据
.collect(Collectors.toList());
setTag(result);
TableDataInfo data = getDataTable(result);
data.setTotal(ctTaskBranches.size());
return data;
}
private void setTag(List<CtTaskBranch> result) {
for (CtTaskBranch branch : result) {
Long taskId = branch.getTaskId();
List<CtTaskTag> ctTaskTags = ctTaskTagService.list(new LambdaQueryWrapper<CtTaskTag>().eq(CtTaskTag::getTaskId, taskId));
branch.setCtTaskTags(ctTaskTags);
}
}
/**
*
*/
@ApiOperation("导出任务交办列表")
@Log(title = "任务交办导出", businessType = BusinessType.EXPORT)
@PostMapping("/exportByUser")
public void exportByUser(HttpServletResponse response, CtTaskBranch ctTaskBranch) {
String userId = String.valueOf(getUserId());
LambdaQueryWrapper<CtTaskBranch> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskBranch);
queryWrapper.orderByDesc(CtTaskBranch::getCreateTime);
String inSqlCondition = "SELECT id FROM ct_task_info WHERE del_flag = '0'";
String inSqlConditionByUserId = "SELECT task_id FROM ct_task_branch WHERE del_flag = '0' and type = '人员' and user_id =" + userId;
queryWrapper.inSql(CtTaskBranch::getTaskId, inSqlCondition);
queryWrapper.inSql(CtTaskBranch::getId, inSqlConditionByUserId);
List<CtTaskBranch> list = ctTaskBranchService.list(queryWrapper);
setAll(list);
List<CtTaskBranch> ctTaskBranches = filterCtTaskBranchList(list,ctTaskBranch);
List<MyTaskVO> ctTaskBranchVOs = new ArrayList<>();
for (CtTaskBranch branch : ctTaskBranches) {
MyTaskVO ctTaskBranchVO = new MyTaskVO();
BeanUtils.copyProperties(branch,ctTaskBranchVO);
ctTaskBranchVOs.add(ctTaskBranchVO);
}
ExcelUtil<MyTaskVO> util = new ExcelUtil<MyTaskVO>(MyTaskVO. class);
util.exportExcel(response, ctTaskBranchVOs, "我的任务");
}
private void setAll(List<CtTaskBranch> list) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
Map<Long, String> deptMap = depts.stream()
.collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
Map<Long, Long> deptMapByParent = depts.stream()
.collect(Collectors.toMap(SysDept::getDeptId, SysDept::getParentId));
for (CtTaskBranch taskOtherBranch : list) {
Long branchCode = Long.valueOf(taskOtherBranch.getBranchCode());
Long branchCodeParent = deptMapByParent.get(branchCode);
String branchNameParent = deptMap.get(branchCodeParent);
taskOtherBranch.setBranchNameParent(branchNameParent);
CtTaskInfo byId = ctTaskInfoService.getById(taskOtherBranch.getTaskId());
if (null != byId) {
taskOtherBranch.setStatus(byId.getStatus());
taskOtherBranch.setTaskType(byId.getTaskType());
taskOtherBranch.setTaskTitle(byId.getTaskTitle());
taskOtherBranch.setTaskContent(byId.getTaskContent());
taskOtherBranch.setTaskDate(byId.getTaskDate());
taskOtherBranch.setSdTaskOther(byId);
}
List<CtTaskFeedback> feedbackListByCreateTime = ctTaskFeedbackService.list(new LambdaQueryWrapper<CtTaskFeedback>()
.eq(CtTaskFeedback::getTaskBranchId, taskOtherBranch.getId())
.ne(CtTaskFeedback::getStatus, 0)
.orderByDesc(CtTaskFeedback::getCreateTime));
// 如果根据创建时间查询到的反馈列表不为空且至少有一个元素
if (!feedbackListByCreateTime.isEmpty() && feedbackListByCreateTime.size() > 0) {
// 将该列表中的第一个元素(因为是倒序排列,所以是最新的一条)设置到当前 SdTaskOtherBranch 对象中
taskOtherBranch.setSdTaskOtherFeedbackByCreate(feedbackListByCreateTime.get(0));
}
List<CtTaskFeedback> feedbackListByFeedbackTime = ctTaskFeedbackService.list(new LambdaQueryWrapper<CtTaskFeedback>()
.eq(CtTaskFeedback::getTaskId, taskOtherBranch.getId())
.eq(CtTaskFeedback::getStatus, 1)
.orderByDesc(CtTaskFeedback::getFeedbackTime));
// 如果根据反馈时间查询到的反馈列表不为空且至少有一个元素
if (!feedbackListByFeedbackTime.isEmpty() && feedbackListByFeedbackTime.size() > 0) {
// 将该列表中的第一个元素(因为是倒序排列,所以是最新的一条)设置到当前 SdTaskOtherBranch 对象中
taskOtherBranch.setSdTaskOtherFeedbackByFeedback(feedbackListByFeedbackTime.get(0));
}
}
for (CtTaskBranch taskInfo : list) {
if (null != taskInfo.getSdTaskOther()) {
CtTaskInfo sdTaskOther = taskInfo.getSdTaskOther();
List<CmAttach> cmAttachList = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().eq(CmAttach::getFileId,sdTaskOther.getFileId()));
taskInfo.setTaskInitiator(sdTaskOther.getTaskInitiator());
sdTaskOther.setFile(cmAttachList);
Date startDate = sdTaskOther.getStartDate();
Date endDate = sdTaskOther.getEndDate();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
// 转换日期为字符串
if (null != startDate && endDate != endDate) {
String startDateStr = sdf.format(startDate);
String endDateStr = sdf.format(endDate);
taskInfo.setStartDate(startDate);
taskInfo.setEndDate(endDate);
taskInfo.setStartToEndDate(startDateStr + "-" + endDateStr);
}
String deptName = deptMap.get(sdTaskOther.getDeptId());
taskInfo.setDeptName(deptName);
if ("1".equals(taskInfo.getStatus()) || "0".equals(taskInfo.getStatus())) {
//未完成0
taskInfo.setTaskStatus("0");
// 获取当前日期
Date currentDate = new Date();
if (endDate.compareTo(currentDate) < 0) {
//已逾期1
taskInfo.setTaskStatus("1");
}
} else if ("2".equals(taskInfo.getStatus())) {
//已完成
taskInfo.setTaskStatus("2");
}
}
List<CtTaskBranch> ctTaskBranches = ctTaskBranchService.list(new LambdaQueryWrapper<CtTaskBranch>()
.eq(CtTaskBranch::getTaskId,taskInfo.getId())
.eq(CtTaskBranch::getType,"人员"));
String transactDeptNames = "";
String transactInitiator = "";
String transactBranchNames = "";
if (null != ctTaskBranches) {
List<String> deptNameList = new ArrayList<>();
List<String> parentDeptNameList = new ArrayList<>();
List<String> userNameList = new ArrayList<>();
List<String> userIdList = new ArrayList<>();
for (CtTaskBranch ctTaskBranchesItem : ctTaskBranches) {
String deptNameVo = deptMap.get(Long.valueOf(ctTaskBranchesItem.getBranchCode()));
Long parentTaskId = deptMapByParent.get(Long.valueOf(ctTaskBranchesItem.getBranchCode()));
String parentDeptName = deptMap.get(parentTaskId);
String userName = ctTaskBranchesItem.getUserName();
String userId = ctTaskBranchesItem.getUserId();
if (deptNameVo != null) {
deptNameList.add(deptNameVo);
}
if (parentDeptName != null) {
parentDeptNameList.add(parentDeptName);
}
if (userName != null) {
userNameList.add(userName);
}
if (null != userId) {
userIdList.add(userId);
}
}
transactDeptNames = String.join(",", deptNameList);
transactInitiator = String.join(",", userNameList);
transactBranchNames = String.join(",", parentDeptNameList);
taskInfo.setTransactDeptName(transactDeptNames);
taskInfo.setTransactInitiator(transactInitiator);
taskInfo.setTransactBranchName(transactBranchNames);
taskInfo.setUserIds(userIdList);
}
}
}
/**
*
*/
@ApiOperation("查询任务机构信息列表")
@GetMapping("/list")
public AjaxResult list(CtTaskBranch ctTaskBranch) {
LambdaQueryWrapper<CtTaskBranch> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskBranch);
List<CtTaskBranch> list = ctTaskBranchService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出任务机构信息列表")
@Log(title = "任务机构信息导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtTaskBranch ctTaskBranch) {
LambdaQueryWrapper<CtTaskBranch> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskBranch);
List<CtTaskBranch> list = ctTaskBranchService.list(queryWrapper);
ExcelUtil<CtTaskBranch> util = new ExcelUtil<CtTaskBranch>(CtTaskBranch. class);
util.exportExcel(response, list, "任务机构信息数据");
}
/**
*
*/
@ApiOperation("获取任务机构信息详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctTaskBranchService.getById(id));
}
/**
*
*/
@ApiOperation("新增任务机构信息")
@Log(title = "任务机构信息新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtTaskBranch ctTaskBranch) {
return toAjax(ctTaskBranchService.save(ctTaskBranch));
}
/**
*
*/
@ApiOperation("指派任务")
@Log(title = "指派任务", businessType = BusinessType.INSERT)
@PostMapping(value = "/addByUser")
public AjaxResult addByUser(@RequestBody CtTaskBranch ctTaskBranch) {
List<CtTaskBranch> ctTaskBranchList = new ArrayList<>();
List<String> userIds = ctTaskBranch.getUserIds();
List<Long> taskIds = ctTaskBranch.getTaskIds();
for (Long taskId :taskIds) {
for (String userId : userIds) {
if (isTaskUserCombinationExists(taskId, userId)) {
continue; // 如果存在,跳过当前组合
}
CtTaskBranch taskBranch = new CtTaskBranch();
SysUser sysUser = userService.selectUserById(Long.valueOf(userId));
taskBranch.setBranchCode(String.valueOf(sysUser.getDeptId()));
taskBranch.setUserName(sysUser.getUserName());
taskBranch.setUserId(userId);
taskBranch.setTaskStatus("0");
taskBranch.setTaskId(taskId);
taskBranch.setType("人员");
ctTaskBranchList.add(taskBranch);
}
}
if (null != ctTaskBranchList && ctTaskBranchList.size() > 0) {
ctTaskBranchService.saveBatch(ctTaskBranchList);
}
return toAjax(true);
}
/**
*
*/
@ApiOperation("撤回任务")
@Log(title = "撤回任务", businessType = BusinessType.INSERT)
@PostMapping(value = "/deleteByUser")
public AjaxResult deleteByUser(@RequestBody CtTaskBranch ctTaskBranch) {
List<Long> taskIds = ctTaskBranch.getTaskIds();
ctTaskBranchService.remove(new LambdaQueryWrapper<CtTaskBranch>().in(CtTaskBranch::getTaskId,taskIds));
return toAjax(true);
}
private boolean isTaskUserCombinationExists(Long taskId, String userId) {
CtTaskBranch branchServiceById = ctTaskBranchService.getById(taskId);
if (null != branchServiceById) {
Long taskIdVo = branchServiceById.getTaskId();
CtTaskInfo ctTaskInfoServiceById = ctTaskInfoService.getById(taskIdVo);
if (null != ctTaskInfoServiceById) {
String status = ctTaskInfoServiceById.getStatus();
if ("0".equals(status)) {
throw new UtilException("该任务还未发布");
}
}
}
List<CtTaskBranch> list = ctTaskBranchService.list(new LambdaQueryWrapper<CtTaskBranch>()
.eq(CtTaskBranch::getTaskId, taskId)
.eq(CtTaskBranch::getType,"人员")
.eq(CtTaskBranch::getUserId, userId));
if (null != list && list.size() > 0) {
return true;
}
return false;
}
/**
*
*/
@ApiOperation("修改任务机构信息")
@Log(title = "任务机构信息修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtTaskBranch ctTaskBranch) {
return toAjax(ctTaskBranchService.updateById(ctTaskBranch));
}
/**
*
*/
@ApiOperation("删除任务机构信息")
@Log(title = "任务机构信息删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctTaskBranchService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtTaskBranch> queryWrapper,CtTaskBranch ctTaskBranch){
//id
if(Validator.isNotEmpty(ctTaskBranch.getId())){
queryWrapper.eq(CtTaskBranch::getId,ctTaskBranch.getId());
}
//任务id
if(Validator.isNotEmpty(ctTaskBranch.getTaskId())){
queryWrapper.eq(CtTaskBranch::getTaskId,ctTaskBranch.getTaskId());
}
//类型人员、机构
if(Validator.isNotEmpty(ctTaskBranch.getType())){
queryWrapper.eq(CtTaskBranch::getType,ctTaskBranch.getType());
}
//机构代码
if(Validator.isNotEmpty(ctTaskBranch.getBranchCode())){
queryWrapper.eq(CtTaskBranch::getBranchCode,ctTaskBranch.getBranchCode());
}
//机构名称
if(Validator.isNotEmpty(ctTaskBranch.getBranchName())){
queryWrapper.eq(CtTaskBranch::getBranchName,ctTaskBranch.getBranchName());
}
//任务状态
// if(Validator.isNotEmpty(ctTaskBranch.getTaskStatus())){
// queryWrapper.eq(CtTaskBranch::getTaskStatus,ctTaskBranch.getTaskStatus());
// }
//备注
if(Validator.isNotEmpty(ctTaskBranch.getRemarks())){
queryWrapper.eq(CtTaskBranch::getRemarks,ctTaskBranch.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctTaskBranch.getDelFlag())){
queryWrapper.eq(CtTaskBranch::getDelFlag,ctTaskBranch.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctTaskBranch.getCreateDept())){
queryWrapper.eq(CtTaskBranch::getCreateDept,ctTaskBranch.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctTaskBranch.getCreateBy())){
queryWrapper.eq(CtTaskBranch::getCreateBy,ctTaskBranch.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctTaskBranch.getCreateTime())){
queryWrapper.eq(CtTaskBranch::getCreateTime,ctTaskBranch.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctTaskBranch.getUpdateBy())){
queryWrapper.eq(CtTaskBranch::getUpdateBy,ctTaskBranch.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctTaskBranch.getUpdateTime())){
queryWrapper.eq(CtTaskBranch::getUpdateTime,ctTaskBranch.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctTaskBranch.getTenantId())){
queryWrapper.eq(CtTaskBranch::getTenantId,ctTaskBranch.getTenantId());
}
}
}

@ -0,0 +1,431 @@
package com.bs.ct.controller;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.common.core.domain.entity.SysDept;
import com.bs.common.core.domain.entity.SysUser;
import com.bs.common.core.domain.model.LoginUser;
import com.bs.ct.domain.*;
import com.bs.ct.service.*;
import com.bs.system.service.ISysDeptService;
import com.bs.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "任务反馈")
@RestController
@RequestMapping("/task/feedback")
public class CtTaskFeedbackController extends BaseController {
@Resource
private ICtTaskFeedbackService ctTaskFeedbackService;
@Resource
private ICtTaskInfoService ctTaskInfoService;
@Autowired
private ISysUserService userService;
@Resource
private ICmAttachService cmAttachService;
@Resource
private ICtTaskTagService ctTaskTagService;
@Resource
private ICtImagesFeedbackRefService ctImagesFeedbackRefService;
@Resource
private ICtGalleryImagesService ctGalleryImagesService;
@Resource
private ICtGalleryImagesTagService ctGalleryImagesTagService;
@Autowired
private ISysDeptService deptService;
/**
*
*/
@ApiOperation("分页查询任务反馈列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtTaskFeedback ctTaskFeedback) {
startPage();
LambdaQueryWrapper<CtTaskFeedback> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskFeedback);
List<CtTaskFeedback> list = ctTaskFeedbackService.list(queryWrapper);
return getDataTable(list);
}
private void setFile(List<CtTaskFeedback> list) {
for (CtTaskFeedback ctFeedback : list) {
List<CtImagesFeedbackRef> ctImagesFeedbackRefs = ctImagesFeedbackRefService.list(new LambdaQueryWrapper<CtImagesFeedbackRef>()
.eq(CtImagesFeedbackRef::getFeedbackId, ctFeedback.getId()));
if (null != ctImagesFeedbackRefs && ctImagesFeedbackRefs.size() > 0) {
List<Long> imageIds = ctImagesFeedbackRefs.stream()
.map(CtImagesFeedbackRef::getImageId)
.collect(Collectors.toList());
List<CtGalleryImages> galleryImages = ctGalleryImagesService.list(new LambdaQueryWrapper<CtGalleryImages>()
.in(CtGalleryImages::getId, imageIds));
List<Long> fileIds = galleryImages.stream()
.map(CtGalleryImages::getFileId)
.collect(Collectors.toList());
List<CmAttach> cmAttachList = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().in(CmAttach::getFileId,fileIds));
ctFeedback.setFile(cmAttachList);
}
}
}
//
/**
*
*/
@ApiOperation("通过图片新增任务反馈")
@Log(title = "通过图片新增任务反馈", businessType = BusinessType.INSERT)
@PostMapping("/addByImage")
public AjaxResult addByImage(@RequestBody CtTaskFeedback ctTaskFeedback) {
List<Long> imageIds = ctTaskFeedback.getImageIds();
Long taskId = ctTaskFeedback.getTaskId();
List<CtTaskTag> ctTaskTags = ctTaskTagService.list(new LambdaQueryWrapper<CtTaskTag>()
.eq(CtTaskTag::getTaskId, taskId));
List<String> tagNamesByTag = ctTaskTags.stream()
.map(CtTaskTag::getTagName)
.collect(Collectors.toList());
LoginUser loginUser = getLoginUser();
SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId());
List<Long> notTags = new ArrayList<>();
Map<String, List<Long>> tagImageIdMap = new HashMap<>();
for (Long imageId : imageIds) {
List<CtGalleryImagesTag> ctGalleryImagesTags = ctGalleryImagesTagService.list(new LambdaQueryWrapper<CtGalleryImagesTag>()
.eq(CtGalleryImagesTag::getImageId, imageId));
List<String> tagNames = ctGalleryImagesTags.stream()
.map(CtGalleryImagesTag::getTagName)
.collect(Collectors.toList());
boolean hasMatch = false;
for (String tagName : tagNames) {
if (tagNamesByTag.contains(tagName)) {
tagImageIdMap.computeIfAbsent(tagName, k -> new ArrayList<>()).add(imageId);
hasMatch = true;
}
}
if (!hasMatch) {
notTags.add(imageId);
}
}
// 为每个标签组创建反馈任务
for (Map.Entry<String, List<Long>> entry : tagImageIdMap.entrySet()) {
String tagName = entry.getKey();
List<Long> groupImageIds = entry.getValue();
Optional<CtTaskTag> firstMatch = ctTaskTags.stream()
.filter(tag -> tagName.equals(tag.getTagName()))
.findFirst();
if (firstMatch.isPresent()) {
CtTaskTag tag = firstMatch.get();
CtTaskFeedback feedback = new CtTaskFeedback();
feedback.setTaskId(taskId);
feedback.setTaskTagId(tag.getId());
feedback.setImageIds(groupImageIds);
feedback.setFeedbackTime(new Date());
feedback.setUserId(String.valueOf(loginUser.getUserId()));
feedback.setUserName(loginUser.getUsername());
feedback.setBranchCode(String.valueOf(loginUser.getDeptId()));
feedback.setUserDept(sysDept.getDeptName());
boolean save = ctTaskFeedbackService.save(feedback);
if (save) {
saveRef(feedback);
}
}
}
return success(notTags);
}
/**
*
*/
@ApiOperation("查询任务反馈列表")
@GetMapping("/list")
public AjaxResult list(CtTaskFeedback ctTaskFeedback) {
LambdaQueryWrapper<CtTaskFeedback> queryWrapper = new LambdaQueryWrapper();
if (-1 == ctTaskFeedback.getTaskTagId()) {
queryWrapper.eq(CtTaskFeedback::getTaskId, ctTaskFeedback.getTaskId())
.eq(CtTaskFeedback::getTaskBranchId,ctTaskFeedback.getTaskBranchId())
.isNull(CtTaskFeedback::getTaskTagId);
} else {
condition(queryWrapper,ctTaskFeedback);
}
List<CtTaskFeedback> list = ctTaskFeedbackService.list(queryWrapper);
setFile(list);
return success(list);
}
/**
*
*/
@ApiOperation("通过标签查询任务反馈列表")
@GetMapping("/listByTag")
public AjaxResult listByTag(CtTaskFeedback ctTaskFeedback) {
Map<String, Object> map = new HashMap<>();
List<CtTaskTag> ctTaskTags = ctTaskTagService.list(new LambdaQueryWrapper<CtTaskTag>().eq(CtTaskTag::getTaskId, ctTaskFeedback.getTaskId()));
List<CtTaskFeedback> ctTaskFeedbacks = ctTaskFeedbackService.list(new LambdaQueryWrapper<CtTaskFeedback>()
.eq(CtTaskFeedback::getTaskId, ctTaskFeedback.getTaskId())
.eq(CtTaskFeedback::getTaskBranchId,ctTaskFeedback.getTaskBranchId())
.isNull(CtTaskFeedback::getTaskTagId));
for (CtTaskTag taskTag : ctTaskTags) {
LambdaQueryWrapper<CtTaskFeedback> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(CtTaskFeedback::getTaskTagId,taskTag.getId());
queryWrapper.eq(CtTaskFeedback::getTaskBranchId,ctTaskFeedback.getTaskBranchId());
List<CtTaskFeedback> list = ctTaskFeedbackService.list(queryWrapper);
setFile(list);
taskTag.setCtTaskFeedbacks(list);
}
map.put("ctTaskTags",ctTaskTags);
map.put("ctTaskFeedbacks",ctTaskFeedbacks);
return success(map);
}
/**
*
*/
@ApiOperation("导出任务反馈列表")
@Log(title = "任务反馈导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtTaskFeedback ctTaskFeedback) {
LambdaQueryWrapper<CtTaskFeedback> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskFeedback);
List<CtTaskFeedback> list = ctTaskFeedbackService.list(queryWrapper);
ExcelUtil<CtTaskFeedback> util = new ExcelUtil<CtTaskFeedback>(CtTaskFeedback. class);
util.exportExcel(response, list, "任务反馈数据");
}
/**
*
*/
@ApiOperation("获取任务反馈详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctTaskFeedbackService.getById(id));
}
/**
*
*/
@ApiOperation("新增任务反馈")
@Log(title = "任务反馈新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtTaskFeedback ctTaskFeedback) {
updateFile(ctTaskFeedback);
boolean save = ctTaskFeedbackService.save(ctTaskFeedback);
if (save) {
saveRef(ctTaskFeedback);
}
return toAjax(true);
}
private void saveRef(CtTaskFeedback ctTaskFeedback) {
List<Long> imageIds = ctTaskFeedback.getImageIds();
if (null != imageIds && imageIds.size() > 0) {
for (Long imageId : imageIds) {
CtImagesFeedbackRef ctImagesFeedbackRef = new CtImagesFeedbackRef();
ctImagesFeedbackRef.setFeedbackId(ctTaskFeedback.getId());
ctImagesFeedbackRef.setImageId(imageId);
ctImagesFeedbackRefService.save(ctImagesFeedbackRef);
}
}
}
private void updateFile(CtTaskFeedback ctTaskFeedback) {
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
List<CmAttach> file = ctTaskFeedback.getFile();
if (null != file) {
for (CmAttach cmAttach : file) {
cmAttach.setFileId(String.valueOf(newId));
}
cmAttachService.updateBatchById(file);
ctTaskFeedback.setFileId(newId);
}
}
/**
*
*/
@ApiOperation("修改任务反馈")
@Log(title = "任务反馈修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtTaskFeedback ctTaskFeedback) {
updateFile(ctTaskFeedback);
saveRef(ctTaskFeedback);
return toAjax(ctTaskFeedbackService.updateById(ctTaskFeedback));
}
/**
*
*/
@ApiOperation("删除任务反馈")
@Log(title = "任务反馈删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctTaskFeedbackService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtTaskFeedback> queryWrapper,CtTaskFeedback ctTaskFeedback){
//id
if(Validator.isNotEmpty(ctTaskFeedback.getId())){
queryWrapper.eq(CtTaskFeedback::getId,ctTaskFeedback.getId());
}
//任务id
if(Validator.isNotEmpty(ctTaskFeedback.getTaskId())){
queryWrapper.eq(CtTaskFeedback::getTaskId,ctTaskFeedback.getTaskId());
}
//任务id
if(Validator.isNotEmpty(ctTaskFeedback.getTaskTagId())){
queryWrapper.eq(CtTaskFeedback::getTaskTagId,ctTaskFeedback.getTaskTagId());
}
//机构任务id
if(Validator.isNotEmpty(ctTaskFeedback.getTaskBranchId())){
queryWrapper.eq(CtTaskFeedback::getTaskBranchId,ctTaskFeedback.getTaskBranchId());
}
//机构代码
if(Validator.isNotEmpty(ctTaskFeedback.getBranchCode())){
queryWrapper.eq(CtTaskFeedback::getBranchCode,ctTaskFeedback.getBranchCode());
}
//任务反馈时间
if(Validator.isNotEmpty(ctTaskFeedback.getFeedbackTime())){
queryWrapper.eq(CtTaskFeedback::getFeedbackTime,ctTaskFeedback.getFeedbackTime());
}
//任务完成情况
if(Validator.isNotEmpty(ctTaskFeedback.getTaskDesc())){
queryWrapper.eq(CtTaskFeedback::getTaskDesc,ctTaskFeedback.getTaskDesc());
}
//操作人员工号
if(Validator.isNotEmpty(ctTaskFeedback.getUserId())){
queryWrapper.eq(CtTaskFeedback::getUserId,ctTaskFeedback.getUserId());
}
//操作人员姓名
if(Validator.isNotEmpty(ctTaskFeedback.getUserName())){
queryWrapper.eq(CtTaskFeedback::getUserName,ctTaskFeedback.getUserName());
}
//操作人员部门
if(Validator.isNotEmpty(ctTaskFeedback.getUserDept())){
queryWrapper.eq(CtTaskFeedback::getUserDept,ctTaskFeedback.getUserDept());
}
//是否已拍照留存
if(Validator.isNotEmpty(ctTaskFeedback.getIsPhoto())){
queryWrapper.eq(CtTaskFeedback::getIsPhoto,ctTaskFeedback.getIsPhoto());
}
//附件id
if(Validator.isNotEmpty(ctTaskFeedback.getFileId())){
queryWrapper.eq(CtTaskFeedback::getFileId,ctTaskFeedback.getFileId());
}
//审核人员id
if(Validator.isNotEmpty(ctTaskFeedback.getCheckUserId())){
queryWrapper.eq(CtTaskFeedback::getCheckUserId,ctTaskFeedback.getCheckUserId());
}
//审核人员姓名
if(Validator.isNotEmpty(ctTaskFeedback.getCheckUserName())){
queryWrapper.eq(CtTaskFeedback::getCheckUserName,ctTaskFeedback.getCheckUserName());
}
//审核人员部门
if(Validator.isNotEmpty(ctTaskFeedback.getCheckUserDept())){
queryWrapper.eq(CtTaskFeedback::getCheckUserDept,ctTaskFeedback.getCheckUserDept());
}
//审核时间
if(Validator.isNotEmpty(ctTaskFeedback.getCheckDate())){
queryWrapper.eq(CtTaskFeedback::getCheckDate,ctTaskFeedback.getCheckDate());
}
//审核状态
if(Validator.isNotEmpty(ctTaskFeedback.getStatus())){
queryWrapper.eq(CtTaskFeedback::getStatus,ctTaskFeedback.getStatus());
}
//审核信息
if(Validator.isNotEmpty(ctTaskFeedback.getCheckInfo())){
queryWrapper.eq(CtTaskFeedback::getCheckInfo,ctTaskFeedback.getCheckInfo());
}
//备注
if(Validator.isNotEmpty(ctTaskFeedback.getRemarks())){
queryWrapper.eq(CtTaskFeedback::getRemarks,ctTaskFeedback.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctTaskFeedback.getDelFlag())){
queryWrapper.eq(CtTaskFeedback::getDelFlag,ctTaskFeedback.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctTaskFeedback.getCreateDept())){
queryWrapper.eq(CtTaskFeedback::getCreateDept,ctTaskFeedback.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctTaskFeedback.getCreateBy())){
queryWrapper.eq(CtTaskFeedback::getCreateBy,ctTaskFeedback.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctTaskFeedback.getCreateTime())){
queryWrapper.eq(CtTaskFeedback::getCreateTime,ctTaskFeedback.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctTaskFeedback.getUpdateBy())){
queryWrapper.eq(CtTaskFeedback::getUpdateBy,ctTaskFeedback.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctTaskFeedback.getUpdateTime())){
queryWrapper.eq(CtTaskFeedback::getUpdateTime,ctTaskFeedback.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctTaskFeedback.getTenantId())){
queryWrapper.eq(CtTaskFeedback::getTenantId,ctTaskFeedback.getTenantId());
}
}
}

@ -0,0 +1,184 @@
package com.bs.ct.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.ct.domain.CtTaskImages;
import com.bs.ct.service.ICtTaskImagesService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "任务图片信息")
@RestController
@RequestMapping("/task/images")
public class CtTaskImagesController extends BaseController {
@Resource
private ICtTaskImagesService ctTaskImagesService;
/**
*
*/
@ApiOperation("分页查询任务图片信息列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtTaskImages ctTaskImages) {
startPage();
LambdaQueryWrapper<CtTaskImages> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskImages);
List<CtTaskImages> list = ctTaskImagesService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询任务图片信息列表")
@GetMapping("/list")
public AjaxResult list(CtTaskImages ctTaskImages) {
LambdaQueryWrapper<CtTaskImages> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskImages);
List<CtTaskImages> list = ctTaskImagesService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出任务图片信息列表")
@Log(title = "任务图片信息导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtTaskImages ctTaskImages) {
LambdaQueryWrapper<CtTaskImages> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskImages);
List<CtTaskImages> list = ctTaskImagesService.list(queryWrapper);
ExcelUtil<CtTaskImages> util = new ExcelUtil<CtTaskImages>(CtTaskImages. class);
util.exportExcel(response, list, "任务图片信息数据");
}
/**
*
*/
@ApiOperation("获取任务图片信息详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctTaskImagesService.getById(id));
}
/**
*
*/
@ApiOperation("新增任务图片信息")
@Log(title = "任务图片信息新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtTaskImages ctTaskImages) {
return toAjax(ctTaskImagesService.save(ctTaskImages));
}
/**
*
*/
@ApiOperation("修改任务图片信息")
@Log(title = "任务图片信息修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtTaskImages ctTaskImages) {
return toAjax(ctTaskImagesService.updateById(ctTaskImages));
}
/**
*
*/
@ApiOperation("删除任务图片信息")
@Log(title = "任务图片信息删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctTaskImagesService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtTaskImages> queryWrapper,CtTaskImages ctTaskImages){
//id
if(Validator.isNotEmpty(ctTaskImages.getId())){
queryWrapper.eq(CtTaskImages::getId,ctTaskImages.getId());
}
//任务id
if(Validator.isNotEmpty(ctTaskImages.getTaskId())){
queryWrapper.eq(CtTaskImages::getTaskId,ctTaskImages.getTaskId());
}
//图片id
if(Validator.isNotEmpty(ctTaskImages.getImageId())){
queryWrapper.eq(CtTaskImages::getImageId,ctTaskImages.getImageId());
}
//备注
if(Validator.isNotEmpty(ctTaskImages.getRemarks())){
queryWrapper.eq(CtTaskImages::getRemarks,ctTaskImages.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctTaskImages.getDelFlag())){
queryWrapper.eq(CtTaskImages::getDelFlag,ctTaskImages.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctTaskImages.getCreateDept())){
queryWrapper.eq(CtTaskImages::getCreateDept,ctTaskImages.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctTaskImages.getCreateBy())){
queryWrapper.eq(CtTaskImages::getCreateBy,ctTaskImages.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctTaskImages.getCreateTime())){
queryWrapper.eq(CtTaskImages::getCreateTime,ctTaskImages.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctTaskImages.getUpdateBy())){
queryWrapper.eq(CtTaskImages::getUpdateBy,ctTaskImages.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctTaskImages.getUpdateTime())){
queryWrapper.eq(CtTaskImages::getUpdateTime,ctTaskImages.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctTaskImages.getTenantId())){
queryWrapper.eq(CtTaskImages::getTenantId,ctTaskImages.getTenantId());
}
}
}

@ -0,0 +1,534 @@
package com.bs.ct.controller;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.common.core.domain.entity.SysDept;
import com.bs.common.core.domain.model.LoginUser;
import com.bs.ct.domain.*;
import com.bs.ct.service.ICtTaskBranchService;
import com.bs.ct.service.ICtTaskFeedbackService;
import com.bs.ct.service.ICtTaskTagService;
import com.bs.system.service.ISysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.ct.service.ICtTaskInfoService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "任务信息")
@RestController
@RequestMapping("/task/info")
public class CtTaskInfoController extends BaseController {
@Resource
private ICtTaskInfoService ctTaskInfoService;
@Autowired
private ISysDeptService deptService;
@Resource
private ICtTaskBranchService ctTaskBranchService;
@Resource
private ICmAttachService cmAttachService;
@Resource
private ICtTaskFeedbackService ctTaskFeedbackService;
@Resource
private ICtTaskTagService ctTaskTagService;
/**
*
*/
@ApiOperation("分页查询任务信息列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtTaskInfo ctTaskInfo) {
startPage();
LambdaQueryWrapper<CtTaskInfo> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskInfo);
List<CtTaskInfo> list = ctTaskInfoService.list(queryWrapper);
setAll(list);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("分页查询任务信息列表")
@GetMapping("/pageListByBranch")
public TableDataInfo pageListByBranch(CtTaskInfo ctTaskInfo) {
startPage();
LambdaQueryWrapper<CtTaskInfo> queryWrapper = new LambdaQueryWrapper();
ctTaskInfo.setStatus("1");
condition(queryWrapper,ctTaskInfo);
List<CtTaskInfo> list = ctTaskInfoService.list(queryWrapper);
setAll(list);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("分页查询任务信息列表")
@GetMapping("/pageListByUser")
public TableDataInfo pageListByUser(CtTaskInfo ctTaskInfo) {
Integer pageNum = ctTaskInfo.getPageNum() != null ? ctTaskInfo.getPageNum() : 1;
Integer pageSize = ctTaskInfo.getPageSize() != null ? ctTaskInfo.getPageSize() : 10;
String userId = String.valueOf(getUserId());
LambdaQueryWrapper<CtTaskInfo> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskInfo);
List<CtTaskInfo> list = ctTaskInfoService.list(queryWrapper);
setAll(list);
List<CtTaskInfo> filteredList = filterTaskInfos(list, userId);
Integer start = (pageNum - 1) * pageSize;
List<CtTaskInfo> result = filteredList.stream()
.skip(start) // 跳过前4条数据
.limit(pageSize) // 最多取6条数据
.collect(Collectors.toList());
for (CtTaskInfo taskOtherBranch : result) {
// 从 sdTaskOtherFeedbackService 中查询符合条件的 SdTaskOtherFeedback 列表:
// 1. taskBranchId 等于当前 SdTaskOtherBranch 的 id
// 2. status 不等于 0
// 3. 按照创建时间CreateTime倒序排列
List<CtTaskFeedback> feedbackListByCreateTime = ctTaskFeedbackService.list(new LambdaQueryWrapper<CtTaskFeedback>()
.eq(CtTaskFeedback::getTaskBranchId, taskOtherBranch.getId())
.ne(CtTaskFeedback::getStatus, 0)
.orderByDesc(CtTaskFeedback::getCreateTime));
// 如果根据创建时间查询到的反馈列表不为空且至少有一个元素
if (!feedbackListByCreateTime.isEmpty() && feedbackListByCreateTime.size() > 0) {
// 将该列表中的第一个元素(因为是倒序排列,所以是最新的一条)设置到当前 SdTaskOtherBranch 对象中
taskOtherBranch.setSdTaskOtherFeedbackByCreate(feedbackListByCreateTime.get(0));
}
// 从 sdTaskOtherFeedbackService 中查询符合条件的 SdTaskOtherFeedback 列表:
// 1. taskBranchId 等于当前 SdTaskOtherBranch 的 id
// 2. status 等于 1
// 3. 按照反馈时间FeedbackTime倒序排列
List<CtTaskFeedback> feedbackListByFeedbackTime = ctTaskFeedbackService.list(new LambdaQueryWrapper<CtTaskFeedback>()
.eq(CtTaskFeedback::getTaskId, taskOtherBranch.getId())
.eq(CtTaskFeedback::getStatus, 1)
.orderByDesc(CtTaskFeedback::getFeedbackTime));
// 如果根据反馈时间查询到的反馈列表不为空且至少有一个元素
if (!feedbackListByFeedbackTime.isEmpty() && feedbackListByFeedbackTime.size() > 0) {
// 将该列表中的第一个元素(因为是倒序排列,所以是最新的一条)设置到当前 SdTaskOtherBranch 对象中
taskOtherBranch.setSdTaskOtherFeedbackByFeedback(feedbackListByFeedbackTime.get(0));
}
}
TableDataInfo data = getDataTable(result);
data.setTotal(filteredList.size());
return data;
}
public static List<CtTaskInfo> filterTaskInfos(List<CtTaskInfo> list, String userId) {
List<CtTaskInfo> filteredList = new ArrayList<>();
for (CtTaskInfo taskInfo : list) {
if (taskInfo.getUserIds() != null && taskInfo.getUserIds().contains(userId)) {
filteredList.add(taskInfo);
}
}
return filteredList;
}
/**
*
*/
@ApiOperation("查询任务信息列表")
@GetMapping("/list")
public AjaxResult list(CtTaskInfo ctTaskInfo) {
LambdaQueryWrapper<CtTaskInfo> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskInfo);
List<CtTaskInfo> list = ctTaskInfoService.list(queryWrapper);
return success(list);
}
private void setAll(List<CtTaskInfo> list) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
Map<Long, String> deptMap = depts.stream()
.collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
Map<Long, Long> deptMapByParent = depts.stream()
.collect(Collectors.toMap(SysDept::getDeptId, SysDept::getParentId));
for (CtTaskInfo taskInfo : list) {
List<CmAttach> cmAttachList = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().eq(CmAttach::getFileId,taskInfo.getFileId()));
taskInfo.setFile(cmAttachList);
Date startDate = taskInfo.getStartDate();
Date endDate = taskInfo.getEndDate();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
// 转换日期为字符串
if (null != startDate && endDate != endDate) {
String startDateStr = sdf.format(startDate);
String endDateStr = sdf.format(endDate);
taskInfo.setStartToEndDate(startDateStr + "-" + endDateStr);
}
String deptName = deptMap.get(taskInfo.getDeptId());
taskInfo.setDeptName(deptName);
if ("1".equals(taskInfo.getStatus()) || "0".equals(taskInfo.getStatus())) {
taskInfo.setTaskStatus("未完成");
// 获取当前日期
Date currentDate = new Date();
if (endDate.compareTo(currentDate) < 0) {
taskInfo.setTaskStatus("已逾期");
}
} else if ("2".equals(taskInfo.getStatus())) {
taskInfo.setTaskStatus("已完成");
}
List<CtTaskBranch> ctTaskBranches = ctTaskBranchService.list(new LambdaQueryWrapper<CtTaskBranch>()
.eq(CtTaskBranch::getTaskId,taskInfo.getId())
.eq(CtTaskBranch::getType,"人员"));
String transactDeptNames = "";
String transactInitiator = "";
String transactBranchNames = "";
if (null != ctTaskBranches) {
List<String> deptNameList = new ArrayList<>();
List<String> parentDeptNameList = new ArrayList<>();
List<String> userNameList = new ArrayList<>();
List<String> userIdList = new ArrayList<>();
for (CtTaskBranch ctTaskBranchesItem : ctTaskBranches) {
String deptNameVo = deptMap.get(Long.valueOf(ctTaskBranchesItem.getBranchCode()));
Long parentTaskId = deptMapByParent.get(Long.valueOf(ctTaskBranchesItem.getBranchCode()));
String parentDeptName = deptMap.get(parentTaskId);
String userName = ctTaskBranchesItem.getUserName();
String userId = ctTaskBranchesItem.getUserId();
if (deptNameVo != null) {
deptNameList.add(deptNameVo);
}
if (parentDeptName != null) {
parentDeptNameList.add(parentDeptName);
}
if (userName != null) {
userNameList.add(userName);
}
if (null != userId) {
userIdList.add(userId);
}
}
transactDeptNames = String.join(",", deptNameList);
transactInitiator = String.join(",", userNameList);
transactBranchNames = String.join(",", parentDeptNameList);
taskInfo.setTransactDeptName(transactDeptNames);
taskInfo.setTransactInitiator(transactInitiator);
taskInfo.setTransactBranchName(transactBranchNames);
taskInfo.setUserIds(userIdList);
}
}
}
/**
*
*/
@ApiOperation("撤回其他任务")
@GetMapping("/withdraw/{ids}")
public void withdraw(@PathVariable List<Long> ids) {
List<CtTaskInfo> sdTaskOthers = ctTaskInfoService.listByIds(ids);
for (CtTaskInfo sdTaskOther : sdTaskOthers) {
sdTaskOther.setStatus("0");
sdTaskOther.setTaskDate(null);
}
List<CtTaskBranch> sdTaskOtherBranches = ctTaskBranchService.list(new LambdaQueryWrapper<CtTaskBranch>()
.in(CtTaskBranch::getTaskId, ids));
for (CtTaskBranch sdTaskOtherBranch : sdTaskOtherBranches) {
sdTaskOtherBranch.setTaskStatus("0");
}
ctTaskBranchService.updateBatchById(sdTaskOtherBranches);
ctTaskInfoService.updateBatchById(sdTaskOthers);
}
/**
*
*/
@ApiOperation("发布其他任务")
@GetMapping("/publishOther/{ids}")
public AjaxResult publishOther(@PathVariable List<Long> ids) {
List<CtTaskInfo> sdTaskOthers = ctTaskInfoService.listByIds(ids);
for (CtTaskInfo sdTaskOther : sdTaskOthers) {
if ("2".equals(sdTaskOther.getStatus())) {
return AjaxResult.error("任务已办结,无法发布");
}
sdTaskOther.setStatus("1");
sdTaskOther.setTaskDate(new Date());
}
List<CtTaskBranch> sdTaskOtherBranches = ctTaskBranchService.list(new LambdaQueryWrapper<CtTaskBranch>()
.in(CtTaskBranch::getTaskId, ids));
for (CtTaskBranch sdTaskOtherBranch : sdTaskOtherBranches) {
sdTaskOtherBranch.setTaskStatus("1");
}
ctTaskBranchService.updateBatchById(sdTaskOtherBranches);
ctTaskInfoService.updateBatchById(sdTaskOthers);
return AjaxResult.success(true);
}
/**
*
*/
@ApiOperation("导出任务信息列表")
@Log(title = "任务信息导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtTaskInfo ctTaskInfo) {
LambdaQueryWrapper<CtTaskInfo> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskInfo);
List<CtTaskInfo> list = ctTaskInfoService.list(queryWrapper);
ExcelUtil<CtTaskInfo> util = new ExcelUtil<CtTaskInfo>(CtTaskInfo. class);
util.exportExcel(response, list, "任务信息数据");
}
/**
*
*/
@ApiOperation("获取任务信息详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctTaskInfoService.getById(id));
}
/**
*
*/
@ApiOperation("新增任务信息")
@Log(title = "任务信息新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtTaskInfo ctTaskInfo) {
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
updateFile(ctTaskInfo);
ctTaskInfo.setId(newId);
List<CtTaskBranch> branchList = ctTaskInfo.getBranchList();
for (CtTaskBranch sdTaskOtherBranch : branchList) {
sdTaskOtherBranch.setTaskId(ctTaskInfo.getId());
sdTaskOtherBranch.setType("机构");
ctTaskBranchService.saveOrUpdate(sdTaskOtherBranch);
}
//设置发起单位与部门
LoginUser loginUser = getLoginUser();
Long deptId = loginUser.getDeptId();
if (null != deptId) {
ctTaskInfo.setDeptId(deptId);
SysDept sysDept = deptService.selectDeptById(deptId);
Long parentId = sysDept.getParentId();
SysDept parentDept = deptService.selectDeptById(parentId);
if (null != parentDept) {
ctTaskInfo.setBranchCode(String.valueOf(parentDept.getDeptId()));
ctTaskInfo.setBranchName(parentDept.getDeptName());
}
}
if ("1".equals(ctTaskInfo.getStatus())) {
ctTaskInfo.setTaskDate(new Date());
}
boolean save = ctTaskInfoService.save(ctTaskInfo);
if (save) {
List<CtTaskTag> tasgs = ctTaskInfo.getTags();
if (null != tasgs && tasgs.size() > 0) {
for (CtTaskTag taskTag : tasgs){
taskTag.setTaskId(ctTaskInfo.getId());
}
ctTaskTagService.saveBatch(tasgs);
}
}
return toAjax(true);
}
/**
*
*/
@ApiOperation("修改任务信息")
@Log(title = "任务信息修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtTaskInfo ctTaskInfo) {
updateFile(ctTaskInfo);
List<CtTaskBranch> branchList = ctTaskInfo.getBranchList();
if (branchList != null && branchList.size() > 0) {
for (CtTaskBranch sdTaskOtherBranch : branchList) {
sdTaskOtherBranch.setTaskId(ctTaskInfo.getId());
sdTaskOtherBranch.setType("机构");
if (sdTaskOtherBranch.getId() == null) {
ctTaskBranchService.save(sdTaskOtherBranch);
} else {
ctTaskBranchService.updateById(sdTaskOtherBranch);
}
}
}
if ("1".equals(ctTaskInfo.getStatus())) {
LoginUser loginUser = getLoginUser();
ctTaskInfo.setTaskDate(new Date());
ctTaskInfo.setTaskInitiator(loginUser.getUsername());
}
List<CtTaskTag> tasgs = ctTaskInfo.getTags();
if (null != tasgs && tasgs.size() > 0) {
for (CtTaskTag taskTag : tasgs) {
taskTag.setTaskId(ctTaskInfo.getId());
}
ctTaskTagService.saveOrUpdateBatch(tasgs);
}
return toAjax(ctTaskInfoService.updateById(ctTaskInfo));
}
private void updateFile(CtTaskInfo ctTaskInfo) {
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
List<CmAttach> file = ctTaskInfo.getFile();
if (null != file) {
for (CmAttach cmAttach : file) {
cmAttach.setFileId(String.valueOf(newId));
}
cmAttachService.updateBatchById(file);
ctTaskInfo.setFileId(newId);
}
}
/**
*
*/
@ApiOperation("删除任务信息")
@Log(title = "任务信息删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctTaskInfoService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtTaskInfo> queryWrapper,CtTaskInfo ctTaskInfo){
//id
if(Validator.isNotEmpty(ctTaskInfo.getId())){
queryWrapper.eq(CtTaskInfo::getId,ctTaskInfo.getId());
}
//任务类型
if(Validator.isNotEmpty(ctTaskInfo.getTaskType())){
queryWrapper.eq(CtTaskInfo::getTaskType,ctTaskInfo.getTaskType());
}
//任务标题
if(Validator.isNotEmpty(ctTaskInfo.getTaskTitle())){
queryWrapper.like(CtTaskInfo::getTaskTitle,ctTaskInfo.getTaskTitle());
}
//任务编号
if(Validator.isNotEmpty(ctTaskInfo.getTaskCode())){
queryWrapper.eq(CtTaskInfo::getTaskCode,ctTaskInfo.getTaskCode());
}
//开始时间
if(Validator.isNotEmpty(ctTaskInfo.getStartDate())){
queryWrapper.ge(CtTaskInfo::getStartDate,ctTaskInfo.getStartDate());
}
//结束时间
if(Validator.isNotEmpty(ctTaskInfo.getEndDate())){
queryWrapper.le(CtTaskInfo::getEndDate,ctTaskInfo.getEndDate());
}
// 查询逾期任务.
if (Validator.isNotEmpty(ctTaskInfo.getQueryDate())) {
queryWrapper.le(CtTaskInfo::getEndDate,ctTaskInfo.getQueryDate()).eq(CtTaskInfo::getStatus, "1");
}
//任务要求
if(Validator.isNotEmpty(ctTaskInfo.getTaskContent())){
queryWrapper.like(CtTaskInfo::getTaskContent,ctTaskInfo.getTaskContent());
}
//完成状态
if(Validator.isNotEmpty(ctTaskInfo.getStatus())){
queryWrapper.eq(CtTaskInfo::getStatus,ctTaskInfo.getStatus());
}
//附件id
if(Validator.isNotEmpty(ctTaskInfo.getFileId())){
queryWrapper.eq(CtTaskInfo::getFileId,ctTaskInfo.getFileId());
}
//任务发起人
if(Validator.isNotEmpty(ctTaskInfo.getTaskInitiator())){
queryWrapper.eq(CtTaskInfo::getTaskInitiator,ctTaskInfo.getTaskInitiator());
}
//任务发起单位机构代码
if(Validator.isNotEmpty(ctTaskInfo.getBranchCode())){
queryWrapper.eq(CtTaskInfo::getBranchCode,ctTaskInfo.getBranchCode());
}
//任务发起单位
if(Validator.isNotEmpty(ctTaskInfo.getBranchName())){
queryWrapper.eq(CtTaskInfo::getBranchName,ctTaskInfo.getBranchName());
}
//任务发起部门
if(Validator.isNotEmpty(ctTaskInfo.getDeptId())){
queryWrapper.eq(CtTaskInfo::getDeptId,ctTaskInfo.getDeptId());
}
//任务发布日期
if(Validator.isNotEmpty(ctTaskInfo.getTaskDate())){
queryWrapper.eq(CtTaskInfo::getTaskDate,ctTaskInfo.getTaskDate());
}
//备注
if(Validator.isNotEmpty(ctTaskInfo.getRemarks())){
queryWrapper.eq(CtTaskInfo::getRemarks,ctTaskInfo.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctTaskInfo.getDelFlag())){
queryWrapper.eq(CtTaskInfo::getDelFlag,ctTaskInfo.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctTaskInfo.getCreateDept())){
queryWrapper.eq(CtTaskInfo::getCreateDept,ctTaskInfo.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctTaskInfo.getCreateBy())){
queryWrapper.eq(CtTaskInfo::getCreateBy,ctTaskInfo.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctTaskInfo.getCreateTime())){
queryWrapper.eq(CtTaskInfo::getCreateTime,ctTaskInfo.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctTaskInfo.getUpdateBy())){
queryWrapper.eq(CtTaskInfo::getUpdateBy,ctTaskInfo.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctTaskInfo.getUpdateTime())){
queryWrapper.eq(CtTaskInfo::getUpdateTime,ctTaskInfo.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctTaskInfo.getTenantId())){
queryWrapper.eq(CtTaskInfo::getTenantId,ctTaskInfo.getTenantId());
}
}
}

@ -0,0 +1,209 @@
package com.bs.ct.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.ct.domain.CtTaskTag;
import com.bs.ct.service.ICtTaskTagService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "任务标签")
@RestController
@RequestMapping("/task/tag")
public class CtTaskTagController extends BaseController {
@Resource
private ICtTaskTagService ctTaskTagService;
/**
*
*/
@ApiOperation("分页查询任务标签列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtTaskTag ctTaskTag) {
startPage();
LambdaQueryWrapper<CtTaskTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskTag);
List<CtTaskTag> list = ctTaskTagService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询任务标签列表")
@GetMapping("/list")
public AjaxResult list(CtTaskTag ctTaskTag) {
LambdaQueryWrapper<CtTaskTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskTag);
List<CtTaskTag> list = ctTaskTagService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出任务标签列表")
@Log(title = "任务标签导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtTaskTag ctTaskTag) {
LambdaQueryWrapper<CtTaskTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskTag);
List<CtTaskTag> list = ctTaskTagService.list(queryWrapper);
ExcelUtil<CtTaskTag> util = new ExcelUtil<CtTaskTag>(CtTaskTag. class);
util.exportExcel(response, list, "任务标签数据");
}
/**
*
*/
@ApiOperation("获取任务标签详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctTaskTagService.getById(id));
}
/**
*
*/
@ApiOperation("新增任务标签")
@Log(title = "任务标签新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtTaskTag ctTaskTag) {
return toAjax(ctTaskTagService.save(ctTaskTag));
}
/**
*
*/
@ApiOperation("修改任务标签")
@Log(title = "任务标签修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtTaskTag ctTaskTag) {
return toAjax(ctTaskTagService.updateById(ctTaskTag));
}
/**
*
*/
@ApiOperation("删除任务标签")
@Log(title = "任务标签删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctTaskTagService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtTaskTag> queryWrapper,CtTaskTag ctTaskTag){
//id
if(Validator.isNotEmpty(ctTaskTag.getId())){
queryWrapper.eq(CtTaskTag::getId,ctTaskTag.getId());
}
//任务模板id
if(Validator.isNotEmpty(ctTaskTag.getTaskId())){
queryWrapper.eq(CtTaskTag::getTaskId,ctTaskTag.getTaskId());
}
//标签名称
if(Validator.isNotEmpty(ctTaskTag.getTagName())){
queryWrapper.eq(CtTaskTag::getTagName,ctTaskTag.getTagName());
}
//标签说明
if(Validator.isNotEmpty(ctTaskTag.getTagDesc())){
queryWrapper.eq(CtTaskTag::getTagDesc,ctTaskTag.getTagDesc());
}
//是否需要拍照
if(Validator.isNotEmpty(ctTaskTag.getIsPhoto())){
queryWrapper.eq(CtTaskTag::getIsPhoto,ctTaskTag.getIsPhoto());
}
//拍照数量要求
if(Validator.isNotEmpty(ctTaskTag.getPhotoNum())){
queryWrapper.eq(CtTaskTag::getPhotoNum,ctTaskTag.getPhotoNum());
}
//照片存放目录
if(Validator.isNotEmpty(ctTaskTag.getSaveDir())){
queryWrapper.eq(CtTaskTag::getSaveDir,ctTaskTag.getSaveDir());
}
//附件id
if(Validator.isNotEmpty(ctTaskTag.getFileId())){
queryWrapper.eq(CtTaskTag::getFileId,ctTaskTag.getFileId());
}
//备注
if(Validator.isNotEmpty(ctTaskTag.getRemarks())){
queryWrapper.eq(CtTaskTag::getRemarks,ctTaskTag.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctTaskTag.getDelFlag())){
queryWrapper.eq(CtTaskTag::getDelFlag,ctTaskTag.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctTaskTag.getCreateDept())){
queryWrapper.eq(CtTaskTag::getCreateDept,ctTaskTag.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctTaskTag.getCreateBy())){
queryWrapper.eq(CtTaskTag::getCreateBy,ctTaskTag.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctTaskTag.getCreateTime())){
queryWrapper.eq(CtTaskTag::getCreateTime,ctTaskTag.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctTaskTag.getUpdateBy())){
queryWrapper.eq(CtTaskTag::getUpdateBy,ctTaskTag.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctTaskTag.getUpdateTime())){
queryWrapper.eq(CtTaskTag::getUpdateTime,ctTaskTag.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctTaskTag.getTenantId())){
queryWrapper.eq(CtTaskTag::getTenantId,ctTaskTag.getTenantId());
}
}
}

@ -0,0 +1,386 @@
package com.bs.ct.controller;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.common.core.domain.entity.SysDept;
import com.bs.common.core.domain.entity.SysUser;
import com.bs.common.utils.StringUtils;
import com.bs.ct.domain.CtTag;
import com.bs.ct.domain.CtTaskTemplateTag;
import com.bs.ct.service.ICtTagService;
import com.bs.ct.service.ICtTaskTemplateTagService;
import com.bs.ct.utils.HtmlUtils;
import com.bs.ct.vo.CtTaskTemplateVO;
import com.bs.system.mapper.SysDeptMapper;
import com.bs.system.mapper.SysUserMapper;
import com.bs.system.service.ISysDeptService;
import com.bs.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.ct.domain.CtTaskTemplate;
import com.bs.ct.service.ICtTaskTemplateService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "任务模板")
@RestController
@RequestMapping("/task/template")
public class CtTaskTemplateController extends BaseController {
@Resource
private ICtTaskTemplateService ctTaskTemplateService;
@Resource
private ICtTaskTemplateTagService ctTaskTemplateTagService;
@Resource
private ICtTagService ctTagService;
@Autowired
private ISysDeptService deptService;
@Autowired
private ISysUserService userService;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Resource
private ICmAttachService cmAttachService;
/**
*
*/
@ApiOperation("分页查询任务模板列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtTaskTemplate ctTaskTemplate) {
Integer pageNum = ctTaskTemplate.getPageNum() != null ? ctTaskTemplate.getPageNum() : 1;
Integer pageSize = ctTaskTemplate.getPageSize() != null ? ctTaskTemplate.getPageSize() : 10;
LambdaQueryWrapper<CtTaskTemplate> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskTemplate);
List<CtTaskTemplate> list = ctTaskTemplateService.list(queryWrapper);
getAll(list);
List<CtTaskTemplate> ctTaskTemplates = filterData(list, ctTaskTemplate);
Integer start = (pageNum - 1) * pageSize;
List<CtTaskTemplate> result = ctTaskTemplates.stream()
.skip(start) // 跳过前4条数据
.limit(pageSize) // 最多取6条数据
.collect(Collectors.toList());
for (CtTaskTemplate taskTemplate : result) {
List<CtTaskTemplateTag> listTag = ctTaskTemplateTagService.list(new LambdaQueryWrapper<CtTaskTemplateTag>()
.eq(CtTaskTemplateTag::getTemplateId,taskTemplate.getId()));
for (CtTaskTemplateTag ctTaskTemplateTag : listTag) {
List<CmAttach> cmAttaches = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().eq(CmAttach::getFileId, ctTaskTemplateTag.getFileId()));
if (null != cmAttaches && cmAttaches.size() > 0) {
ctTaskTemplateTag.setFiles(cmAttaches);
}
}
taskTemplate.setTags(listTag);
}
TableDataInfo data = getDataTable(result);
data.setTotal(ctTaskTemplates.size());
return data;
}
private void getAll(List<CtTaskTemplate> list) {
List<CtTaskTemplateTag> ctTaskTemplateTags = ctTaskTemplateTagService.list();
Map<Long, String> collect = ctTaskTemplateTags.stream()
.filter(tag -> tag.getTemplateId() != null) // 过滤null值
.collect(Collectors.groupingBy(
CtTaskTemplateTag::getTemplateId,
Collectors.mapping(
CtTaskTemplateTag::getTagName,
Collectors.joining(", ")
)
));
List<SysDept> depts = sysDeptMapper.selectDeptListAll();
Map<Long, String> deptMap = depts.stream()
.collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
Map<Long, Long> deptMapByParent = depts.stream()
.collect(Collectors.toMap(SysDept::getDeptId, SysDept::getParentId));
List<SysUser> sysUsers = sysUserMapper.selectUserAll();
Map<Long, String> stringHashMap = sysUsers.stream()
.collect(Collectors.toMap(
SysUser::getUserId,
SysUser::getUserName,
(existing, replacement) -> existing,
HashMap::new
));
for (CtTaskTemplate tag : list) {
String tagName = collect.get(tag.getId());
tag.setTagNames(tagName);
String deptName = deptMap.get(tag.getCreateDept());
Long parentId = deptMapByParent.get(tag.getCreateDept());
String parentName = deptMap.get(parentId);
String userName = stringHashMap.get(tag.getCreateBy());
Date createTime = tag.getCreateTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formattedDate = sdf.format(createTime);
tag.setCreateByUserName(userName);
tag.setCreateByDeptName(deptName);
tag.setCreateByBranch(parentName);
tag.setCreateTimeVo(formattedDate);
}
}
private List<CtTaskTemplate> filterData(List<CtTaskTemplate> allList, CtTaskTemplate ctTaskTemplate) {
return allList.stream()
.filter(item -> {
boolean match = true;
if (StringUtils.isNotBlank(ctTaskTemplate.getCreateByBranch())) {
match = match && item.getCreateByBranch() != null && item.getCreateByBranch().contains(ctTaskTemplate.getCreateByBranch());
}
if (StringUtils.isNotBlank(ctTaskTemplate.getCreateByDeptName())) {
match = match && item.getCreateByDeptName() != null && item.getCreateByDeptName().contains(ctTaskTemplate.getCreateByDeptName());
}
if (StringUtils.isNotBlank(ctTaskTemplate.getCreateByUserName())) {
match = match && item.getCreateByUserName() != null && item.getCreateByUserName().contains(ctTaskTemplate.getCreateByUserName());
}
if (ctTaskTemplate.getStartCreateTime() != null || ctTaskTemplate.getEndCreateTime() != null) {
Date itemCreateTime = item.getCreateTime();
if (ctTaskTemplate.getStartCreateTime() != null && (itemCreateTime == null || itemCreateTime.before(ctTaskTemplate.getStartCreateTime()))) {
match = false;
}
if (ctTaskTemplate.getEndCreateTime() != null && (itemCreateTime == null || itemCreateTime.after(ctTaskTemplate.getEndCreateTime()))) {
match = false;
}
}
if (StringUtils.isNotBlank(ctTaskTemplate.getTagNames())) {
// 这里假设CtTaskTemplate类有一个方法可以获取标签名称的字符串
String tagNamesStr = item.getTagNames();
match = match && tagNamesStr != null && tagNamesStr.contains(ctTaskTemplate.getTagNames());
}
return match;
})
.collect(Collectors.toList());
}
/**
*
*/
@ApiOperation("查询任务模板列表")
@GetMapping("/list")
public AjaxResult list(CtTaskTemplate ctTaskTemplate) {
LambdaQueryWrapper<CtTaskTemplate> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskTemplate);
List<CtTaskTemplate> list = ctTaskTemplateService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出任务模板列表")
@Log(title = "任务模板导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtTaskTemplate ctTaskTemplate) {
LambdaQueryWrapper<CtTaskTemplate> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskTemplate);
List<CtTaskTemplate> list = ctTaskTemplateService.list(queryWrapper);
getAll(list);
List<CtTaskTemplate> ctTaskTemplates = filterData(list, ctTaskTemplate);
List<CtTaskTemplateVO> ctTaskTemplateVOList = new ArrayList<>();
for (CtTaskTemplate ctTaskTemp : ctTaskTemplates) {
CtTaskTemplateVO ctTaskTemplateVO = new CtTaskTemplateVO();
BeanUtils.copyProperties(ctTaskTemp, ctTaskTemplateVO);
ctTaskTemplateVO.setTaskContent(HtmlUtils.stripHtmlTags(ctTaskTemplateVO.getTaskContent()));
ctTaskTemplateVOList.add(ctTaskTemplateVO);
}
ExcelUtil<CtTaskTemplateVO> util = new ExcelUtil<CtTaskTemplateVO>(CtTaskTemplateVO. class);
util.exportExcel(response, ctTaskTemplateVOList, "任务模板数据");
}
/**
*
*/
@ApiOperation("获取任务模板详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
CtTaskTemplate templateServiceById = ctTaskTemplateService.getById(id);
List<CtTaskTemplateTag> list = ctTaskTemplateTagService.list(new LambdaQueryWrapper<CtTaskTemplateTag>()
.eq(CtTaskTemplateTag::getTemplateId,id));
for (CtTaskTemplateTag ctTaskTemplateTag : list) {
List<CmAttach> cmAttaches = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().eq(CmAttach::getFileId, ctTaskTemplateTag.getFileId()));
if (null != cmAttaches && cmAttaches.size() > 0) {
ctTaskTemplateTag.setFiles(cmAttaches);
}
}
templateServiceById.setTags(list);
return success(templateServiceById);
}
/**
*
*/
@ApiOperation("删除任务模板相关标签")
@Log(title = "删除任务模板相关标签", businessType = BusinessType.UPDATE)
@PostMapping(value = "/removeTag")
public AjaxResult removeTag(@RequestBody CtTaskTemplate ctTaskTemplate) {
List<String> ids = ctTaskTemplate.getTagIds();
boolean remove = ctTaskTemplateTagService.remove(new LambdaQueryWrapper<CtTaskTemplateTag>().in(CtTaskTemplateTag::getId, ids));
return toAjax(remove);
}
/**
*
*/
@ApiOperation("新增任务模板相关标签")
@Log(title = "新增任务模板相关标签", businessType = BusinessType.UPDATE)
@PostMapping(value = "/addTag")
public AjaxResult addTag(@RequestBody CtTaskTemplate ctTaskTemplate) {
saveTags(ctTaskTemplate);
return toAjax(true);
}
/**
*
*/
@ApiOperation("新增任务模板")
@Log(title = "任务模板新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtTaskTemplate ctTaskTemplate) {
boolean save = ctTaskTemplateService.save(ctTaskTemplate);
if (save) {
saveTags(ctTaskTemplate);
}
return toAjax(true);
}
/**
*
*/
@ApiOperation("修改任务模板")
@Log(title = "任务模板修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtTaskTemplate ctTaskTemplate) {
saveTags(ctTaskTemplate);
return toAjax(ctTaskTemplateService.updateById(ctTaskTemplate));
}
private void saveTags(CtTaskTemplate ctTaskTemplate) {
List<String> tagIds = ctTaskTemplate.getTagIds();
if (null != tagIds && tagIds.size() > 0) {
List<CtTag> ctTags = ctTagService.list(new LambdaQueryWrapper<CtTag>().in(CtTag::getId, tagIds));
for (CtTag ctTag : ctTags) {
Long ctTaskTemplateId = ctTaskTemplate.getId();
CtTaskTemplateTag ctTaskTemplateTag = new CtTaskTemplateTag();
ctTaskTemplateTag.setTemplateId(ctTaskTemplateId);
ctTaskTemplateTag.setTagName(ctTag.getTagName());
ctTaskTemplateTag.setTagDesc(ctTag.getTagDesc());
ctTaskTemplateTag.setIsPhoto(ctTag.getIsPhoto());
ctTaskTemplateTag.setPhotoNum(ctTag.getPhotoNum());
ctTaskTemplateTag.setSaveDir(ctTag.getSaveDir());
ctTaskTemplateTag.setFileId(ctTag.getFileId());
ctTaskTemplateTagService.save(ctTaskTemplateTag);
}
}
}
/**
*
*/
@ApiOperation("删除任务模板")
@Log(title = "任务模板删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctTaskTemplateService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtTaskTemplate> queryWrapper,CtTaskTemplate ctTaskTemplate){
//id
if(Validator.isNotEmpty(ctTaskTemplate.getId())){
queryWrapper.eq(CtTaskTemplate::getId,ctTaskTemplate.getId());
}
//任务类型
if(Validator.isNotEmpty(ctTaskTemplate.getTaskType())){
queryWrapper.eq(CtTaskTemplate::getTaskType,ctTaskTemplate.getTaskType());
}
//模板名称
if(Validator.isNotEmpty(ctTaskTemplate.getTemplateName())){
queryWrapper.eq(CtTaskTemplate::getTemplateName,ctTaskTemplate.getTemplateName());
}
//任务标题
if(Validator.isNotEmpty(ctTaskTemplate.getTaskTitle())){
queryWrapper.eq(CtTaskTemplate::getTaskTitle,ctTaskTemplate.getTaskTitle());
}
//任务要求
if(Validator.isNotEmpty(ctTaskTemplate.getTaskContent())){
queryWrapper.eq(CtTaskTemplate::getTaskContent,ctTaskTemplate.getTaskContent());
}
//备注
if(Validator.isNotEmpty(ctTaskTemplate.getRemarks())){
queryWrapper.eq(CtTaskTemplate::getRemarks,ctTaskTemplate.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctTaskTemplate.getDelFlag())){
queryWrapper.eq(CtTaskTemplate::getDelFlag,ctTaskTemplate.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctTaskTemplate.getCreateDept())){
queryWrapper.eq(CtTaskTemplate::getCreateDept,ctTaskTemplate.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctTaskTemplate.getCreateBy())){
queryWrapper.eq(CtTaskTemplate::getCreateBy,ctTaskTemplate.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctTaskTemplate.getCreateTime())){
queryWrapper.eq(CtTaskTemplate::getCreateTime,ctTaskTemplate.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctTaskTemplate.getUpdateBy())){
queryWrapper.eq(CtTaskTemplate::getUpdateBy,ctTaskTemplate.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctTaskTemplate.getUpdateTime())){
queryWrapper.eq(CtTaskTemplate::getUpdateTime,ctTaskTemplate.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctTaskTemplate.getTenantId())){
queryWrapper.eq(CtTaskTemplate::getTenantId,ctTaskTemplate.getTenantId());
}
}
}

@ -0,0 +1,209 @@
package com.bs.ct.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.ct.domain.CtTaskTemplateTag;
import com.bs.ct.service.ICtTaskTemplateTagService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "任务模板标签")
@RestController
@RequestMapping("/task/template/tag")
public class CtTaskTemplateTagController extends BaseController {
@Resource
private ICtTaskTemplateTagService ctTaskTemplateTagService;
/**
*
*/
@ApiOperation("分页查询任务模板标签列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtTaskTemplateTag ctTaskTemplateTag) {
startPage();
LambdaQueryWrapper<CtTaskTemplateTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskTemplateTag);
List<CtTaskTemplateTag> list = ctTaskTemplateTagService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询任务模板标签列表")
@GetMapping("/list")
public AjaxResult list(CtTaskTemplateTag ctTaskTemplateTag) {
LambdaQueryWrapper<CtTaskTemplateTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskTemplateTag);
List<CtTaskTemplateTag> list = ctTaskTemplateTagService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出任务模板标签列表")
@Log(title = "任务模板标签导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtTaskTemplateTag ctTaskTemplateTag) {
LambdaQueryWrapper<CtTaskTemplateTag> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctTaskTemplateTag);
List<CtTaskTemplateTag> list = ctTaskTemplateTagService.list(queryWrapper);
ExcelUtil<CtTaskTemplateTag> util = new ExcelUtil<CtTaskTemplateTag>(CtTaskTemplateTag. class);
util.exportExcel(response, list, "任务模板标签数据");
}
/**
*
*/
@ApiOperation("获取任务模板标签详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctTaskTemplateTagService.getById(id));
}
/**
*
*/
@ApiOperation("新增任务模板标签")
@Log(title = "任务模板标签新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtTaskTemplateTag ctTaskTemplateTag) {
return toAjax(ctTaskTemplateTagService.save(ctTaskTemplateTag));
}
/**
*
*/
@ApiOperation("修改任务模板标签")
@Log(title = "任务模板标签修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtTaskTemplateTag ctTaskTemplateTag) {
return toAjax(ctTaskTemplateTagService.updateById(ctTaskTemplateTag));
}
/**
*
*/
@ApiOperation("删除任务模板标签")
@Log(title = "任务模板标签删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctTaskTemplateTagService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<CtTaskTemplateTag> queryWrapper,CtTaskTemplateTag ctTaskTemplateTag){
//id
if(Validator.isNotEmpty(ctTaskTemplateTag.getId())){
queryWrapper.eq(CtTaskTemplateTag::getId,ctTaskTemplateTag.getId());
}
//任务模板id
if(Validator.isNotEmpty(ctTaskTemplateTag.getTemplateId())){
queryWrapper.eq(CtTaskTemplateTag::getTemplateId,ctTaskTemplateTag.getTemplateId());
}
//标签名称
if(Validator.isNotEmpty(ctTaskTemplateTag.getTagName())){
queryWrapper.eq(CtTaskTemplateTag::getTagName,ctTaskTemplateTag.getTagName());
}
//标签说明
if(Validator.isNotEmpty(ctTaskTemplateTag.getTagDesc())){
queryWrapper.eq(CtTaskTemplateTag::getTagDesc,ctTaskTemplateTag.getTagDesc());
}
//是否需要拍照
if(Validator.isNotEmpty(ctTaskTemplateTag.getIsPhoto())){
queryWrapper.eq(CtTaskTemplateTag::getIsPhoto,ctTaskTemplateTag.getIsPhoto());
}
//拍照数量要求
if(Validator.isNotEmpty(ctTaskTemplateTag.getPhotoNum())){
queryWrapper.eq(CtTaskTemplateTag::getPhotoNum,ctTaskTemplateTag.getPhotoNum());
}
//照片存放目录
if(Validator.isNotEmpty(ctTaskTemplateTag.getSaveDir())){
queryWrapper.eq(CtTaskTemplateTag::getSaveDir,ctTaskTemplateTag.getSaveDir());
}
//附件id
if(Validator.isNotEmpty(ctTaskTemplateTag.getFileId())){
queryWrapper.eq(CtTaskTemplateTag::getFileId,ctTaskTemplateTag.getFileId());
}
//备注
if(Validator.isNotEmpty(ctTaskTemplateTag.getRemarks())){
queryWrapper.eq(CtTaskTemplateTag::getRemarks,ctTaskTemplateTag.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctTaskTemplateTag.getDelFlag())){
queryWrapper.eq(CtTaskTemplateTag::getDelFlag,ctTaskTemplateTag.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctTaskTemplateTag.getCreateDept())){
queryWrapper.eq(CtTaskTemplateTag::getCreateDept,ctTaskTemplateTag.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctTaskTemplateTag.getCreateBy())){
queryWrapper.eq(CtTaskTemplateTag::getCreateBy,ctTaskTemplateTag.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctTaskTemplateTag.getCreateTime())){
queryWrapper.eq(CtTaskTemplateTag::getCreateTime,ctTaskTemplateTag.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctTaskTemplateTag.getUpdateBy())){
queryWrapper.eq(CtTaskTemplateTag::getUpdateBy,ctTaskTemplateTag.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctTaskTemplateTag.getUpdateTime())){
queryWrapper.eq(CtTaskTemplateTag::getUpdateTime,ctTaskTemplateTag.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctTaskTemplateTag.getTenantId())){
queryWrapper.eq(CtTaskTemplateTag::getTenantId,ctTaskTemplateTag.getTenantId());
}
}
}

@ -0,0 +1,62 @@
package com.bs.ct.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
import java.util.List;
/**
* ct_gallery_cata
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_gallery_cata")
@Data
public class CtGalleryCata extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 目录名称 */
@Excel(name = "目录名称")
@ApiModelProperty(value = "目录名称")
private String cataName;
/** 父级id */
@Excel(name = "父级id")
@ApiModelProperty(value = "父级id")
private Long parentId;
/** 类型 */
@Excel(name = "类型")
@ApiModelProperty(value = "类型")
private String type;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
@TableField(exist = false)
private List<CtGalleryCata> children;
}

@ -0,0 +1,94 @@
package com.bs.ct.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
/**
* ct_gallery_cata_share
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_gallery_cata_share")
@Data
public class CtGalleryCataShare extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 共享类型目录共享、图片共享 */
@Excel(name = "共享类型目录共享、图片共享")
@ApiModelProperty(value = "共享类型目录共享、图片共享")
private String type;
/** 目录id */
@Excel(name = "目录id")
@ApiModelProperty(value = "目录id")
private Long cataId;
@Excel(name = "共享名称")
@ApiModelProperty(value = "共享名称")
private String cataName;
@TableField(exist = false)
private List<Long> cataIds;
@TableField(exist = false)
private String userType;
/** 共享用户 */
@Excel(name = "共享用户")
@ApiModelProperty(value = "共享用户")
private Long userId;
@TableField(exist = false)
private List<Long> userIds;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "开始时间")
private Date beginDate;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "结束时间")
private Date endDate;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
@TableField(exist = false)
private List<CtGalleryShareUser> lsUsers;
@TableField(exist = false)
private String queryType;
}

@ -0,0 +1,159 @@
package com.bs.ct.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.bs.cm.domain.CmAttach;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
/**
* ct_gallery_images
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_gallery_images")
@Data
public class CtGalleryImages extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 目录id */
@Excel(name = "目录id")
@ApiModelProperty(value = "目录id")
private Long cataId;
/** 图片名称 */
@Excel(name = "图片名称")
@ApiModelProperty(value = "图片名称")
private String imageName;
/** 图片标题 */
@Excel(name = "图片标题")
@ApiModelProperty(value = "图片标题")
private String imageTitle;
/** 图片路径 */
@Excel(name = "图片路径")
@ApiModelProperty(value = "图片路径")
private String imagePath;
/** 图片大小 */
@Excel(name = "图片大小")
@ApiModelProperty(value = "图片大小")
private BigDecimal imageSize;
/** 图片拍摄时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "图片拍摄时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "图片拍摄时间")
private Date photoTime;
/** 图片上传时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "图片上传时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "图片上传时间")
private Date uploadTime;
/** 是否公开 */
@Excel(name = "是否公开")
@ApiModelProperty(value = "是否公开")
private String isOpen;
/** 图片关键字 */
@Excel(name = "图片关键字")
@ApiModelProperty(value = "图片关键字")
private String keyWords;
/** 附件id */
@Excel(name = "附件id")
@ApiModelProperty(value = "附件id")
private Long fileId;
@Excel(name = "EXIF信息")
@ApiModelProperty(value = "EXIF信息")
private String exifInfo;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
/** 附件id */
@ApiModelProperty(value = "附件")
@TableField(exist = false)
private List<CmAttach> file;
@TableField(exist = false)
private List<Long> ids;
@TableField(exist = false)
private Long taskTagId;
@TableField(exist = false)
private List<CtGalleryImagesTag> imagesTags;
@TableField(exist = false)
private Long feedbackId;
/**
* nineGrid
* fourGrid
* horizontalMerge
* verticalMerge
* video
* */
@TableField(exist = false)
private String imageType;
/** 目录名称 */
@TableField(exist = false)
private String cataName;
/** 标签名称 */
@TableField(exist = false)
private List<String> tagNames;
/** 标签名称 */
@TableField(exist = false)
private List<String> taskTitles;
@TableField(exist = false)
private Integer pageNum;
@TableField(exist = false)
private Integer pageSize;
}

@ -0,0 +1,89 @@
package com.bs.ct.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
/**
* ct_gallery_images_tag
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_gallery_images_tag")
@Data
public class CtGalleryImagesTag extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 图片id */
@Excel(name = "图片id")
@ApiModelProperty(value = "图片id")
private Long imageId;
@Excel(name = "标签类型")
@ApiModelProperty(value = "标签类型")
private String tagType;
/** 标签名称 */
@Excel(name = "标签名称")
@ApiModelProperty(value = "标签名称")
private String tagName;
/** 标签说明 */
@Excel(name = "标签说明")
@ApiModelProperty(value = "标签说明")
private String tagDesc;
/** 是否需要拍照 */
@Excel(name = "是否需要拍照")
@ApiModelProperty(value = "是否需要拍照")
private String isPhoto;
/** 拍照数量要求 */
@Excel(name = "拍照数量要求")
@ApiModelProperty(value = "拍照数量要求")
private Long photoNum;
/** 照片存放目录 */
@Excel(name = "照片存放目录")
@ApiModelProperty(value = "照片存放目录")
private Long saveDir;
/** 附件id */
@Excel(name = "附件id")
@ApiModelProperty(value = "附件id")
private Long fileId;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
}

@ -0,0 +1,73 @@
package com.bs.ct.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import com.bs.common.core.domain.entity.SysDept;
import com.bs.common.core.domain.entity.SysUser;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
import java.util.Date;
/**
* ct_gallery_share_user
*
* @author bs
* @date 2025-06-14
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_gallery_share_user")
@Data
public class CtGalleryShareUser extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 共享id */
@Excel(name = "共享id")
@ApiModelProperty(value = "共享id")
private Long shareId;
@Excel(name = "用户类型")
@ApiModelProperty(value = "用户类型")
private String userType;
/** 共享用户 */
@Excel(name = "共享用户")
@ApiModelProperty(value = "共享用户")
private Long userId;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "开始时间")
private Date beginDate;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "结束时间")
private Date endDate;
@TableField(exist = false)
private SysDept dept;
@TableField(exist = false)
private SysUser user;
}

@ -0,0 +1,42 @@
package com.bs.ct.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
/**
* ct_images_feedback_ref
*
* @author bs
* @date 2025-04-20
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_images_feedback_ref")
@Data
public class CtImagesFeedbackRef extends BaseEntity{
private static final long serialVersionUID = 1L;
/** 图片id */
@Excel(name = "图片id")
@ApiModelProperty(value = "图片id")
private Long imageId;
/** 任务反馈id */
@Excel(name = "任务反馈id")
@ApiModelProperty(value = "任务反馈id")
private Long feedbackId;
}

@ -0,0 +1,89 @@
package com.bs.ct.domain;
import com.bs.cm.domain.CmAttach;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
import java.util.List;
/**
* ct_tag
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_tag")
@Data
public class CtTag extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
@Excel(name = "标签类型")
@ApiModelProperty(value = "标签类型")
private String tagType;
/** 标签名称 */
@Excel(name = "标签名称")
@ApiModelProperty(value = "标签名称")
private String tagName;
/** 标签说明 */
@Excel(name = "标签说明")
@ApiModelProperty(value = "标签说明")
private String tagDesc;
/** 是否需要拍照 */
@Excel(name = "是否需要拍照")
@ApiModelProperty(value = "是否需要拍照")
private String isPhoto;
/** 拍照数量要求 */
@Excel(name = "拍照数量要求")
@ApiModelProperty(value = "拍照数量要求")
private Long photoNum;
/** 照片存放目录 */
@Excel(name = "照片存放目录")
@ApiModelProperty(value = "照片存放目录")
private Long saveDir;
/** 附件id */
@Excel(name = "附件id")
@ApiModelProperty(value = "附件id")
private Long fileId;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
/** 附件id */
@ApiModelProperty(value = "附件")
@TableField(exist = false)
private List<CmAttach> files;
}

@ -0,0 +1,211 @@
package com.bs.ct.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;
/**
* ct_task_branch
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_task_branch")
@Data
public class CtTaskBranch extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 任务id */
@Excel(name = "任务id")
@ApiModelProperty(value = "任务id")
private Long taskId;
/** 任务id */
@Excel(name = "任务ids")
@ApiModelProperty(value = "任务ids")
@TableField(exist = false)
private List<Long> taskIds;
/** 类型人员、机构 */
@Excel(name = "类型人员、机构")
@ApiModelProperty(value = "类型人员、机构")
private String type;
/** 机构代码 */
@Excel(name = "机构代码")
@ApiModelProperty(value = "机构代码")
private String branchCode;
/** 机构名称 */
@Excel(name = "机构名称")
@ApiModelProperty(value = "机构名称")
private String branchName;
/** 机构名称 */
@Excel(name = "上级机构名称")
@ApiModelProperty(value = "上级机构名称")
@TableField(exist = false)
private String branchNameParent;
/** 机构代码 */
@Excel(name = "用户Id")
@ApiModelProperty(value = "用户Id")
private String userId;
/** 机构代码 */
@Excel(name = "用户Ids")
@ApiModelProperty(value = "用户Id")
@TableField(exist = false)
private List<String> userIds;
/** 用户名称 */
@Excel(name = "用户名称")
@ApiModelProperty(value = "用户名称")
private String userName;
/** 任务状态 0未完成 1已逾期 2已完成 */
@Excel(name = "任务状态")
@ApiModelProperty(value = "任务状态")
private String taskStatus;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
@TableField(exist = false)
private CtTaskFeedback sdTaskOtherFeedbackByCreate;
@TableField(exist = false)
private CtTaskFeedback sdTaskOtherFeedbackByFeedback;
@TableField(exist = false)
private CtTaskInfo sdTaskOther;
/** 任务要求 */
@Excel(name = "任务内容")
@ApiModelProperty(value = "任务内容")
@TableField(exist = false)
private String taskContent;
/** 完成状态 */
@Excel(name = "完成状态")
@ApiModelProperty(value = "完成状态")
@TableField(exist = false)
private String status;
/** 任务类型 */
@Excel(name = "任务类型")
@ApiModelProperty(value = "任务类型")
@TableField(exist = false)
private String taskType;
/** 任务标题 */
@Excel(name = "任务标题")
@ApiModelProperty(value = "任务标题")
@TableField(exist = false)
private String taskTitle;
@ApiModelProperty(value = "任务期限")
@TableField(exist = false)
private String startToEndDate;
/** 任务发起部门 */
@Excel(name = "任务发起部门")
@ApiModelProperty(value = "任务发起部门")
@TableField(exist = false)
private String deptName;
@Excel(name = "办理单位")
@ApiModelProperty(value = "办理单位")
@TableField(exist = false)
private String transactBranchName;
@Excel(name = "办理部门")
@ApiModelProperty(value = "办理部门")
@TableField(exist = false)
private String transactDeptName;
@Excel(name = "办理人")
@ApiModelProperty(value = "办理人")
@TableField(exist = false)
private String transactInitiator;
/** 任务发起人 */
@Excel(name = "任务发起人")
@ApiModelProperty(value = "任务发起人")
@TableField(exist = false)
private String taskInitiator;
/** 是否为交办任务 1是 0否 */
@Excel(name = "是否为交办任务")
@ApiModelProperty(value = "是否为交办任务")
@TableField(exist = false)
private String isTask;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "开始时间")
@TableField(exist = false)
private Date startDate;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "结束时间")
@TableField(exist = false)
private Date endDate;
/** 任务发布日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "任务发布日期", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "任务发布日期")
@TableField(exist = false)
private Date taskDate;
@TableField(exist = false)
private Integer pageNum;
@TableField(exist = false)
private Integer pageSize;
@TableField(exist = false)
private List<CtTaskTag> ctTaskTags;
}

@ -0,0 +1,172 @@
package com.bs.ct.domain;
import java.util.Date;
import java.util.List;
import com.bs.cm.domain.CmAttach;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
/**
* ct_task_feedback
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_task_feedback")
@Data
public class CtTaskFeedback extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 任务id */
@Excel(name = "任务id")
@ApiModelProperty(value = "任务id")
private Long taskId;
/** 任务标签id */
@Excel(name = "任务标签id")
@ApiModelProperty(value = "任务标签id")
private Long taskTagId;
/** 任务id */
@Excel(name = "任务id")
@TableField(exist = false)
private List<Long> taskIds;
/** 图片id */
@Excel(name = "图片id")
@TableField(exist = false)
private List<Long> imageIds;
/** 机构任务id */
@Excel(name = "机构任务id")
@ApiModelProperty(value = "机构任务id")
private Long taskBranchId;
/** 机构代码 */
@Excel(name = "机构代码")
@ApiModelProperty(value = "机构代码")
private String branchCode;
/** 任务反馈时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "任务反馈时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "任务反馈时间")
private Date feedbackTime;
/** 任务完成情况 */
@Excel(name = "任务完成情况")
@ApiModelProperty(value = "任务完成情况")
private String taskDesc;
/** 操作人员工号 */
@Excel(name = "操作人员工号")
@ApiModelProperty(value = "操作人员工号")
private String userId;
/** 人员ids */
@Excel(name = "人员ids")
@TableField(exist = false)
private List<String> userIds;
/** 操作人员姓名 */
@Excel(name = "操作人员姓名")
@ApiModelProperty(value = "操作人员姓名")
private String userName;
/** 操作人员部门 */
@Excel(name = "操作人员部门")
@ApiModelProperty(value = "操作人员部门")
private String userDept;
/** 是否已拍照留存 */
@Excel(name = "是否已拍照留存")
@ApiModelProperty(value = "是否已拍照留存")
private String isPhoto;
/** 附件id */
@Excel(name = "附件id")
@ApiModelProperty(value = "附件id")
private Long fileId;
/** 审核人员id */
@Excel(name = "审核人员id")
@ApiModelProperty(value = "审核人员id")
private String checkUserId;
/** 审核人员姓名 */
@Excel(name = "审核人员姓名")
@ApiModelProperty(value = "审核人员姓名")
private String checkUserName;
/** 审核人员部门 */
@Excel(name = "审核人员部门")
@ApiModelProperty(value = "审核人员部门")
private String checkUserDept;
/** 审核时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "审核时间")
private Date checkDate;
/** 审核状态 */
@Excel(name = "审核状态")
@ApiModelProperty(value = "审核状态")
private String status;
/** 审核信息 */
@Excel(name = "审核信息")
@ApiModelProperty(value = "审核信息")
private String checkInfo;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
/** 附件id */
@ApiModelProperty(value = "附件")
@TableField(exist = false)
private List<CmAttach> file;
}

@ -0,0 +1,53 @@
package com.bs.ct.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
/**
* ct_task_images
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_task_images")
@Data
public class CtTaskImages extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 任务id */
@Excel(name = "任务id")
@ApiModelProperty(value = "任务id")
private Long taskId;
/** 图片id */
@Excel(name = "图片id")
@ApiModelProperty(value = "图片id")
private Long imageId;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
}

@ -0,0 +1,185 @@
package com.bs.ct.domain;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import com.bs.cm.domain.CmAttach;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import io.swagger.annotations.ApiModelProperty;
/**
* ct_task_info
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_task_info")
@Data
public class CtTaskInfo extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 任务类型 */
@Excel(name = "任务类型")
@ApiModelProperty(value = "任务类型")
private String taskType;
/** 任务标题 */
@Excel(name = "任务标题")
@ApiModelProperty(value = "任务标题")
private String taskTitle;
/** 任务编号 */
@Excel(name = "任务编号")
@ApiModelProperty(value = "任务编号")
private String taskCode;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "开始时间")
private Date startDate;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "结束时间")
private Date endDate;
//@Excel(name = "任务要求")
@ApiModelProperty(value = "任务期限")
@TableField(exist = false)
private String startToEndDate;
/** 任务要求 */
@Excel(name = "任务内容")
@ApiModelProperty(value = "任务内容")
private String taskContent;
/** 完成状态 */
@Excel(name = "完成状态")
@ApiModelProperty(value = "完成状态")
private String status;
/** 附件id */
@Excel(name = "附件id")
@ApiModelProperty(value = "附件id")
private Long fileId;
/** 附件id */
@ApiModelProperty(value = "附件")
@TableField(exist = false)
private List<CmAttach> file;
/** 任务发起人 */
@Excel(name = "任务发起人")
@ApiModelProperty(value = "任务发起人")
private String taskInitiator;
/** 任务发起单位机构代码 */
@Excel(name = "任务发起单位机构代码")
@ApiModelProperty(value = "任务发起单位机构代码")
private String branchCode;
/** 任务发起单位 */
@Excel(name = "任务发起单位")
@ApiModelProperty(value = "任务发起单位")
private String branchName;
/** 任务发起部门 */
//@Excel(name = "任务发起部门")
@ApiModelProperty(value = "任务发起部门")
private Long deptId;
/** 任务发起部门 */
@Excel(name = "任务发起部门")
@ApiModelProperty(value = "任务发起部门")
@TableField(exist = false)
private String deptName;
/** 任务发布日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "任务发布日期", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "任务发布日期")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Date taskDate;
@Excel(name = "办理单位")
@ApiModelProperty(value = "办理单位")
@TableField(exist = false)
private String transactBranchName;
@Excel(name = "办理部门")
@ApiModelProperty(value = "办理部门")
@TableField(exist = false)
private String transactDeptName;
@Excel(name = "办理人")
@ApiModelProperty(value = "办理人")
@TableField(exist = false)
private String transactInitiator;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
@TableField(exist = false)
private List<CtTaskBranch> branchList;
@Excel(name = "任务状态")
@TableField(exist = false)
private String taskStatus;
@Excel(name = "办理人Id")
@TableField(exist = false)
private List<String> userIds;
@TableField(exist = false)
private Integer pageNum;
@TableField(exist = false)
private Integer pageSize;
@TableField(exist = false)
private CtTaskFeedback sdTaskOtherFeedbackByCreate;
@TableField(exist = false)
private CtTaskFeedback sdTaskOtherFeedbackByFeedback;
@TableField(exist = false)
private List<CtTaskTag> tags;
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd")
private Date queryDate;
}

@ -0,0 +1,92 @@
package com.bs.ct.domain;
import com.bs.cm.domain.CmAttach;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
import java.util.List;
/**
* ct_task_tag
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_task_tag")
@Data
public class CtTaskTag extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 任务模板id */
@Excel(name = "任务模板id")
@ApiModelProperty(value = "任务模板id")
private Long taskId;
@Excel(name = "标签类型")
@ApiModelProperty(value = "标签类型")
private String tagType;
/** 标签名称 */
@Excel(name = "标签名称")
@ApiModelProperty(value = "标签名称")
private String tagName;
/** 标签说明 */
@Excel(name = "标签说明")
@ApiModelProperty(value = "标签说明")
private String tagDesc;
/** 是否需要拍照 */
@Excel(name = "是否需要拍照")
@ApiModelProperty(value = "是否需要拍照")
private String isPhoto;
/** 拍照数量要求 */
@Excel(name = "拍照数量要求")
@ApiModelProperty(value = "拍照数量要求")
private Long photoNum;
/** 照片存放目录 */
@Excel(name = "照片存放目录")
@ApiModelProperty(value = "照片存放目录")
private Long saveDir;
/** 附件id */
@Excel(name = "附件id")
@ApiModelProperty(value = "附件id")
private Long fileId;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
@TableField(exist = false)
private List<CtTaskFeedback> ctTaskFeedbacks;
}

@ -0,0 +1,126 @@
package com.bs.ct.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
import java.util.Date;
import java.util.List;
/**
* ct_task_template
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_task_template")
@Data
public class CtTaskTemplate extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 任务类型 */
@Excel(name = "任务类型")
@ApiModelProperty(value = "任务类型")
private String taskType;
/** 模板名称 */
@Excel(name = "模板名称")
@ApiModelProperty(value = "模板名称")
private String templateName;
/** 任务标题 */
@Excel(name = "任务标题")
@ApiModelProperty(value = "任务标题")
private String taskTitle;
/** 任务要求 */
@Excel(name = "任务要求")
@ApiModelProperty(value = "任务要求")
private String taskContent;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
/** 创建人 */
@Excel(name = "创建人")
@ApiModelProperty(value = "创建人")
@TableField(exist = false)
private String createByUserName;
/** 创建部门 */
@Excel(name = "创建部门")
@ApiModelProperty(value = "创建部门")
@TableField(exist = false)
private String createByDeptName;
/** 创建单位 */
@Excel(name = "创建单位")
@ApiModelProperty(value = "创建单位")
@TableField(exist = false)
private String createByBranch;
/** 任务标签 */
@Excel(name = "任务标签id")
@ApiModelProperty(value = "任务标签id")
@TableField(exist = false)
private List<String> tagIds;
/** 任务标签 */
@Excel(name = "任务标签")
@ApiModelProperty(value = "任务标签")
@TableField(exist = false)
private List<CtTaskTemplateTag> tags;
/** 任务标签 */
@Excel(name = "任务标签")
@ApiModelProperty(value = "任务标签")
@TableField(exist = false)
private String tagNames;
@Excel(name = "创建时间")
@ApiModelProperty(value = "创建时间")
@TableField(exist = false)
private String createTimeVo;
@TableField(exist = false)
private Integer pageNum;
@TableField(exist = false)
private Integer pageSize;
@TableField(exist = false)
private Date startCreateTime;
@TableField(exist = false)
private Date endCreateTime;
}

@ -0,0 +1,97 @@
package com.bs.ct.domain;
import com.bs.cm.domain.CmAttach;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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.ApiModelProperty;
import java.util.List;
/**
* ct_task_template_tag
*
* @author bs
* @date 2025-02-22
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ct_task_template_tag")
@Data
public class CtTaskTemplateTag extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 任务模板id */
@Excel(name = "任务模板id")
@ApiModelProperty(value = "任务模板id")
private Long templateId;
@Excel(name = "标签类型")
@ApiModelProperty(value = "标签类型")
private String tagType;
/** 标签名称 */
@Excel(name = "标签名称")
@ApiModelProperty(value = "标签名称")
private String tagName;
/** 标签说明 */
@Excel(name = "标签说明")
@ApiModelProperty(value = "标签说明")
private String tagDesc;
/** 是否需要拍照 */
@Excel(name = "是否需要拍照")
@ApiModelProperty(value = "是否需要拍照")
private String isPhoto;
/** 拍照数量要求 */
@Excel(name = "拍照数量要求")
@ApiModelProperty(value = "拍照数量要求")
private Long photoNum;
/** 照片存放目录 */
@Excel(name = "照片存放目录")
@ApiModelProperty(value = "照片存放目录")
private Long saveDir;
/** 附件id */
@Excel(name = "附件id")
@ApiModelProperty(value = "附件id")
private Long fileId;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
/** 附件id */
@Excel(name = "附件")
@ApiModelProperty(value = "附件")
@TableField(exist = false)
private List<CmAttach> files;
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtGalleryCata;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtGalleryCataMapper extends BaseMapperX<CtGalleryCata> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtGalleryCataShare;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtGalleryCataShareMapper extends BaseMapperX<CtGalleryCataShare> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtGalleryImages;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtGalleryImagesMapper extends BaseMapperX<CtGalleryImages> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtGalleryImagesTag;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtGalleryImagesTagMapper extends BaseMapperX<CtGalleryImagesTag> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtGalleryShareUser;
/**
* Mapper
*
* @author bs
* @date 2025-06-14
*/
public interface CtGalleryShareUserMapper extends BaseMapperX<CtGalleryShareUser> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtImagesFeedbackRef;
/**
* Mapper
*
* @author bs
* @date 2025-04-20
*/
public interface CtImagesFeedbackRefMapper extends BaseMapperX<CtImagesFeedbackRef> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtTag;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtTagMapper extends BaseMapperX<CtTag> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtTaskBranch;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtTaskBranchMapper extends BaseMapperX<CtTaskBranch> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtTaskFeedback;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtTaskFeedbackMapper extends BaseMapperX<CtTaskFeedback> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtTaskImages;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtTaskImagesMapper extends BaseMapperX<CtTaskImages> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtTaskInfo;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtTaskInfoMapper extends BaseMapperX<CtTaskInfo> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtTaskTag;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtTaskTagMapper extends BaseMapperX<CtTaskTag> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtTaskTemplate;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtTaskTemplateMapper extends BaseMapperX<CtTaskTemplate> {
}

@ -0,0 +1,14 @@
package com.bs.ct.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.ct.domain.CtTaskTemplateTag;
/**
* Mapper
*
* @author bs
* @date 2025-02-22
*/
public interface CtTaskTemplateTagMapper extends BaseMapperX<CtTaskTemplateTag> {
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtGalleryCata;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtGalleryCataService extends MPJBaseService<CtGalleryCata>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtGalleryCataShare;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtGalleryCataShareService extends MPJBaseService<CtGalleryCataShare>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtGalleryImages;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtGalleryImagesService extends MPJBaseService<CtGalleryImages>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtGalleryImagesTag;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtGalleryImagesTagService extends MPJBaseService<CtGalleryImagesTag>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtGalleryShareUser;
/**
* Service
*
* @author bs
* @date 2025-06-14
*/
public interface ICtGalleryShareUserService extends MPJBaseService<CtGalleryShareUser>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtImagesFeedbackRef;
/**
* Service
*
* @author bs
* @date 2025-04-20
*/
public interface ICtImagesFeedbackRefService extends MPJBaseService<CtImagesFeedbackRef>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtTag;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtTagService extends MPJBaseService<CtTag>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtTaskBranch;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtTaskBranchService extends MPJBaseService<CtTaskBranch>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtTaskFeedback;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtTaskFeedbackService extends MPJBaseService<CtTaskFeedback>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtTaskImages;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtTaskImagesService extends MPJBaseService<CtTaskImages>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtTaskInfo;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtTaskInfoService extends MPJBaseService<CtTaskInfo>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtTaskTag;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtTaskTagService extends MPJBaseService<CtTaskTag>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtTaskTemplate;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtTaskTemplateService extends MPJBaseService<CtTaskTemplate>{
}

@ -0,0 +1,14 @@
package com.bs.ct.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.ct.domain.CtTaskTemplateTag;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
public interface ICtTaskTemplateTagService extends MPJBaseService<CtTaskTemplateTag>{
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtGalleryCataMapper;
import com.bs.ct.domain.CtGalleryCata;
import com.bs.ct.service.ICtGalleryCataService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtGalleryCataServiceImpl extends MPJBaseServiceImpl<CtGalleryCataMapper, CtGalleryCata> implements ICtGalleryCataService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtGalleryCataShareMapper;
import com.bs.ct.domain.CtGalleryCataShare;
import com.bs.ct.service.ICtGalleryCataShareService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtGalleryCataShareServiceImpl extends MPJBaseServiceImpl<CtGalleryCataShareMapper, CtGalleryCataShare> implements ICtGalleryCataShareService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtGalleryImagesMapper;
import com.bs.ct.domain.CtGalleryImages;
import com.bs.ct.service.ICtGalleryImagesService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtGalleryImagesServiceImpl extends MPJBaseServiceImpl<CtGalleryImagesMapper, CtGalleryImages> implements ICtGalleryImagesService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtGalleryImagesTagMapper;
import com.bs.ct.domain.CtGalleryImagesTag;
import com.bs.ct.service.ICtGalleryImagesTagService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtGalleryImagesTagServiceImpl extends MPJBaseServiceImpl<CtGalleryImagesTagMapper, CtGalleryImagesTag> implements ICtGalleryImagesTagService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtGalleryShareUserMapper;
import com.bs.ct.domain.CtGalleryShareUser;
import com.bs.ct.service.ICtGalleryShareUserService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-06-14
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtGalleryShareUserServiceImpl extends MPJBaseServiceImpl<CtGalleryShareUserMapper, CtGalleryShareUser> implements ICtGalleryShareUserService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtImagesFeedbackRefMapper;
import com.bs.ct.domain.CtImagesFeedbackRef;
import com.bs.ct.service.ICtImagesFeedbackRefService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-04-20
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtImagesFeedbackRefServiceImpl extends MPJBaseServiceImpl<CtImagesFeedbackRefMapper, CtImagesFeedbackRef> implements ICtImagesFeedbackRefService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtTagMapper;
import com.bs.ct.domain.CtTag;
import com.bs.ct.service.ICtTagService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtTagServiceImpl extends MPJBaseServiceImpl<CtTagMapper, CtTag> implements ICtTagService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtTaskBranchMapper;
import com.bs.ct.domain.CtTaskBranch;
import com.bs.ct.service.ICtTaskBranchService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtTaskBranchServiceImpl extends MPJBaseServiceImpl<CtTaskBranchMapper, CtTaskBranch> implements ICtTaskBranchService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtTaskFeedbackMapper;
import com.bs.ct.domain.CtTaskFeedback;
import com.bs.ct.service.ICtTaskFeedbackService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtTaskFeedbackServiceImpl extends MPJBaseServiceImpl<CtTaskFeedbackMapper, CtTaskFeedback> implements ICtTaskFeedbackService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtTaskImagesMapper;
import com.bs.ct.domain.CtTaskImages;
import com.bs.ct.service.ICtTaskImagesService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtTaskImagesServiceImpl extends MPJBaseServiceImpl<CtTaskImagesMapper, CtTaskImages> implements ICtTaskImagesService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtTaskInfoMapper;
import com.bs.ct.domain.CtTaskInfo;
import com.bs.ct.service.ICtTaskInfoService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtTaskInfoServiceImpl extends MPJBaseServiceImpl<CtTaskInfoMapper, CtTaskInfo> implements ICtTaskInfoService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtTaskTagMapper;
import com.bs.ct.domain.CtTaskTag;
import com.bs.ct.service.ICtTaskTagService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtTaskTagServiceImpl extends MPJBaseServiceImpl<CtTaskTagMapper, CtTaskTag> implements ICtTaskTagService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtTaskTemplateMapper;
import com.bs.ct.domain.CtTaskTemplate;
import com.bs.ct.service.ICtTaskTemplateService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtTaskTemplateServiceImpl extends MPJBaseServiceImpl<CtTaskTemplateMapper, CtTaskTemplate> implements ICtTaskTemplateService {
}

@ -0,0 +1,19 @@
package com.bs.ct.service.impl;
import com.bs.ct.mapper.CtTaskTemplateTagMapper;
import com.bs.ct.domain.CtTaskTemplateTag;
import com.bs.ct.service.ICtTaskTemplateTagService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2025-02-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CtTaskTemplateTagServiceImpl extends MPJBaseServiceImpl<CtTaskTemplateTagMapper, CtTaskTemplateTag> implements ICtTaskTemplateTagService {
}

@ -0,0 +1,74 @@
package com.bs.ct.utils;
import com.drew.imaging.ImageMetadataReader;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.metadata.Tag;
import com.drew.metadata.exif.ExifIFD0Directory;
import com.drew.metadata.exif.ExifSubIFDDirectory;
import com.drew.metadata.exif.GpsDirectory;
import java.io.File;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public class ExifUtils {
private static final Map<String, String> CHINESE_TAG_NAMES = new HashMap<>();
static {
// 初始化常用EXIF标签的中文翻译
CHINESE_TAG_NAMES.put("Compression Type", "压缩类型");
CHINESE_TAG_NAMES.put("Image Width", "图像宽度");
CHINESE_TAG_NAMES.put("Image Height", "图像高度");
CHINESE_TAG_NAMES.put("Data Precision", "数据精度");
CHINESE_TAG_NAMES.put("Make", "制造商");
CHINESE_TAG_NAMES.put("Model", "型号");
CHINESE_TAG_NAMES.put("Orientation", "方向");
CHINESE_TAG_NAMES.put("DateTime Original", "拍摄时间");
CHINESE_TAG_NAMES.put("Create Date", "创建日期");
CHINESE_TAG_NAMES.put("Exposure Time", "曝光时间");
CHINESE_TAG_NAMES.put("F-Number", "光圈值");
CHINESE_TAG_NAMES.put("ISO Speed Ratings", "ISO速度");
CHINESE_TAG_NAMES.put("Focal Length", "焦距");
CHINESE_TAG_NAMES.put("Flash", "闪光灯");
CHINESE_TAG_NAMES.put("Metering Mode", "测光模式");
CHINESE_TAG_NAMES.put("White Balance", "白平衡");
CHINESE_TAG_NAMES.put("Exposure Program", "曝光程序");
CHINESE_TAG_NAMES.put("Exposure Bias Value", "曝光补偿");
CHINESE_TAG_NAMES.put("GPS Latitude", "GPS纬度");
CHINESE_TAG_NAMES.put("GPS Longitude", "GPS经度");
CHINESE_TAG_NAMES.put("GPS Altitude", "GPS海拔");
CHINESE_TAG_NAMES.put("GPS Date Stamp", "GPS日期");
CHINESE_TAG_NAMES.put("GPS Time Stamp", "GPS时间");
CHINESE_TAG_NAMES.put("File Name", "文件名");
CHINESE_TAG_NAMES.put("File Size", "文件大小");
CHINESE_TAG_NAMES.put("File Modified Date", "文件修改时间");
}
public static Map<String, String> getExifInfoMap(String imagePath) throws Exception {
Map<String, String> result = new LinkedHashMap<>();
Metadata metadata = ImageMetadataReader.readMetadata(new File(imagePath));
for (Directory directory : metadata.getDirectories()) {
for (Tag tag : directory.getTags()) {
String chineseName = CHINESE_TAG_NAMES.getOrDefault(tag.getTagName(), tag.getTagName());
result.put(chineseName, tag.getDescription());
}
}
return result;
}
public static StringBuffer getExifInfo(String imagePath) throws Exception {
StringBuffer result = new StringBuffer();
Metadata metadata = ImageMetadataReader.readMetadata(new File(imagePath));
for (Directory directory : metadata.getDirectories()) {
for (Tag tag : directory.getTags()) {
String chineseName = CHINESE_TAG_NAMES.getOrDefault(tag.getTagName(), tag.getTagName());
result.append(chineseName + ":" + tag.getDescription() + "\n");
}
}
return result;
}
}

@ -0,0 +1,20 @@
package com.bs.ct.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class HtmlUtils {
// 定义 HTML 标签的正则表达式
private static final Pattern HTML_TAG_PATTERN = Pattern.compile("<[^>]+>");
// 去除 HTML 标签的方法
public static String stripHtmlTags(String html) {
if (html == null || html.trim().isEmpty()) {
return "";
}
Matcher matcher = HTML_TAG_PATTERN.matcher(html);
return matcher.replaceAll("");
}
}

@ -0,0 +1,339 @@
package com.bs.ct.utils;
import org.bytedeco.ffmpeg.global.avcodec;
import org.bytedeco.ffmpeg.global.avutil;
import org.bytedeco.javacv.FFmpegFrameRecorder;
import org.bytedeco.javacv.FrameRecorder;
import org.bytedeco.javacv.Java2DFrameConverter;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.imageio.ImageIO;
/**
* @author oucq
* @version Aug 3, 2016 6:13:55 PM
*
*
*/
public class OperateImageUtils {
/**
* @param fileUrl
*
* @return
* @throws IOException
* IO
*/
public static BufferedImage getBufferedImage(String fileUrl) throws IOException {
File f = new File(fileUrl);
return ImageIO.read(f);
}
/**
* @param savedImg
*
* @param saveDir
*
* @param fileName
* "beauty.jpg"
* @param format
* jpgpngbmp
* @return
*/
public static boolean saveImage(BufferedImage savedImg, String saveDir, String fileName, String format) {
boolean flag = false;
// 先检查保存的图片格式是否正确
String[] legalFormats = { "jpg", "JPG", "png", "PNG", "bmp", "BMP" };
int i = 0;
for (i = 0; i < legalFormats.length; i++) {
if (format.equals(legalFormats[i])) {
break;
}
}
if (i == legalFormats.length) { // 图片格式不支持
System.out.println("不是保存所支持的图片格式!");
return false;
}
// 再检查文件后缀和保存的格式是否一致
String postfix = fileName.substring(fileName.lastIndexOf('.') + 1);
if (!postfix.equalsIgnoreCase(format)) {
System.out.println("待保存文件后缀和保存的格式不一致!");
return false;
}
String fileUrl = "";
if (saveDir.endsWith("/") || saveDir.endsWith("\\")) {
fileUrl = saveDir + fileName;
} else {
fileUrl = saveDir + "/" + fileName;
}
File file = new File(fileUrl);
try {
flag = ImageIO.write(savedImg, format, file);
} catch (IOException e) {
e.printStackTrace();
}
return flag;
}
/**
*
* mergeImage
*
* @param img1
*
* @param img2
*
* @param isHorizontal
* truefalse
* @return BufferedImage
* @throws IOException
*/
public static BufferedImage mergeImage(boolean isHorizontal, BufferedImage img1, BufferedImage img2)
throws IOException {
int w1 = img1.getWidth();
int h1 = img1.getHeight();
int w2 = img2.getWidth();
int h2 = img2.getHeight();
// 从图片中读取RGB
int[] ImageArrayOne = new int[w1 * h1];
ImageArrayOne = img1.getRGB(0, 0, w1, h1, ImageArrayOne, 0, w1); // 逐行扫描图像中各个像素的RGB到数组中
int[] ImageArrayTwo = new int[w2 * h2];
ImageArrayTwo = img2.getRGB(0, 0, w2, h2, ImageArrayTwo, 0, w2);
// 生成新图片
BufferedImage DestImage = null;
if (isHorizontal) { // 水平方向合并
DestImage = new BufferedImage(w1 + w2, h1, BufferedImage.TYPE_INT_RGB);
DestImage.setRGB(0, 0, w1, h1, ImageArrayOne, 0, w1); // 设置上半部分或左半部分的RGB
DestImage.setRGB(w1, 0, w2, h2, ImageArrayTwo, 0, w2);
} else { // 垂直方向合并
DestImage = new BufferedImage(w1, h1 + h2, BufferedImage.TYPE_INT_RGB);
DestImage.setRGB(0, 0, w1, h1, ImageArrayOne, 0, w1); // 设置上半部分或左半部分的RGB
DestImage.setRGB(0, h1, w2, h2, ImageArrayTwo, 0, w2); // 设置下半部分的RGB
}
return DestImage;
}
/**
*
*
* @param isHorizontal truefalse
* @param imgs
* @return
* @throws IOException
*/
public static BufferedImage mergeImage(boolean isHorizontal, BufferedImage... imgs) throws IOException {
// 生成新图片
BufferedImage DestImage = null;
// 计算新图片的长和高
int allw = 0, allh = 0, allwMax = 0, allhMax = 0;
for (BufferedImage img : imgs) {
allw += img.getWidth();
allh += img.getHeight();
if (img.getWidth() > allwMax) {
allwMax = img.getWidth();
}
if (img.getHeight() > allhMax) {
allhMax = img.getHeight();
}
}
// 创建新图片
if (isHorizontal) {
DestImage = new BufferedImage(allw, allhMax, BufferedImage.TYPE_INT_RGB);
} else {
DestImage = new BufferedImage(allwMax, allh, BufferedImage.TYPE_INT_RGB);
}
// 合并所有子图片到新图片
int wx = 0, wy = 0;
for (int i = 0; i < imgs.length; i++) {
BufferedImage img = imgs[i];
int w1 = img.getWidth();
int h1 = img.getHeight();
// 从图片中读取RGB
int[] ImageArrayOne = new int[w1 * h1];
ImageArrayOne = img.getRGB(0, 0, w1, h1, ImageArrayOne, 0, w1); // 逐行扫描图像中各个像素的RGB到数组中
if (isHorizontal) { // 水平方向合并
DestImage.setRGB(wx, 0, w1, h1, ImageArrayOne, 0, w1); // 设置上半部分或左半部分的RGB
} else { // 垂直方向合并
DestImage.setRGB(0, wy, w1, h1, ImageArrayOne, 0, w1); // 设置上半部分或左半部分的RGB
}
wx += w1;
wy += h1;
}
return DestImage;
}
/**
*
*
* @param rows
* @param cols
* @param imgs
* @return BufferedImage
* @throws IOException
*/
public static BufferedImage mergeImageToGrid(int rows, int cols, BufferedImage... imgs) throws IOException {
if (imgs.length < rows * cols) {
throw new IllegalArgumentException("图片数量不足,无法组成指定的网格");
}
// 计算新图片的宽度和高度
int maxWidth = 0;
int maxHeight = 0;
for (BufferedImage img : imgs) {
maxWidth = Math.max(maxWidth, img.getWidth());
maxHeight = Math.max(maxHeight, img.getHeight());
}
int newWidth = maxWidth * cols;
int newHeight = maxHeight * rows;
// 创建新图片
BufferedImage destImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
// 合并图片到新图片
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
int index = i * cols + j;
BufferedImage img = imgs[index];
int x = j * maxWidth;
int y = i * maxHeight;
int[] imageArray = new int[img.getWidth() * img.getHeight()];
imageArray = img.getRGB(0, 0, img.getWidth(), img.getHeight(), imageArray, 0, img.getWidth());
destImage.setRGB(x, y, img.getWidth(), img.getHeight(), imageArray, 0, img.getWidth());
}
}
return destImage;
}
public static void createMp4(String saveDir, String fileName, Map<Integer, File> imgMap, int width, int height) throws FrameRecorder.Exception {
String mp4SavePath = "";
if (saveDir.endsWith("/") || saveDir.endsWith("\\")) {
mp4SavePath = saveDir + fileName;
} else {
mp4SavePath = saveDir + "/" + fileName;
}
// 调整宽度和高度为偶数
width = width % 2 == 0 ? width : width + 1;
height = height % 2 == 0 ? height : height + 1;
// 视频宽高最好是按照常见的视频的宽高 169 或者 916
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(mp4SavePath, width, height);
// 设置视频编码层模式
recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
// 设置视频为25帧每秒
recorder.setFrameRate(25);
// 设置视频图像数据格式
recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
recorder.setFormat("mp4");
try {
recorder.start();
Java2DFrameConverter converter = new Java2DFrameConverter();
// 录制一个22秒的视频,22秒为自定义的一个视频时间长度,图片少则在22秒内,多则到22秒停止
for (int i = 0; i < 22; i++) {
if (imgMap.containsKey(i)) {
BufferedImage read = ImageIO.read(imgMap.get(i));
// 调整图片尺寸为偶数
read = resizeToEven(read);
// 转换图像颜色模式为 TYPE_3BYTE_BGR
BufferedImage bgrImage = new BufferedImage(read.getWidth(), read.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
java.awt.Graphics g = bgrImage.getGraphics();
g.drawImage(read, 0, 0, null);
g.dispose();
// 一秒是25帧 所以要记录25次
for (int j = 0; j < 25; j++) {
recorder.record(converter.getFrame(bgrImage));
}
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
// 最后一定要结束并释放资源
recorder.stop();
recorder.release();
}
}
public static BufferedImage resizeToEven(BufferedImage image) {
int width = image.getWidth();
int height = image.getHeight();
width = width % 2 == 0 ? width : width + 1;
height = height % 2 == 0 ? height : height + 1;
java.awt.Image tmp = image.getScaledInstance(width, height, java.awt.Image.SCALE_SMOOTH);
BufferedImage resized = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
java.awt.Graphics2D g2d = resized.createGraphics();
g2d.drawImage(tmp, 0, 0, null);
g2d.dispose();
return resized;
}
public static void main(String[] args) {
try {
// 读取待合并的文件
BufferedImage[] imgs = new BufferedImage[9];
Map<Integer, File> imgMap = new HashMap<>();
for (int i = 0; i < 9; i++) {
imgs[i] = getBufferedImage("D:\\edge下载\\下载\\1_2019年-2024年数据\\" + (i + 1) + ".jpg");
imgMap.put(i, new File("D:\\edge下载\\下载\\1_2019年-2024年数据\\" + (i + 1) + ".jpg"));
}
// 合并成九宫格
BufferedImage destImg = mergeImageToGrid(3, 3, imgs);
saveImage(destImg, "D:\\edge下载\\下载\\1_2019年-2024年数据\\", "nineGrid.jpg", "jpg");
System.out.println("九宫格合并完毕!");
// 合并成四宫格
BufferedImage[] fourImgs = new BufferedImage[4];
System.arraycopy(imgs, 0, fourImgs, 0, 4);
destImg = mergeImageToGrid(2, 2, fourImgs);
saveImage(destImg, "D:\\edge下载\\下载\\1_2019年-2024年数据\\", "fourGrid.jpg", "jpg");
System.out.println("四宫格合并完毕!");
// 测试水平合并
BufferedImage horizontalMergedImg = mergeImage(true, imgs[0], imgs[1]);
saveImage(horizontalMergedImg, "D:\\edge下载\\下载\\1_2019年-2024年数据\\", "horizontalMerge.jpg", "jpg");
System.out.println("水平合并完毕!");
// 测试垂直合并
BufferedImage verticalMergedImg = mergeImage(false, imgs[0], imgs[1]);
saveImage(verticalMergedImg, "D:\\edge下载\\下载\\1_2019年-2024年数据\\", "verticalMerge.jpg", "jpg");
System.out.println("垂直合并完毕!");
// 测试多张图片水平合并
BufferedImage multiHorizontalMergedImg = mergeImage(true, imgs[0], imgs[1], imgs[2]);
saveImage(multiHorizontalMergedImg, "D:\\edge下载\\下载\\1_2019年-2024年数据\\", "multiHorizontalMerge.jpg", "jpg");
System.out.println("多张图片水平合并完毕!");
// 测试多张图片垂直合并
BufferedImage multiVerticalMergedImg = mergeImage(false, imgs[0], imgs[1], imgs[2]);
saveImage(multiVerticalMergedImg, "D:\\edge下载\\下载\\1_2019年-2024年数据\\", "multiVerticalMerge.jpg", "jpg");
System.out.println("多张图片垂直合并完毕!");
// 测试图片转视频
int width = imgs[0].getWidth();
int height = imgs[0].getHeight();
String mp4SavePath = "\\output.mp4";
createMp4("D:\\edge下载\\下载\\1_2019年-2024年数据", mp4SavePath, imgMap, width, height);
System.out.println("MP4视频生成完毕!");
} catch (IOException e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,29 @@
package com.bs.ct.utils;
import java.util.UUID;
public final class UUIDUtils {
private UUIDUtils() {
}
public static String generatorUUID() {
UUID uuid = UUID.randomUUID();
return uuid.toString().replaceAll("-", "");
}
/**
* 20UUID
* @return UUID
*/
public static String generator20UUID(){
UUID id=UUID.randomUUID();
String[] idd=id.toString().split("-");
return idd[0]+idd[1]+idd[2]+idd[3];
}
}

@ -0,0 +1,101 @@
package com.bs.ct.vo;
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 com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import com.bs.ct.domain.CtTaskFeedback;
import com.bs.ct.domain.CtTaskInfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
* ct_task_branch
*
* @author bs
* @date 2025-02-22
*/
@Data
public class CtTaskBranchVO extends BaseEntity{
/** 任务标题 */
@Excel(name = "任务名称")
@ApiModelProperty(value = "任务名称")
private String taskTitle;
/** 任务类型 */
@Excel(name = "任务类型",dictType = "task_type")
@ApiModelProperty(value = "任务类型")
private String taskType;
/** 任务要求 */
@Excel(name = "任务内容")
@ApiModelProperty(value = "任务内容")
private String taskContent;
/** 发布单位 */
@Excel(name = "发布单位")
@ApiModelProperty(value = "发布单位")
@TableField(exist = false)
private String branchNameParent;
/** 发布部门 */
@Excel(name = "发布部门")
@ApiModelProperty(value = "发布部门")
private String branchName;
/** 发布人 */
@Excel(name = "发布人")
@ApiModelProperty(value = "发布人")
private String taskInitiator;
@Excel(name = "任务期限")
@ApiModelProperty(value = "任务期限")
private String startToEndDate;
@Excel(name = "办理单位")
@ApiModelProperty(value = "办理单位")
private String transactBranchName;
@Excel(name = "办理部门")
@ApiModelProperty(value = "办理部门")
private String transactDeptName;
@Excel(name = "办理人")
@ApiModelProperty(value = "办理人")
private String transactInitiator;
/** 任务状态 */
@Excel(name = "任务状态")
@ApiModelProperty(value = "任务状态")
private String taskStatus;
@TableField(exist = false)
private CtTaskFeedback sdTaskOtherFeedbackByCreate;
@TableField(exist = false)
private CtTaskFeedback sdTaskOtherFeedbackByFeedback;
@TableField(exist = false)
private CtTaskInfo sdTaskOther;
}

@ -0,0 +1,114 @@
package com.bs.ct.vo;
import com.baomidou.mybatisplus.annotation.*;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import com.bs.ct.domain.CtTaskBranch;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
* ct_task_info
*
* @author bs
* @date 2025-02-22
*/
@Data
public class CtTaskInfoVO {
/** 任务类型 */
@Excel(name = "任务类型")
@ApiModelProperty(value = "任务类型")
private String taskType;
/** 任务标题 */
@Excel(name = "任务标题")
@ApiModelProperty(value = "任务标题")
private String taskTitle;
/** 任务编号 */
@Excel(name = "任务编号")
@ApiModelProperty(value = "任务编号")
private String taskCode;
//@Excel(name = "任务要求")
@ApiModelProperty(value = "任务期限")
@TableField(exist = false)
private String startToEndDate;
/** 任务要求 */
@Excel(name = "任务内容")
@ApiModelProperty(value = "任务内容")
private String taskContent;
/** 完成状态 */
@Excel(name = "完成状态")
@ApiModelProperty(value = "完成状态")
private String status;
/** 任务发起人 */
@Excel(name = "任务发起人")
@ApiModelProperty(value = "任务发起人")
private String taskInitiator;
/** 任务发起单位 */
@Excel(name = "任务发起单位")
@ApiModelProperty(value = "任务发起单位")
private String branchName;
/** 任务发起部门 */
@Excel(name = "任务发起部门")
@ApiModelProperty(value = "任务发起部门")
@TableField(exist = false)
private String deptName;
/** 任务发布日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "任务发布日期", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "任务发布日期")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Date taskDate;
@Excel(name = "办理单位")
@ApiModelProperty(value = "办理单位")
@TableField(exist = false)
private String transactBranchName;
@Excel(name = "办理部门")
@ApiModelProperty(value = "办理部门")
@TableField(exist = false)
private String transactDeptName;
@Excel(name = "办理人")
@ApiModelProperty(value = "办理人")
@TableField(exist = false)
private String transactInitiator;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
}

@ -0,0 +1,87 @@
package com.bs.ct.vo;
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 com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
* ct_task_template
*
* @author bs
* @date 2025-02-22
*/
@Data
public class CtTaskTemplateVO extends BaseEntity{
/** 模板名称 */
@Excel(name = "模板名称")
@ApiModelProperty(value = "模板名称")
private String templateName;
/** 任务类型 */
@Excel(name = "任务类型",dictType = "task_type")
@ApiModelProperty(value = "任务类型")
private String taskType;
/** 任务要求 */
@Excel(name = "任务要求")
@ApiModelProperty(value = "任务要求")
private String taskContent;
/** 任务标题 */
@Excel(name = "任务标题")
@ApiModelProperty(value = "任务标题")
private String taskTitle;
/** 任务标签 */
@Excel(name = "任务标签")
@ApiModelProperty(value = "任务标签")
@TableField(exist = false)
private String tagNames;
/** 创建单位 */
@Excel(name = "创建单位")
@ApiModelProperty(value = "创建单位")
@TableField(exist = false)
private String createByBranch;
/** 创建部门 */
@Excel(name = "创建部门")
@ApiModelProperty(value = "创建部门")
@TableField(exist = false)
private String createByDeptName;
/** 创建人 */
@Excel(name = "创建人")
@ApiModelProperty(value = "创建人")
@TableField(exist = false)
private String createByUserName;
@Excel(name = "创建时间")
@ApiModelProperty(value = "创建时间")
@TableField(exist = false)
private String createTimeVo;
}

@ -0,0 +1,80 @@
package com.bs.ct.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import com.bs.ct.domain.CtTaskFeedback;
import com.bs.ct.domain.CtTaskInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* ct_task_branch
*
* @author bs
* @date 2025-02-22
*/
@Data
public class MyTaskVO extends BaseEntity{
/** 任务标题 */
@Excel(name = "任务名称")
@ApiModelProperty(value = "任务名称")
private String taskTitle;
/** 任务类型 */
@Excel(name = "任务类型",dictType = "task_type")
@ApiModelProperty(value = "任务类型")
private String taskType;
/** 任务要求 */
@Excel(name = "任务内容")
@ApiModelProperty(value = "任务内容")
private String taskContent;
/** 发布单位 */
@Excel(name = "发布单位")
@ApiModelProperty(value = "发布单位")
@TableField(exist = false)
private String branchNameParent;
/** 发布部门 */
@Excel(name = "发布部门")
@ApiModelProperty(value = "发布部门")
private String branchName;
/** 发布人 */
@Excel(name = "发布人")
@ApiModelProperty(value = "发布人")
private String taskInitiator;
@Excel(name = "任务期限")
@ApiModelProperty(value = "任务期限")
private String startToEndDate;
/** 任务状态 */
@Excel(name = "任务状态")
@ApiModelProperty(value = "任务状态")
private String taskStatus;
@TableField(exist = false)
private CtTaskFeedback sdTaskOtherFeedbackByCreate;
@TableField(exist = false)
private CtTaskFeedback sdTaskOtherFeedbackByFeedback;
@TableField(exist = false)
private CtTaskInfo sdTaskOther;
}

@ -0,0 +1,94 @@
package com.bs.web.controller.common;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer;
import com.bs.common.config.BsConfig;
import com.bs.common.constant.CacheConstants;
import com.bs.common.constant.Constants;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.redis.RedisCache;
import com.bs.common.utils.sign.Base64;
import com.bs.common.utils.uuid.IdUtils;
import com.bs.system.service.ISysConfigService;
/**
*
*
* @author bs
*/
@RestController
public class CaptchaController
{
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
@Autowired
private ISysConfigService configService;
/**
*
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException
{
AjaxResult ajax = AjaxResult.success();
boolean captchaEnabled = configService.selectCaptchaEnabled();
ajax.put("captchaEnabled", captchaEnabled);
if (!captchaEnabled)
{
return ajax;
}
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
String captchaType = BsConfig.getCaptchaType();
if ("math".equals(captchaType))
{
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
}
else if ("char".equals(captchaType))
{
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try
{
ImageIO.write(image, "jpg", os);
}
catch (IOException e)
{
return AjaxResult.error(e.getMessage());
}
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}

@ -0,0 +1,403 @@
package com.bs.web.controller.common;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.*;
import java.util.List;
import javax.annotation.Resource;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.lang.Validator;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bs.BsApplication;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.cm.vo.CmAttachVO;
import com.bs.common.exception.ServiceException;
import com.bs.ct.domain.CtGalleryImages;
import com.bs.ct.service.ICtGalleryImagesService;
import com.bs.ct.utils.UUIDUtils;
import io.swagger.annotations.ApiOperation;
import org.aspectj.util.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.bs.common.config.BsConfig;
import com.bs.common.constant.Constants;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.utils.StringUtils;
import com.bs.common.utils.file.FileUploadUtils;
import com.bs.common.utils.file.FileUtils;
import com.bs.framework.config.ServerConfig;
import static cn.hutool.core.img.ImgUtil.getWriter;
/**
*
*
* @author bs
*/
@RestController
@RequestMapping("/common")
public class CommonController
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Value("${bs.profile}")
private String profile;
@Autowired
private ServerConfig serverConfig;
@Autowired
private ICmAttachService cmAttachService;
@Resource
private ICtGalleryImagesService ctGalleryImagesService;
public static final String SEPARATOR = "/";
// public static final String SUFFIX = RESOURCE_PREFIX;
private static final String FILE_DELIMETER = ",";
public static void clockwise90(File file, File outputFile, String formatName) {
try {
// 原图片
BufferedImage image = ImageIO.read(file);
int width = image.getWidth();
int height = image.getHeight();
// 新生成的图片
BufferedImage imageNew = new BufferedImage(height, width, image.getType());
// 把原图顺时针旋转后,像素存入新图片。
// 算法实现方式:
// 把原图片的最后一行转变为新图片的第1列.
// 把原图片的倒数第2行转变为新图片的第2列.
// ......
// 以此类推进行变换。代码中行数列数从0开始计算。
int maxY = height - 1;
for (int y = maxY; y >= 0; y--) {
for (int x = 0; x < width; x++) {
int rgb = image.getRGB(x, y);
imageNew.setRGB(maxY - y, x, rgb);
}
}
// 把图片输出到硬盘上。
ImageIO.write(imageNew, formatName, outputFile);
// 检查输出文件的父目录是否存在,如果不存在则创建
File parentDir = outputFile.getParentFile();
if (parentDir != null &&!parentDir.exists()) {
if (!parentDir.mkdirs()) {
System.err.println("无法创建输出文件的父目录: " + parentDir.getAbsolutePath());
return;
}
}
// 把图片输出到硬盘上。
if (!ImageIO.write(imageNew, formatName, outputFile)) {
System.err.println("无法保存图片到: " + outputFile.getAbsolutePath());
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static ImageWriter getWriter(BufferedImage im, String formatName) {
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName(formatName);
if (writers.hasNext()) {
return writers.next();
}
return null;
}
public static BufferedImage rotateImage90DegreesClockwise(BufferedImage originalImage) {
int width = originalImage.getWidth();
int height = originalImage.getHeight();
BufferedImage rotatedImage = new BufferedImage(height, width, originalImage.getType());
Graphics2D g2d = rotatedImage.createGraphics();
g2d.rotate(Math.toRadians(90), height / 2.0, width / 2.0);
g2d.translate((height - width) / 2, (width - height) / 2);
g2d.drawImage(originalImage, 0, 0, null);
g2d.dispose();
return rotatedImage;
}
public static void clockwise180(File file, File outputFile, String formatName) {
try {
// 原图片
BufferedImage image = ImageIO.read(file);
int width = image.getWidth();
int height = image.getHeight();
// 新生成的图片
BufferedImage imageNew = new BufferedImage(width, height, image.getType());
// 把原图片顺时针旋转180度后像素存入新图片。
// 算法实现方式:
// 原图片第1行转变为新图片倒数第1行。并且旧行中像素的顺序在新行倒转了过来。
// 原图片第2行转变为新图片倒数第2行。并且旧行中像素的顺序在新行倒转了过来。
// ......
// 以此类推进行变换。代码中行数列数从0开始计算。
int maxX = width - 1;
int maxY = height - 1;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int rgb = image.getRGB(x, y);
imageNew.setRGB(maxX - x, maxY - y, rgb);
}
}
// 把图片输出到硬盘上。
ImageIO.write(imageNew, formatName, outputFile);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void anticlockwise90(File file, File outputFile, String formatName) {
try {
// 原图片
BufferedImage image = ImageIO.read(file);
int width = image.getWidth();
int height = image.getHeight();
// 新生成的图片
BufferedImage imageNew = new BufferedImage(height, width, image.getType());
// 把原图逆时针旋转后,像素存入新图片。
// 算法实现方式:
// 把原图片第1行转变为新图片第1列。并且旧行中第1个像素是新列中最后1个像素.
// 把原图片第2行转变为新图片第2列。并且旧行中第1个像素是新列中最后1个像素.
// ......
// 以此类推进行变换。代码中行数列数从0开始计算。
int maxX = width - 1;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int rgb = image.getRGB(x, y);
imageNew.setRGB(y, maxX - x, rgb);
}
}
// 把图片输出到硬盘上。
ImageIO.write(imageNew, formatName, outputFile);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
*
*
* @param fileName
* @param delete
*/
@GetMapping("/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{
try
{
if (!FileUtils.checkAllowDownload(fileName))
{
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = BsConfig.getDownloadPath() + fileName;
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete)
{
FileUtils.deleteFile(filePath);
}
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
@ApiOperation("下载文件")
@GetMapping("/file/download/{attachId}")
public void download(@PathVariable String attachId, HttpServletRequest request, HttpServletResponse response) {
if (org.apache.commons.lang3.StringUtils.isBlank(attachId) || "null".equals(attachId)) {
throw new ServiceException("附件ID不能为空");
}
try {
Map<Object, Object> param = new HashMap<>();
param.put("attachId", attachId);
//CmAttach cmAttach = cmAttachMapper.selectByAttachId(param);
CmAttach vwAttach = cmAttachService.getById(attachId);
String attachFileurl = vwAttach.getAttachFileUrl();
if (Validator.isNotEmpty(attachFileurl) && attachFileurl.contains(Constants.RESOURCE_PREFIX)) {
attachFileurl = attachFileurl.replace("/profile", "");
}
File file = new File(profile + attachFileurl);
boolean exists = file.exists();
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
com.bs.web.controller.utils.FileUtil.downloadFile(request, response, file, false);
} catch (Exception e) {
throw new ServiceException("下载失败:" + e.getMessage());
}
}
@ApiOperation("修改附件")
@PutMapping("/editFile")
public AjaxResult edit(@RequestBody CmAttachVO attachVo) throws Exception {
Long id = attachVo.getId();
String attachFileUrl = attachVo.getAttachFileUrl();
String attachUrl = attachVo.getAttachFileUrl().replace("/profile", "");
String filePath = profile + attachUrl;
String formatName = FileUtils.getName(filePath);
String fileName = UUIDUtils.generatorUUID() + formatName;
String newAttachUrl = attachUrl.substring(0, attachUrl.lastIndexOf(SEPARATOR)) + SEPARATOR + fileName;
String outFilePath = profile + newAttachUrl;
File inputFile = new File(filePath);
File outputFile = new File(outFilePath);
formatName = "jpeg";
if ("90".equals(attachVo.getAngle())) {
// 旋转90度
//BufferedImage rotated90Image = rotateImage(inputImage, 90);
clockwise90(inputFile, outputFile, formatName);
} else if ("180".equals(attachVo.getAngle())) {
// 旋转180度
clockwise180(inputFile, outputFile, formatName);
} else if ("270".equals(attachVo.getAngle())) {
anticlockwise90(inputFile, outputFile, formatName);
}
List<CmAttach> list = cmAttachService.list(new LambdaQueryWrapper<CmAttach>()
.eq(CmAttach::getFileId, attachVo.getFileId()));
List<CtGalleryImages> ctGalleryImages = ctGalleryImagesService.list(new LambdaQueryWrapper<CtGalleryImages>()
.eq(CtGalleryImages::getFileId, attachVo.getFileId()));
if (null != list && list.size() > 0) {
for (CmAttach cmAttach : list) {
cmAttach.setOldName(attachVo.getOldName());
System.out.println(newAttachUrl);
String attachUrlNew = "/profile" + newAttachUrl;
cmAttach.setAttachFileUrl(attachUrlNew);
}
cmAttachService.updateBatchById(list);
}
if (null != ctGalleryImages && ctGalleryImages.size() > 0) {
for (CtGalleryImages ctGalleryImage : ctGalleryImages) {
String attachUrlNew = "/profile" + newAttachUrl;
ctGalleryImage.setImagePath(attachUrlNew);
}
ctGalleryImagesService.updateBatchById(ctGalleryImages);
}
return AjaxResult.success();
}
/**
*
*/
@PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file, String fileId) throws Exception
{
try
{
// 上传文件路径
String filePath = BsConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
String newFileName = FileUtils.getName(fileName);
String originalFilename = file.getOriginalFilename();
CmAttach cmAttach = new CmAttach();
cmAttach.setFileId(fileId);
cmAttach.setFileSort(1L);
cmAttach.setAttachName(newFileName);
cmAttach.setAttachContentType(file.getContentType());
cmAttach.setAttachFileSize(file.getSize());
cmAttach.setAttachFileUrl(fileName);
cmAttach.setOldName(originalFilename);
cmAttach.setVersionNo("1");
cmAttach.setRemark("");
boolean save = cmAttachService.save(cmAttach);
if (save) {
Long id = cmAttach.getId();
AjaxResult ajax = AjaxResult.success();
ajax.put("cmAttach", cmAttach);
return ajax;
}
return null;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@PostMapping("/uploads")
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
{
try
{
// 上传文件路径
String filePath = BsConfig.getUploadPath();
List<String> urls = new ArrayList<String>();
List<String> fileNames = new ArrayList<String>();
List<String> newFileNames = new ArrayList<String>();
List<String> originalFilenames = new ArrayList<String>();
for (MultipartFile file : files)
{
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
urls.add(url);
fileNames.add(fileName);
newFileNames.add(FileUtils.getName(fileName));
originalFilenames.add(file.getOriginalFilename());
}
AjaxResult ajax = AjaxResult.success();
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@GetMapping("/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception
{
try
{
if (!FileUtils.checkAllowDownload(resource))
{
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
}
// 本地资源路径
String localPath = BsConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
}

@ -0,0 +1,120 @@
package com.bs.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.constant.CacheConstants;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.utils.StringUtils;
import com.bs.system.domain.SysCache;
/**
*
*
* @author bs
*/
@RestController
@RequestMapping("/monitor/cache")
public class CacheController
{
@Autowired
private RedisTemplate<String, String> redisTemplate;
private final static List<SysCache> caches = new ArrayList<SysCache>();
{
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
Map<String, Object> result = new HashMap<>(3);
result.put("info", info);
result.put("dbSize", dbSize);
List<Map<String, String>> pieList = new ArrayList<>();
commandStats.stringPropertyNames().forEach(key -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
result.put("commandStats", pieList);
return AjaxResult.success(result);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getNames")
public AjaxResult cache()
{
return AjaxResult.success(caches);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getKeys/{cacheName}")
public AjaxResult getCacheKeys(@PathVariable String cacheName)
{
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
return AjaxResult.success(cacheKeys);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getValue/{cacheName}/{cacheKey}")
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
{
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
return AjaxResult.success(sysCache);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheName/{cacheName}")
public AjaxResult clearCacheName(@PathVariable String cacheName)
{
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
redisTemplate.delete(cacheKeys);
return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheKey/{cacheKey}")
public AjaxResult clearCacheKey(@PathVariable String cacheKey)
{
redisTemplate.delete(cacheKey);
return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheAll")
public AjaxResult clearCacheAll()
{
Collection<String> cacheKeys = redisTemplate.keys("*");
redisTemplate.delete(cacheKeys);
return AjaxResult.success();
}
}

@ -0,0 +1,27 @@
package com.bs.web.controller.monitor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.framework.web.domain.Server;
/**
*
*
* @author bs
*/
@RestController
@RequestMapping("/monitor/server")
public class ServerController
{
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Server server = new Server();
server.copyTo();
return AjaxResult.success(server);
}
}

@ -0,0 +1,82 @@
package com.bs.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.bs.framework.web.service.SysPasswordService;
import com.bs.system.domain.SysLogininfor;
import com.bs.system.service.ISysLogininforService;
/**
* 访
*
* @author bs
*/
@RestController
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController
{
@Autowired
private ISysLogininforService logininforService;
@Autowired
private SysPasswordService passwordService;
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor)
{
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysLogininfor logininfor)
{
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
util.exportExcel(response, list, "登录日志");
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds)
{
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean()
{
logininforService.cleanLogininfor();
return success();
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
@GetMapping("/unlock/{userName}")
public AjaxResult unlock(@PathVariable("userName") String userName)
{
passwordService.clearLoginRecordCache(userName);
return success();
}
}

@ -0,0 +1,69 @@
package com.bs.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.bs.system.domain.SysOperLog;
import com.bs.system.service.ISysOperLogService;
/**
*
*
* @author bs
*/
@RestController
@RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController
{
@Autowired
private ISysOperLogService operLogService;
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog)
{
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysOperLog operLog)
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
util.exportExcel(response, list, "操作日志");
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds)
{
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean")
public AjaxResult clean()
{
operLogService.cleanOperLog();
return success();
}
}

@ -0,0 +1,83 @@
package com.bs.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.constant.CacheConstants;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.domain.model.LoginUser;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.core.redis.RedisCache;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.StringUtils;
import com.bs.system.domain.SysUserOnline;
import com.bs.system.service.ISysUserOnlineService;
/**
* 线
*
* @author bs
*/
@RestController
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController
{
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private RedisCache redisCache;
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName)
{
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys)
{
LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
else if (StringUtils.isNotEmpty(ipaddr))
{
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
{
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
else
{
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 退
*/
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
return success();
}
}

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

Loading…
Cancel
Save