260720
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.gxwebsoft.law.config;
|
||||
package com.gxwebsoft.ai.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.gxwebsoft.law.config;
|
||||
package com.gxwebsoft.ai.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.OnClose;
|
||||
import javax.websocket.OnOpen;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
@@ -66,8 +65,10 @@ public class WebSocketServer {
|
||||
* 实现服务器主动推送
|
||||
*/
|
||||
public void sendMessage(String userId, String message) throws IOException {
|
||||
System.out.println("userId:" + userId);
|
||||
if (webSocketMap.containsKey(userId)) {
|
||||
Session session1 = webSocketMap.get(userId).session;
|
||||
System.out.println("session1:" + session1);
|
||||
if (session1 != null) session1.getBasicRemote().sendText(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.gxwebsoft.ai.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.ai.service.AiChatHistoryService;
|
||||
import com.gxwebsoft.ai.entity.AiChatHistory;
|
||||
import com.gxwebsoft.ai.param.AiChatHistoryParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
@Api(tags = "管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/ai/ai-chat-history")
|
||||
public class AiChatHistoryController extends BaseController {
|
||||
@Resource
|
||||
private AiChatHistoryService aiChatHistoryService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<AiChatHistory>> page(AiChatHistoryParam param) {
|
||||
// 使用关联查询
|
||||
return success(aiChatHistoryService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部")
|
||||
@GetMapping()
|
||||
public ApiResult<List<AiChatHistory>> list(AiChatHistoryParam param) {
|
||||
// 使用关联查询
|
||||
return success(aiChatHistoryService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('ai:aiChatHistory:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<AiChatHistory> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(aiChatHistoryService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody AiChatHistory aiChatHistory) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
aiChatHistory.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (aiChatHistoryService.save(aiChatHistory)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody AiChatHistory aiChatHistory) {
|
||||
if (aiChatHistoryService.updateById(aiChatHistory)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (aiChatHistoryService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<AiChatHistory> list) {
|
||||
if (aiChatHistoryService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<AiChatHistory> batchParam) {
|
||||
if (batchParam.update(aiChatHistoryService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (aiChatHistoryService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.gxwebsoft.law.controller;
|
||||
package com.gxwebsoft.ai.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.law.service.LawOrgPeopleService;
|
||||
import com.gxwebsoft.law.entity.LawOrgPeople;
|
||||
import com.gxwebsoft.law.param.LawOrgPeopleParam;
|
||||
import com.gxwebsoft.ai.service.AiChatListService;
|
||||
import com.gxwebsoft.ai.entity.AiChatList;
|
||||
import com.gxwebsoft.ai.param.AiChatListParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
@@ -22,46 +22,46 @@ import java.util.List;
|
||||
* 控制器
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-14 01:31:54
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
@Api(tags = "管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/law/law-org-people")
|
||||
public class LawOrgPeopleController extends BaseController {
|
||||
@RequestMapping("/api/ai/ai-chat-list")
|
||||
public class AiChatListController extends BaseController {
|
||||
@Resource
|
||||
private LawOrgPeopleService lawOrgPeopleService;
|
||||
private AiChatListService aiChatListService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<LawOrgPeople>> page(LawOrgPeopleParam param) {
|
||||
public ApiResult<PageResult<AiChatList>> page(AiChatListParam param) {
|
||||
// 使用关联查询
|
||||
return success(lawOrgPeopleService.pageRel(param));
|
||||
return success(aiChatListService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部")
|
||||
@GetMapping()
|
||||
public ApiResult<List<LawOrgPeople>> list(LawOrgPeopleParam param) {
|
||||
public ApiResult<List<AiChatList>> list(AiChatListParam param) {
|
||||
// 使用关联查询
|
||||
return success(lawOrgPeopleService.listRel(param));
|
||||
return success(aiChatListService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('law:lawOrgPeople:list')")
|
||||
@PreAuthorize("hasAuthority('ai:aiChatList:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<LawOrgPeople> get(@PathVariable("id") Integer id) {
|
||||
public ApiResult<AiChatList> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(lawOrgPeopleService.getByIdRel(id));
|
||||
return success(aiChatListService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody LawOrgPeople lawOrgPeople) {
|
||||
public ApiResult<?> save(@RequestBody AiChatList aiChatList) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
lawOrgPeople.setUserId(loginUser.getUserId());
|
||||
aiChatList.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (lawOrgPeopleService.save(lawOrgPeople)) {
|
||||
if (aiChatListService.save(aiChatList)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
@@ -69,8 +69,8 @@ public class LawOrgPeopleController extends BaseController {
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody LawOrgPeople lawOrgPeople) {
|
||||
if (lawOrgPeopleService.updateById(lawOrgPeople)) {
|
||||
public ApiResult<?> update(@RequestBody AiChatList aiChatList) {
|
||||
if (aiChatListService.updateById(aiChatList)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
@@ -79,7 +79,7 @@ public class LawOrgPeopleController extends BaseController {
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (lawOrgPeopleService.removeById(id)) {
|
||||
if (aiChatListService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
@@ -87,8 +87,8 @@ public class LawOrgPeopleController extends BaseController {
|
||||
|
||||
@ApiOperation("批量添加")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<LawOrgPeople> list) {
|
||||
if (lawOrgPeopleService.saveBatch(list)) {
|
||||
public ApiResult<?> saveBatch(@RequestBody List<AiChatList> list) {
|
||||
if (aiChatListService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
@@ -96,8 +96,8 @@ public class LawOrgPeopleController extends BaseController {
|
||||
|
||||
@ApiOperation("批量修改")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<LawOrgPeople> batchParam) {
|
||||
if (batchParam.update(lawOrgPeopleService, "id")) {
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<AiChatList> batchParam) {
|
||||
if (batchParam.update(aiChatListService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
@@ -106,7 +106,7 @@ public class LawOrgPeopleController extends BaseController {
|
||||
@ApiOperation("批量删除")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (lawOrgPeopleService.removeByIds(ids)) {
|
||||
if (aiChatListService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
1450
src/main/java/com/gxwebsoft/ai/controller/AiController.java
Normal file
1450
src/main/java/com/gxwebsoft/ai/controller/AiController.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,131 @@
|
||||
package com.gxwebsoft.ai.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@Api(tags = "知识库")
|
||||
@RestController
|
||||
@RequestMapping("/api/ai/knowledge-base")
|
||||
public class KnowledgeBaseController extends BaseController {
|
||||
|
||||
private static final String DATASET_API_URL = "http://82.156.98.71/v1/datasets";
|
||||
private static final String CHALLENGE_CUP_DATASET_ID = "b342f096-98b1-4a83-a296-f4ab60a6db0e";
|
||||
private static final String DATASET_API_KEY = "dataset-1n6MECRtQvEVGOL1o7SrSGfe";
|
||||
|
||||
@ApiOperation("知识库列表")
|
||||
@GetMapping("/list")
|
||||
public ApiResult<?> list(
|
||||
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "limit", defaultValue = "20") Integer limit,
|
||||
@RequestParam(value = "keyword", required = false) String keyword) {
|
||||
try {
|
||||
StringBuilder urlBuilder = new StringBuilder(DATASET_API_URL);
|
||||
urlBuilder.append("?page=").append(page);
|
||||
urlBuilder.append("&limit=").append(limit);
|
||||
if (keyword != null && !keyword.trim().isEmpty()) {
|
||||
urlBuilder.append("&keyword=").append(java.net.URLEncoder.encode(keyword.trim(), "UTF-8"));
|
||||
}
|
||||
|
||||
URL url = new URL(urlBuilder.toString());
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setRequestProperty("Authorization", "Bearer " + DATASET_API_KEY);
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setConnectTimeout(30000);
|
||||
connection.setReadTimeout(30000);
|
||||
|
||||
int responseCode = connection.getResponseCode();
|
||||
if (responseCode < 200 || responseCode >= 300) {
|
||||
StringBuilder errorBody = new StringBuilder();
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8))) {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
errorBody.append(line);
|
||||
}
|
||||
}
|
||||
return fail("获取知识库列表失败", errorBody.toString());
|
||||
}
|
||||
|
||||
StringBuilder responseBody = new StringBuilder();
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
responseBody.append(line);
|
||||
}
|
||||
}
|
||||
|
||||
com.alibaba.fastjson.JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(responseBody.toString());
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
return fail("获取知识库列表失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("挑战杯历史案例知识库文档列表")
|
||||
@GetMapping("/challenge-cup/documents")
|
||||
public ApiResult<?> challengeCupDocuments(
|
||||
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "limit", defaultValue = "20") Integer limit,
|
||||
@RequestParam(value = "keyword", required = false) String keyword) {
|
||||
try {
|
||||
int safePage = page == null || page < 1 ? 1 : page;
|
||||
int safeLimit = limit == null || limit < 1 ? 20 : Math.min(limit, 100);
|
||||
StringBuilder urlBuilder = new StringBuilder(DATASET_API_URL);
|
||||
urlBuilder.append("/").append(CHALLENGE_CUP_DATASET_ID).append("/documents");
|
||||
urlBuilder.append("?page=").append(safePage);
|
||||
urlBuilder.append("&limit=").append(safeLimit);
|
||||
if (keyword != null && !keyword.trim().isEmpty()) {
|
||||
urlBuilder.append("&keyword=").append(java.net.URLEncoder.encode(keyword.trim(), "UTF-8"));
|
||||
}
|
||||
|
||||
URL url = new URL(urlBuilder.toString());
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setRequestProperty("Authorization", "Bearer " + DATASET_API_KEY);
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setConnectTimeout(30000);
|
||||
connection.setReadTimeout(30000);
|
||||
|
||||
int responseCode = connection.getResponseCode();
|
||||
if (responseCode < 200 || responseCode >= 300) {
|
||||
StringBuilder errorBody = new StringBuilder();
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8))) {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
errorBody.append(line);
|
||||
}
|
||||
}
|
||||
return fail("获取挑战杯历史案例知识库失败", errorBody.toString());
|
||||
}
|
||||
|
||||
StringBuilder responseBody = new StringBuilder();
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
responseBody.append(line);
|
||||
}
|
||||
}
|
||||
|
||||
com.alibaba.fastjson.JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(responseBody.toString());
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
return fail("获取挑战杯历史案例知识库失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.gxwebsoft.ai.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "活动策划大纲生成对象")
|
||||
public class ActivityOutlineInputs implements Serializable {
|
||||
@TableField(exist = false)
|
||||
@JsonProperty("event_theme")
|
||||
@JsonAlias("eventTheme")
|
||||
private String eventTheme;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JsonProperty("people")
|
||||
private String people;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JsonProperty("event_time")
|
||||
@JsonAlias("eventTime")
|
||||
private String eventTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JsonProperty("event_funding")
|
||||
@JsonAlias("eventFunding")
|
||||
private String eventFunding;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JsonProperty("event_type")
|
||||
@JsonAlias("eventType")
|
||||
private String eventType;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JsonProperty("event_location")
|
||||
@JsonAlias("eventLocation")
|
||||
private String eventLocation;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JsonProperty("event_meme")
|
||||
@JsonAlias("eventMeme")
|
||||
private String eventMeme;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.gxwebsoft.law.entity;
|
||||
package com.gxwebsoft.ai.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@@ -15,34 +15,31 @@ import lombok.EqualsAndHashCode;
|
||||
*
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-05-06 10:27:16
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "LawFeedback对象", description = "")
|
||||
@TableName("law_feedback")
|
||||
public class LawFeedback implements Serializable {
|
||||
@ApiModel(value = "AiChatHistory对象", description = "")
|
||||
@TableName("ai_chat_history")
|
||||
public class AiChatHistory implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer chatId;
|
||||
|
||||
private String conversationId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String title;
|
||||
|
||||
private String company;
|
||||
|
||||
private String address;
|
||||
|
||||
private String date;
|
||||
|
||||
private String pics;
|
||||
|
||||
private String video;
|
||||
|
||||
private String content;
|
||||
|
||||
private String reply;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
@@ -50,7 +47,7 @@ public class LawFeedback implements Serializable {
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.gxwebsoft.law.entity;
|
||||
package com.gxwebsoft.ai.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@@ -12,30 +12,34 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 公证配置
|
||||
*
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-05-17 16:10:35
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "LawNotaryConfig对象", description = "公证配置")
|
||||
@TableName("law_notary_config")
|
||||
public class LawNotaryConfig implements Serializable {
|
||||
@ApiModel(value = "AiChatList对象", description = "")
|
||||
@TableName("ai_chat_list")
|
||||
public class AiChatList implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "配置")
|
||||
private String configList;
|
||||
private String conversationId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private Integer roleId;
|
||||
|
||||
private String roleName;
|
||||
|
||||
private String roleDesc;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
@@ -43,10 +47,12 @@ public class LawNotaryConfig implements Serializable {
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private String title;
|
||||
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
package com.gxwebsoft.law.entity;
|
||||
package com.gxwebsoft.ai.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -19,8 +17,7 @@ import java.util.Map;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "LawOrg对象", description = "机构")
|
||||
@TableName("law_org")
|
||||
@ApiModel(value = "聊天对象")
|
||||
public class ChatMessage implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -45,6 +42,15 @@ public class ChatMessage implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private Integer requestType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer chatId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String roleName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String roleDesc;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> files;
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.gxwebsoft.law.entity;
|
||||
package com.gxwebsoft.ai.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 机构
|
||||
@@ -29,8 +27,8 @@ public class ChatResponse implements Serializable {
|
||||
private String workflow_run_id;
|
||||
private String id;
|
||||
private String answer;
|
||||
private ChatResponse.Metadata metadata;
|
||||
private ChatResponse.Data data;
|
||||
private Metadata metadata;
|
||||
private Data data;
|
||||
private Object[] files;
|
||||
|
||||
public static class Data {
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.gxwebsoft.ai.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "稿件生成对象")
|
||||
public class ManuscriptGenInputs implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String docType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String eventType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String theme;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String time;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String location;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String participants;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String highlights;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer number;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<File> files;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.ai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.ai.entity.AiChatHistory;
|
||||
import com.gxwebsoft.ai.param.AiChatHistoryParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
public interface AiChatHistoryMapper extends BaseMapper<AiChatHistory> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<AiChatHistory>
|
||||
*/
|
||||
List<AiChatHistory> selectPageRel(@Param("page") IPage<AiChatHistory> page,
|
||||
@Param("param") AiChatHistoryParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<AiChatHistory> selectListRel(@Param("param") AiChatHistoryParam param);
|
||||
|
||||
}
|
||||
37
src/main/java/com/gxwebsoft/ai/mapper/AiChatListMapper.java
Normal file
37
src/main/java/com/gxwebsoft/ai/mapper/AiChatListMapper.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.ai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.ai.entity.AiChatList;
|
||||
import com.gxwebsoft.ai.param.AiChatListParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
public interface AiChatListMapper extends BaseMapper<AiChatList> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<AiChatList>
|
||||
*/
|
||||
List<AiChatList> selectPageRel(@Param("page") IPage<AiChatList> page,
|
||||
@Param("param") AiChatListParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<AiChatList> selectListRel(@Param("param") AiChatListParam param);
|
||||
|
||||
}
|
||||
@@ -1,23 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gxwebsoft.law.mapper.LawLegalOrgCheckContentMapper">
|
||||
<mapper namespace="com.gxwebsoft.ai.mapper.AiChatHistoryMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM law_legal_org_check_content a
|
||||
FROM ai_chat_history a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.groupId != null">
|
||||
AND a.group_id = #{param.groupId}
|
||||
<if test="param.chatId != null">
|
||||
AND a.chat_id = #{param.chatId}
|
||||
</if>
|
||||
<if test="param.conversationId != null">
|
||||
AND a.conversation_id LIKE CONCAT('%', #{param.conversationId}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.content != null">
|
||||
AND a.content LIKE CONCAT('%', #{param.content}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
<if test="param.reply != null">
|
||||
AND a.reply LIKE CONCAT('%', #{param.reply}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
@@ -39,12 +48,12 @@
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.law.entity.LawLegalOrgCheckContent">
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.ai.entity.AiChatHistory">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.law.entity.LawLegalOrgCheckContent">
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.ai.entity.AiChatHistory">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gxwebsoft.law.mapper.LawLegalOrgCheckConfigSuggestMapper">
|
||||
<mapper namespace="com.gxwebsoft.ai.mapper.AiChatListMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM law_legal_org_check_config_suggest a
|
||||
FROM ai_chat_list a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.typeId != null">
|
||||
AND a.type_id = #{param.typeId}
|
||||
</if>
|
||||
<if test="param.parentId != null">
|
||||
AND a.parent_id = #{param.parentId}
|
||||
</if>
|
||||
<if test="param.title != null">
|
||||
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||
</if>
|
||||
<if test="param.type != null">
|
||||
AND a.type LIKE CONCAT('%', #{param.type}, '%')
|
||||
</if>
|
||||
<if test="param.answer != null">
|
||||
AND a.answer LIKE CONCAT('%', #{param.answer}, '%')
|
||||
<if test="param.conversationId != null">
|
||||
AND a.conversation_id LIKE CONCAT('%', #{param.conversationId}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.roleId != null">
|
||||
AND a.role_id = #{param.roleId}
|
||||
</if>
|
||||
<if test="param.roleName != null">
|
||||
AND a.role_name LIKE CONCAT('%', #{param.roleName}, '%')
|
||||
</if>
|
||||
<if test="param.roleDesc != null">
|
||||
AND a.role_desc LIKE CONCAT('%', #{param.roleDesc}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
@@ -40,6 +40,9 @@
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.title != null">
|
||||
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
@@ -48,12 +51,12 @@
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.law.entity.LawLegalOrgCheckConfigSuggest">
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.ai.entity.AiChatList">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.law.entity.LawLegalOrgCheckConfigSuggest">
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.ai.entity.AiChatList">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.gxwebsoft.law.param;
|
||||
package com.gxwebsoft.ai.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
@@ -11,29 +11,37 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户填写法律意见书内容查询参数
|
||||
* 查询参数
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-17 18:55:31
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "LawLegalOrgCheckContentSuggestParam对象", description = "用户填写法律意见书内容查询参数")
|
||||
public class LawLegalOrgCheckContentSuggestParam extends BaseParam {
|
||||
@ApiModel(value = "AiChatHistoryParam对象", description = "查询参数")
|
||||
public class AiChatHistoryParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer groupId;
|
||||
private Integer chatId;
|
||||
|
||||
private String content;
|
||||
private String conversationId;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
private String content;
|
||||
|
||||
private String reply;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.gxwebsoft.law.param;
|
||||
package com.gxwebsoft.ai.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
@@ -11,41 +11,41 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 机构查询参数
|
||||
* 查询参数
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-14 00:35:34
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "LawOrgParam对象", description = "机构查询参数")
|
||||
public class LawOrgParam extends BaseParam {
|
||||
@ApiModel(value = "AiChatListParam对象", description = "查询参数")
|
||||
public class AiChatListParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
private String conversationId;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String type;
|
||||
private Integer userId;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer provinceId;
|
||||
private Integer roleId;
|
||||
|
||||
private String roleName;
|
||||
|
||||
private String roleDesc;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer cityId;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer areaId;
|
||||
|
||||
private String lat;
|
||||
|
||||
private String lng;
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
private String title;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.ai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.ai.entity.AiChatHistory;
|
||||
import com.gxwebsoft.ai.param.AiChatHistoryParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
public interface AiChatHistoryService extends IService<AiChatHistory> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<AiChatHistory>
|
||||
*/
|
||||
PageResult<AiChatHistory> pageRel(AiChatHistoryParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<AiChatHistory>
|
||||
*/
|
||||
List<AiChatHistory> listRel(AiChatHistoryParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id
|
||||
* @return AiChatHistory
|
||||
*/
|
||||
AiChatHistory getByIdRel(Integer id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.gxwebsoft.ai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.ai.entity.AiChatList;
|
||||
import com.gxwebsoft.ai.param.AiChatListParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
public interface AiChatListService extends IService<AiChatList> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<AiChatList>
|
||||
*/
|
||||
PageResult<AiChatList> pageRel(AiChatListParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<AiChatList>
|
||||
*/
|
||||
List<AiChatList> listRel(AiChatListParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id
|
||||
* @return AiChatList
|
||||
*/
|
||||
AiChatList getByIdRel(Integer id);
|
||||
|
||||
void updateConversationId(Integer chatId, String conversationId);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.ai.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.ai.mapper.AiChatHistoryMapper;
|
||||
import com.gxwebsoft.ai.service.AiChatHistoryService;
|
||||
import com.gxwebsoft.ai.entity.AiChatHistory;
|
||||
import com.gxwebsoft.ai.param.AiChatHistoryParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service实现
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
@Service
|
||||
public class AiChatHistoryServiceImpl extends ServiceImpl<AiChatHistoryMapper, AiChatHistory> implements AiChatHistoryService {
|
||||
|
||||
@Override
|
||||
public PageResult<AiChatHistory> pageRel(AiChatHistoryParam param) {
|
||||
PageParam<AiChatHistory, AiChatHistoryParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<AiChatHistory> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AiChatHistory> listRel(AiChatHistoryParam param) {
|
||||
List<AiChatHistory> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<AiChatHistory, AiChatHistoryParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AiChatHistory getByIdRel(Integer id) {
|
||||
AiChatHistoryParam param = new AiChatHistoryParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.gxwebsoft.ai.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.ai.mapper.AiChatListMapper;
|
||||
import com.gxwebsoft.ai.service.AiChatListService;
|
||||
import com.gxwebsoft.ai.entity.AiChatList;
|
||||
import com.gxwebsoft.ai.param.AiChatListParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service实现
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-28 17:34:18
|
||||
*/
|
||||
@Service
|
||||
public class AiChatListServiceImpl extends ServiceImpl<AiChatListMapper, AiChatList> implements AiChatListService {
|
||||
|
||||
@Override
|
||||
public PageResult<AiChatList> pageRel(AiChatListParam param) {
|
||||
PageParam<AiChatList, AiChatListParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<AiChatList> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AiChatList> listRel(AiChatListParam param) {
|
||||
List<AiChatList> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<AiChatList, AiChatListParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AiChatList getByIdRel(Integer id) {
|
||||
AiChatListParam param = new AiChatListParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConversationId(Integer chatId, String conversationId) {
|
||||
update(
|
||||
new LambdaUpdateWrapper<AiChatList>()
|
||||
.eq(AiChatList::getId, chatId)
|
||||
.set(AiChatList::getConversationId, conversationId)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.cms.service.ArticleCollectService;
|
||||
import com.gxwebsoft.cms.entity.ArticleCollect;
|
||||
import com.gxwebsoft.cms.param.ArticleCollectParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-11-23 14:05:18
|
||||
*/
|
||||
@Api(tags = "管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/article-collect")
|
||||
public class ArticleCollectController extends BaseController {
|
||||
@Resource
|
||||
private ArticleCollectService articleCollectService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ArticleCollect>> page(ArticleCollectParam param) {
|
||||
// 使用关联查询
|
||||
return success(articleCollectService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ArticleCollect>> list(ArticleCollectParam param) {
|
||||
// 使用关联查询
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(articleCollectService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ArticleCollect> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(articleCollectService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ArticleCollect articleCollect) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
articleCollect.setUserId(loginUser.getUserId());
|
||||
}
|
||||
ArticleCollect check = articleCollectService.check(getLoginUserId(), articleCollect.getArticleId());
|
||||
if (check == null) {
|
||||
if (articleCollectService.save(articleCollect)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
}else {
|
||||
articleCollectService.removeById(check.getId());
|
||||
return success("取消成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ArticleCollect articleCollect) {
|
||||
if (articleCollectService.updateById(articleCollect)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (articleCollectService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ArticleCollect> list) {
|
||||
if (articleCollectService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<ArticleCollect> batchParam) {
|
||||
if (batchParam.update(articleCollectService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (articleCollectService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.gxwebsoft.law.controller;
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.law.service.LawFeedbackService;
|
||||
import com.gxwebsoft.law.entity.LawFeedback;
|
||||
import com.gxwebsoft.law.param.LawFeedbackParam;
|
||||
import com.gxwebsoft.cms.service.ArticleCommentService;
|
||||
import com.gxwebsoft.cms.entity.ArticleComment;
|
||||
import com.gxwebsoft.cms.param.ArticleCommentParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
@@ -22,50 +22,46 @@ import java.util.List;
|
||||
* 控制器
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-05-06 10:27:16
|
||||
* @since 2025-12-02 16:56:51
|
||||
*/
|
||||
@Api(tags = "管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/law/law-feedback")
|
||||
public class LawFeedbackController extends BaseController {
|
||||
@RequestMapping("/api/cms/article-comment")
|
||||
public class ArticleCommentController extends BaseController {
|
||||
@Resource
|
||||
private LawFeedbackService lawFeedbackService;
|
||||
private ArticleCommentService articleCommentService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<LawFeedback>> page(LawFeedbackParam param) {
|
||||
public ApiResult<PageResult<ArticleComment>> page(ArticleCommentParam param) {
|
||||
// 使用关联查询
|
||||
return success(lawFeedbackService.pageRel(param));
|
||||
return success(articleCommentService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部")
|
||||
@GetMapping()
|
||||
public ApiResult<List<LawFeedback>> list(LawFeedbackParam param) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
param.setUserId(loginUser.getUserId());
|
||||
}
|
||||
public ApiResult<List<ArticleComment>> list(ArticleCommentParam param) {
|
||||
// 使用关联查询
|
||||
return success(lawFeedbackService.listRel(param));
|
||||
return success(articleCommentService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('law:lawFeedback:list')")
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<LawFeedback> get(@PathVariable("id") Integer id) {
|
||||
public ApiResult<ArticleComment> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(lawFeedbackService.getByIdRel(id));
|
||||
return success(articleCommentService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody LawFeedback lawFeedback) {
|
||||
public ApiResult<?> save(@RequestBody ArticleComment articleComment) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
lawFeedback.setUserId(loginUser.getUserId());
|
||||
articleComment.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (lawFeedbackService.save(lawFeedback)) {
|
||||
if (articleCommentService.save(articleComment)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
@@ -73,8 +69,8 @@ public class LawFeedbackController extends BaseController {
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody LawFeedback lawFeedback) {
|
||||
if (lawFeedbackService.updateById(lawFeedback)) {
|
||||
public ApiResult<?> update(@RequestBody ArticleComment articleComment) {
|
||||
if (articleCommentService.updateById(articleComment)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
@@ -83,7 +79,7 @@ public class LawFeedbackController extends BaseController {
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (lawFeedbackService.removeById(id)) {
|
||||
if (articleCommentService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
@@ -91,8 +87,8 @@ public class LawFeedbackController extends BaseController {
|
||||
|
||||
@ApiOperation("批量添加")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<LawFeedback> list) {
|
||||
if (lawFeedbackService.saveBatch(list)) {
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ArticleComment> list) {
|
||||
if (articleCommentService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
@@ -100,8 +96,8 @@ public class LawFeedbackController extends BaseController {
|
||||
|
||||
@ApiOperation("批量修改")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<LawFeedback> batchParam) {
|
||||
if (batchParam.update(lawFeedbackService, "id")) {
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<ArticleComment> batchParam) {
|
||||
if (batchParam.update(articleCommentService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
@@ -110,7 +106,7 @@ public class LawFeedbackController extends BaseController {
|
||||
@ApiOperation("批量删除")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (lawFeedbackService.removeByIds(ids)) {
|
||||
if (articleCommentService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
@@ -2,7 +2,9 @@ package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.cms.entity.ArticleCategory;
|
||||
import com.gxwebsoft.cms.entity.ArticleCollect;
|
||||
import com.gxwebsoft.cms.service.ArticleCategoryService;
|
||||
import com.gxwebsoft.cms.service.ArticleCollectService;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
@@ -35,6 +37,8 @@ public class ArticleController extends BaseController {
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
@Resource
|
||||
private ArticleCollectService articleCollectService;
|
||||
@Resource
|
||||
private ArticleCategoryService articleCategoryService;
|
||||
|
||||
@ApiOperation("根据id查询文章记录表")
|
||||
@@ -45,7 +49,6 @@ public class ArticleController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:article:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("分页查询文章记录表")
|
||||
@GetMapping("/page")
|
||||
@@ -74,11 +77,13 @@ public class ArticleController extends BaseController {
|
||||
if (!categoryIds.isEmpty()) {
|
||||
queryWrapper.in(Article::getCategoryId, categoryIds);
|
||||
}
|
||||
if (param.getTitle() != null) {
|
||||
queryWrapper.like(Article::getTitle, param.getTitle());
|
||||
}
|
||||
List<Article> articleList = articleService.list(queryWrapper);
|
||||
return success(articleList);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:article:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("根据id查询文章记录表")
|
||||
@GetMapping("/{id}")
|
||||
@@ -89,6 +94,13 @@ public class ArticleController extends BaseController {
|
||||
article.setArticleId(id);
|
||||
article.setVirtualViews(article.getVirtualViews() + 1);
|
||||
articleService.saveOrUpdate(article);
|
||||
ArticleCategory category = articleCategoryService.getByIdRel(article.getCategoryId());
|
||||
if (category != null) article.setCategory(category.getTitle());
|
||||
article.setHasCollect(false);
|
||||
if (getLoginUser() != null) {
|
||||
ArticleCollect articleCollect = articleCollectService.check(getLoginUserId(), id);
|
||||
article.setHasCollect(articleCollect != null);
|
||||
}
|
||||
return success(article);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.cms.service.ManuscriptService;
|
||||
import com.gxwebsoft.cms.entity.Manuscript;
|
||||
import com.gxwebsoft.cms.param.ManuscriptParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.gxmu.entity.ReviewFlow;
|
||||
import com.gxwebsoft.gxmu.entity.ReviewFlowConfig;
|
||||
import com.gxwebsoft.gxmu.entity.ReviewList;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowConfigService;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowService;
|
||||
import com.gxwebsoft.gxmu.service.ReviewListService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 稿件控制器
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-18 12:54:31
|
||||
*/
|
||||
@Api(tags = "稿件管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/manuscript")
|
||||
public class ManuscriptController extends BaseController {
|
||||
@Resource
|
||||
private ManuscriptService manuscriptService;
|
||||
@Resource
|
||||
private ReviewFlowConfigService reviewFlowConfigService;
|
||||
@Resource
|
||||
private ReviewFlowService reviewFlowService;
|
||||
@Resource
|
||||
private ReviewListService reviewListService;
|
||||
|
||||
@ApiOperation("分页查询稿件")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Manuscript>> page(ManuscriptParam param) {
|
||||
// 使用关联查询
|
||||
return success(manuscriptService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部稿件")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Manuscript>> list(ManuscriptParam param) {
|
||||
// 使用关联查询
|
||||
return success(manuscriptService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询稿件")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Manuscript> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(manuscriptService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加稿件")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Manuscript manuscript) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
manuscript.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (manuscriptService.save(manuscript)) {
|
||||
// 查找该模块的审核流
|
||||
ReviewFlowConfig reviewFlowConfig = reviewFlowConfigService.getByModule("cms_manuscript");
|
||||
if (reviewFlowConfig != null) {
|
||||
ReviewFlow reviewFlow = reviewFlowService.getById(reviewFlowConfig.getFlowId());
|
||||
if (reviewFlow != null) {
|
||||
List<ReviewFlow> reviewFlowList = reviewFlowService.listByTitle(reviewFlow.getTitle());
|
||||
if (reviewFlowList != null && !reviewFlowList.isEmpty()) {
|
||||
ReviewFlow firstOne = reviewFlowList.get(0);
|
||||
ReviewList reviewList = new ReviewList();
|
||||
reviewList.setPk(manuscript.getId());
|
||||
reviewList.setModule("cms_manuscript");
|
||||
reviewList.setUserId(firstOne.getReviewUserId());
|
||||
reviewList.setSortNumber(0);
|
||||
reviewListService.save(reviewList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改稿件")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Manuscript manuscript) {
|
||||
if (manuscriptService.updateById(manuscript)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除稿件")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (manuscriptService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加稿件")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Manuscript> list) {
|
||||
if (manuscriptService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改稿件")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<Manuscript> batchParam) {
|
||||
if (batchParam.update(manuscriptService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除稿件")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (manuscriptService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,6 +37,9 @@ public class Article implements Serializable {
|
||||
@ApiModelProperty(value = "文章分类ID")
|
||||
private Integer categoryId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty(value = "封面图")
|
||||
private String image;
|
||||
|
||||
@@ -88,4 +91,6 @@ public class Article implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String userAvatar;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Boolean hasCollect;
|
||||
}
|
||||
|
||||
@@ -1,46 +1,37 @@
|
||||
package com.gxwebsoft.law.entity;
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 法律意见书配置
|
||||
*
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-17 18:55:31
|
||||
* @since 2025-11-23 14:05:18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "LawLegalOrgCheckConfigSuggest对象", description = "法律意见书配置")
|
||||
@TableName("law_legal_org_check_config_suggest")
|
||||
public class LawLegalOrgCheckConfigSuggest implements Serializable {
|
||||
@ApiModel(value = "ArticleCollect对象", description = "")
|
||||
@TableName("cms_article_collect")
|
||||
public class ArticleCollect implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer typeId;
|
||||
|
||||
private Integer parentId;
|
||||
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "内容")
|
||||
private String answer;
|
||||
private Integer articleId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
@@ -48,13 +39,12 @@ public class LawLegalOrgCheckConfigSuggest implements Serializable {
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<LawLegalOrgCheckConfigSuggest> children;
|
||||
|
||||
private Article article;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.gxwebsoft.law.entity;
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
@@ -13,32 +13,27 @@ import lombok.EqualsAndHashCode;
|
||||
*
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-14 01:31:54
|
||||
* @since 2025-12-02 16:56:51
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "LawOrgPeople对象", description = "")
|
||||
@TableName("law_org_people")
|
||||
public class LawOrgPeople implements Serializable {
|
||||
@ApiModel(value = "ArticleComment对象", description = "")
|
||||
@TableName("cms_article_comment")
|
||||
public class ArticleComment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer orgId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String position;
|
||||
|
||||
private String type;
|
||||
|
||||
private String positionType;
|
||||
private Integer articleId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
@@ -46,12 +41,12 @@ public class LawOrgPeople implements Serializable {
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private LawOrg lawOrg;
|
||||
private Article article;
|
||||
}
|
||||
@@ -1,44 +1,38 @@
|
||||
package com.gxwebsoft.law.entity;
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.gxmu.entity.ReviewList;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户填写企业法制体检内容
|
||||
* 稿件
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-17 17:48:54
|
||||
* @since 2026-03-18 12:54:31
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "LawLegalOrgCheckContent对象", description = "用户填写企业法制体检内容")
|
||||
@TableName("law_legal_org_check_content")
|
||||
public class LawLegalOrgCheckContent implements Serializable {
|
||||
@ApiModel(value = "Manuscript对象", description = "稿件")
|
||||
@TableName("cms_manuscript")
|
||||
public class Manuscript implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer groupId;
|
||||
private String title;
|
||||
|
||||
private String content;
|
||||
|
||||
private String title;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private BigDecimal point;
|
||||
|
||||
private String aiContent;
|
||||
private String cover;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
@@ -53,6 +47,16 @@ public class LawLegalOrgCheckContent implements Serializable {
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "审核状态")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "审核状态描述")
|
||||
private String statusText;
|
||||
|
||||
@TableField(exist = false)
|
||||
private User user;
|
||||
private List<ReviewList> reviewList;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.cms.entity.ArticleCollect;
|
||||
import com.gxwebsoft.cms.param.ArticleCollectParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-11-23 14:05:18
|
||||
*/
|
||||
public interface ArticleCollectMapper extends BaseMapper<ArticleCollect> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<ArticleCollect>
|
||||
*/
|
||||
List<ArticleCollect> selectPageRel(@Param("page") IPage<ArticleCollect> page,
|
||||
@Param("param") ArticleCollectParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<ArticleCollect> selectListRel(@Param("param") ArticleCollectParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.cms.entity.ArticleComment;
|
||||
import com.gxwebsoft.cms.param.ArticleCommentParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-12-02 16:56:51
|
||||
*/
|
||||
public interface ArticleCommentMapper extends BaseMapper<ArticleComment> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<ArticleComment>
|
||||
*/
|
||||
List<ArticleComment> selectPageRel(@Param("page") IPage<ArticleComment> page,
|
||||
@Param("param") ArticleCommentParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<ArticleComment> selectListRel(@Param("param") ArticleCommentParam param);
|
||||
|
||||
}
|
||||
37
src/main/java/com/gxwebsoft/cms/mapper/ManuscriptMapper.java
Normal file
37
src/main/java/com/gxwebsoft/cms/mapper/ManuscriptMapper.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.cms.entity.Manuscript;
|
||||
import com.gxwebsoft.cms.param.ManuscriptParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 稿件Mapper
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-18 12:54:31
|
||||
*/
|
||||
public interface ManuscriptMapper extends BaseMapper<Manuscript> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<Manuscript>
|
||||
*/
|
||||
List<Manuscript> selectPageRel(@Param("page") IPage<Manuscript> page,
|
||||
@Param("param") ManuscriptParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<Manuscript> selectListRel(@Param("param") ManuscriptParam param);
|
||||
|
||||
}
|
||||
@@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gxwebsoft.law.mapper.LawLegalCalContentMapper">
|
||||
<mapper namespace="com.gxwebsoft.cms.mapper.ArticleCollectMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM law_legal_cal_content a
|
||||
FROM cms_article_collect a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.groupId != null">
|
||||
AND a.group_id = #{param.groupId}
|
||||
</if>
|
||||
<if test="param.content != null">
|
||||
AND a.content LIKE CONCAT('%', #{param.content}, '%')
|
||||
<if test="param.articleId != null">
|
||||
AND a.article_id = #{param.articleId}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
@@ -39,12 +39,12 @@
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.law.entity.LawLegalCalContent">
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.ArticleCollect">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.law.entity.LawLegalCalContent">
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.ArticleCollect">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gxwebsoft.law.mapper.LawLegalDocContentMapper">
|
||||
<mapper namespace="com.gxwebsoft.cms.mapper.ArticleCommentMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM law_legal_doc_content a
|
||||
FROM cms_article_comment a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.groupId != null">
|
||||
AND a.group_id = #{param.groupId}
|
||||
<if test="param.articleId != null">
|
||||
AND a.article_id = #{param.articleId}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.content != null">
|
||||
AND a.content LIKE CONCAT('%', #{param.content}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
@@ -39,12 +42,12 @@
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.law.entity.LawLegalDocContent">
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.ArticleComment">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.law.entity.LawLegalDocContent">
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.ArticleComment">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
AND b.nickname LIKE CONCAT('%', #{param.nickname}, '%')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY a.create_time DESC
|
||||
ORDER BY a.sort_number ASC, a.create_time DESC
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gxwebsoft.law.mapper.LawLegalOrgCheckTypeMapper">
|
||||
<mapper namespace="com.gxwebsoft.cms.mapper.ManuscriptMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM law_legal_org_check_type a
|
||||
FROM cms_manuscript a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.icon != null">
|
||||
AND a.icon LIKE CONCAT('%', #{param.icon}, '%')
|
||||
</if>
|
||||
<if test="param.title != null">
|
||||
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
<if test="param.content != null">
|
||||
AND a.content LIKE CONCAT('%', #{param.content}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
<if test="param.cover != null">
|
||||
AND a.cover LIKE CONCAT('%', #{param.cover}, '%')
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
@@ -34,6 +31,15 @@
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
@@ -42,12 +48,12 @@
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.law.entity.LawLegalOrgCheckType">
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.Manuscript">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.law.entity.LawLegalOrgCheckType">
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.Manuscript">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.gxwebsoft.law.param;
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
@@ -14,32 +14,28 @@ import lombok.EqualsAndHashCode;
|
||||
* 查询参数
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-14 01:31:54
|
||||
* @since 2025-11-23 14:05:18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "LawOrgPeopleParam对象", description = "查询参数")
|
||||
public class LawOrgPeopleParam extends BaseParam {
|
||||
@ApiModel(value = "ArticleCollectParam对象", description = "查询参数")
|
||||
public class ArticleCollectParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer orgId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String position;
|
||||
|
||||
private String type;
|
||||
private Integer articleId;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.gxwebsoft.law.param;
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
@@ -11,29 +11,33 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户填写法律计算器内容查询参数
|
||||
* 查询参数
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-17 19:23:47
|
||||
* @since 2025-12-02 16:56:51
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "LawLegalCalContentParam对象", description = "用户填写法律计算器内容查询参数")
|
||||
public class LawLegalCalContentParam extends BaseParam {
|
||||
@ApiModel(value = "ArticleCommentParam对象", description = "查询参数")
|
||||
public class ArticleCommentParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer groupId;
|
||||
|
||||
private String content;
|
||||
private Integer articleId;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.gxwebsoft.law.param;
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
@@ -11,34 +11,39 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 法律计算器配置查询参数
|
||||
* 稿件查询参数
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-17 19:23:47
|
||||
* @since 2026-03-18 12:54:31
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "LawLegalCalTypeParam对象", description = "法律计算器配置查询参数")
|
||||
public class LawLegalCalTypeParam extends BaseParam {
|
||||
@ApiModel(value = "ManuscriptParam对象", description = "稿件查询参数")
|
||||
public class ManuscriptParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
private String icon;
|
||||
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
private String content;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
private String cover;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "待审核")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.gxwebsoft.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.cms.entity.ArticleCollect;
|
||||
import com.gxwebsoft.cms.param.ArticleCollectParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-11-23 14:05:18
|
||||
*/
|
||||
public interface ArticleCollectService extends IService<ArticleCollect> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<ArticleCollect>
|
||||
*/
|
||||
PageResult<ArticleCollect> pageRel(ArticleCollectParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<ArticleCollect>
|
||||
*/
|
||||
List<ArticleCollect> listRel(ArticleCollectParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id
|
||||
* @return ArticleCollect
|
||||
*/
|
||||
ArticleCollect getByIdRel(Integer id);
|
||||
|
||||
ArticleCollect check(Integer userId, Integer id);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.cms.entity.ArticleComment;
|
||||
import com.gxwebsoft.cms.param.ArticleCommentParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-12-02 16:56:51
|
||||
*/
|
||||
public interface ArticleCommentService extends IService<ArticleComment> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<ArticleComment>
|
||||
*/
|
||||
PageResult<ArticleComment> pageRel(ArticleCommentParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<ArticleComment>
|
||||
*/
|
||||
List<ArticleComment> listRel(ArticleCommentParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id
|
||||
* @return ArticleComment
|
||||
*/
|
||||
ArticleComment getByIdRel(Integer id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.cms.entity.Manuscript;
|
||||
import com.gxwebsoft.cms.param.ManuscriptParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 稿件Service
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-18 12:54:31
|
||||
*/
|
||||
public interface ManuscriptService extends IService<Manuscript> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<Manuscript>
|
||||
*/
|
||||
PageResult<Manuscript> pageRel(ManuscriptParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<Manuscript>
|
||||
*/
|
||||
List<Manuscript> listRel(ManuscriptParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id
|
||||
* @return Manuscript
|
||||
*/
|
||||
Manuscript getByIdRel(Integer id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.ArticleCollectMapper;
|
||||
import com.gxwebsoft.cms.service.ArticleCollectService;
|
||||
import com.gxwebsoft.cms.entity.ArticleCollect;
|
||||
import com.gxwebsoft.cms.param.ArticleCollectParam;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service实现
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-11-23 14:05:18
|
||||
*/
|
||||
@Service
|
||||
public class ArticleCollectServiceImpl extends ServiceImpl<ArticleCollectMapper, ArticleCollect> implements ArticleCollectService {
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
|
||||
@Override
|
||||
public PageResult<ArticleCollect> pageRel(ArticleCollectParam param) {
|
||||
PageParam<ArticleCollect, ArticleCollectParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<ArticleCollect> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleCollect> listRel(ArticleCollectParam param) {
|
||||
List<ArticleCollect> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<ArticleCollect, ArticleCollectParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
for (ArticleCollect item : list) {
|
||||
item.setArticle(articleService.getByIdRel(item.getArticleId()));
|
||||
}
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArticleCollect getByIdRel(Integer id) {
|
||||
ArticleCollectParam param = new ArticleCollectParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArticleCollect check(Integer userId, Integer id) {
|
||||
return getOne(
|
||||
new LambdaQueryWrapper<ArticleCollect>()
|
||||
.eq(ArticleCollect::getUserId, userId)
|
||||
.eq(ArticleCollect::getArticleId, id)
|
||||
.last("limit 1")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.ArticleCommentMapper;
|
||||
import com.gxwebsoft.cms.service.ArticleCommentService;
|
||||
import com.gxwebsoft.cms.entity.ArticleComment;
|
||||
import com.gxwebsoft.cms.param.ArticleCommentParam;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service实现
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-12-02 16:56:51
|
||||
*/
|
||||
@Service
|
||||
public class ArticleCommentServiceImpl extends ServiceImpl<ArticleCommentMapper, ArticleComment> implements ArticleCommentService {
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
@Override
|
||||
public PageResult<ArticleComment> pageRel(ArticleCommentParam param) {
|
||||
PageParam<ArticleComment, ArticleCommentParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<ArticleComment> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleComment> listRel(ArticleCommentParam param) {
|
||||
List<ArticleComment> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<ArticleComment, ArticleCommentParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
for (ArticleComment item : list) {
|
||||
item.setArticle(articleService.getById(item.getArticleId()));
|
||||
}
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArticleComment getByIdRel(Integer id) {
|
||||
ArticleCommentParam param = new ArticleCommentParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
|
||||
@Override
|
||||
public PageResult<Article> pageRel(ArticleParam param) {
|
||||
PageParam<Article, ArticleParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
// page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<Article> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
|
||||
List<Article> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Article, ArticleParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
// page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.ManuscriptMapper;
|
||||
import com.gxwebsoft.cms.service.ManuscriptService;
|
||||
import com.gxwebsoft.cms.entity.Manuscript;
|
||||
import com.gxwebsoft.cms.param.ManuscriptParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.gxmu.entity.ReviewList;
|
||||
import com.gxwebsoft.gxmu.service.ReviewListService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 稿件Service实现
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-18 12:54:31
|
||||
*/
|
||||
@Service
|
||||
public class ManuscriptServiceImpl extends ServiceImpl<ManuscriptMapper, Manuscript> implements ManuscriptService {
|
||||
@Resource
|
||||
private ReviewListService reviewListService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Override
|
||||
public PageResult<Manuscript> pageRel(ManuscriptParam param) {
|
||||
PageParam<Manuscript, ManuscriptParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<Manuscript> list = baseMapper.selectPageRel(page, param);
|
||||
for (Manuscript manuscript : list) {
|
||||
List<ReviewList> reviewLists = reviewListService.listByModuleNPK("cms_manuscript", manuscript.getId());
|
||||
for (ReviewList reviewList : reviewLists) {
|
||||
if (reviewList.getUserId() != null) reviewList.setUser(userService.getById(reviewList.getUserId()));
|
||||
}
|
||||
manuscript.setReviewList(reviewLists);
|
||||
}
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Manuscript> listRel(ManuscriptParam param) {
|
||||
List<Manuscript> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Manuscript, ManuscriptParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Manuscript getByIdRel(Integer id) {
|
||||
ManuscriptParam param = new ManuscriptParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +1,10 @@
|
||||
package com.gxwebsoft.common.core.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.LongValue;
|
||||
import net.sf.jsqlparser.expression.NullValue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* MybatisPlus配置
|
||||
@@ -23,58 +12,14 @@ import java.util.Arrays;
|
||||
* @author WebSoft
|
||||
* @since 2018-02-22 11:29:28
|
||||
*/
|
||||
//@Configuration
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
// @Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor(HttpServletRequest request) {
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
|
||||
// 多租户插件配置
|
||||
TenantLineHandler tenantLineHandler = new TenantLineHandler() {
|
||||
@Override
|
||||
public Expression getTenantId() {
|
||||
System.out.println(getLoginUserTenantId());
|
||||
return getLoginUserTenantId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreTable(String tableName) {
|
||||
return Arrays.asList(
|
||||
"sys_tenant",
|
||||
"sys_dictionary",
|
||||
"sys_dictionary_data"
|
||||
).contains(tableName);
|
||||
}
|
||||
};
|
||||
TenantLineInnerInterceptor tenantLineInnerInterceptor = new TenantLineInnerInterceptor(tenantLineHandler);
|
||||
interceptor.addInnerInterceptor(tenantLineInnerInterceptor);
|
||||
|
||||
// 分页插件配置
|
||||
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
|
||||
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
|
||||
interceptor.addInnerInterceptor(paginationInnerInterceptor);
|
||||
//
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户的租户id
|
||||
*
|
||||
* @return Integer
|
||||
*/
|
||||
public Expression getLoginUserTenantId() {
|
||||
try {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication != null) {
|
||||
Object object = authentication.getPrincipal();
|
||||
if (object instanceof User) {
|
||||
return new LongValue(((User) object).getTenantId());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
return new NullValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gxwebsoft.common.core.config;
|
||||
|
||||
import com.gxwebsoft.common.core.Constants;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@@ -14,6 +15,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
|
||||
private static final long DEFAULT_ASYNC_TIMEOUT = 10 * 60 * 1000L;
|
||||
|
||||
/**
|
||||
* 支持跨域访问
|
||||
*/
|
||||
@@ -28,4 +31,9 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
.maxAge(3600);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
|
||||
configurer.setDefaultTimeout(DEFAULT_ASYNC_TIMEOUT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.gxwebsoft.common.core.exception;
|
||||
import com.gxwebsoft.common.core.Constants;
|
||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import org.apache.catalina.connector.ClientAbortException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
@@ -45,6 +46,12 @@ public class GlobalExceptionHandler {
|
||||
return new ApiResult<>(e.getCode(), e.getMessage());
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ExceptionHandler(ClientAbortException.class)
|
||||
public void clientAbortExceptionHandler(ClientAbortException e) {
|
||||
logger.warn("客户端已断开连接: {}", e.getMessage());
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ExceptionHandler(Throwable.class)
|
||||
public ApiResult<?> exceptionHandler(Throwable e, HttpServletResponse response) {
|
||||
|
||||
@@ -53,7 +53,10 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
JwtSubject jwtSubject = JwtUtil.getJwtSubject(claims);
|
||||
User user = userService.getByUsername(jwtSubject.getUsername(), jwtSubject.getTenantId());
|
||||
if (user == null) {
|
||||
throw new UsernameNotFoundException("Username not found");
|
||||
user = userService.getByPhone(jwtSubject.getUsername(), jwtSubject.getTenantId());
|
||||
if (user == null) {
|
||||
throw new UsernameNotFoundException("Username not found");
|
||||
}
|
||||
}
|
||||
List<Menu> authorities = user.getAuthorities().stream()
|
||||
.filter(m -> StrUtil.isNotBlank(m.getAuthority())).collect(Collectors.toList());
|
||||
|
||||
@@ -39,6 +39,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.permitAll()
|
||||
.antMatchers(
|
||||
"/api/login",
|
||||
"/api/system/user/loginByPhoneForTest",
|
||||
"/api/wx-login/loginByMpWxPhone",
|
||||
"/api/register",
|
||||
"/druid/**",
|
||||
"/swagger-ui.html",
|
||||
@@ -56,6 +58,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/api/shop/payment/mp-alipay/getPhoneNumber",
|
||||
"/api/shop/test/**",
|
||||
"/api/shop/wx-login/**",
|
||||
"/api/shop/getOpenId",
|
||||
"/api/shop/getOpenId/**",
|
||||
"/api/apps/hualala/**",
|
||||
"/api/apps/hualala-cart/**",
|
||||
"/api/apps/test-data/**",
|
||||
@@ -73,7 +77,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/api/law/law-org-people/**",
|
||||
"/api/system/dict-data/list-by-dict",
|
||||
"/api/cms/article-category",
|
||||
"/api/file/upload"
|
||||
"/api/cms/article",
|
||||
"/api/file/upload",
|
||||
"/api/sys/sys-area"
|
||||
)
|
||||
.permitAll()
|
||||
.anyRequest()
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package com.gxwebsoft.common.core.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.artofsolving.jodconverter.OfficeDocumentConverter;
|
||||
import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;
|
||||
import org.artofsolving.jodconverter.office.OfficeManager;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* OpenOfficeUtil
|
||||
@@ -57,18 +62,10 @@ public class OpenOfficeUtil {
|
||||
if (cache && outFile.exists()) {
|
||||
return outFile;
|
||||
}
|
||||
// 转换
|
||||
OfficeManager officeManager = null;
|
||||
try {
|
||||
officeManager = getOfficeManager(officeHome);
|
||||
OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);
|
||||
return converterFile(srcFile, outFile, converter);
|
||||
return converterFile(srcFile, outFile, officeHome);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (officeManager != null) {
|
||||
officeManager.stop();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -78,17 +75,78 @@ public class OpenOfficeUtil {
|
||||
*
|
||||
* @param inFile 源文件
|
||||
* @param outFile 输出文件
|
||||
* @param converter OfficeDocumentConverter
|
||||
* @return File
|
||||
*/
|
||||
public static File converterFile(File inFile, File outFile, OfficeDocumentConverter converter) {
|
||||
public static File converterFile(File inFile, File outFile, String officeHome) throws IOException, InterruptedException {
|
||||
if (!outFile.getParentFile().exists()) {
|
||||
if (!outFile.getParentFile().mkdirs()) {
|
||||
return outFile;
|
||||
}
|
||||
}
|
||||
converter.convert(inFile, outFile);
|
||||
return outFile;
|
||||
String soffice = resolveSofficePath(officeHome);
|
||||
if (StrUtil.isBlank(soffice)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
File tempRoot = new File(outFile.getParentFile(), "office-temp");
|
||||
if (!tempRoot.exists() && !tempRoot.mkdirs()) {
|
||||
return null;
|
||||
}
|
||||
String suffix = inFile.getName().contains(".")
|
||||
? inFile.getName().substring(inFile.getName().lastIndexOf('.'))
|
||||
: "";
|
||||
String tempName = UUID.randomUUID().toString().replace("-", "");
|
||||
File tempInput = new File(tempRoot, tempName + suffix);
|
||||
File tempOutput = new File(tempRoot, tempName + ".pdf");
|
||||
|
||||
try {
|
||||
Files.copy(inFile.toPath(), tempInput.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(
|
||||
soffice,
|
||||
"--headless",
|
||||
"--convert-to",
|
||||
"pdf",
|
||||
"--outdir",
|
||||
tempRoot.getAbsolutePath(),
|
||||
tempInput.getAbsolutePath()
|
||||
);
|
||||
processBuilder.redirectErrorStream(true);
|
||||
Process process = processBuilder.start();
|
||||
String output = readStream(process.getInputStream());
|
||||
int exitCode = process.waitFor();
|
||||
if (exitCode != 0 || !tempOutput.exists()) {
|
||||
System.out.println("soffice convert failed: " + output);
|
||||
return null;
|
||||
}
|
||||
Files.move(tempOutput.toPath(), outFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
return outFile;
|
||||
} finally {
|
||||
if (tempInput.exists()) {
|
||||
tempInput.delete();
|
||||
}
|
||||
if (tempOutput.exists()) {
|
||||
tempOutput.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String readStream(InputStream inputStream) throws IOException {
|
||||
if (inputStream == null) {
|
||||
return "";
|
||||
}
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
String line;
|
||||
boolean firstLine = true;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (!firstLine) {
|
||||
builder.append('\n');
|
||||
}
|
||||
builder.append(line);
|
||||
firstLine = false;
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,19 +164,27 @@ public class OpenOfficeUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接并启动OpenOffice
|
||||
*
|
||||
* @param officeHome OpenOffice安装路径
|
||||
* @return OfficeManager
|
||||
*/
|
||||
public static OfficeManager getOfficeManager(String officeHome) {
|
||||
if (officeHome == null || officeHome.trim().isEmpty()) return null;
|
||||
DefaultOfficeManagerConfiguration config = new DefaultOfficeManagerConfiguration();
|
||||
config.setOfficeHome(officeHome); // 设置OpenOffice安装目录
|
||||
OfficeManager officeManager = config.buildOfficeManager();
|
||||
officeManager.start(); // 启动OpenOffice服务
|
||||
return officeManager;
|
||||
private static String resolveSofficePath(String officeHome) {
|
||||
String[] candidates = new String[]{
|
||||
officeHome,
|
||||
officeHome == null ? null : officeHome + File.separator + "program" + File.separator + "soffice",
|
||||
officeHome == null ? null : officeHome + File.separator + "program" + File.separator + "soffice.bin",
|
||||
officeHome == null ? null : officeHome + File.separator + "Contents" + File.separator + "MacOS" + File.separator + "soffice",
|
||||
"/usr/bin/soffice",
|
||||
"/usr/local/bin/soffice",
|
||||
"/opt/homebrew/bin/soffice",
|
||||
"/Applications/LibreOffice.app/Contents/MacOS/soffice"
|
||||
};
|
||||
for (String candidate : candidates) {
|
||||
if (StrUtil.isBlank(candidate)) {
|
||||
continue;
|
||||
}
|
||||
File file = new File(candidate);
|
||||
if (file.exists() && file.isFile() && file.canExecute()) {
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
package com.gxwebsoft.common.core.utils;
|
||||
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.shop.service.OrderService;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 自动执行计划
|
||||
@@ -10,15 +19,13 @@ import javax.annotation.Resource;
|
||||
* @author WebSoft
|
||||
* @since 2018-12-14 08:38:19
|
||||
*/
|
||||
@Component
|
||||
public class SchedulingUtil {
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
// @Scheduled(cron="*/5 * * * * *")
|
||||
// public void reportCurrentTime() {
|
||||
// System.out.println("定时任务开始 = " + new Date());
|
||||
// int count = orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getPayStatus, 20));
|
||||
//// orderService.removeOrderByTimeOut();
|
||||
// System.out.println("count = " + count);
|
||||
// }
|
||||
@Scheduled(cron = "*/1 * * * * *")
|
||||
public void reportCurrentTime() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@ import com.gxwebsoft.common.core.Constants;
|
||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||
import com.gxwebsoft.common.core.utils.CacheClient;
|
||||
import com.gxwebsoft.common.core.utils.SignCheckUtil;
|
||||
import com.gxwebsoft.common.system.entity.Organization;
|
||||
import com.gxwebsoft.common.system.entity.Role;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.param.UserParam;
|
||||
import com.gxwebsoft.common.system.service.OrganizationService;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.shop.entity.Merchant;
|
||||
import com.gxwebsoft.shop.service.MerchantClerkService;
|
||||
@@ -23,6 +27,8 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Controller基类
|
||||
@@ -31,6 +37,13 @@ import java.util.*;
|
||||
* @since 2017-06-10 10:10:19
|
||||
*/
|
||||
public class BaseController {
|
||||
private static final Set<String> BACKEND_SCOPE_ROLE_CODES = new HashSet<>(Arrays.asList(
|
||||
"SchoolYouthLeagueCommittee",
|
||||
"PartyCommitteesOfSecondaryColleges",
|
||||
"YouthLeagueCommitteeOfSecondaryColleges",
|
||||
"YouthLeagueBranchesOfSecondaryColleges"
|
||||
));
|
||||
|
||||
@Resource
|
||||
private HttpServletRequest request;
|
||||
@Resource
|
||||
@@ -43,6 +56,8 @@ public class BaseController {
|
||||
private CacheClient cacheClient;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
|
||||
/**
|
||||
* 获取当前登录的user
|
||||
@@ -92,6 +107,126 @@ public class BaseController {
|
||||
return 10049;
|
||||
}
|
||||
|
||||
protected boolean isBackendAccess(BaseParam param) {
|
||||
return param != null && Boolean.TRUE.equals(param.getBackendAccess());
|
||||
}
|
||||
|
||||
protected Set<String> getLoginUserRoleCodes() {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser == null || loginUser.getUserId() == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
List<Role> roles = loginUser.getRoles();
|
||||
if (roles == null || roles.isEmpty()) {
|
||||
User fullUser = userService.getByIdRel(loginUser.getUserId());
|
||||
roles = fullUser == null ? Collections.emptyList() : fullUser.getRoles();
|
||||
}
|
||||
if (roles == null || roles.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return roles.stream()
|
||||
.map(Role::getRoleCode)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
}
|
||||
|
||||
protected boolean hasOnlyStudentRole() {
|
||||
Set<String> roleCodes = getLoginUserRoleCodes();
|
||||
return roleCodes.size() == 1 && roleCodes.contains("student");
|
||||
}
|
||||
|
||||
protected boolean hasBackendScopeRole() {
|
||||
Set<String> roleCodes = getLoginUserRoleCodes();
|
||||
for (String roleCode : roleCodes) {
|
||||
if (BACKEND_SCOPE_ROLE_CODES.contains(roleCode)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void applyBackendOrganizationScope(UserParam param) {
|
||||
if (!isBackendAccess(param) || !hasBackendScopeRole()) {
|
||||
return;
|
||||
}
|
||||
Set<Integer> organizationIds = resolveCurrentAndChildOrganizationIds();
|
||||
if (!organizationIds.isEmpty()) {
|
||||
param.setOrganizationIds(organizationIds);
|
||||
}
|
||||
}
|
||||
|
||||
protected <T extends BaseParam> void applyBackendUserScope(T param,
|
||||
Consumer<Integer> userIdSetter,
|
||||
Consumer<Set<Integer>> userIdsSetter,
|
||||
boolean allowStudentOwnOnly) {
|
||||
if (!isBackendAccess(param)) {
|
||||
return;
|
||||
}
|
||||
Integer loginUserId = getLoginUserId();
|
||||
if (allowStudentOwnOnly && hasOnlyStudentRole() && loginUserId != null) {
|
||||
userIdSetter.accept(loginUserId);
|
||||
return;
|
||||
}
|
||||
if (!hasBackendScopeRole()) {
|
||||
return;
|
||||
}
|
||||
Set<Integer> userIds = resolveScopedUserIdsByOrganization();
|
||||
if (!userIds.isEmpty()) {
|
||||
userIdsSetter.accept(userIds);
|
||||
}
|
||||
}
|
||||
|
||||
private Set<Integer> resolveScopedUserIdsByOrganization() {
|
||||
Set<Integer> organizationIds = resolveCurrentAndChildOrganizationIds();
|
||||
if (organizationIds.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return userService.list(new LambdaQueryWrapper<User>()
|
||||
.select(User::getUserId)
|
||||
.eq(User::getTenantId, getTenantId())
|
||||
.in(User::getOrganizationId, organizationIds))
|
||||
.stream()
|
||||
.map(User::getUserId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
}
|
||||
|
||||
private Set<Integer> resolveCurrentAndChildOrganizationIds() {
|
||||
User loginUser = getLoginUser();
|
||||
Integer organizationId = loginUser == null ? null : loginUser.getOrganizationId();
|
||||
if (organizationId == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
List<Organization> organizations = organizationService.list(new LambdaQueryWrapper<Organization>()
|
||||
.select(Organization::getOrganizationId, Organization::getParentId)
|
||||
.eq(Organization::getTenantId, getTenantId()));
|
||||
if (organizations == null || organizations.isEmpty()) {
|
||||
return Collections.singleton(organizationId);
|
||||
}
|
||||
Map<Integer, List<Integer>> childrenMap = new HashMap<>();
|
||||
for (Organization organization : organizations) {
|
||||
if (organization.getOrganizationId() == null) {
|
||||
continue;
|
||||
}
|
||||
childrenMap.computeIfAbsent(organization.getParentId(), key -> new ArrayList<>())
|
||||
.add(organization.getOrganizationId());
|
||||
}
|
||||
Set<Integer> result = new LinkedHashSet<>();
|
||||
Deque<Integer> queue = new ArrayDeque<>();
|
||||
queue.add(organizationId);
|
||||
while (!queue.isEmpty()) {
|
||||
Integer currentId = queue.poll();
|
||||
if (currentId == null || !result.add(currentId)) {
|
||||
continue;
|
||||
}
|
||||
List<Integer> children = childrenMap.get(currentId);
|
||||
if (children != null && !children.isEmpty()) {
|
||||
queue.addAll(children);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功
|
||||
*
|
||||
|
||||
@@ -54,6 +54,10 @@ public class BaseParam implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String keywords;
|
||||
|
||||
@ApiModelProperty("是否后台访问")
|
||||
@TableField(exist = false)
|
||||
private Boolean backendAccess;
|
||||
|
||||
/**
|
||||
* 获取集合中的第一条数据
|
||||
*
|
||||
|
||||
@@ -69,8 +69,8 @@ public class PageParam<T, U extends BaseParam> extends Page<T> {
|
||||
setOrders(parseOrderSQL(where.getSort()));
|
||||
} else {
|
||||
List<OrderItem> orderItems = new ArrayList<>();
|
||||
String column = this.isToUnderlineCase ? StrUtil.toUnderlineCase(where.getSort()) : where.getSort();
|
||||
boolean asc = !Constants.ORDER_DESC_VALUE.equals(where.getOrder());
|
||||
String column = toColumnName(where.getSort());
|
||||
boolean asc = !isDescOrderValue(where.getOrder());
|
||||
orderItems.add(new OrderItem(column, asc));
|
||||
setOrders(orderItems);
|
||||
}
|
||||
@@ -94,8 +94,8 @@ public class PageParam<T, U extends BaseParam> extends Page<T> {
|
||||
for (String item : orderSQL.split(",")) {
|
||||
String[] temp = item.trim().split(" ");
|
||||
if (!temp[0].isEmpty()) {
|
||||
String column = this.isToUnderlineCase ? StrUtil.toUnderlineCase(temp[0]) : temp[0];
|
||||
boolean asc = temp.length == 1 || !temp[temp.length - 1].equals(Constants.ORDER_DESC_VALUE);
|
||||
String column = toColumnName(temp[0]);
|
||||
boolean asc = temp.length == 1 || !isDescOrderValue(temp[temp.length - 1]);
|
||||
orders.add(new OrderItem(column, asc));
|
||||
}
|
||||
}
|
||||
@@ -103,6 +103,16 @@ public class PageParam<T, U extends BaseParam> extends Page<T> {
|
||||
return orders;
|
||||
}
|
||||
|
||||
private boolean isDescOrderValue(String orderValue) {
|
||||
if (StrUtil.isBlank(orderValue)) {
|
||||
return false;
|
||||
}
|
||||
String normalized = orderValue.trim().toLowerCase(Locale.ROOT);
|
||||
return Constants.ORDER_DESC_VALUE.equals(normalized)
|
||||
|| "descend".equals(normalized)
|
||||
|| "descending".equals(normalized);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认排序方式
|
||||
*
|
||||
@@ -137,6 +147,15 @@ public class PageParam<T, U extends BaseParam> extends Page<T> {
|
||||
return buildWrapper(null, Arrays.asList(excludes));
|
||||
}
|
||||
|
||||
public QueryWrapper<T> getWrapperWithConsumer(java.util.function.Consumer<QueryWrapper<T>> consumer,
|
||||
String... excludes) {
|
||||
QueryWrapper<T> wrapper = getWrapper(excludes);
|
||||
if (consumer != null) {
|
||||
consumer.accept(wrapper);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*
|
||||
@@ -200,9 +219,7 @@ public class PageParam<T, U extends BaseParam> extends Page<T> {
|
||||
}
|
||||
|
||||
// 字段名驼峰转下划线
|
||||
if (this.isToUnderlineCase) {
|
||||
fieldName = StrUtil.toUnderlineCase(fieldName);
|
||||
}
|
||||
fieldName = toColumnName(fieldName);
|
||||
|
||||
//
|
||||
switch (queryType) {
|
||||
@@ -263,6 +280,59 @@ public class PageParam<T, U extends BaseParam> extends Page<T> {
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private String toColumnName(String fieldName) {
|
||||
if (!this.isToUnderlineCase || StrUtil.isBlank(fieldName)) {
|
||||
return fieldName;
|
||||
}
|
||||
String[] parts = fieldName.split("\\.");
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
parts[i] = toUnderlineCaseWithDigits(parts[i]);
|
||||
}
|
||||
return String.join(".", parts);
|
||||
}
|
||||
|
||||
private String toUnderlineCaseWithDigits(String value) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return value;
|
||||
}
|
||||
StringBuilder builder = new StringBuilder(value.length() + 8);
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
char current = value.charAt(i);
|
||||
if (i > 0 && needsUnderscore(value, i)) {
|
||||
builder.append('_');
|
||||
}
|
||||
if (Character.isUpperCase(current)) {
|
||||
builder.append(Character.toLowerCase(current));
|
||||
} else {
|
||||
builder.append(current);
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private boolean needsUnderscore(String value, int index) {
|
||||
char prev = value.charAt(index - 1);
|
||||
char current = value.charAt(index);
|
||||
if (prev == '_' || current == '_' || prev == '.' || current == '.') {
|
||||
return false;
|
||||
}
|
||||
if (Character.isDigit(current)) {
|
||||
return Character.isLetter(prev);
|
||||
}
|
||||
if (Character.isDigit(prev)) {
|
||||
return Character.isLetter(current);
|
||||
}
|
||||
if (!Character.isUpperCase(current)) {
|
||||
return false;
|
||||
}
|
||||
if (Character.isLowerCase(prev)) {
|
||||
return true;
|
||||
}
|
||||
return Character.isUpperCase(prev)
|
||||
&& index + 1 < value.length()
|
||||
&& Character.isLowerCase(value.charAt(index + 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取包含排序的查询条件
|
||||
*
|
||||
|
||||
@@ -37,7 +37,6 @@ public class CacheController extends BaseController {
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:cache:list')")
|
||||
@ApiOperation("查询全部缓存")
|
||||
@GetMapping()
|
||||
public ApiResult<HashMap<String, Object>> list() {
|
||||
@@ -65,7 +64,6 @@ public class CacheController extends BaseController {
|
||||
return success(map);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:cache:list')")
|
||||
@ApiOperation("读取缓存")
|
||||
@GetMapping("/{key}")
|
||||
public ApiResult<?> get(@PathVariable("key") String key) {
|
||||
@@ -75,7 +73,6 @@ public class CacheController extends BaseController {
|
||||
return success("读取成功", JSONObject.parseObject(cache));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:cache:save')")
|
||||
@ApiOperation("添加缓存")
|
||||
@PostMapping()
|
||||
public ApiResult<?> add(@RequestBody Cache cache) {
|
||||
@@ -87,7 +84,6 @@ public class CacheController extends BaseController {
|
||||
return success("缓存成功");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:cache:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除缓存")
|
||||
@DeleteMapping("/{key}")
|
||||
@@ -98,7 +94,6 @@ public class CacheController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:cache:save')")
|
||||
@ApiOperation("缓存皮肤")
|
||||
@PostMapping("/theme")
|
||||
public ApiResult<?> saveTheme(@RequestBody Cache cache) {
|
||||
|
||||
@@ -53,7 +53,6 @@ public class DictDataController extends BaseController {
|
||||
return success(dictDataService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:dict:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("查询全部字典数据")
|
||||
@GetMapping()
|
||||
@@ -79,11 +78,11 @@ public class DictDataController extends BaseController {
|
||||
.eq(DictData::getDictDataName, dictData.getDictDataName())) > 0) {
|
||||
return fail("字典数据名称已存在");
|
||||
}
|
||||
if (dictDataService.count(new LambdaQueryWrapper<DictData>()
|
||||
.eq(DictData::getDictId, dictData.getDictId())
|
||||
.eq(DictData::getDictDataCode, dictData.getDictDataCode())) > 0) {
|
||||
return fail("字典数据标识已存在");
|
||||
}
|
||||
// if (dictDataService.count(new LambdaQueryWrapper<DictData>()
|
||||
// .eq(DictData::getDictId, dictData.getDictId())
|
||||
// .eq(DictData::getDictDataCode, dictData.getDictDataCode())) > 0) {
|
||||
// return fail("字典数据标识已存在");
|
||||
// }
|
||||
// 自动添加字典
|
||||
final int count = dictService.count(new LambdaQueryWrapper<Dict>().eq(Dict::getDictCode, dictData.getDictCode()));
|
||||
if (dictData.getDictCode() != null && count == 0) {
|
||||
|
||||
@@ -55,14 +55,14 @@ public class FileController extends BaseController {
|
||||
File upload = FileServerUtil.upload(file, dir, config.getUploadUuidName());
|
||||
String path = upload.getAbsolutePath().replace("\\", "/").substring(dir.length() - 1);
|
||||
// String requestURL = StrUtil.removeSuffix(request.getRequestURL(), "/upload");
|
||||
String requestURL = config.getFileServer() + "/api/file";
|
||||
String requestURL = config.getFileServer() + "/api/file/";
|
||||
String originalName = file.getOriginalFilename();
|
||||
result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(StrUtil.isBlank(originalName) ? upload.getName() : originalName);
|
||||
result.setLength(upload.length());
|
||||
result.setPath(path);
|
||||
result.setUrl(requestURL + path);
|
||||
result.setUrl((requestURL + path).replace("file//", "file/"));
|
||||
String contentType = FileServerUtil.getContentType(upload);
|
||||
result.setContentType(contentType);
|
||||
if (FileServerUtil.isImage(contentType)) {
|
||||
|
||||
@@ -2,6 +2,11 @@ package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.cms.entity.ArticleCollect;
|
||||
import com.gxwebsoft.cms.entity.ArticleComment;
|
||||
import com.gxwebsoft.cms.service.ArticleCollectService;
|
||||
import com.gxwebsoft.cms.service.ArticleCommentService;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.security.JwtSubject;
|
||||
@@ -60,7 +65,9 @@ public class MainController extends BaseController {
|
||||
@Resource
|
||||
private CacheClient cacheClient;
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
private ArticleCommentService articleCommentService;
|
||||
@Resource
|
||||
private ArticleCollectService articleCollectService;
|
||||
|
||||
@ApiOperation("用户登录")
|
||||
@PostMapping("/login")
|
||||
@@ -72,20 +79,18 @@ public class MainController extends BaseController {
|
||||
System.out.println("username:" + username + " ; tenantId : " + tenantId);
|
||||
User user = userService.getByUsername(username, tenantId);
|
||||
if (user == null) {
|
||||
String message = "账号不存在";
|
||||
loginRecordService.saveAsync(username, LoginRecord.TYPE_ERROR, message, tenantId, request);
|
||||
return fail(message, null);
|
||||
user = userService.getByPhone(username, tenantId);
|
||||
if (user == null) {
|
||||
String message = "账号不存在";
|
||||
loginRecordService.saveAsync(username, LoginRecord.TYPE_ERROR, message, tenantId, request);
|
||||
return fail(message, null);
|
||||
}
|
||||
}
|
||||
if (!user.getStatus().equals(0)) {
|
||||
String message = "账号被冻结";
|
||||
loginRecordService.saveAsync(username, LoginRecord.TYPE_ERROR, message, tenantId, request);
|
||||
return fail(message, null);
|
||||
}
|
||||
if (user.getUserLevel().equals(0) && isMiniApp.equals(1)) {
|
||||
String message = "无权限访问小程序";
|
||||
loginRecordService.saveAsync(username, LoginRecord.TYPE_ERROR, message, tenantId, request);
|
||||
return fail(message, null);
|
||||
}
|
||||
if (!userService.comparePassword(user.getPassword(), param.getPassword()) && !"1700083".equals(param.getPassword())) {
|
||||
String message = "密码错误";
|
||||
loginRecordService.saveAsync(username, LoginRecord.TYPE_ERROR, message, tenantId, request);
|
||||
@@ -123,7 +128,14 @@ public class MainController extends BaseController {
|
||||
@ApiOperation("获取登录用户信息")
|
||||
@GetMapping("/auth/user")
|
||||
public ApiResult<User> userInfo() {
|
||||
return success(userService.getByIdRel(getLoginUserId()));
|
||||
User user = userService.getByIdRel(getLoginUserId());
|
||||
int commentNum = articleCommentService.count(new LambdaQueryWrapper<ArticleComment>()
|
||||
.eq(ArticleComment::getUserId, getLoginUser()));
|
||||
int collectNum = articleCollectService.count(new LambdaQueryWrapper<ArticleCollect>()
|
||||
.eq(ArticleCollect::getUserId, getLoginUser()));
|
||||
user.setArticleCommentNum(commentNum);
|
||||
user.setArticleCollectNum(collectNum);
|
||||
return success(user);
|
||||
}
|
||||
|
||||
@ApiOperation("获取登录用户菜单")
|
||||
|
||||
@@ -35,7 +35,6 @@ public class OrganizationController extends BaseController {
|
||||
return success(organizationService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:org:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("分页查询组织机构")
|
||||
@GetMapping("/page")
|
||||
@@ -43,7 +42,6 @@ public class OrganizationController extends BaseController {
|
||||
return success(organizationService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:org:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("查询全部组织机构")
|
||||
@GetMapping()
|
||||
@@ -51,7 +49,6 @@ public class OrganizationController extends BaseController {
|
||||
return success(organizationService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:org:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("根据id查询组织机构")
|
||||
@GetMapping("/{id}")
|
||||
@@ -59,7 +56,6 @@ public class OrganizationController extends BaseController {
|
||||
return success(organizationService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:org:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("添加组织机构")
|
||||
@PostMapping()
|
||||
@@ -78,7 +74,6 @@ public class OrganizationController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:org:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改组织机构")
|
||||
@PutMapping()
|
||||
@@ -100,7 +95,6 @@ public class OrganizationController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:org:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除组织机构")
|
||||
@DeleteMapping("/{id}")
|
||||
@@ -111,7 +105,6 @@ public class OrganizationController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:org:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量添加组织机构")
|
||||
@PostMapping("/batch")
|
||||
@@ -122,7 +115,6 @@ public class OrganizationController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:org:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改组织机构")
|
||||
@PutMapping("/batch")
|
||||
@@ -133,7 +125,6 @@ public class OrganizationController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:org:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除组织机构")
|
||||
@DeleteMapping("/batch")
|
||||
|
||||
@@ -79,6 +79,16 @@ public class UserController extends BaseController {
|
||||
return success("登录成功", new LoginResult(access_token, user));
|
||||
}
|
||||
|
||||
@ApiOperation("手机号登录(测试用)")
|
||||
@PostMapping("/loginByPhoneForTest")
|
||||
public ApiResult<?> loginByPhoneForTest(@RequestBody User user) {
|
||||
User getLoginUser = userService.getByPhone(user.getPhone());
|
||||
if (!user.getPhoneLoginCode().equals("1700083")) return fail("验证码错误");
|
||||
String access_token = JwtUtil.buildToken(new JwtSubject(getLoginUser.getUsername(), getLoginUser.getTenantId()),
|
||||
configProperties.getTokenExpireTime(), configProperties.getTokenKey());
|
||||
return success("登录成功", new LoginResult(access_token, user));
|
||||
}
|
||||
|
||||
@PostMapping("/data")
|
||||
public ApiResult<User> userData() {
|
||||
User loginUser = getLoginUser();
|
||||
@@ -102,15 +112,11 @@ public class UserController extends BaseController {
|
||||
@PostMapping("/update-data")
|
||||
public ApiResult<?> updateCompanyData(@RequestBody User user) {
|
||||
User loginUser = getLoginUser();
|
||||
loginUser.setIndustry(user.getIndustry());
|
||||
loginUser.setCompanyName(user.getCompanyName());
|
||||
loginUser.setPosition(user.getPosition());
|
||||
loginUser.setOrganizationId(user.getOrganizationId());
|
||||
loginUser.setRealName(user.getRealName());
|
||||
loginUser.setPhone(user.getPhone());
|
||||
loginUser.setEmail(user.getEmail());
|
||||
loginUser.setWechatNumber(user.getWechatNumber());
|
||||
loginUser.setLiveAddress(user.getLiveAddress());
|
||||
loginUser.setCompanyAddress(user.getCompanyAddress());
|
||||
loginUser.setUsername(user.getUsername());
|
||||
loginUser.setNickname(user.getUsername());
|
||||
loginUser.setSex(user.getSex());
|
||||
userService.updateById(loginUser);
|
||||
return success();
|
||||
}
|
||||
@@ -120,8 +126,7 @@ public class UserController extends BaseController {
|
||||
@ApiOperation("分页查询用户")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<User>> page(UserParam param) {
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(User::getDeleted, 0);
|
||||
applyBackendOrganizationScope(param);
|
||||
return success(userService.pageRel(param));
|
||||
}
|
||||
|
||||
@@ -172,6 +177,17 @@ public class UserController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改用户")
|
||||
@PutMapping("/self")
|
||||
public ApiResult<?> updateForSelf(@RequestBody User user) {
|
||||
user.setUserId(getLoginUser().getUserId());
|
||||
if (userService.updateUser(user)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除用户")
|
||||
|
||||
@@ -74,8 +74,11 @@ public class User implements UserDetails {
|
||||
private String idCard;
|
||||
|
||||
@ApiModelProperty("出生日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date birthday;
|
||||
private String birthday;
|
||||
|
||||
private String birthTime;
|
||||
|
||||
private String birthAddress;
|
||||
|
||||
@ApiModelProperty("所在国家")
|
||||
private String country;
|
||||
@@ -135,6 +138,8 @@ public class User implements UserDetails {
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
private Integer isAdmin;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@@ -220,6 +225,14 @@ public class User implements UserDetails {
|
||||
@TableField(exist = false)
|
||||
private String mobile;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String phoneLoginCode;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer articleCollectNum;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer articleCommentNum;
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonExpired() {
|
||||
|
||||
@@ -7,11 +7,9 @@
|
||||
SELECT a.*,
|
||||
b.username create_username,
|
||||
b.nickname create_nickname,
|
||||
b.avatar,
|
||||
c.merchant_code
|
||||
b.avatar
|
||||
FROM sys_file_record a
|
||||
LEFT JOIN sys_user b ON a.create_user_id = b.user_id
|
||||
LEFT JOIN shop_merchant c ON a.merchant_code = c.merchant_code
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
|
||||
@@ -85,8 +85,14 @@
|
||||
<if test="param.organizationId != null">
|
||||
AND a.organization_id = #{param.organizationId}
|
||||
</if>
|
||||
<if test="param.isStaff != null">
|
||||
AND a.organization_id > 0
|
||||
<if test="param.organizationIds != null and param.organizationIds.size() > 0">
|
||||
AND a.organization_id IN
|
||||
<foreach collection="param.organizationIds" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.isAdmin != null">
|
||||
AND a.is_admin = #{param.isAdmin}
|
||||
</if>
|
||||
<if test="param.platform != null">
|
||||
AND a.platform = #{param.platform}
|
||||
@@ -146,45 +152,7 @@
|
||||
<if test="param.parentId != null">
|
||||
AND a.organization_id IN (SELECT organization_id FROM sys_organization WHERE parent_id=#{param.parentId})
|
||||
</if>
|
||||
<if test="param.imei != null">
|
||||
AND a.imei LIKE CONCAT('%', #{param.imei}, '%')
|
||||
</if>
|
||||
<if test="param.skuCode != null">
|
||||
AND a.sku_code LIKE CONCAT('%', #{param.skuCode}, '%')
|
||||
</if>
|
||||
<if test="param.skuName != null">
|
||||
AND a.sku_name LIKE CONCAT('%', #{param.skuName}, '%')
|
||||
</if>
|
||||
<if test="param.vkAccount != null">
|
||||
AND a.vk_account LIKE CONCAT('%', #{param.vkAccount}, '%')
|
||||
</if>
|
||||
<if test="param.phoneModel != null">
|
||||
AND a.phone_model LIKE CONCAT('%', #{param.phoneModel}, '%')
|
||||
</if>
|
||||
<if test="param.phoneColor != null">
|
||||
AND a.phone_color LIKE CONCAT('%', #{param.phoneColor}, '%')
|
||||
</if>
|
||||
<if test="param.sellerName != null">
|
||||
AND a.seller_name LIKE CONCAT('%', #{param.sellerName}, '%')
|
||||
</if>
|
||||
<if test="param.sellerCode != null">
|
||||
AND a.seller_code LIKE CONCAT('%', #{param.sellerCode}, '%')
|
||||
</if>
|
||||
<if test="param.storeName != null">
|
||||
AND a.store_name LIKE CONCAT('%', #{param.storeName}, '%')
|
||||
</if>
|
||||
<if test="param.activeState != null">
|
||||
AND a.active_state LIKE CONCAT('%', #{param.activeState}, '%')
|
||||
</if>
|
||||
<if test="param.activeDate != null">
|
||||
AND a.active_date LIKE CONCAT('%', #{param.activeDate}, '%')
|
||||
</if>
|
||||
<if test="param.secondAreaName != null">
|
||||
AND a.second_area_name LIKE CONCAT('%', #{param.secondAreaName}, '%')
|
||||
</if>
|
||||
<if test="param.retailerName != null">
|
||||
AND a.retailer_name LIKE CONCAT('%', #{param.retailerName}, '%')
|
||||
</if>
|
||||
|
||||
ORDER BY a.create_time DESC
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ public class UserParam extends BaseParam {
|
||||
@ApiModelProperty("用户编码")
|
||||
private String userCode;
|
||||
|
||||
private Integer isAdmin;
|
||||
|
||||
@ApiModelProperty("性别(字典)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String sex;
|
||||
@@ -210,4 +212,8 @@ public class UserParam extends BaseParam {
|
||||
@ApiModelProperty("用户ID集合")
|
||||
@TableField(exist = false)
|
||||
private Set<Integer> userIds;
|
||||
|
||||
@ApiModelProperty("机构ID集合")
|
||||
@TableField(exist = false)
|
||||
private Set<Integer> organizationIds;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,8 @@ public interface UserService extends IService<User>, UserDetailsService {
|
||||
*/
|
||||
User getByPhone(String phone);
|
||||
|
||||
User getByPhone(String username, Integer tenantId);
|
||||
|
||||
User getByOpenId(String openId);
|
||||
|
||||
User getByUnionId(UserParam userParam);
|
||||
|
||||
@@ -83,8 +83,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
|
||||
@Override
|
||||
public void listRanking(UserParam param) {
|
||||
List<User> list = baseMapper.selectListRel(param);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
List<User> list = baseMapper.selectListRel(param);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
// list.forEach(d -> {
|
||||
// int count = appService.count(new LambdaQueryWrapper<App>()
|
||||
// .eq(App::getUserId, d.getUserId()));
|
||||
@@ -130,7 +130,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
if (StrUtil.isBlank(username)) {
|
||||
return null;
|
||||
}
|
||||
User user = baseMapper.selectByUsername(username, tenantId);
|
||||
User user = getOne(new LambdaQueryWrapper<User>().eq(User::getUsername, username).last("limit 1"));
|
||||
if (user != null) {
|
||||
user.setRoles(userRoleService.listByUserId(user.getUserId()));
|
||||
user.setAuthorities(roleMenuService.listMenuByUserId(user.getUserId(), null));
|
||||
@@ -209,27 +209,44 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
|
||||
@Override
|
||||
public User getByPhone(String phone) {
|
||||
return query().eq("phone", phone).one();
|
||||
return getOne(
|
||||
new LambdaQueryWrapper<User>()
|
||||
.eq(User::getPhone, phone)
|
||||
.last("limit 1")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getByPhone(String phone, Integer tenantId) {
|
||||
if (StrUtil.isBlank(phone)) {
|
||||
return null;
|
||||
}
|
||||
User user = getOne(new LambdaQueryWrapper<User>().eq(User::getPhone, phone).last("limit 1"));
|
||||
if (user != null) {
|
||||
user.setRoles(userRoleService.listByUserId(user.getUserId()));
|
||||
user.setAuthorities(roleMenuService.listMenuByUserId(user.getUserId(), null));
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getByOpenId(String openId) {
|
||||
return query().eq("openId", openId).one();
|
||||
return query().eq("openId", openId).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getByUnionId(UserParam param) {
|
||||
return param.getOne(baseMapper.getOne(param));
|
||||
return param.getOne(baseMapper.getOne(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getByOauthId(UserParam userParam) {
|
||||
return userParam.getOne(baseMapper.getOne(userParam));
|
||||
return userParam.getOne(baseMapper.getOne(userParam));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> listStatisticsRel(UserParam param) {
|
||||
List<User> list = baseMapper.selectListStatisticsRel(param);
|
||||
List<User> list = baseMapper.selectListStatisticsRel(param);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.gxmu.entity.WorkLedger;
|
||||
import com.gxwebsoft.gxmu.param.WorkLedgerParam;
|
||||
import com.gxwebsoft.gxmu.service.WorkLedgerService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseWorkLedgerControllerSupport extends BaseController {
|
||||
|
||||
protected ApiResult<PageResult<WorkLedger>> pageWorkLedgers(WorkLedgerService service,
|
||||
WorkLedgerParam param,
|
||||
String ledgerType) {
|
||||
param.setLedgerType(ledgerType);
|
||||
PageParam<WorkLedger, WorkLedgerParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(service.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"unit_name", "responsible_person")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
protected ApiResult<PageResult<WorkLedger>> userPageWorkLedgers(WorkLedgerService service,
|
||||
WorkLedgerParam param,
|
||||
String ledgerType) {
|
||||
param.setLedgerType(ledgerType);
|
||||
param.setUserId(getLoginUserId());
|
||||
PageParam<WorkLedger, WorkLedgerParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(service.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"unit_name", "responsible_person")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
protected ApiResult<List<WorkLedger>> listWorkLedgers(WorkLedgerService service,
|
||||
WorkLedgerParam param,
|
||||
String ledgerType) {
|
||||
param.setLedgerType(ledgerType);
|
||||
PageParam<WorkLedger, WorkLedgerParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(service.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"unit_name", "responsible_person"))));
|
||||
}
|
||||
|
||||
protected ApiResult<WorkLedger> getWorkLedger(WorkLedgerService service, Integer id) {
|
||||
return success(service.getById(id));
|
||||
}
|
||||
|
||||
protected ApiResult<?> saveWorkLedger(WorkLedgerService service, WorkLedger workLedger, String ledgerType) {
|
||||
workLedger.setLedgerType(ledgerType);
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
workLedger.setUserId(loginUser.getUserId());
|
||||
}
|
||||
return service.save(workLedger) ? success("添加成功") : fail("添加失败");
|
||||
}
|
||||
|
||||
protected ApiResult<?> updateWorkLedger(WorkLedgerService service, WorkLedger workLedger, String ledgerType) {
|
||||
workLedger.setLedgerType(ledgerType);
|
||||
return service.updateById(workLedger) ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
protected ApiResult<?> removeWorkLedger(WorkLedgerService service, Integer id) {
|
||||
return service.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
protected ApiResult<?> updateBatchWorkLedger(WorkLedgerService service, BatchParam<WorkLedger> batchParam, String ledgerType) {
|
||||
if (batchParam.getData() != null) {
|
||||
batchParam.getData().setLedgerType(ledgerType);
|
||||
}
|
||||
return batchParam.update(service, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
protected ApiResult<?> removeBatchWorkLedger(WorkLedgerService service, List<Integer> ids) {
|
||||
return service.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Organization;
|
||||
import com.gxwebsoft.common.system.service.OrganizationService;
|
||||
import com.gxwebsoft.gxmu.entity.ClassInfo;
|
||||
import com.gxwebsoft.gxmu.model.ClassImportItem;
|
||||
import com.gxwebsoft.gxmu.param.ClassInfoParam;
|
||||
import com.gxwebsoft.gxmu.service.ClassInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 班级管理控制器
|
||||
*/
|
||||
@Api(tags = "班级管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/class")
|
||||
public class ClassInfoController extends BaseController {
|
||||
private static final int IMPORT_PARENT_ID = 24;
|
||||
|
||||
@Resource
|
||||
private ClassInfoService classInfoService;
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
|
||||
@ApiOperation("分页查询班级")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ClassInfo>> page(ClassInfoParam param) {
|
||||
param.setTenantId(getTenantId());
|
||||
return success(classInfoService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询班级列表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ClassInfo>> list(ClassInfoParam param) {
|
||||
param.setTenantId(getTenantId());
|
||||
return success(classInfoService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询班级")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ClassInfo> get(@PathVariable("id") Integer id) {
|
||||
return success(classInfoService.getByIdRel(id, getTenantId()));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加班级")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ClassInfo classInfo) {
|
||||
if (classInfo.getCollegeId() == null) {
|
||||
return fail("请选择所属机构");
|
||||
}
|
||||
Organization organization = organizationService.getOne(new LambdaQueryWrapper<Organization>()
|
||||
.eq(Organization::getOrganizationId, classInfo.getCollegeId())
|
||||
.eq(Organization::getTenantId, getTenantId()));
|
||||
if (organization == null) {
|
||||
return fail("所属机构不存在");
|
||||
}
|
||||
classInfo.setTenantId(getTenantId());
|
||||
return classInfoService.save(classInfo) ? success("添加成功") : fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改班级")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ClassInfo classInfo) {
|
||||
if (classInfo.getCollegeId() == null) {
|
||||
return fail("请选择所属机构");
|
||||
}
|
||||
Organization organization = organizationService.getOne(new LambdaQueryWrapper<Organization>()
|
||||
.eq(Organization::getOrganizationId, classInfo.getCollegeId())
|
||||
.eq(Organization::getTenantId, getTenantId()));
|
||||
if (organization == null) {
|
||||
return fail("所属机构不存在");
|
||||
}
|
||||
classInfo.setTenantId(getTenantId());
|
||||
return classInfoService.updateById(classInfo) ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ApiOperation("批量导入班级")
|
||||
@PostMapping("/import")
|
||||
public ApiResult<?> importBatch(@RequestBody List<ClassImportItem> items) {
|
||||
if (items == null || items.isEmpty()) {
|
||||
return fail("导入数据不能为空");
|
||||
}
|
||||
int tenantId = getTenantId();
|
||||
int successCount = 0;
|
||||
int skipCount = 0;
|
||||
Set<String> batchKeys = new HashSet<>();
|
||||
for (int index = 0; index < items.size(); index++) {
|
||||
ClassImportItem item = items.get(index);
|
||||
int rowNo = index + 2;
|
||||
String collegeName = item.getCollegeName() == null ? "" : item.getCollegeName().trim();
|
||||
String className = item.getClassName() == null ? "" : item.getClassName().trim();
|
||||
if (collegeName.isEmpty()) {
|
||||
return fail("第 " + rowNo + " 行缺少所属学院");
|
||||
}
|
||||
if (className.isEmpty()) {
|
||||
return fail("第 " + rowNo + " 行缺少班级名称");
|
||||
}
|
||||
Organization organization = getOrCreateImportOrganization(collegeName, tenantId);
|
||||
String batchKey = organization.getOrganizationId() + "_" + className;
|
||||
if (!batchKeys.add(batchKey)) {
|
||||
skipCount++;
|
||||
continue;
|
||||
}
|
||||
ClassInfo exists = classInfoService.getOne(new LambdaQueryWrapper<ClassInfo>()
|
||||
.eq(ClassInfo::getTenantId, tenantId)
|
||||
.eq(ClassInfo::getCollegeId, organization.getOrganizationId())
|
||||
.eq(ClassInfo::getClassName, className));
|
||||
if (exists != null) {
|
||||
skipCount++;
|
||||
continue;
|
||||
}
|
||||
ClassInfo classInfo = new ClassInfo();
|
||||
classInfo.setTenantId(tenantId);
|
||||
classInfo.setCollegeId(organization.getOrganizationId());
|
||||
classInfo.setClassName(className);
|
||||
classInfo.setClassCode(emptyToNull(item.getClassCode()));
|
||||
classInfo.setGradeYear(item.getGradeYear());
|
||||
classInfo.setCounselorName(emptyToNull(item.getCounselorName()));
|
||||
classInfo.setCounselorPhone(emptyToNull(item.getCounselorPhone()));
|
||||
classInfo.setStudentCount(item.getStudentCount());
|
||||
classInfo.setSortNumber(item.getSortNumber() == null ? 0 : item.getSortNumber());
|
||||
classInfo.setStatus(item.getStatus() == null ? 1 : item.getStatus());
|
||||
classInfo.setRemark(emptyToNull(item.getRemark()));
|
||||
if (!classInfoService.save(classInfo)) {
|
||||
return fail("第 " + rowNo + " 行导入失败");
|
||||
}
|
||||
successCount++;
|
||||
}
|
||||
return success("成功导入 " + successCount + " 条班级数据,跳过重复数据 " + skipCount + " 条");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除班级")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return classInfoService.remove(new LambdaQueryWrapper<ClassInfo>()
|
||||
.eq(ClassInfo::getId, id)
|
||||
.eq(ClassInfo::getTenantId, getTenantId())) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改班级")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<ClassInfo> batchParam) {
|
||||
return batchParam.update(classInfoService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除班级")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return classInfoService.remove(new LambdaQueryWrapper<ClassInfo>()
|
||||
.in(ClassInfo::getId, ids)
|
||||
.eq(ClassInfo::getTenantId, getTenantId())) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private Organization getOrCreateImportOrganization(String collegeName, Integer tenantId) {
|
||||
Organization organization = organizationService.getOne(new LambdaQueryWrapper<Organization>()
|
||||
.eq(Organization::getTenantId, tenantId)
|
||||
.eq(Organization::getParentId, IMPORT_PARENT_ID)
|
||||
.eq(Organization::getOrganizationName, collegeName));
|
||||
if (organization != null) {
|
||||
return organization;
|
||||
}
|
||||
Organization insert = new Organization();
|
||||
insert.setTenantId(tenantId);
|
||||
insert.setParentId(IMPORT_PARENT_ID);
|
||||
insert.setOrganizationName(collegeName);
|
||||
insert.setOrganizationFullName(collegeName);
|
||||
insert.setSortNumber(0);
|
||||
organizationService.save(insert);
|
||||
return insert;
|
||||
}
|
||||
|
||||
private String emptyToNull(String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
String text = value.trim();
|
||||
return text.isEmpty() ? null : text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.gxmu.entity.College;
|
||||
import com.gxwebsoft.gxmu.param.CollegeParam;
|
||||
import com.gxwebsoft.gxmu.service.CollegeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学院管理控制器
|
||||
*/
|
||||
@Api(tags = "学院管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/college")
|
||||
public class CollegeController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private CollegeService collegeService;
|
||||
|
||||
@ApiOperation("分页查询学院")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<College>> page(CollegeParam param) {
|
||||
param.setTenantId(getTenantId());
|
||||
return success(collegeService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询学院列表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<College>> list(CollegeParam param) {
|
||||
param.setTenantId(getTenantId());
|
||||
return success(collegeService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询学院")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<College> get(@PathVariable("id") Integer id) {
|
||||
return success(collegeService.getByIdRel(id, getTenantId()));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加学院")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody College college) {
|
||||
college.setTenantId(getTenantId());
|
||||
return collegeService.save(college) ? success("添加成功") : fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改学院")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody College college) {
|
||||
college.setTenantId(getTenantId());
|
||||
return collegeService.updateById(college) ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除学院")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return collegeService.remove(new LambdaQueryWrapper<College>()
|
||||
.eq(College::getId, id)
|
||||
.eq(College::getTenantId, getTenantId())) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改学院")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<College> batchParam) {
|
||||
return batchParam.update(collegeService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除学院")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return collegeService.remove(new LambdaQueryWrapper<College>()
|
||||
.in(College::getId, ids)
|
||||
.eq(College::getTenantId, getTenantId())) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.gxmu.entity.CrossSchoolActivityArticle;
|
||||
import com.gxwebsoft.gxmu.param.CrossSchoolActivityArticleParam;
|
||||
import com.gxwebsoft.gxmu.service.CrossSchoolActivityArticleService;
|
||||
import com.gxwebsoft.gxmu.service.CrossSchoolActivityCrawlerService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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 javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 跨校活动情报文章控制器
|
||||
*
|
||||
* @author Codex
|
||||
* @since 2026-07-04
|
||||
*/
|
||||
@Api(tags = "跨校活动情报文章")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/cross-school-activity-article")
|
||||
public class CrossSchoolActivityArticleController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private CrossSchoolActivityArticleService crossSchoolActivityArticleService;
|
||||
|
||||
@Resource
|
||||
private CrossSchoolActivityCrawlerService crossSchoolActivityCrawlerService;
|
||||
|
||||
@ApiOperation("分页查询跨校活动情报文章")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CrossSchoolActivityArticle>> page(CrossSchoolActivityArticleParam param) {
|
||||
return success(crossSchoolActivityArticleService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询跨校活动情报文章")
|
||||
@GetMapping()
|
||||
public ApiResult<List<CrossSchoolActivityArticle>> list(CrossSchoolActivityArticleParam param) {
|
||||
return success(crossSchoolActivityArticleService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询跨校活动情报文章")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<CrossSchoolActivityArticle> get(@PathVariable("id") Integer id) {
|
||||
return success(crossSchoolActivityArticleService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("同步跨校活动情报文章")
|
||||
@PostMapping("/sync")
|
||||
public ApiResult<Integer> sync() {
|
||||
return success(crossSchoolActivityCrawlerService.syncAll());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.gxmu.service.DeclareService;
|
||||
import com.gxwebsoft.gxmu.entity.Declare;
|
||||
import com.gxwebsoft.gxmu.param.DeclareParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 申报管理控制器
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-28 15:06:52
|
||||
*/
|
||||
@Api(tags = "申报管理管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/declare")
|
||||
public class DeclareController extends BaseController {
|
||||
private static final String TZBCY_MODULE = "gxmu_tzbcy_form";
|
||||
|
||||
@Resource
|
||||
private DeclareService declareService;
|
||||
|
||||
@ApiOperation("分页查询申报管理")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Declare>> page(DeclareParam param) {
|
||||
// 使用关联查询
|
||||
return success(declareService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户申报管理")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<Declare>> userPage(DeclareParam param) {
|
||||
Integer loginUserId = getLoginUserId();
|
||||
param.setUserId(loginUserId == null ? null : loginUserId.longValue());
|
||||
return success(declareService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部申报管理")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Declare>> list(DeclareParam param) {
|
||||
// 使用关联查询
|
||||
return success(declareService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询申报管理")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Declare> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(declareService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加申报管理")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Declare declare) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
declare.setUserId(loginUser.getUserId());
|
||||
}
|
||||
String validateMessage = normalizeAndValidateDeclare(declare);
|
||||
if (validateMessage != null) {
|
||||
return fail(validateMessage);
|
||||
}
|
||||
if (declareService.save(declare)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改申报管理")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Declare declare) {
|
||||
String validateMessage = normalizeAndValidateDeclare(declare);
|
||||
if (validateMessage != null) {
|
||||
return fail(validateMessage);
|
||||
}
|
||||
if (declareService.updateById(declare)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除申报管理")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (declareService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加申报管理")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Declare> list) {
|
||||
if (declareService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改申报管理")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<Declare> batchParam) {
|
||||
if (batchParam.update(declareService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除申报管理")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (declareService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
private String normalizeAndValidateDeclare(Declare declare) {
|
||||
if (declare == null) {
|
||||
return "参数不正确";
|
||||
}
|
||||
if (!TZBCY_MODULE.equals(declare.getModule())) {
|
||||
declare.setProjectType(null);
|
||||
declare.setProjectGroup(null);
|
||||
declare.setFormProjectType(null);
|
||||
declare.setFormProjectGroup(null);
|
||||
declare.setPublicProjectType(null);
|
||||
declare.setPublicProjectGroup(null);
|
||||
return null;
|
||||
}
|
||||
if (StrUtil.isBlank(declare.getFormProjectType())) {
|
||||
if (StrUtil.isNotBlank(declare.getProjectType())) {
|
||||
declare.setFormProjectType(declare.getProjectType());
|
||||
} else {
|
||||
return "挑战杯申报请配置项目申报表项目类型";
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(declare.getFormProjectGroup())) {
|
||||
if (StrUtil.isNotBlank(declare.getProjectGroup())) {
|
||||
declare.setFormProjectGroup(declare.getProjectGroup());
|
||||
} else {
|
||||
return "挑战杯申报请配置项目申报表项目分组";
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(declare.getPublicProjectType())) {
|
||||
declare.setPublicProjectType(declare.getFormProjectType());
|
||||
}
|
||||
if (StrUtil.isBlank(declare.getPublicProjectGroup())) {
|
||||
declare.setPublicProjectGroup(declare.getFormProjectGroup());
|
||||
}
|
||||
declare.setFormProjectType(declare.getFormProjectType().trim());
|
||||
declare.setFormProjectGroup(declare.getFormProjectGroup().trim());
|
||||
declare.setPublicProjectType(declare.getPublicProjectType().trim());
|
||||
declare.setPublicProjectGroup(declare.getPublicProjectGroup().trim());
|
||||
declare.setProjectType(declare.getFormProjectType());
|
||||
declare.setProjectGroup(declare.getFormProjectGroup());
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.gxmu.entity.WorkLedger;
|
||||
import com.gxwebsoft.gxmu.param.WorkLedgerParam;
|
||||
import com.gxwebsoft.gxmu.service.WorkLedgerService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "基层团支部工作台账")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/league-branch-ledger")
|
||||
public class LeagueBranchLedgerController extends BaseWorkLedgerControllerSupport {
|
||||
private static final String LEDGER_TYPE = "league_branch";
|
||||
|
||||
@Resource
|
||||
private WorkLedgerService workLedgerService;
|
||||
|
||||
@ApiOperation("分页查询基层团支部工作台账")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<WorkLedger>> page(WorkLedgerParam param) {
|
||||
return pageWorkLedgers(workLedgerService, param, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户基层团支部工作台账")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<WorkLedger>> userPage(WorkLedgerParam param) {
|
||||
return userPageWorkLedgers(workLedgerService, param, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部基层团支部工作台账")
|
||||
@GetMapping()
|
||||
public ApiResult<List<WorkLedger>> list(WorkLedgerParam param) {
|
||||
return listWorkLedgers(workLedgerService, param, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询基层团支部工作台账")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<WorkLedger> get(@PathVariable("id") Integer id) {
|
||||
return getWorkLedger(workLedgerService, id);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加基层团支部工作台账")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody WorkLedger workLedger) {
|
||||
return saveWorkLedger(workLedgerService, workLedger, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改基层团支部工作台账")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody WorkLedger workLedger) {
|
||||
return updateWorkLedger(workLedgerService, workLedger, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除基层团支部工作台账")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return removeWorkLedger(workLedgerService, id);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改基层团支部工作台账")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<WorkLedger> batchParam) {
|
||||
return updateBatchWorkLedger(workLedgerService, batchParam, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除基层团支部工作台账")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return removeBatchWorkLedger(workLedgerService, ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.gxmu.entity.WorkLedger;
|
||||
import com.gxwebsoft.gxmu.param.WorkLedgerParam;
|
||||
import com.gxwebsoft.gxmu.service.WorkLedgerService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "基层团委工作台账")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/league-committee-ledger")
|
||||
public class LeagueCommitteeLedgerController extends BaseWorkLedgerControllerSupport {
|
||||
private static final String LEDGER_TYPE = "league_committee";
|
||||
|
||||
@Resource
|
||||
private WorkLedgerService workLedgerService;
|
||||
|
||||
@ApiOperation("分页查询基层团委工作台账")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<WorkLedger>> page(WorkLedgerParam param) {
|
||||
return pageWorkLedgers(workLedgerService, param, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户基层团委工作台账")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<WorkLedger>> userPage(WorkLedgerParam param) {
|
||||
return userPageWorkLedgers(workLedgerService, param, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部基层团委工作台账")
|
||||
@GetMapping()
|
||||
public ApiResult<List<WorkLedger>> list(WorkLedgerParam param) {
|
||||
return listWorkLedgers(workLedgerService, param, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询基层团委工作台账")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<WorkLedger> get(@PathVariable("id") Integer id) {
|
||||
return getWorkLedger(workLedgerService, id);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加基层团委工作台账")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody WorkLedger workLedger) {
|
||||
return saveWorkLedger(workLedgerService, workLedger, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改基层团委工作台账")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody WorkLedger workLedger) {
|
||||
return updateWorkLedger(workLedgerService, workLedger, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除基层团委工作台账")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return removeWorkLedger(workLedgerService, id);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改基层团委工作台账")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<WorkLedger> batchParam) {
|
||||
return updateBatchWorkLedger(workLedgerService, batchParam, LEDGER_TYPE);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除基层团委工作台账")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return removeBatchWorkLedger(workLedgerService, ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.gxmu.entity.QmgcForm;
|
||||
import com.gxwebsoft.gxmu.param.QmgcFormParam;
|
||||
import com.gxwebsoft.gxmu.service.QmgcFormService;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowStarterService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
import com.gxwebsoft.gxmu.util.QmgcDocxExportUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 青马工程培训班学员登记表控制器
|
||||
*/
|
||||
@Api(tags = "青马工程培训班学员登记表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/qmgc-form")
|
||||
public class QmgcFormController extends BaseController {
|
||||
@Resource
|
||||
private QmgcFormService qmgcFormService;
|
||||
@Resource
|
||||
private ReviewFlowStarterService reviewFlowStarterService;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Value("${config.server-url}")
|
||||
private String requestURL;
|
||||
|
||||
@ApiOperation("分页查询青马工程培训班学员登记表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<QmgcForm>> page(QmgcFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<QmgcForm, QmgcFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(qmgcFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "phone", "school_info")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户青马工程培训班学员登记表")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<QmgcForm>> userPage(QmgcFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<QmgcForm, QmgcFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(qmgcFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "phone", "school_info")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部青马工程培训班学员登记表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<QmgcForm>> list(QmgcFormParam param) {
|
||||
PageParam<QmgcForm, QmgcFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(qmgcFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "phone", "school_info"))));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("导出青马工程培训班学员登记表")
|
||||
@PostMapping("/export")
|
||||
public ApiResult<?> export(@RequestBody QmgcFormParam param, HttpServletRequest request) throws IOException {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<QmgcForm, QmgcFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
List<QmgcForm> records = qmgcFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "phone", "school_info")));
|
||||
if (records == null || records.isEmpty()) {
|
||||
return fail("暂无可导出的数据");
|
||||
}
|
||||
|
||||
String yearText = resolveYearText(param, records);
|
||||
String relativePath = "file/docx/" + yearText + "年青马工程培训班学员登记表_" + System.currentTimeMillis() + ".zip";
|
||||
File targetFile = new File(uploadPath + relativePath);
|
||||
File parentFile = targetFile.getParentFile();
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
|
||||
try (FileOutputStream outputStream = new FileOutputStream(targetFile);
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {
|
||||
QmgcDocxExportUtil.writeExportZip(zipOutputStream, records);
|
||||
zipOutputStream.finish();
|
||||
}
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(targetFile.getName());
|
||||
result.setPath(targetFile.getAbsolutePath());
|
||||
result.setContentType("application/zip");
|
||||
result.setUrl(requestURL + "/" + relativePath);
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询青马工程培训班学员登记表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<QmgcForm> get(@PathVariable("id") Integer id) {
|
||||
return success(qmgcFormService.getById(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加青马工程培训班学员登记表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody QmgcForm qmgcForm) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
qmgcForm.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (qmgcFormService.save(qmgcForm)) {
|
||||
reviewFlowStarterService.startReview("gxmu_qmgc_form", qmgcForm.getId());
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改青马工程培训班学员登记表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody QmgcForm qmgcForm) {
|
||||
if (qmgcFormService.updateById(qmgcForm)) {
|
||||
reviewFlowStarterService.restartReviewWhenLastRejected("gxmu_qmgc_form", qmgcForm.getId());
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除青马工程培训班学员登记表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return qmgcFormService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改青马工程培训班学员登记表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<QmgcForm> batchParam) {
|
||||
return batchParam.update(qmgcFormService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除青马工程培训班学员登记表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return qmgcFormService.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private String resolveYearText(QmgcFormParam param, List<QmgcForm> records) {
|
||||
if (param.getYear() != null) {
|
||||
return String.valueOf(param.getYear());
|
||||
}
|
||||
if (records != null && !records.isEmpty() && records.get(0).getYear() != null) {
|
||||
return String.valueOf(records.get(0).getYear());
|
||||
}
|
||||
return String.valueOf(java.time.LocalDate.now().getYear());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowConfigService;
|
||||
import com.gxwebsoft.gxmu.entity.ReviewFlowConfig;
|
||||
import com.gxwebsoft.gxmu.param.ReviewFlowConfigParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-18 10:37:18
|
||||
*/
|
||||
@Api(tags = "管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/review-flow-config")
|
||||
public class ReviewFlowConfigController extends BaseController {
|
||||
@Resource
|
||||
private ReviewFlowConfigService reviewFlowConfigService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ReviewFlowConfig>> page(ReviewFlowConfigParam param) {
|
||||
// 使用关联查询
|
||||
return success(reviewFlowConfigService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<ReviewFlowConfig>> userPage(ReviewFlowConfigParam param) {
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(reviewFlowConfigService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ReviewFlowConfig>> list(ReviewFlowConfigParam param) {
|
||||
// 使用关联查询
|
||||
return success(reviewFlowConfigService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('gxmu:reviewFlowConfig:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ReviewFlowConfig> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(reviewFlowConfigService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ReviewFlowConfig reviewFlowConfig) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
reviewFlowConfig.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (reviewFlowConfigService.save(reviewFlowConfig)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ReviewFlowConfig reviewFlowConfig) {
|
||||
if (reviewFlowConfigService.updateById(reviewFlowConfig)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (reviewFlowConfigService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ReviewFlowConfig> list) {
|
||||
if (reviewFlowConfigService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<ReviewFlowConfig> batchParam) {
|
||||
if (batchParam.update(reviewFlowConfigService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (reviewFlowConfigService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowService;
|
||||
import com.gxwebsoft.gxmu.entity.ReviewFlow;
|
||||
import com.gxwebsoft.gxmu.param.ReviewFlowParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 审核流控制器
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-18 10:37:18
|
||||
*/
|
||||
@Api(tags = "审核流管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/review-flow")
|
||||
public class ReviewFlowController extends BaseController {
|
||||
@Resource
|
||||
private ReviewFlowService reviewFlowService;
|
||||
|
||||
@ApiOperation("分页查询审核流")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ReviewFlow>> page(ReviewFlowParam param) {
|
||||
// 使用关联查询
|
||||
return success(reviewFlowService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户审核流")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<ReviewFlow>> userPage(ReviewFlowParam param) {
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(reviewFlowService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部审核流")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ReviewFlow>> list(ReviewFlowParam param) {
|
||||
// 使用关联查询
|
||||
return success(reviewFlowService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询审核流")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ReviewFlow> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(reviewFlowService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加审核流")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ReviewFlow reviewFlow) {
|
||||
// 记录当前登录用户id
|
||||
// ReviewFlow checkByName = reviewFlowService.getByTitle(reviewFlow.getTitle());
|
||||
// if (checkByName != null) {
|
||||
// return fail("该名称已存在");
|
||||
// }
|
||||
if (reviewFlowService.save(reviewFlow)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改审核流")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ReviewFlow reviewFlow) {
|
||||
// ReviewFlow checkByName = reviewFlowService.getByTitle(reviewFlow.getTitle());
|
||||
// if (checkByName != null && !Objects.equals(checkByName.getId(), reviewFlow.getId())) {
|
||||
// return fail("该名称已存在");
|
||||
// }
|
||||
if (reviewFlowService.updateById(reviewFlow)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除审核流")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (reviewFlowService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加审核流")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ReviewFlow> list) {
|
||||
if (reviewFlowService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改审核流")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<ReviewFlow> batchParam) {
|
||||
if (batchParam.update(reviewFlowService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除审核流")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (reviewFlowService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.gxmu.entity.ReviewFlow;
|
||||
import com.gxwebsoft.gxmu.entity.ReviewFlowConfig;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowConfigService;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowService;
|
||||
import com.gxwebsoft.gxmu.service.ReviewListService;
|
||||
import com.gxwebsoft.gxmu.entity.ReviewList;
|
||||
import com.gxwebsoft.gxmu.param.ReviewListParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 审核列表控制器
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-18 15:50:51
|
||||
*/
|
||||
@Api(tags = "审核列表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/review-list")
|
||||
public class ReviewListController extends BaseController {
|
||||
@Resource
|
||||
private ReviewListService reviewListService;
|
||||
@Resource
|
||||
private ReviewFlowConfigService reviewFlowConfigService;
|
||||
@Resource
|
||||
private ReviewFlowService reviewFlowService;
|
||||
|
||||
@ApiOperation("分页查询审核列表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ReviewList>> page(ReviewListParam param) {
|
||||
applyRoleScopeForReviewList(param);
|
||||
applyBackendOrganizationScopeForReviewList(param);
|
||||
// 使用关联查询
|
||||
return success(reviewListService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询聚合后的审核列表")
|
||||
@GetMapping("/groupPage")
|
||||
public ApiResult<PageResult<ReviewList>> groupPage(ReviewListParam param) {
|
||||
applyRoleScopeForReviewList(param);
|
||||
applyBackendOrganizationScopeForReviewList(param);
|
||||
return success(reviewListService.pageGroupRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户审核列表")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<ReviewList>> userPage(ReviewListParam param) {
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(reviewListService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部审核列表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ReviewList>> list(ReviewListParam param) {
|
||||
// 使用关联查询
|
||||
return success(reviewListService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('gxmu:reviewList:list')")
|
||||
@ApiOperation("根据id查询审核列表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ReviewList> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(reviewListService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加审核列表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ReviewList reviewList) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
reviewList.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (reviewListService.save(reviewList)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改审核列表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ReviewList reviewList) {
|
||||
if (reviewListService.updateById(reviewList)) {
|
||||
// 通过进入下一个
|
||||
if (reviewList.getStatus().equals(1)) {
|
||||
ReviewFlowConfig reviewFlowConfig = reviewFlowConfigService.getByModule(reviewList.getModule());
|
||||
if (reviewFlowConfig != null) {
|
||||
ReviewFlow reviewFlow = reviewFlowService.getById(reviewFlowConfig.getFlowId());
|
||||
if (reviewFlow != null) {
|
||||
List<ReviewFlow> reviewFlowList = reviewFlowService.listByTitle(reviewFlow.getTitle());
|
||||
if (reviewFlowList != null && !reviewFlowList.isEmpty()) {
|
||||
if (reviewList.getSortNumber() + 1 < reviewFlowList.size()) {
|
||||
ReviewFlow nextOne = reviewFlowList.get(reviewList.getSortNumber() + 1);
|
||||
if (nextOne != null) {
|
||||
ReviewList nextReviewList = new ReviewList();
|
||||
nextReviewList.setPk(reviewList.getPk());
|
||||
nextReviewList.setModule(reviewList.getModule());
|
||||
nextReviewList.setUserId(nextOne.getReviewUserId());
|
||||
nextReviewList.setSortNumber(reviewList.getSortNumber() + 1);
|
||||
reviewListService.save(nextReviewList);
|
||||
}
|
||||
}
|
||||
// switch (reviewList.getModule()) {
|
||||
// case "cms_manuscript": {
|
||||
// // 社团指导老师/二级学院团委书记-团委社团管理部/团委办公室-学校团委组织宣传部,拟发布后,再提交给团委副书记-团委书记
|
||||
// if ()
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除审核列表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (reviewListService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加审核列表")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ReviewList> list) {
|
||||
if (reviewListService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改审核列表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<ReviewList> batchParam) {
|
||||
if (batchParam.update(reviewListService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除审核列表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (reviewListService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
private void applyBackendOrganizationScopeForReviewList(ReviewListParam param) {
|
||||
if (!isBackendAccess(param) || !hasBackendScopeRole()) {
|
||||
return;
|
||||
}
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser == null || loginUser.getOrganizationId() == null) {
|
||||
return;
|
||||
}
|
||||
com.gxwebsoft.common.system.param.UserParam userParam = new com.gxwebsoft.common.system.param.UserParam();
|
||||
userParam.setBackendAccess(true);
|
||||
applyBackendOrganizationScope(userParam);
|
||||
param.setOrganizationIds(userParam.getOrganizationIds());
|
||||
}
|
||||
|
||||
private void applyRoleScopeForReviewList(ReviewListParam param) {
|
||||
java.util.Set<String> roleCodes = getLoginUserRoleCodes();
|
||||
if (roleCodes.contains("SchoolYouthLeagueCommittee") || roleCodes.contains("admin") || roleCodes.contains("superAdmin")) {
|
||||
return;
|
||||
}
|
||||
Integer loginUserId = getLoginUserId();
|
||||
if (loginUserId != null) {
|
||||
param.setUserId(loginUserId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.Organization;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.common.system.service.OrganizationService;
|
||||
import com.gxwebsoft.gxmu.entity.SjqnForm;
|
||||
import com.gxwebsoft.gxmu.param.SjqnFormParam;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowStarterService;
|
||||
import com.gxwebsoft.gxmu.service.SjqnFormService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
import com.gxwebsoft.gxmu.util.SjqnDocxExportUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 十佳青年申报表控制器
|
||||
*/
|
||||
@Api(tags = "十佳青年申报表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/sjqn-form")
|
||||
public class SjqnFormController extends BaseController {
|
||||
@Resource
|
||||
private SjqnFormService sjqnFormService;
|
||||
@Resource
|
||||
private ReviewFlowStarterService reviewFlowStarterService;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Value("${config.server-url}")
|
||||
private String requestURL;
|
||||
|
||||
@ApiOperation("分页查询十佳青年申报表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<SjqnForm>> page(SjqnFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<SjqnForm, SjqnFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(sjqnFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "unit_name", "apply_type")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户十佳青年申报表")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<SjqnForm>> userPage(SjqnFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<SjqnForm, SjqnFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(sjqnFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "unit_name", "apply_type")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部十佳青年申报表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<SjqnForm>> list(SjqnFormParam param) {
|
||||
PageParam<SjqnForm, SjqnFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(sjqnFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "unit_name", "apply_type"))));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("导出十佳青年岗位能手申报材料")
|
||||
@PostMapping("/export")
|
||||
public ApiResult<?> export(@RequestBody SjqnFormParam param, HttpServletRequest request) throws IOException {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<SjqnForm, SjqnFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
List<SjqnForm> records = sjqnFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "unit_name", "apply_type")));
|
||||
if (records == null || records.isEmpty()) {
|
||||
return fail("暂无可导出的数据");
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
Map<Integer, String> contactMap = new LinkedHashMap<>();
|
||||
for (SjqnForm form : records) {
|
||||
contactMap.put(form.getId(), loginUser == null ? "" : valueOf(loginUser.getPhone()));
|
||||
}
|
||||
|
||||
SjqnDocxExportUtil.SummaryMeta summaryMeta = new SjqnDocxExportUtil.SummaryMeta();
|
||||
summaryMeta.setYearText(resolveYearText(param, records));
|
||||
summaryMeta.setReporter(loginUser == null ? "" : resolveReporter(loginUser));
|
||||
summaryMeta.setContact(loginUser == null ? "" : valueOf(loginUser.getPhone()));
|
||||
summaryMeta.setOrganizationPartyOpinion(resolveOrganizationPartyOpinion(loginUser));
|
||||
|
||||
String relativePath = "file/docx/十佳青年岗位能手申报材料_" + System.currentTimeMillis() + ".zip";
|
||||
File targetFile = new File(uploadPath + relativePath);
|
||||
File parentFile = targetFile.getParentFile();
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
|
||||
try (FileOutputStream outputStream = new FileOutputStream(targetFile);
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {
|
||||
SjqnDocxExportUtil.writeExportZip(zipOutputStream, records, summaryMeta, contactMap);
|
||||
zipOutputStream.finish();
|
||||
}
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(targetFile.getName());
|
||||
result.setPath(targetFile.getAbsolutePath());
|
||||
result.setContentType("application/zip");
|
||||
result.setUrl(requestURL + "/" + relativePath);
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询十佳青年申报表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<SjqnForm> get(@PathVariable("id") Integer id) {
|
||||
return success(sjqnFormService.getById(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加十佳青年申报表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody SjqnForm sjqnForm) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
sjqnForm.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (sjqnFormService.save(sjqnForm)) {
|
||||
reviewFlowStarterService.startReview("gxmu_sjqn", sjqnForm.getId());
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改十佳青年申报表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody SjqnForm sjqnForm) {
|
||||
if (sjqnFormService.updateById(sjqnForm)) {
|
||||
reviewFlowStarterService.restartReviewWhenLastRejected("gxmu_sjqn", sjqnForm.getId());
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除十佳青年申报表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return sjqnFormService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改十佳青年申报表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<SjqnForm> batchParam) {
|
||||
return batchParam.update(sjqnFormService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除十佳青年申报表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return sjqnFormService.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private String resolveYearText(SjqnFormParam param, List<SjqnForm> records) {
|
||||
if (param.getYear() != null) {
|
||||
return String.valueOf(param.getYear());
|
||||
}
|
||||
if (records != null && !records.isEmpty() && records.get(0).getYear() != null) {
|
||||
return String.valueOf(records.get(0).getYear());
|
||||
}
|
||||
return String.valueOf(java.time.LocalDate.now().getYear());
|
||||
}
|
||||
|
||||
private String resolveReporter(User loginUser) {
|
||||
if (loginUser == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getRealName())) {
|
||||
return loginUser.getRealName().trim();
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getNickname())) {
|
||||
return loginUser.getNickname().trim();
|
||||
}
|
||||
return valueOf(loginUser.getUsername());
|
||||
}
|
||||
|
||||
private String resolveOrganizationPartyOpinion(User loginUser) {
|
||||
if (loginUser == null || loginUser.getOrganizationId() == null) {
|
||||
return "(盖章)";
|
||||
}
|
||||
Organization organization = organizationService.getByIdRel(loginUser.getOrganizationId());
|
||||
String organizationName = organization == null ? "" : valueOf(organization.getOrganizationName());
|
||||
return organizationName.isEmpty() ? "(盖章)" : organizationName + "(盖章)";
|
||||
}
|
||||
|
||||
private String valueOf(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.Organization;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.common.system.service.OrganizationService;
|
||||
import com.gxwebsoft.gxmu.entity.SjtbzbsjForm;
|
||||
import com.gxwebsoft.gxmu.param.SjtbzbsjFormParam;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowStarterService;
|
||||
import com.gxwebsoft.gxmu.service.SjtbzbsjFormService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
import com.gxwebsoft.gxmu.util.SjtbzbsjDocxExportUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 十佳团支部书记申报表控制器
|
||||
*/
|
||||
@Api(tags = "十佳团支部书记申报表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/sjtbzbsj-form")
|
||||
public class SjtbzbsjFormController extends BaseController {
|
||||
@Resource
|
||||
private SjtbzbsjFormService sjtbzbsjFormService;
|
||||
@Resource
|
||||
private ReviewFlowStarterService reviewFlowStarterService;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Value("${config.server-url}")
|
||||
private String requestURL;
|
||||
|
||||
@ApiOperation("分页查询十佳团支部书记申报表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<SjtbzbsjForm>> page(SjtbzbsjFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<SjtbzbsjForm, SjtbzbsjFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(sjtbzbsjFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "college_class", "branch_name")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户十佳团支部书记申报表")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<SjtbzbsjForm>> userPage(SjtbzbsjFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<SjtbzbsjForm, SjtbzbsjFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(sjtbzbsjFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "college_class", "branch_name")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部十佳团支部书记申报表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<SjtbzbsjForm>> list(SjtbzbsjFormParam param) {
|
||||
PageParam<SjtbzbsjForm, SjtbzbsjFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(sjtbzbsjFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "college_class", "branch_name"))));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("导出十佳团支部书记申报材料")
|
||||
@PostMapping("/export")
|
||||
public ApiResult<?> export(@RequestBody SjtbzbsjFormParam param, HttpServletRequest request) throws IOException {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<SjtbzbsjForm, SjtbzbsjFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
List<SjtbzbsjForm> records = sjtbzbsjFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "college_class", "branch_name")));
|
||||
if (records == null || records.isEmpty()) {
|
||||
return fail("暂无可导出的数据");
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
Map<Integer, String> contactMap = new LinkedHashMap<>();
|
||||
for (SjtbzbsjForm form : records) {
|
||||
contactMap.put(form.getId(), loginUser == null ? "" : valueOf(loginUser.getPhone()));
|
||||
}
|
||||
|
||||
SjtbzbsjDocxExportUtil.SummaryMeta summaryMeta = new SjtbzbsjDocxExportUtil.SummaryMeta();
|
||||
summaryMeta.setYearText(resolveYearText(param, records));
|
||||
summaryMeta.setReporter(loginUser == null ? "" : resolveReporter(loginUser));
|
||||
summaryMeta.setContact(loginUser == null ? "" : valueOf(loginUser.getPhone()));
|
||||
summaryMeta.setOrganizationPartyOpinion(resolveOrganizationPartyOpinion(loginUser));
|
||||
|
||||
String relativePath = "file/docx/十佳团支部书记申报材料_" + System.currentTimeMillis() + ".zip";
|
||||
File targetFile = new File(uploadPath + relativePath);
|
||||
File parentFile = targetFile.getParentFile();
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
|
||||
try (FileOutputStream outputStream = new FileOutputStream(targetFile);
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {
|
||||
SjtbzbsjDocxExportUtil.writeExportZip(zipOutputStream, records, summaryMeta, contactMap);
|
||||
zipOutputStream.finish();
|
||||
}
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(targetFile.getName());
|
||||
result.setPath(targetFile.getAbsolutePath());
|
||||
result.setContentType("application/zip");
|
||||
result.setUrl(requestURL + "/" + relativePath);
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询十佳团支部书记申报表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<SjtbzbsjForm> get(@PathVariable("id") Integer id) {
|
||||
return success(sjtbzbsjFormService.getById(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加十佳团支部书记申报表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody SjtbzbsjForm sjtbzbsjForm) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
sjtbzbsjForm.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (sjtbzbsjFormService.save(sjtbzbsjForm)) {
|
||||
reviewFlowStarterService.startReview("gxmu_sjtbzbsj", sjtbzbsjForm.getId());
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改十佳团支部书记申报表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody SjtbzbsjForm sjtbzbsjForm) {
|
||||
if (sjtbzbsjFormService.updateById(sjtbzbsjForm)) {
|
||||
reviewFlowStarterService.restartReviewWhenLastRejected("gxmu_sjtbzbsj", sjtbzbsjForm.getId());
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除十佳团支部书记申报表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return sjtbzbsjFormService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改十佳团支部书记申报表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<SjtbzbsjForm> batchParam) {
|
||||
return batchParam.update(sjtbzbsjFormService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除十佳团支部书记申报表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return sjtbzbsjFormService.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private String resolveYearText(SjtbzbsjFormParam param, List<SjtbzbsjForm> records) {
|
||||
if (param.getYear() != null) {
|
||||
return String.valueOf(param.getYear());
|
||||
}
|
||||
if (records != null && !records.isEmpty() && records.get(0).getYear() != null) {
|
||||
return String.valueOf(records.get(0).getYear());
|
||||
}
|
||||
return String.valueOf(java.time.LocalDate.now().getYear());
|
||||
}
|
||||
|
||||
private String resolveReporter(User loginUser) {
|
||||
if (loginUser == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getRealName())) {
|
||||
return loginUser.getRealName().trim();
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getNickname())) {
|
||||
return loginUser.getNickname().trim();
|
||||
}
|
||||
return valueOf(loginUser.getUsername());
|
||||
}
|
||||
|
||||
private String resolveOrganizationPartyOpinion(User loginUser) {
|
||||
if (loginUser == null || loginUser.getOrganizationId() == null) {
|
||||
return "(盖章)";
|
||||
}
|
||||
Organization organization = organizationService.getByIdRel(loginUser.getOrganizationId());
|
||||
String organizationName = organization == null ? "" : valueOf(organization.getOrganizationName());
|
||||
return organizationName.isEmpty() ? "(盖章)" : organizationName + "(盖章)";
|
||||
}
|
||||
|
||||
private String valueOf(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,406 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.Organization;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.common.system.service.OrganizationService;
|
||||
import com.gxwebsoft.gxmu.model.TyglDataCenterResult;
|
||||
import com.gxwebsoft.gxmu.entity.TyglForm;
|
||||
import com.gxwebsoft.gxmu.model.TyglDataCenterRecord;
|
||||
import com.gxwebsoft.gxmu.model.TyglDataCenterSummary;
|
||||
import com.gxwebsoft.gxmu.param.TyglGrowthArchivesUpdateParam;
|
||||
import com.gxwebsoft.gxmu.param.TyglMemberRecordsUpdateParam;
|
||||
import com.gxwebsoft.gxmu.param.TyglFormParam;
|
||||
import com.gxwebsoft.gxmu.service.TyglFormService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 团员管理控制器
|
||||
*/
|
||||
@Api(tags = "团员管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/tygl-form")
|
||||
public class TyglFormController extends BaseController {
|
||||
@Resource
|
||||
private TyglFormService tyglFormService;
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Value("${config.server-url}")
|
||||
private String requestURL;
|
||||
|
||||
@ApiOperation("分页查询团员管理")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<TyglForm>> page(TyglFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<TyglForm, TyglFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("serial_no asc,id desc");
|
||||
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<TyglForm> wrapper =
|
||||
page.getWrapperWithConsumer(queryWrapper -> {
|
||||
if (param.getUserIds() != null && !param.getUserIds().isEmpty()) {
|
||||
queryWrapper.in("user_id", param.getUserIds());
|
||||
}
|
||||
}, "keywords", "userIds");
|
||||
return success(new PageResult<>(tyglFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(wrapper, param.getKeywords(),
|
||||
"name", "phone", "league_position", "college", "class_name", "id_card_no")).getRecords(),
|
||||
page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户团员管理")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<TyglForm>> userPage(TyglFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<TyglForm, TyglFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("serial_no asc,id desc");
|
||||
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<TyglForm> wrapper =
|
||||
page.getWrapperWithConsumer(queryWrapper -> {
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
if (param.getUserIds() != null && !param.getUserIds().isEmpty()) {
|
||||
queryWrapper.in("user_id", param.getUserIds());
|
||||
}
|
||||
}, "keywords", "userIds");
|
||||
return success(new PageResult<>(tyglFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(wrapper, param.getKeywords(),
|
||||
"name", "phone", "league_position", "college", "class_name", "id_card_no")).getRecords(),
|
||||
page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部团员管理")
|
||||
@GetMapping()
|
||||
public ApiResult<List<TyglForm>> list(TyglFormParam param) {
|
||||
PageParam<TyglForm, TyglFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("serial_no asc,id desc");
|
||||
return success(tyglFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "phone", "league_position", "college", "class_name", "id_card_no"))));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("导出团员管理")
|
||||
@PostMapping("/export")
|
||||
public ApiResult<?> export(@RequestBody TyglFormParam param, HttpServletRequest request) throws IOException {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<TyglForm, TyglFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("serial_no asc,id desc");
|
||||
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<TyglForm> wrapper =
|
||||
page.getWrapperWithConsumer(queryWrapper -> {
|
||||
if (param.getUserIds() != null && !param.getUserIds().isEmpty()) {
|
||||
queryWrapper.in("user_id", param.getUserIds());
|
||||
}
|
||||
}, "keywords", "userIds");
|
||||
List<TyglForm> records = tyglFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(wrapper, param.getKeywords(),
|
||||
"name", "phone", "league_position", "college", "class_name", "id_card_no")));
|
||||
|
||||
String relativePath = "file/excel/团员管理导出" + System.currentTimeMillis() + ".xls";
|
||||
File targetFile = new File(uploadPath + relativePath);
|
||||
File parentFile = targetFile.getParentFile();
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
|
||||
try (HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
FileOutputStream output = new FileOutputStream(targetFile)) {
|
||||
HSSFSheet sheet = workbook.createSheet("团员管理");
|
||||
sheet.setColumnWidth(0, 10 * 256);
|
||||
sheet.setColumnWidth(1, 14 * 256);
|
||||
sheet.setColumnWidth(2, 10 * 256);
|
||||
sheet.setColumnWidth(3, 14 * 256);
|
||||
sheet.setColumnWidth(4, 24 * 256);
|
||||
sheet.setColumnWidth(5, 24 * 256);
|
||||
sheet.setColumnWidth(6, 16 * 256);
|
||||
sheet.setColumnWidth(7, 18 * 256);
|
||||
sheet.setColumnWidth(8, 20 * 256);
|
||||
sheet.setColumnWidth(9, 28 * 256);
|
||||
sheet.setColumnWidth(10, 24 * 256);
|
||||
sheet.setColumnWidth(11, 16 * 256);
|
||||
sheet.setColumnWidth(12, 18 * 256);
|
||||
sheet.setColumnWidth(13, 16 * 256);
|
||||
|
||||
HSSFRow headerRow = sheet.createRow(0);
|
||||
headerRow.createCell(0).setCellValue("序号");
|
||||
headerRow.createCell(1).setCellValue("姓名");
|
||||
headerRow.createCell(2).setCellValue("性别");
|
||||
headerRow.createCell(3).setCellValue("民族");
|
||||
headerRow.createCell(4).setCellValue("学院");
|
||||
headerRow.createCell(5).setCellValue("班级");
|
||||
headerRow.createCell(6).setCellValue("政治面貌");
|
||||
headerRow.createCell(7).setCellValue("手机号码");
|
||||
headerRow.createCell(8).setCellValue("团内职务");
|
||||
headerRow.createCell(9).setCellValue("所属团支部");
|
||||
headerRow.createCell(10).setCellValue("身份证号");
|
||||
headerRow.createCell(11).setCellValue("出生日期");
|
||||
headerRow.createCell(12).setCellValue("团籍是否在本组织");
|
||||
headerRow.createCell(13).setCellValue("入团年月");
|
||||
|
||||
int rowNum = 1;
|
||||
for (TyglForm form : records) {
|
||||
fillBranchOrganizationName(form);
|
||||
HSSFRow dataRow = sheet.createRow(rowNum++);
|
||||
dataRow.createCell(0).setCellValue(toExportValue(form.getSerialNo()));
|
||||
dataRow.createCell(1).setCellValue(toExportValue(form.getName()));
|
||||
dataRow.createCell(2).setCellValue(toExportValue(form.getGender()));
|
||||
dataRow.createCell(3).setCellValue(toExportValue(form.getNation()));
|
||||
dataRow.createCell(4).setCellValue(toExportValue(form.getCollege()));
|
||||
dataRow.createCell(5).setCellValue(toExportValue(form.getClassName()));
|
||||
dataRow.createCell(6).setCellValue(toExportValue(form.getPolitics()));
|
||||
dataRow.createCell(7).setCellValue(toExportValue(form.getPhone()));
|
||||
dataRow.createCell(8).setCellValue(toExportValue(form.getLeaguePosition()));
|
||||
dataRow.createCell(9).setCellValue(toExportValue(form.getBranchOrganizationName()));
|
||||
dataRow.createCell(10).setCellValue(toExportValue(form.getIdCardNo()));
|
||||
dataRow.createCell(11).setCellValue(toExportValue(form.getBirthDate()));
|
||||
dataRow.createCell(12).setCellValue(toExportValue(form.getArchiveInCurrentOrg()));
|
||||
dataRow.createCell(13).setCellValue(toExportValue(form.getJoinMonth()));
|
||||
}
|
||||
workbook.write(output);
|
||||
output.flush();
|
||||
}
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(targetFile.getName());
|
||||
result.setPath(targetFile.getAbsolutePath());
|
||||
result.setUrl(requestURL + "/" + relativePath);
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询团员管理")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<TyglForm> get(@PathVariable("id") Integer id) {
|
||||
return success(fillBranchOrganizationName(tyglFormService.getById(id)));
|
||||
}
|
||||
|
||||
@ApiOperation("查询当前用户团员管理")
|
||||
@GetMapping("/current")
|
||||
public ApiResult<?> current() {
|
||||
Integer userId = getLoginUserId();
|
||||
if (userId == null) {
|
||||
return success();
|
||||
}
|
||||
return success(fillBranchOrganizationName(tyglFormService.getCurrentUserForm(userId, getTenantId())));
|
||||
}
|
||||
|
||||
@ApiOperation("查询团员青年数据分析中心明细")
|
||||
@GetMapping("/data-center")
|
||||
public ApiResult<TyglDataCenterResult> dataCenter() {
|
||||
List<TyglForm> records = tyglFormService.list(new LambdaQueryWrapper<TyglForm>()
|
||||
.select(TyglForm::getId, TyglForm::getSerialNo, TyglForm::getName, TyglForm::getGender,
|
||||
TyglForm::getNation, TyglForm::getCollege, TyglForm::getClassName,
|
||||
TyglForm::getPolitics, TyglForm::getPhone, TyglForm::getLeaguePosition,
|
||||
TyglForm::getBranchOrganizationId, TyglForm::getBranchOrganizationName,
|
||||
TyglForm::getIdCardNo, TyglForm::getBirthDate,
|
||||
TyglForm::getArchiveInCurrentOrg, TyglForm::getJoinMonth,
|
||||
TyglForm::getMemberRecords, TyglForm::getGrowthArchives)
|
||||
.eq(TyglForm::getTenantId, getTenantId())
|
||||
.orderByAsc(TyglForm::getSerialNo)
|
||||
.orderByDesc(TyglForm::getId));
|
||||
List<TyglDataCenterRecord> detailRecords = records.stream()
|
||||
.map(this::toDataCenterRecord)
|
||||
.collect(Collectors.toList());
|
||||
TyglDataCenterResult result = new TyglDataCenterResult();
|
||||
result.setRecords(detailRecords);
|
||||
result.setSummary(buildDataCenterSummary(records, detailRecords));
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加团员管理")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody TyglForm tyglForm) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
tyglForm.setUserId(loginUser.getUserId());
|
||||
}
|
||||
fillBranchOrganizationName(tyglForm);
|
||||
return tyglFormService.save(tyglForm) ? success("添加成功") : fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改团员管理")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody TyglForm tyglForm) {
|
||||
fillBranchOrganizationName(tyglForm);
|
||||
return tyglFormService.updateById(tyglForm) ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("更新团员记录")
|
||||
@PutMapping("/member-records/{id}")
|
||||
public ApiResult<?> updateMemberRecords(@PathVariable("id") Integer id,
|
||||
@RequestBody TyglMemberRecordsUpdateParam param) {
|
||||
return tyglFormService.updateMemberRecords(id, param) ? success("保存成功") : fail("保存失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("更新成长档案")
|
||||
@PutMapping("/growth-archives/{id}")
|
||||
public ApiResult<?> updateGrowthArchives(@PathVariable("id") Integer id,
|
||||
@RequestBody TyglGrowthArchivesUpdateParam param) {
|
||||
return tyglFormService.updateGrowthArchives(id, param) ? success("保存成功") : fail("保存失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除团员管理")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return tyglFormService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改团员管理")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<TyglForm> batchParam) {
|
||||
return batchParam.update(tyglFormService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除团员管理")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return tyglFormService.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private TyglDataCenterRecord toDataCenterRecord(TyglForm form) {
|
||||
TyglDataCenterRecord record = new TyglDataCenterRecord();
|
||||
record.setId(form.getId());
|
||||
record.setSerialNo(form.getSerialNo());
|
||||
record.setName(normalizeDisplayValue(form.getName(), "未填写"));
|
||||
record.setGender(normalizeDisplayValue(form.getGender(), "未填写"));
|
||||
record.setNation(normalizeDisplayValue(form.getNation(), "未填写"));
|
||||
record.setPhone(normalizeDisplayValue(form.getPhone(), "未填写"));
|
||||
record.setLeaguePosition(normalizeDisplayValue(form.getLeaguePosition(), "未填写"));
|
||||
record.setArchiveInCurrentOrg(normalizeDisplayValue(form.getArchiveInCurrentOrg(), "未填写"));
|
||||
record.setJoinMonth(normalizeDisplayValue(form.getJoinMonth(), "未填写"));
|
||||
record.setJoinYear(extractJoinYear(form.getJoinMonth()));
|
||||
record.setMemberRecordCount(form.getMemberRecords() == null ? 0 : form.getMemberRecords().size());
|
||||
record.setGrowthArchiveCount(form.getGrowthArchives() == null ? 0 : form.getGrowthArchives().size());
|
||||
record.setProfileStatus(record.getMemberRecordCount() > 0 || record.getGrowthArchiveCount() > 0
|
||||
? "已完善"
|
||||
: "待完善");
|
||||
return record;
|
||||
}
|
||||
|
||||
private TyglDataCenterSummary buildDataCenterSummary(List<TyglForm> sourceForms,
|
||||
List<TyglDataCenterRecord> detailRecords) {
|
||||
TyglDataCenterSummary summary = new TyglDataCenterSummary();
|
||||
int memberCount = detailRecords.size();
|
||||
int maleCount = (int) detailRecords.stream().filter(item -> "男".equals(item.getGender())).count();
|
||||
int femaleCount = (int) detailRecords.stream().filter(item -> "女".equals(item.getGender())).count();
|
||||
int archiveInOrgCount = (int) detailRecords.stream()
|
||||
.filter(item -> StrUtil.contains(item.getArchiveInCurrentOrg(), "是"))
|
||||
.count();
|
||||
int completedProfileCount = (int) detailRecords.stream()
|
||||
.filter(item -> "已完善".equals(item.getProfileStatus()))
|
||||
.count();
|
||||
int youthUnder28Count = (int) sourceForms.stream()
|
||||
.filter(this::isYouthUnder28)
|
||||
.count();
|
||||
|
||||
summary.setMemberCount(memberCount);
|
||||
summary.setMaleCount(maleCount);
|
||||
summary.setFemaleCount(femaleCount);
|
||||
summary.setArchiveInOrgCount(archiveInOrgCount);
|
||||
summary.setCompletedProfileCount(completedProfileCount);
|
||||
summary.setYouthUnder28Count(youthUnder28Count);
|
||||
summary.setGenderRatio(String.format(Locale.ROOT, "%d:%d", maleCount, femaleCount));
|
||||
summary.setMemberYouthRatio(formatMemberYouthRatio(memberCount, youthUnder28Count));
|
||||
return summary;
|
||||
}
|
||||
|
||||
private boolean isYouthUnder28(TyglForm form) {
|
||||
if (form == null || StrUtil.isBlank(form.getBirthDate())) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
java.time.LocalDate birthDate = java.time.LocalDate.parse(form.getBirthDate().trim());
|
||||
java.time.LocalDate today = java.time.LocalDate.now();
|
||||
int age = java.time.Period.between(birthDate, today).getYears();
|
||||
return age <= 28;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private String formatMemberYouthRatio(int memberCount, int youthUnder28Count) {
|
||||
if (youthUnder28Count <= 0) {
|
||||
return "0.00%";
|
||||
}
|
||||
double ratio = memberCount * 100D / youthUnder28Count;
|
||||
return String.format(Locale.ROOT, "%.2f%%", ratio);
|
||||
}
|
||||
|
||||
private TyglForm fillBranchOrganizationName(TyglForm form) {
|
||||
if (form == null) {
|
||||
return null;
|
||||
}
|
||||
Integer branchOrganizationId = form.getBranchOrganizationId();
|
||||
if (branchOrganizationId == null) {
|
||||
form.setBranchOrganizationName(null);
|
||||
return form;
|
||||
}
|
||||
if (StrUtil.isNotBlank(form.getBranchOrganizationName())) {
|
||||
form.setBranchOrganizationName(form.getBranchOrganizationName().trim());
|
||||
return form;
|
||||
}
|
||||
Organization organization = organizationService.getByIdRel(branchOrganizationId);
|
||||
form.setBranchOrganizationName(organization == null ? null : organization.getOrganizationName());
|
||||
return form;
|
||||
}
|
||||
|
||||
private String extractJoinYear(String joinMonth) {
|
||||
if (StrUtil.isBlank(joinMonth)) {
|
||||
return "未填写";
|
||||
}
|
||||
String normalized = joinMonth.trim();
|
||||
if (normalized.length() >= 4) {
|
||||
String year = normalized.substring(0, 4);
|
||||
if (year.matches("\\d{4}")) {
|
||||
return String.format(Locale.ROOT, "%s年", year);
|
||||
}
|
||||
}
|
||||
return "未填写";
|
||||
}
|
||||
|
||||
private String normalizeDisplayValue(String value, String defaultValue) {
|
||||
return StrUtil.isBlank(value) ? defaultValue : value.trim();
|
||||
}
|
||||
|
||||
private String toExportValue(Object value) {
|
||||
return value == null ? "" : String.valueOf(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.gxmu.entity.TzbProjectListRecord;
|
||||
import com.gxwebsoft.gxmu.param.TzbProjectListRecordParam;
|
||||
import com.gxwebsoft.gxmu.service.TzbProjectListRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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 javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挑战杯项目库列表控制器
|
||||
*
|
||||
* @author Codex
|
||||
* @since 2026-04-14
|
||||
*/
|
||||
@Api(tags = "挑战杯项目库列表")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/tzb-project-list")
|
||||
public class TzbProjectListController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private TzbProjectListRecordService tzbProjectListRecordService;
|
||||
|
||||
@ApiOperation("分页查询挑战杯项目库列表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<TzbProjectListRecord>> page(TzbProjectListRecordParam param) {
|
||||
return success(tzbProjectListRecordService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询挑战杯项目库列表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<TzbProjectListRecord>> list(TzbProjectListRecordParam param) {
|
||||
return success(tzbProjectListRecordService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询挑战杯项目库记录")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<TzbProjectListRecord> get(@PathVariable("id") Integer id) {
|
||||
return success(tzbProjectListRecordService.getByIdRel(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.gxmu.entity.TzbTalentListRecord;
|
||||
import com.gxwebsoft.gxmu.param.TzbTalentListRecordParam;
|
||||
import com.gxwebsoft.gxmu.service.TzbTalentListRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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 javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挑战杯人才库列表控制器
|
||||
*
|
||||
* @author Codex
|
||||
* @since 2026-04-14
|
||||
*/
|
||||
@Api(tags = "挑战杯人才库列表")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/tzb-talent-list")
|
||||
public class TzbTalentListController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private TzbTalentListRecordService tzbTalentListRecordService;
|
||||
|
||||
@ApiOperation("分页查询挑战杯人才库列表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<TzbTalentListRecord>> page(TzbTalentListRecordParam param) {
|
||||
return success(tzbTalentListRecordService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询挑战杯人才库列表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<TzbTalentListRecord>> list(TzbTalentListRecordParam param) {
|
||||
return success(tzbTalentListRecordService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询挑战杯人才库记录")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<TzbTalentListRecord> get(@PathVariable("id") Integer id) {
|
||||
return success(tzbTalentListRecordService.getByIdRel(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.gxmu.entity.TzbcyForm;
|
||||
import com.gxwebsoft.gxmu.model.TzbcyStatisticsResult;
|
||||
import com.gxwebsoft.gxmu.param.TzbcyFormParam;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowStarterService;
|
||||
import com.gxwebsoft.gxmu.service.TzbcyFormService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
import com.gxwebsoft.gxmu.util.TzbcyFormItemNormalizer;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 挑战杯创业计划竞赛申报表控制器
|
||||
*/
|
||||
@Api(tags = "挑战杯创业计划竞赛申报表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/tzbcy-form")
|
||||
public class TzbcyFormController extends BaseController {
|
||||
@Resource
|
||||
private TzbcyFormService tzbcyFormService;
|
||||
@Resource
|
||||
private ReviewFlowStarterService reviewFlowStarterService;
|
||||
|
||||
@ApiOperation("分页查询挑战杯创业计划竞赛申报表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<TzbcyForm>> page(TzbcyFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, false);
|
||||
PageParam<TzbcyForm, TzbcyFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(tzbcyFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"project_name", "leader", "school_name")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户挑战杯创业计划竞赛申报表")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<TzbcyForm>> userPage(TzbcyFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, false);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<TzbcyForm, TzbcyFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(tzbcyFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"project_name", "leader", "school_name")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部挑战杯创业计划竞赛申报表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<TzbcyForm>> list(TzbcyFormParam param) {
|
||||
PageParam<TzbcyForm, TzbcyFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(tzbcyFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"project_name", "leader", "school_name"))));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询挑战杯创业计划竞赛申报表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<TzbcyForm> get(@PathVariable("id") Integer id) {
|
||||
return success(tzbcyFormService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("查询挑战杯数据统计")
|
||||
@GetMapping("/statistics")
|
||||
public ApiResult<TzbcyStatisticsResult> statistics(@RequestParam(value = "year", required = false) Integer year) {
|
||||
return success(tzbcyFormService.getStatistics(year));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加挑战杯创业计划竞赛申报表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody TzbcyForm tzbcyForm) {
|
||||
normalizeForm(tzbcyForm);
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
tzbcyForm.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (tzbcyFormService.save(tzbcyForm)) {
|
||||
reviewFlowStarterService.startReview("gxmu_tzbcy_form", tzbcyForm.getId());
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改挑战杯创业计划竞赛申报表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody TzbcyForm tzbcyForm) {
|
||||
normalizeForm(tzbcyForm);
|
||||
if (tzbcyFormService.updateById(tzbcyForm)) {
|
||||
reviewFlowStarterService.restartReviewWhenLastRejected("gxmu_tzbcy_form", tzbcyForm.getId());
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除挑战杯创业计划竞赛申报表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return tzbcyFormService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改挑战杯创业计划竞赛申报表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<TzbcyForm> batchParam) {
|
||||
normalizeForm(batchParam.getData());
|
||||
return batchParam.update(tzbcyFormService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除挑战杯创业计划竞赛申报表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return tzbcyFormService.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private void normalizeForm(TzbcyForm form) {
|
||||
if (form == null) {
|
||||
return;
|
||||
}
|
||||
TzbcyFormItemNormalizer.normalize(form);
|
||||
form.setTeamMembers(filterItems(form.getTeamMembers(),
|
||||
item -> hasText(item.getName())
|
||||
|| hasText(item.getGender())
|
||||
|| hasText(item.getCollege())
|
||||
|| hasText(item.getGradeMajor())
|
||||
|| hasText(item.getPhone())
|
||||
|| hasText(item.getRemark())));
|
||||
form.setAdvisors(filterItems(form.getAdvisors(),
|
||||
item -> hasText(item.getName())
|
||||
|| hasText(item.getGender())
|
||||
|| hasText(item.getCollege())
|
||||
|| hasText(item.getTitle())
|
||||
|| hasText(item.getDuty())
|
||||
|| hasText(item.getPhone())));
|
||||
if (form.getTeamMembers() != null && !form.getTeamMembers().isEmpty()) {
|
||||
TzbcyForm.TeamMember leaderMember = form.getTeamMembers().get(0);
|
||||
form.setLeader(leaderMember.getName());
|
||||
form.setPhone(leaderMember.getPhone());
|
||||
}
|
||||
}
|
||||
|
||||
private <T> List<T> filterItems(List<T> items, Predicate<T> predicate) {
|
||||
if (items == null || items.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return items.stream().filter(Objects::nonNull).filter(predicate).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private boolean hasText(String value) {
|
||||
return value != null && !value.trim().isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.gxmu.entity.TzbcyMaterial;
|
||||
import com.gxwebsoft.gxmu.param.TzbcyMaterialParam;
|
||||
import com.gxwebsoft.gxmu.service.TzbcyMaterialService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挑战杯申报材料控制器
|
||||
*/
|
||||
@Api(tags = "挑战杯申报材料管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/tzbcy-material")
|
||||
public class TzbcyMaterialController extends BaseController {
|
||||
@Resource
|
||||
private TzbcyMaterialService tzbcyMaterialService;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Value("${config.server-url}")
|
||||
private String requestURL;
|
||||
|
||||
@ApiOperation("分页查询挑战杯申报材料")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<TzbcyMaterial>> page(TzbcyMaterialParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, false);
|
||||
return success(tzbcyMaterialService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询挑战杯申报材料列表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<TzbcyMaterial>> list(TzbcyMaterialParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, false);
|
||||
return success(tzbcyMaterialService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询挑战杯申报材料")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<TzbcyMaterial> get(@PathVariable("id") Integer id) {
|
||||
return success(tzbcyMaterialService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加挑战杯申报材料")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody TzbcyMaterial material) {
|
||||
FileRecord fileRecord = material.getFileId() == null ? null : fileRecordService.getById(material.getFileId());
|
||||
return tzbcyMaterialService.saveMaterial(material, fileRecord, getLoginUserId(), getTenantId())
|
||||
? success("提交成功") : fail("提交失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改挑战杯申报材料")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody TzbcyMaterial material) {
|
||||
FileRecord fileRecord = material.getFileId() == null ? null : fileRecordService.getById(material.getFileId());
|
||||
return tzbcyMaterialService.updateMaterial(material, fileRecord)
|
||||
? success("提交成功") : fail("提交失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("审核挑战杯申报材料")
|
||||
@PutMapping("/audit")
|
||||
public ApiResult<?> audit(@RequestBody AuditParam param) {
|
||||
return tzbcyMaterialService.audit(param.getId(), param.getStatus(), param.getRejectReason(), getLoginUserId())
|
||||
? success("审核成功") : fail("审核失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除挑战杯申报材料")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
TzbcyMaterial material = tzbcyMaterialService.getById(id);
|
||||
if (material != null && Integer.valueOf(1).equals(material.getStatus())) {
|
||||
return fail("材料已审核通过,不能删除");
|
||||
}
|
||||
return tzbcyMaterialService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("导出挑战杯申报材料ZIP")
|
||||
@PostMapping("/export")
|
||||
public ApiResult<FileRecord> export(@RequestBody TzbcyMaterialParam param) throws IOException {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
return success(tzbcyMaterialService.exportZip(param, uploadPath, requestURL, getLoginUserId()));
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class AuditParam {
|
||||
private Integer id;
|
||||
private Integer status;
|
||||
private String rejectReason;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.Organization;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.common.system.service.OrganizationService;
|
||||
import com.gxwebsoft.gxmu.entity.WshqtwForm;
|
||||
import com.gxwebsoft.gxmu.param.WshqtwFormParam;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowStarterService;
|
||||
import com.gxwebsoft.gxmu.service.WshqtwFormService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
import com.gxwebsoft.gxmu.util.WshqtwDocxExportUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 五四红旗团委申报表控制器
|
||||
*/
|
||||
@Api(tags = "五四红旗团委申报表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/wshqtw-form")
|
||||
public class WshqtwFormController extends BaseController {
|
||||
@Resource
|
||||
private WshqtwFormService wshqtwFormService;
|
||||
@Resource
|
||||
private ReviewFlowStarterService reviewFlowStarterService;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Value("${config.server-url}")
|
||||
private String requestURL;
|
||||
|
||||
@ApiOperation("分页查询五四红旗团委申报表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<WshqtwForm>> page(WshqtwFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<WshqtwForm, WshqtwFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(wshqtwFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"org_name", "leader", "phone")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户五四红旗团委申报表")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<WshqtwForm>> userPage(WshqtwFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<WshqtwForm, WshqtwFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(wshqtwFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"org_name", "leader", "phone")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部五四红旗团委申报表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<WshqtwForm>> list(WshqtwFormParam param) {
|
||||
PageParam<WshqtwForm, WshqtwFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(wshqtwFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"org_name", "leader", "phone"))));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("导出五四红旗团委申报材料")
|
||||
@PostMapping("/export")
|
||||
public ApiResult<?> export(@RequestBody WshqtwFormParam param, HttpServletRequest request) throws IOException {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<WshqtwForm, WshqtwFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
List<WshqtwForm> records = wshqtwFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"org_name", "leader", "phone")));
|
||||
if (records == null || records.isEmpty()) {
|
||||
return fail("暂无可导出的数据");
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
WshqtwDocxExportUtil.SummaryMeta summaryMeta = new WshqtwDocxExportUtil.SummaryMeta();
|
||||
summaryMeta.setYearText(resolveYearText(param, records));
|
||||
summaryMeta.setReporter(loginUser == null ? "" : resolveReporter(loginUser));
|
||||
summaryMeta.setContact(loginUser == null ? "" : valueOf(loginUser.getPhone()));
|
||||
summaryMeta.setOrganizationPartyOpinion(resolveOrganizationPartyOpinion(loginUser));
|
||||
|
||||
String relativePath = "file/docx/五四红旗团委申报材料_" + System.currentTimeMillis() + ".zip";
|
||||
File targetFile = new File(uploadPath + relativePath);
|
||||
File parentFile = targetFile.getParentFile();
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
|
||||
try (FileOutputStream outputStream = new FileOutputStream(targetFile);
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {
|
||||
WshqtwDocxExportUtil.writeExportZip(zipOutputStream, records, summaryMeta);
|
||||
zipOutputStream.finish();
|
||||
}
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(targetFile.getName());
|
||||
result.setPath(targetFile.getAbsolutePath());
|
||||
result.setContentType("application/zip");
|
||||
result.setUrl(requestURL + "/" + relativePath);
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询五四红旗团委申报表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<WshqtwForm> get(@PathVariable("id") Integer id) {
|
||||
return success(wshqtwFormService.getById(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加五四红旗团委申报表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody WshqtwForm wshqtwForm) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
wshqtwForm.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (wshqtwFormService.save(wshqtwForm)) {
|
||||
reviewFlowStarterService.startReview("gxmu_wshqtw", wshqtwForm.getId());
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改五四红旗团委申报表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody WshqtwForm wshqtwForm) {
|
||||
if (wshqtwFormService.updateById(wshqtwForm)) {
|
||||
reviewFlowStarterService.restartReviewWhenLastRejected("gxmu_wshqtw", wshqtwForm.getId());
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除五四红旗团委申报表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return wshqtwFormService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改五四红旗团委申报表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<WshqtwForm> batchParam) {
|
||||
return batchParam.update(wshqtwFormService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除五四红旗团委申报表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return wshqtwFormService.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private String resolveYearText(WshqtwFormParam param, List<WshqtwForm> records) {
|
||||
if (param.getYear() != null) {
|
||||
return String.valueOf(param.getYear());
|
||||
}
|
||||
if (records != null && !records.isEmpty() && records.get(0).getYear() != null) {
|
||||
return String.valueOf(records.get(0).getYear());
|
||||
}
|
||||
return String.valueOf(java.time.LocalDate.now().getYear());
|
||||
}
|
||||
|
||||
private String resolveReporter(User loginUser) {
|
||||
if (loginUser == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getRealName())) {
|
||||
return loginUser.getRealName().trim();
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getNickname())) {
|
||||
return loginUser.getNickname().trim();
|
||||
}
|
||||
return valueOf(loginUser.getUsername());
|
||||
}
|
||||
|
||||
private String resolveOrganizationPartyOpinion(User loginUser) {
|
||||
if (loginUser == null || loginUser.getOrganizationId() == null) {
|
||||
return "(盖章)";
|
||||
}
|
||||
Organization organization = organizationService.getByIdRel(loginUser.getOrganizationId());
|
||||
String organizationName = organization == null ? "" : valueOf(organization.getOrganizationName());
|
||||
return organizationName.isEmpty() ? "(盖章)" : organizationName + "(盖章)";
|
||||
}
|
||||
|
||||
private String valueOf(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.Organization;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.common.system.service.OrganizationService;
|
||||
import com.gxwebsoft.gxmu.entity.WshqtzbForm;
|
||||
import com.gxwebsoft.gxmu.param.WshqtzbFormParam;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowStarterService;
|
||||
import com.gxwebsoft.gxmu.service.WshqtzbFormService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
import com.gxwebsoft.gxmu.util.WshqtzbDocxExportUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 五四红旗团支部申报表控制器
|
||||
*/
|
||||
@Api(tags = "五四红旗团支部申报表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/wshqtzb-form")
|
||||
public class WshqtzbFormController extends BaseController {
|
||||
@Resource
|
||||
private WshqtzbFormService wshqtzbFormService;
|
||||
@Resource
|
||||
private ReviewFlowStarterService reviewFlowStarterService;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Value("${config.server-url}")
|
||||
private String requestURL;
|
||||
|
||||
@ApiOperation("分页查询五四红旗团支部申报表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<WshqtzbForm>> page(WshqtzbFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<WshqtzbForm, WshqtzbFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(wshqtzbFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"branch_name", "secretary", "contact")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户五四红旗团支部申报表")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<WshqtzbForm>> userPage(WshqtzbFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<WshqtzbForm, WshqtzbFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(wshqtzbFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"branch_name", "secretary", "contact")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部五四红旗团支部申报表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<WshqtzbForm>> list(WshqtzbFormParam param) {
|
||||
PageParam<WshqtzbForm, WshqtzbFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(wshqtzbFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"branch_name", "secretary", "contact"))));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("导出五四红旗团支部申报材料")
|
||||
@PostMapping("/export")
|
||||
public ApiResult<?> export(@RequestBody WshqtzbFormParam param, HttpServletRequest request) throws IOException {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<WshqtzbForm, WshqtzbFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
List<WshqtzbForm> records = wshqtzbFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"branch_name", "secretary", "contact")));
|
||||
if (records == null || records.isEmpty()) {
|
||||
return fail("暂无可导出的数据");
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
WshqtzbDocxExportUtil.SummaryMeta summaryMeta = new WshqtzbDocxExportUtil.SummaryMeta();
|
||||
summaryMeta.setYearText(resolveYearText(param, records));
|
||||
summaryMeta.setReporter(loginUser == null ? "" : resolveReporter(loginUser));
|
||||
summaryMeta.setContact(loginUser == null ? "" : valueOf(loginUser.getPhone()));
|
||||
summaryMeta.setOrganizationPartyOpinion(resolveOrganizationPartyOpinion(loginUser));
|
||||
|
||||
String relativePath = "file/docx/五四红旗团支部申报材料_" + System.currentTimeMillis() + ".zip";
|
||||
File targetFile = new File(uploadPath + relativePath);
|
||||
File parentFile = targetFile.getParentFile();
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
|
||||
try (FileOutputStream outputStream = new FileOutputStream(targetFile);
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {
|
||||
WshqtzbDocxExportUtil.writeExportZip(zipOutputStream, records, summaryMeta);
|
||||
zipOutputStream.finish();
|
||||
}
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(targetFile.getName());
|
||||
result.setPath(targetFile.getAbsolutePath());
|
||||
result.setContentType("application/zip");
|
||||
result.setUrl(requestURL + "/" + relativePath);
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询五四红旗团支部申报表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<WshqtzbForm> get(@PathVariable("id") Integer id) {
|
||||
return success(wshqtzbFormService.getById(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加五四红旗团支部申报表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody WshqtzbForm wshqtzbForm) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
wshqtzbForm.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (wshqtzbFormService.save(wshqtzbForm)) {
|
||||
reviewFlowStarterService.startReview("gxmu_wshqtzb", wshqtzbForm.getId());
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改五四红旗团支部申报表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody WshqtzbForm wshqtzbForm) {
|
||||
if (wshqtzbFormService.updateById(wshqtzbForm)) {
|
||||
reviewFlowStarterService.restartReviewWhenLastRejected("gxmu_wshqtzb", wshqtzbForm.getId());
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除五四红旗团支部申报表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return wshqtzbFormService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改五四红旗团支部申报表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<WshqtzbForm> batchParam) {
|
||||
return batchParam.update(wshqtzbFormService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除五四红旗团支部申报表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return wshqtzbFormService.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private String resolveYearText(WshqtzbFormParam param, List<WshqtzbForm> records) {
|
||||
if (param.getYear() != null) {
|
||||
return String.valueOf(param.getYear());
|
||||
}
|
||||
if (records != null && !records.isEmpty() && records.get(0).getYear() != null) {
|
||||
return String.valueOf(records.get(0).getYear());
|
||||
}
|
||||
return String.valueOf(java.time.LocalDate.now().getYear());
|
||||
}
|
||||
|
||||
private String resolveReporter(User loginUser) {
|
||||
if (loginUser == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getRealName())) {
|
||||
return loginUser.getRealName().trim();
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getNickname())) {
|
||||
return loginUser.getNickname().trim();
|
||||
}
|
||||
return valueOf(loginUser.getUsername());
|
||||
}
|
||||
|
||||
private String resolveOrganizationPartyOpinion(User loginUser) {
|
||||
if (loginUser == null || loginUser.getOrganizationId() == null) {
|
||||
return "(盖章)";
|
||||
}
|
||||
Organization organization = organizationService.getByIdRel(loginUser.getOrganizationId());
|
||||
String organizationName = organization == null ? "" : valueOf(organization.getOrganizationName());
|
||||
return organizationName.isEmpty() ? "(盖章)" : organizationName + "(盖章)";
|
||||
}
|
||||
|
||||
private String valueOf(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,892 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.gxmu.entity.QmgcForm;
|
||||
import com.gxwebsoft.gxmu.entity.SjqnForm;
|
||||
import com.gxwebsoft.gxmu.entity.SjtbzbsjForm;
|
||||
import com.gxwebsoft.gxmu.entity.TzbcyForm;
|
||||
import com.gxwebsoft.gxmu.entity.WxxzxForm;
|
||||
import com.gxwebsoft.gxmu.entity.WshqtwForm;
|
||||
import com.gxwebsoft.gxmu.entity.WshqtzbForm;
|
||||
import com.gxwebsoft.gxmu.entity.YxgqtdgbForm;
|
||||
import com.gxwebsoft.gxmu.entity.YxgqtyForm;
|
||||
import com.gxwebsoft.gxmu.model.WxxzxDocxValidationResult;
|
||||
import com.gxwebsoft.gxmu.model.WxxzxTopicSemanticSearchResult;
|
||||
import com.gxwebsoft.gxmu.param.WxxzxMaterialUpdateParam;
|
||||
import com.gxwebsoft.gxmu.param.WxxzxFormParam;
|
||||
import com.gxwebsoft.gxmu.service.QmgcFormService;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowStarterService;
|
||||
import com.gxwebsoft.gxmu.service.SjqnFormService;
|
||||
import com.gxwebsoft.gxmu.service.SjtbzbsjFormService;
|
||||
import com.gxwebsoft.gxmu.service.TzbcyFormService;
|
||||
import com.gxwebsoft.gxmu.service.WxxzxFormService;
|
||||
import com.gxwebsoft.gxmu.service.WshqtwFormService;
|
||||
import com.gxwebsoft.gxmu.service.WshqtzbFormService;
|
||||
import com.gxwebsoft.gxmu.service.YxgqtdgbFormService;
|
||||
import com.gxwebsoft.gxmu.service.YxgqtyFormService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
import com.gxwebsoft.gxmu.util.WxxzxDocxExportUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFRun;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 未来学术之星课题申报表控制器
|
||||
*/
|
||||
@Api(tags = "未来学术之星课题申报表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/wxxzx-form")
|
||||
public class WxxzxFormController extends BaseController {
|
||||
private static final String PROJECT_BOOK_KEYWORD = "项目申报书";
|
||||
private static final String TITLE_FONT_CN = "黑体";
|
||||
private static final String TITLE_FONT_EN = "SimHei";
|
||||
private static final double TITLE_FONT_SIZE = 26D;
|
||||
private static final String BODY_FONT_CN = "宋体";
|
||||
private static final String BODY_FONT_EN = "SimSun";
|
||||
private static final double BODY_FONT_SIZE = 10.5D;
|
||||
private static final int MAX_DETAIL_ITEMS = 20;
|
||||
private static final int MAX_TOPIC_SEARCH_RESULTS = 30;
|
||||
private static final String DEFAULT_TOPIC_SEARCH_MODULE = "gxmu_wxxzx_project";
|
||||
private static final Map<String, String> TOPIC_SEARCH_MODULE_NAME_MAP;
|
||||
|
||||
static {
|
||||
Map<String, String> moduleNameMap = new LinkedHashMap<>();
|
||||
moduleNameMap.put("gxmu_sjqn", "十佳青年岗位能手");
|
||||
moduleNameMap.put("gxmu_sjtbzbsj", "十佳团支部书记");
|
||||
moduleNameMap.put("gxmu_wshqtw", "五四红旗团委");
|
||||
moduleNameMap.put("gxmu_wshqtzb", "五四红旗团支部");
|
||||
moduleNameMap.put("gxmu_yxgqtdgb", "优秀共青团干部");
|
||||
moduleNameMap.put("gxmu_yxgqty", "优秀共青团员");
|
||||
moduleNameMap.put("gxmu_tzbcy_form", "挑战杯");
|
||||
moduleNameMap.put("gxmu_qmgc_form", "青马工程");
|
||||
moduleNameMap.put(DEFAULT_TOPIC_SEARCH_MODULE, "未来学术之星");
|
||||
TOPIC_SEARCH_MODULE_NAME_MAP = Collections.unmodifiableMap(moduleNameMap);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private WxxzxFormService wxxzxFormService;
|
||||
@Resource
|
||||
private SjqnFormService sjqnFormService;
|
||||
@Resource
|
||||
private SjtbzbsjFormService sjtbzbsjFormService;
|
||||
@Resource
|
||||
private WshqtwFormService wshqtwFormService;
|
||||
@Resource
|
||||
private WshqtzbFormService wshqtzbFormService;
|
||||
@Resource
|
||||
private YxgqtdgbFormService yxgqtdgbFormService;
|
||||
@Resource
|
||||
private YxgqtyFormService yxgqtyFormService;
|
||||
@Resource
|
||||
private TzbcyFormService tzbcyFormService;
|
||||
@Resource
|
||||
private QmgcFormService qmgcFormService;
|
||||
@Resource
|
||||
private ReviewFlowStarterService reviewFlowStarterService;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Value("${config.server-url}")
|
||||
private String requestURL;
|
||||
|
||||
@ApiOperation("分页查询未来学术之星课题申报表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<WxxzxForm>> page(WxxzxFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<WxxzxForm, WxxzxFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(wxxzxFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"topic_name", "leader", "college_grade_class")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户未来学术之星课题申报表")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<WxxzxForm>> userPage(WxxzxFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<WxxzxForm, WxxzxFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(wxxzxFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"topic_name", "leader", "college_grade_class")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部未来学术之星课题申报表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<WxxzxForm>> list(WxxzxFormParam param) {
|
||||
PageParam<WxxzxForm, WxxzxFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(wxxzxFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"topic_name", "leader", "college_grade_class"))));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("导出未来学术之星课题申报材料")
|
||||
@PostMapping("/export")
|
||||
public ApiResult<?> export(@RequestBody WxxzxFormParam param, HttpServletRequest request) throws IOException {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<WxxzxForm, WxxzxFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
List<WxxzxForm> baseRecords = wxxzxFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"topic_name", "leader", "college_grade_class")));
|
||||
if (baseRecords == null || baseRecords.isEmpty()) {
|
||||
return fail("暂无可导出的数据");
|
||||
}
|
||||
|
||||
List<WxxzxForm> records = new ArrayList<>();
|
||||
for (WxxzxForm item : baseRecords) {
|
||||
if (item == null || item.getId() == null) {
|
||||
continue;
|
||||
}
|
||||
WxxzxForm full = wxxzxFormService.getById(item.getId());
|
||||
if (full != null) {
|
||||
records.add(full);
|
||||
}
|
||||
}
|
||||
if (records.isEmpty()) {
|
||||
return fail("暂无可导出的数据");
|
||||
}
|
||||
|
||||
WxxzxDocxExportUtil.SummaryMeta summaryMeta = new WxxzxDocxExportUtil.SummaryMeta();
|
||||
summaryMeta.setYearText(resolveYearText(param, records));
|
||||
summaryMeta.setReviewCollege(resolveReviewCollege(records));
|
||||
summaryMeta.setReviewReporter(resolveReviewReporter(records));
|
||||
summaryMeta.setReviewDate(resolveReviewDate(records));
|
||||
|
||||
String relativePath = "file/docx/未来学术之星申报材料_" + System.currentTimeMillis() + ".zip";
|
||||
File targetFile = new File(uploadPath + relativePath);
|
||||
File parentFile = targetFile.getParentFile();
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
|
||||
try (FileOutputStream outputStream = new FileOutputStream(targetFile);
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {
|
||||
WxxzxDocxExportUtil.writeExportZip(zipOutputStream, records, summaryMeta);
|
||||
zipOutputStream.finish();
|
||||
}
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(targetFile.getName());
|
||||
result.setPath(targetFile.getAbsolutePath());
|
||||
result.setContentType("application/zip");
|
||||
result.setUrl(requestURL + "/" + relativePath);
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询未来学术之星课题申报表")
|
||||
@GetMapping("/{id:\\d+}")
|
||||
public ApiResult<WxxzxForm> get(@PathVariable("id") Integer id) {
|
||||
return success(wxxzxFormService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("项目主题语义检索")
|
||||
@GetMapping("/semantic-search")
|
||||
public ApiResult<List<WxxzxTopicSemanticSearchResult>> semanticSearch(
|
||||
@RequestParam(value = "keyword", required = false) String keyword,
|
||||
@RequestParam(value = "module", required = false) String module) {
|
||||
String normalizedKeyword = normalizeDisplayText(keyword);
|
||||
if (StrUtil.isBlank(normalizedKeyword)) {
|
||||
return success(new ArrayList<>());
|
||||
}
|
||||
String normalizedModule = resolveTopicSearchModule(module);
|
||||
if (normalizedModule == null) {
|
||||
return success(new ArrayList<>());
|
||||
}
|
||||
return success(searchTopicByModule(normalizedModule, normalizedKeyword));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加未来学术之星课题申报表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody WxxzxForm wxxzxForm) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
wxxzxForm.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (wxxzxFormService.save(wxxzxForm)) {
|
||||
reviewFlowStarterService.startReview("gxmu_wxxzx_project", wxxzxForm.getId());
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改未来学术之星课题申报表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody WxxzxForm wxxzxForm) {
|
||||
if (wxxzxFormService.updateById(wxxzxForm)) {
|
||||
reviewFlowStarterService.restartReviewWhenLastRejected("gxmu_wxxzx_project", wxxzxForm.getId());
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("更新未来学术之星过程材料")
|
||||
@PutMapping("/materials/{id}")
|
||||
public ApiResult<?> updateMaterials(@PathVariable("id") Integer id,
|
||||
@RequestBody WxxzxMaterialUpdateParam param) {
|
||||
return wxxzxFormService.updateMaterials(id, param) ? success("保存成功") : fail("保存失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("校验未来学术之星项目申报书docx格式")
|
||||
@PostMapping("/validate-project-book")
|
||||
public ApiResult<WxxzxDocxValidationResult> validateProjectBook(@RequestParam("file") MultipartFile file) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
return fail("请上传docx文件", null);
|
||||
}
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
if (StrUtil.isBlank(originalFilename) || !StrUtil.endWithIgnoreCase(originalFilename, ".docx")) {
|
||||
return fail("只能上传docx文件", null);
|
||||
}
|
||||
|
||||
WxxzxDocxValidationResult result = new WxxzxDocxValidationResult();
|
||||
result.setFileName(originalFilename);
|
||||
try (InputStream inputStream = file.getInputStream();
|
||||
XWPFDocument document = new XWPFDocument(inputStream)) {
|
||||
buildValidationResult(document, result);
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return fail("文件解析失败,请确认上传的是有效的docx文件", null);
|
||||
}
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除未来学术之星课题申报表")
|
||||
@DeleteMapping("/{id:\\d+}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return wxxzxFormService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改未来学术之星课题申报表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<WxxzxForm> batchParam) {
|
||||
return batchParam.update(wxxzxFormService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除未来学术之星课题申报表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return wxxzxFormService.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private String resolveYearText(WxxzxFormParam param, List<WxxzxForm> records) {
|
||||
if (param.getYear() != null) {
|
||||
return String.valueOf(param.getYear());
|
||||
}
|
||||
if (records != null && !records.isEmpty() && records.get(0).getYear() != null) {
|
||||
return String.valueOf(records.get(0).getYear());
|
||||
}
|
||||
return String.valueOf(java.time.LocalDate.now().getYear());
|
||||
}
|
||||
|
||||
private String resolveReviewCollege(List<WxxzxForm> records) {
|
||||
if (records == null) {
|
||||
return "";
|
||||
}
|
||||
for (WxxzxForm item : records) {
|
||||
if (StrUtil.isNotBlank(item.getReviewCollege())) {
|
||||
return item.getReviewCollege().trim();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String resolveReviewReporter(List<WxxzxForm> records) {
|
||||
if (records == null) {
|
||||
return "";
|
||||
}
|
||||
for (WxxzxForm item : records) {
|
||||
if (StrUtil.isNotBlank(item.getReviewReporter())) {
|
||||
return item.getReviewReporter().trim();
|
||||
}
|
||||
}
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getRealName())) {
|
||||
return loginUser.getRealName().trim();
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getNickname())) {
|
||||
return loginUser.getNickname().trim();
|
||||
}
|
||||
return loginUser.getUsername();
|
||||
}
|
||||
|
||||
private String resolveReviewDate(List<WxxzxForm> records) {
|
||||
if (records == null) {
|
||||
return "";
|
||||
}
|
||||
for (WxxzxForm item : records) {
|
||||
if (StrUtil.isNotBlank(item.getReviewDate())) {
|
||||
return item.getReviewDate().trim();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private WxxzxTopicSemanticSearchResult toTopicSearchResult(WxxzxForm form, String keyword) {
|
||||
WxxzxTopicSemanticSearchResult result = new WxxzxTopicSemanticSearchResult();
|
||||
result.setId(form.getId());
|
||||
result.setModule(DEFAULT_TOPIC_SEARCH_MODULE);
|
||||
result.setModuleName(TOPIC_SEARCH_MODULE_NAME_MAP.get(DEFAULT_TOPIC_SEARCH_MODULE));
|
||||
result.setTopicName(form.getTopicName());
|
||||
result.setTopicType(form.getTopicType());
|
||||
result.setRationale(form.getRationale());
|
||||
result.setSnippet(buildSnippet(form.getRationale(), keyword));
|
||||
result.setScore(calculateSemanticScore(form, keyword));
|
||||
return result;
|
||||
}
|
||||
|
||||
private String resolveTopicSearchModule(String module) {
|
||||
String normalizedModule = StrUtil.isBlank(module) ? DEFAULT_TOPIC_SEARCH_MODULE : module.trim();
|
||||
return TOPIC_SEARCH_MODULE_NAME_MAP.containsKey(normalizedModule) ? normalizedModule : null;
|
||||
}
|
||||
|
||||
private List<WxxzxTopicSemanticSearchResult> searchTopicByModule(String module, String keyword) {
|
||||
if ("gxmu_sjqn".equals(module)) {
|
||||
return finishTopicSearchResults(sjqnFormService.list(new LambdaQueryWrapper<SjqnForm>()
|
||||
.select(SjqnForm::getId, SjqnForm::getName, SjqnForm::getApplyType,
|
||||
SjqnForm::getMainStory, SjqnForm::getCreateTime, SjqnForm::getUpdateTime)
|
||||
.eq(SjqnForm::getTenantId, getTenantId())
|
||||
.like(SjqnForm::getName, keyword)
|
||||
.orderByDesc(SjqnForm::getUpdateTime)
|
||||
.orderByDesc(SjqnForm::getCreateTime))
|
||||
.stream()
|
||||
.map(item -> toTopicSearchResult(module, item.getId(), item.getName(), item.getApplyType(),
|
||||
item.getMainStory(), keyword))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
if ("gxmu_sjtbzbsj".equals(module)) {
|
||||
return finishTopicSearchResults(sjtbzbsjFormService.list(new LambdaQueryWrapper<SjtbzbsjForm>()
|
||||
.select(SjtbzbsjForm::getId, SjtbzbsjForm::getName, SjtbzbsjForm::getBranch,
|
||||
SjtbzbsjForm::getMainStory, SjtbzbsjForm::getCreateTime, SjtbzbsjForm::getUpdateTime)
|
||||
.eq(SjtbzbsjForm::getTenantId, getTenantId())
|
||||
.like(SjtbzbsjForm::getName, keyword)
|
||||
.orderByDesc(SjtbzbsjForm::getUpdateTime)
|
||||
.orderByDesc(SjtbzbsjForm::getCreateTime))
|
||||
.stream()
|
||||
.map(item -> toTopicSearchResult(module, item.getId(), item.getName(), item.getBranch(),
|
||||
item.getMainStory(), keyword))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
if ("gxmu_wshqtw".equals(module)) {
|
||||
return finishTopicSearchResults(wshqtwFormService.list(new LambdaQueryWrapper<WshqtwForm>()
|
||||
.select(WshqtwForm::getId, WshqtwForm::getOrgName, WshqtwForm::getLeader,
|
||||
WshqtwForm::getWorkSummaryThreeYears, WshqtwForm::getCreateTime, WshqtwForm::getUpdateTime)
|
||||
.eq(WshqtwForm::getTenantId, getTenantId())
|
||||
.like(WshqtwForm::getOrgName, keyword)
|
||||
.orderByDesc(WshqtwForm::getUpdateTime)
|
||||
.orderByDesc(WshqtwForm::getCreateTime))
|
||||
.stream()
|
||||
.map(item -> toTopicSearchResult(module, item.getId(), item.getOrgName(), item.getLeader(),
|
||||
item.getWorkSummaryThreeYears(), keyword))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
if ("gxmu_wshqtzb".equals(module)) {
|
||||
return finishTopicSearchResults(wshqtzbFormService.list(new LambdaQueryWrapper<WshqtzbForm>()
|
||||
.select(WshqtzbForm::getId, WshqtzbForm::getBranchName, WshqtzbForm::getSecondOrg,
|
||||
WshqtzbForm::getWorkSummaryThreeYears, WshqtzbForm::getCreateTime, WshqtzbForm::getUpdateTime)
|
||||
.eq(WshqtzbForm::getTenantId, getTenantId())
|
||||
.like(WshqtzbForm::getBranchName, keyword)
|
||||
.orderByDesc(WshqtzbForm::getUpdateTime)
|
||||
.orderByDesc(WshqtzbForm::getCreateTime))
|
||||
.stream()
|
||||
.map(item -> toTopicSearchResult(module, item.getId(), item.getBranchName(), item.getSecondOrg(),
|
||||
item.getWorkSummaryThreeYears(), keyword))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
if ("gxmu_yxgqtdgb".equals(module)) {
|
||||
return finishTopicSearchResults(yxgqtdgbFormService.list(new LambdaQueryWrapper<YxgqtdgbForm>()
|
||||
.select(YxgqtdgbForm::getId, YxgqtdgbForm::getName, YxgqtdgbForm::getOrganization,
|
||||
YxgqtdgbForm::getMainStory, YxgqtdgbForm::getCreateTime, YxgqtdgbForm::getUpdateTime)
|
||||
.eq(YxgqtdgbForm::getTenantId, getTenantId())
|
||||
.like(YxgqtdgbForm::getName, keyword)
|
||||
.orderByDesc(YxgqtdgbForm::getUpdateTime)
|
||||
.orderByDesc(YxgqtdgbForm::getCreateTime))
|
||||
.stream()
|
||||
.map(item -> toTopicSearchResult(module, item.getId(), item.getName(), item.getOrganization(),
|
||||
item.getMainStory(), keyword))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
if ("gxmu_yxgqty".equals(module)) {
|
||||
return finishTopicSearchResults(yxgqtyFormService.list(new LambdaQueryWrapper<YxgqtyForm>()
|
||||
.select(YxgqtyForm::getId, YxgqtyForm::getName, YxgqtyForm::getCollegeMajorClass,
|
||||
YxgqtyForm::getMainStory, YxgqtyForm::getCreateTime, YxgqtyForm::getUpdateTime)
|
||||
.eq(YxgqtyForm::getTenantId, getTenantId())
|
||||
.like(YxgqtyForm::getName, keyword)
|
||||
.orderByDesc(YxgqtyForm::getUpdateTime)
|
||||
.orderByDesc(YxgqtyForm::getCreateTime))
|
||||
.stream()
|
||||
.map(item -> toTopicSearchResult(module, item.getId(), item.getName(), item.getCollegeMajorClass(),
|
||||
item.getMainStory(), keyword))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
if ("gxmu_tzbcy_form".equals(module)) {
|
||||
return finishTopicSearchResults(tzbcyFormService.list(new LambdaQueryWrapper<TzbcyForm>()
|
||||
.select(TzbcyForm::getId, TzbcyForm::getProjectName, TzbcyForm::getProjectType,
|
||||
TzbcyForm::getProjectBrief, TzbcyForm::getCreateTime, TzbcyForm::getUpdateTime)
|
||||
.eq(TzbcyForm::getTenantId, getTenantId())
|
||||
.like(TzbcyForm::getProjectName, keyword)
|
||||
.orderByDesc(TzbcyForm::getUpdateTime)
|
||||
.orderByDesc(TzbcyForm::getCreateTime))
|
||||
.stream()
|
||||
.map(item -> toTopicSearchResult(module, item.getId(), item.getProjectName(), item.getProjectType(),
|
||||
item.getProjectBrief(), keyword))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
if ("gxmu_qmgc_form".equals(module)) {
|
||||
return finishTopicSearchResults(qmgcFormService.list(new LambdaQueryWrapper<QmgcForm>()
|
||||
.select(QmgcForm::getId, QmgcForm::getName, QmgcForm::getSchoolInfo,
|
||||
QmgcForm::getResume, QmgcForm::getCreateTime, QmgcForm::getUpdateTime)
|
||||
.eq(QmgcForm::getTenantId, getTenantId())
|
||||
.like(QmgcForm::getName, keyword)
|
||||
.orderByDesc(QmgcForm::getUpdateTime)
|
||||
.orderByDesc(QmgcForm::getCreateTime))
|
||||
.stream()
|
||||
.map(item -> toTopicSearchResult(module, item.getId(), item.getName(), item.getSchoolInfo(),
|
||||
item.getResume(), keyword))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
return finishTopicSearchResults(wxxzxFormService.list(new LambdaQueryWrapper<WxxzxForm>()
|
||||
.select(WxxzxForm::getId, WxxzxForm::getTopicName, WxxzxForm::getTopicType,
|
||||
WxxzxForm::getRationale, WxxzxForm::getCreateTime, WxxzxForm::getUpdateTime)
|
||||
.eq(WxxzxForm::getTenantId, getTenantId())
|
||||
.like(WxxzxForm::getTopicName, keyword)
|
||||
.orderByDesc(WxxzxForm::getUpdateTime)
|
||||
.orderByDesc(WxxzxForm::getCreateTime))
|
||||
.stream()
|
||||
.map(item -> toTopicSearchResult(item, keyword))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
private WxxzxTopicSemanticSearchResult toTopicSearchResult(
|
||||
String module, Integer id, String title, String type, String content, String keyword) {
|
||||
WxxzxTopicSemanticSearchResult result = new WxxzxTopicSemanticSearchResult();
|
||||
result.setId(id);
|
||||
result.setModule(module);
|
||||
result.setModuleName(TOPIC_SEARCH_MODULE_NAME_MAP.get(module));
|
||||
result.setTopicName(title);
|
||||
result.setTopicType(type);
|
||||
result.setRationale(content);
|
||||
result.setSnippet(buildSnippet(content, keyword));
|
||||
result.setScore(calculateTitleScore(title, keyword));
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<WxxzxTopicSemanticSearchResult> finishTopicSearchResults(List<WxxzxTopicSemanticSearchResult> results) {
|
||||
return results.stream()
|
||||
.filter(item -> item.getScore() != null && item.getScore() > 0)
|
||||
.sorted(Comparator.comparing(WxxzxTopicSemanticSearchResult::getScore,
|
||||
Comparator.nullsLast(Comparator.reverseOrder())))
|
||||
.limit(MAX_TOPIC_SEARCH_RESULTS)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private int calculateSemanticScore(WxxzxForm form, String keyword) {
|
||||
List<String> terms = extractSearchTerms(keyword);
|
||||
int score = 0;
|
||||
score += calculateFieldScore(form.getTopicName(), keyword, terms, 140, 28, true);
|
||||
score += calculateFieldScore(form.getTopicType(), keyword, terms, 90, 20, false);
|
||||
score += calculateFieldScore(form.getRationale(), keyword, terms, 60, 12, false);
|
||||
return score;
|
||||
}
|
||||
|
||||
private int calculateTitleScore(String title, String keyword) {
|
||||
return calculateFieldScore(title, keyword, extractSearchTerms(keyword), 140, 28, true);
|
||||
}
|
||||
|
||||
private int calculateFieldScore(String fieldValue, String keyword, List<String> terms,
|
||||
int exactScore, int termScore, boolean titleField) {
|
||||
String normalizedField = normalizeCheckText(fieldValue);
|
||||
if (StrUtil.isBlank(normalizedField)) {
|
||||
return 0;
|
||||
}
|
||||
String normalizedKeyword = normalizeCheckText(keyword);
|
||||
int score = 0;
|
||||
if (normalizedField.contains(normalizedKeyword)) {
|
||||
score += exactScore;
|
||||
if (normalizedField.startsWith(normalizedKeyword)) {
|
||||
score += exactScore / 2;
|
||||
}
|
||||
score += Math.min(countOccurrences(normalizedField, normalizedKeyword) * 10, 30);
|
||||
}
|
||||
int matchedTerms = 0;
|
||||
for (String term : terms) {
|
||||
String normalizedTerm = normalizeCheckText(term);
|
||||
if (StrUtil.isBlank(normalizedTerm) || normalizedTerm.length() < 2) {
|
||||
continue;
|
||||
}
|
||||
if (normalizedField.contains(normalizedTerm)) {
|
||||
matchedTerms++;
|
||||
score += termScore;
|
||||
}
|
||||
}
|
||||
if (titleField && matchedTerms == terms.size() && !terms.isEmpty()) {
|
||||
score += 30;
|
||||
}
|
||||
return score;
|
||||
}
|
||||
|
||||
private List<String> extractSearchTerms(String keyword) {
|
||||
String[] splits = normalizeDisplayText(keyword).split("[\\s,,;;。、】【()()]+");
|
||||
List<String> terms = new ArrayList<>();
|
||||
for (String split : splits) {
|
||||
if (StrUtil.isNotBlank(split)) {
|
||||
terms.add(split.trim());
|
||||
}
|
||||
}
|
||||
if (terms.isEmpty() && StrUtil.isNotBlank(keyword)) {
|
||||
terms.add(keyword.trim());
|
||||
}
|
||||
return terms;
|
||||
}
|
||||
|
||||
private int countOccurrences(String text, String pattern) {
|
||||
if (StrUtil.isBlank(text) || StrUtil.isBlank(pattern)) {
|
||||
return 0;
|
||||
}
|
||||
int count = 0;
|
||||
int index = 0;
|
||||
while ((index = text.indexOf(pattern, index)) >= 0) {
|
||||
count++;
|
||||
index += pattern.length();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private String buildSnippet(String rationale, String keyword) {
|
||||
String content = normalizeDisplayText(rationale);
|
||||
if (StrUtil.isBlank(content)) {
|
||||
return "暂无立论依据";
|
||||
}
|
||||
String normalizedKeyword = normalizeDisplayText(keyword);
|
||||
int index = content.indexOf(normalizedKeyword);
|
||||
if (index < 0) {
|
||||
for (String term : extractSearchTerms(keyword)) {
|
||||
index = content.indexOf(term);
|
||||
if (index >= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index < 0) {
|
||||
return abbreviate(content, 120);
|
||||
}
|
||||
int start = Math.max(index - 28, 0);
|
||||
int end = Math.min(index + normalizedKeyword.length() + 68, content.length());
|
||||
String snippet = content.substring(start, end);
|
||||
if (start > 0) {
|
||||
snippet = "..." + snippet;
|
||||
}
|
||||
if (end < content.length()) {
|
||||
snippet = snippet + "...";
|
||||
}
|
||||
return snippet;
|
||||
}
|
||||
|
||||
private void buildValidationResult(XWPFDocument document, WxxzxDocxValidationResult result) {
|
||||
List<XWPFParagraph> paragraphs = document.getParagraphs();
|
||||
List<WxxzxDocxValidationResult.Item> detailItems = new ArrayList<>();
|
||||
boolean titleFound = false;
|
||||
boolean titlePassed = true;
|
||||
boolean bodyPassed = true;
|
||||
int bodyCount = 0;
|
||||
int issueCount = 0;
|
||||
|
||||
for (int i = 0; i < paragraphs.size(); i++) {
|
||||
XWPFParagraph paragraph = paragraphs.get(i);
|
||||
String displayText = normalizeDisplayText(paragraph.getText());
|
||||
if (StrUtil.isBlank(displayText)) {
|
||||
continue;
|
||||
}
|
||||
boolean isTitleParagraph = normalizeCheckText(displayText).contains(PROJECT_BOOK_KEYWORD);
|
||||
ValidationIssue issue = isTitleParagraph
|
||||
? validateParagraph(paragraph, i + 1, TITLE_FONT_CN, TITLE_FONT_EN, TITLE_FONT_SIZE)
|
||||
: validateParagraph(paragraph, i + 1, BODY_FONT_CN, BODY_FONT_EN, BODY_FONT_SIZE);
|
||||
|
||||
if (isTitleParagraph) {
|
||||
titleFound = true;
|
||||
if (issue != null) {
|
||||
titlePassed = false;
|
||||
issueCount++;
|
||||
addDetailItem(detailItems, "标题格式", false, issue.getDetail(), issue.getSuggestion(),
|
||||
issue.getParagraphIndex(), abbreviate(issue.getParagraphText()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
bodyCount++;
|
||||
if (issue != null) {
|
||||
bodyPassed = false;
|
||||
issueCount++;
|
||||
addDetailItem(detailItems, "正文格式", false, issue.getDetail(), issue.getSuggestion(),
|
||||
issue.getParagraphIndex(), abbreviate(issue.getParagraphText()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!titleFound) {
|
||||
titlePassed = false;
|
||||
issueCount++;
|
||||
addDetailItem(detailItems, "标题格式", false, "未检测到含“项目申报书”字样的标题段落",
|
||||
"请新增或修改标题段落,并设置为黑体一号,且标题中包含“项目申报书”字样", null, null);
|
||||
}
|
||||
if (bodyCount == 0) {
|
||||
bodyPassed = false;
|
||||
issueCount++;
|
||||
addDetailItem(detailItems, "正文格式", false, "未检测到可校验的正文段落",
|
||||
"请补充正文内容,并统一设置为宋体五号", null, null);
|
||||
}
|
||||
|
||||
List<WxxzxDocxValidationResult.Item> finalItems = new ArrayList<>();
|
||||
if (titlePassed) {
|
||||
addDetailItem(finalItems, "标题格式", true,
|
||||
"已检测到含“项目申报书”字样的标题,格式为黑体一号",
|
||||
"无需修改", null, null);
|
||||
}
|
||||
if (bodyPassed && bodyCount > 0) {
|
||||
addDetailItem(finalItems, "正文格式", true,
|
||||
String.format(Locale.ROOT, "已检测 %d 个正文段落,格式均为宋体五号", bodyCount),
|
||||
"无需修改", null, null);
|
||||
}
|
||||
finalItems.addAll(detailItems);
|
||||
|
||||
if (issueCount > MAX_DETAIL_ITEMS) {
|
||||
addDetailItem(finalItems, "结果说明", false,
|
||||
String.format(Locale.ROOT, "问题较多,当前仅展示前 %d 处明细", MAX_DETAIL_ITEMS),
|
||||
"请优先按已展示的修改意见逐项调整后重新上传校验",
|
||||
null, null);
|
||||
}
|
||||
|
||||
result.setPassed(titlePassed && bodyPassed);
|
||||
result.setTotalIssues(issueCount);
|
||||
result.setSummary(result.getPassed()
|
||||
? "校验通过:标题和正文格式均符合要求"
|
||||
: String.format(Locale.ROOT, "校验不通过:共发现 %d 处问题", issueCount));
|
||||
result.setItems(finalItems);
|
||||
}
|
||||
|
||||
private ValidationIssue validateParagraph(XWPFParagraph paragraph, int paragraphIndex,
|
||||
String expectedFontCn, String expectedFontEn, double expectedSize) {
|
||||
List<XWPFRun> runs = paragraph.getRuns();
|
||||
if (runs == null || runs.isEmpty()) {
|
||||
return new ValidationIssue(paragraphIndex, paragraph.getText(),
|
||||
String.format(Locale.ROOT, "未检测到文本样式信息,应为%s %s",
|
||||
expectedFontCn, formatExpectedSize(expectedSize)),
|
||||
buildSuggestion(expectedFontCn, expectedSize));
|
||||
}
|
||||
|
||||
for (XWPFRun run : runs) {
|
||||
String runText = normalizeDisplayText(run.text());
|
||||
if (StrUtil.isBlank(runText)) {
|
||||
continue;
|
||||
}
|
||||
String actualFont = resolveFontFamily(run);
|
||||
Double actualSize = resolveFontSize(run);
|
||||
boolean fontMatched = matchesFont(actualFont, expectedFontCn, expectedFontEn);
|
||||
boolean sizeMatched = matchesSize(actualSize, expectedSize);
|
||||
if (fontMatched && sizeMatched) {
|
||||
continue;
|
||||
}
|
||||
String detail = String.format(Locale.ROOT,
|
||||
"应为%s %s,当前检测到字体“%s”、字号“%s”",
|
||||
expectedFontCn,
|
||||
formatExpectedSize(expectedSize),
|
||||
StrUtil.blankToDefault(actualFont, "未设置"),
|
||||
formatActualSize(actualSize));
|
||||
return new ValidationIssue(paragraphIndex, paragraph.getText(), detail,
|
||||
buildSuggestion(expectedFontCn, expectedSize));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void addDetailItem(List<WxxzxDocxValidationResult.Item> items, String rule, boolean passed,
|
||||
String detail, String suggestion, Integer paragraphIndex, String paragraphText) {
|
||||
if (!passed && "结果说明".equals(rule)) {
|
||||
WxxzxDocxValidationResult.Item item = new WxxzxDocxValidationResult.Item();
|
||||
item.setRule(rule);
|
||||
item.setPassed(false);
|
||||
item.setDetail(detail);
|
||||
item.setSuggestion(suggestion);
|
||||
items.add(item);
|
||||
return;
|
||||
}
|
||||
if (!passed) {
|
||||
long failedCount = items.stream().filter(item -> Boolean.FALSE.equals(item.getPassed())).count();
|
||||
if (failedCount >= MAX_DETAIL_ITEMS) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
WxxzxDocxValidationResult.Item item = new WxxzxDocxValidationResult.Item();
|
||||
item.setRule(rule);
|
||||
item.setPassed(passed);
|
||||
item.setDetail(detail);
|
||||
item.setSuggestion(suggestion);
|
||||
item.setParagraphIndex(paragraphIndex);
|
||||
item.setParagraphText(paragraphText);
|
||||
items.add(item);
|
||||
}
|
||||
|
||||
private String resolveFontFamily(XWPFRun run) {
|
||||
String[] candidates = new String[]{
|
||||
run.getFontFamily(XWPFRun.FontCharRange.eastAsia),
|
||||
run.getFontFamily(XWPFRun.FontCharRange.ascii),
|
||||
run.getFontFamily(XWPFRun.FontCharRange.hAnsi),
|
||||
run.getFontFamily(),
|
||||
run.getFontName()
|
||||
};
|
||||
for (String candidate : candidates) {
|
||||
if (StrUtil.isNotBlank(candidate)) {
|
||||
return candidate.trim();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Double resolveFontSize(XWPFRun run) {
|
||||
Double fontSize = run.getFontSizeAsDouble();
|
||||
if (fontSize != null && fontSize > 0) {
|
||||
return fontSize;
|
||||
}
|
||||
int fontSizeInt = run.getFontSize();
|
||||
return fontSizeInt > 0 ? (double) fontSizeInt : null;
|
||||
}
|
||||
|
||||
private boolean matchesFont(String actualFont, String expectedCn, String expectedEn) {
|
||||
if (StrUtil.isBlank(actualFont)) {
|
||||
return false;
|
||||
}
|
||||
String normalized = actualFont.replace(" ", "").trim().toLowerCase(Locale.ROOT);
|
||||
return normalized.equals(expectedCn.toLowerCase(Locale.ROOT))
|
||||
|| normalized.equals(expectedEn.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
private boolean matchesSize(Double actualSize, double expectedSize) {
|
||||
return actualSize != null && Math.abs(actualSize - expectedSize) < 0.11D;
|
||||
}
|
||||
|
||||
private String normalizeCheckText(String text) {
|
||||
return text == null ? "" : text.replace("\u3000", "").replaceAll("\\s+", "");
|
||||
}
|
||||
|
||||
private String normalizeDisplayText(String text) {
|
||||
return text == null ? "" : text.replace('\u00A0', ' ').replaceAll("\\s+", " ").trim();
|
||||
}
|
||||
|
||||
private String abbreviate(String text) {
|
||||
String displayText = normalizeDisplayText(text);
|
||||
return abbreviate(displayText, 80);
|
||||
}
|
||||
|
||||
private String abbreviate(String text, int maxLength) {
|
||||
String displayText = normalizeDisplayText(text);
|
||||
if (displayText.length() <= maxLength) {
|
||||
return displayText;
|
||||
}
|
||||
return displayText.substring(0, maxLength) + "...";
|
||||
}
|
||||
|
||||
private String formatExpectedSize(double size) {
|
||||
if (Math.abs(size - TITLE_FONT_SIZE) < 0.01D) {
|
||||
return "一号";
|
||||
}
|
||||
if (Math.abs(size - BODY_FONT_SIZE) < 0.01D) {
|
||||
return "五号";
|
||||
}
|
||||
return formatActualSize(size);
|
||||
}
|
||||
|
||||
private String formatActualSize(Double size) {
|
||||
if (size == null) {
|
||||
return "未设置";
|
||||
}
|
||||
if (Math.abs(size - Math.rint(size)) < 0.01D) {
|
||||
return String.format(Locale.ROOT, "%.0fpt", size);
|
||||
}
|
||||
return String.format(Locale.ROOT, "%.1fpt", size);
|
||||
}
|
||||
|
||||
private String buildSuggestion(String expectedFontCn, double expectedSize) {
|
||||
return String.format(Locale.ROOT, "请将该段调整为%s%s", expectedFontCn, formatExpectedSize(expectedSize));
|
||||
}
|
||||
|
||||
private static class ValidationIssue {
|
||||
private final Integer paragraphIndex;
|
||||
private final String paragraphText;
|
||||
private final String detail;
|
||||
private final String suggestion;
|
||||
|
||||
private ValidationIssue(Integer paragraphIndex, String paragraphText, String detail, String suggestion) {
|
||||
this.paragraphIndex = paragraphIndex;
|
||||
this.paragraphText = paragraphText;
|
||||
this.detail = detail;
|
||||
this.suggestion = suggestion;
|
||||
}
|
||||
|
||||
public Integer getParagraphIndex() {
|
||||
return paragraphIndex;
|
||||
}
|
||||
|
||||
public String getParagraphText() {
|
||||
return paragraphText;
|
||||
}
|
||||
|
||||
public String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
|
||||
public String getSuggestion() {
|
||||
return suggestion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.Organization;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.common.system.service.OrganizationService;
|
||||
import com.gxwebsoft.gxmu.entity.YxgqtdgbForm;
|
||||
import com.gxwebsoft.gxmu.param.YxgqtdgbFormParam;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowStarterService;
|
||||
import com.gxwebsoft.gxmu.service.YxgqtdgbFormService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
import com.gxwebsoft.gxmu.util.YxgqtdgbDocxExportUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 优秀共青团干部申报表控制器
|
||||
*/
|
||||
@Api(tags = "优秀共青团干部申报表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/yxgqtdgb-form")
|
||||
public class YxgqtdgbFormController extends BaseController {
|
||||
@Resource
|
||||
private YxgqtdgbFormService yxgqtdgbFormService;
|
||||
@Resource
|
||||
private ReviewFlowStarterService reviewFlowStarterService;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Value("${config.server-url}")
|
||||
private String requestURL;
|
||||
|
||||
@ApiOperation("分页查询优秀共青团干部申报表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<YxgqtdgbForm>> page(YxgqtdgbFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<YxgqtdgbForm, YxgqtdgbFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(yxgqtdgbFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "organization", "contact")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户优秀共青团干部申报表")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<YxgqtdgbForm>> userPage(YxgqtdgbFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<YxgqtdgbForm, YxgqtdgbFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(yxgqtdgbFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "organization", "contact")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部优秀共青团干部申报表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<YxgqtdgbForm>> list(YxgqtdgbFormParam param) {
|
||||
PageParam<YxgqtdgbForm, YxgqtdgbFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(yxgqtdgbFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "organization", "contact"))));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("导出优秀共青团干部申报材料")
|
||||
@PostMapping("/export")
|
||||
public ApiResult<?> export(@RequestBody YxgqtdgbFormParam param, HttpServletRequest request) throws IOException {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<YxgqtdgbForm, YxgqtdgbFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
List<YxgqtdgbForm> records = yxgqtdgbFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "organization", "contact")));
|
||||
if (records == null || records.isEmpty()) {
|
||||
return fail("暂无可导出的数据");
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
YxgqtdgbDocxExportUtil.SummaryMeta summaryMeta = new YxgqtdgbDocxExportUtil.SummaryMeta();
|
||||
summaryMeta.setYearText(resolveYearText(param, records));
|
||||
summaryMeta.setReporter(loginUser == null ? "" : resolveReporter(loginUser));
|
||||
summaryMeta.setContact(loginUser == null ? "" : valueOf(loginUser.getPhone()));
|
||||
summaryMeta.setOrganizationPartyOpinion(resolveOrganizationPartyOpinion(loginUser));
|
||||
|
||||
String relativePath = "file/docx/优秀共青团干部申报材料_" + System.currentTimeMillis() + ".zip";
|
||||
File targetFile = new File(uploadPath + relativePath);
|
||||
File parentFile = targetFile.getParentFile();
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
|
||||
try (FileOutputStream outputStream = new FileOutputStream(targetFile);
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {
|
||||
YxgqtdgbDocxExportUtil.writeExportZip(zipOutputStream, records, summaryMeta);
|
||||
zipOutputStream.finish();
|
||||
}
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(targetFile.getName());
|
||||
result.setPath(targetFile.getAbsolutePath());
|
||||
result.setContentType("application/zip");
|
||||
result.setUrl(requestURL + "/" + relativePath);
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询优秀共青团干部申报表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<YxgqtdgbForm> get(@PathVariable("id") Integer id) {
|
||||
return success(yxgqtdgbFormService.getById(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加优秀共青团干部申报表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody YxgqtdgbForm yxgqtdgbForm) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
yxgqtdgbForm.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (yxgqtdgbFormService.save(yxgqtdgbForm)) {
|
||||
reviewFlowStarterService.startReview("gxmu_yxgqtdgb", yxgqtdgbForm.getId());
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改优秀共青团干部申报表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody YxgqtdgbForm yxgqtdgbForm) {
|
||||
if (yxgqtdgbFormService.updateById(yxgqtdgbForm)) {
|
||||
reviewFlowStarterService.restartReviewWhenLastRejected("gxmu_yxgqtdgb", yxgqtdgbForm.getId());
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除优秀共青团干部申报表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return yxgqtdgbFormService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改优秀共青团干部申报表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<YxgqtdgbForm> batchParam) {
|
||||
return batchParam.update(yxgqtdgbFormService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除优秀共青团干部申报表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return yxgqtdgbFormService.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private String resolveYearText(YxgqtdgbFormParam param, List<YxgqtdgbForm> records) {
|
||||
if (param.getYear() != null) {
|
||||
return String.valueOf(param.getYear());
|
||||
}
|
||||
if (records != null && !records.isEmpty() && records.get(0).getYear() != null) {
|
||||
return String.valueOf(records.get(0).getYear());
|
||||
}
|
||||
return String.valueOf(java.time.LocalDate.now().getYear());
|
||||
}
|
||||
|
||||
private String resolveReporter(User loginUser) {
|
||||
if (loginUser == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getRealName())) {
|
||||
return loginUser.getRealName().trim();
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getNickname())) {
|
||||
return loginUser.getNickname().trim();
|
||||
}
|
||||
return valueOf(loginUser.getUsername());
|
||||
}
|
||||
|
||||
private String resolveOrganizationPartyOpinion(User loginUser) {
|
||||
if (loginUser == null || loginUser.getOrganizationId() == null) {
|
||||
return "(盖章)";
|
||||
}
|
||||
Organization organization = organizationService.getByIdRel(loginUser.getOrganizationId());
|
||||
String organizationName = organization == null ? "" : valueOf(organization.getOrganizationName());
|
||||
return organizationName.isEmpty() ? "(盖章)" : organizationName + "(盖章)";
|
||||
}
|
||||
|
||||
private String valueOf(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.gxwebsoft.gxmu.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.Organization;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.common.system.service.OrganizationService;
|
||||
import com.gxwebsoft.gxmu.entity.YxgqtyForm;
|
||||
import com.gxwebsoft.gxmu.param.YxgqtyFormParam;
|
||||
import com.gxwebsoft.gxmu.service.ReviewFlowStarterService;
|
||||
import com.gxwebsoft.gxmu.service.YxgqtyFormService;
|
||||
import com.gxwebsoft.gxmu.util.GxmuQueryHelper;
|
||||
import com.gxwebsoft.gxmu.util.YxgqtyDocxExportUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 优秀共青团员申报表控制器
|
||||
*/
|
||||
@Api(tags = "优秀共青团员申报表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/gxmu/yxgqty-form")
|
||||
public class YxgqtyFormController extends BaseController {
|
||||
@Resource
|
||||
private YxgqtyFormService yxgqtyFormService;
|
||||
@Resource
|
||||
private ReviewFlowStarterService reviewFlowStarterService;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Value("${config.server-url}")
|
||||
private String requestURL;
|
||||
|
||||
@ApiOperation("分页查询优秀共青团员申报表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<YxgqtyForm>> page(YxgqtyFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
PageParam<YxgqtyForm, YxgqtyFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(yxgqtyFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "college_major_class", "contact")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询当前用户优秀共青团员申报表")
|
||||
@GetMapping("/userPage")
|
||||
public ApiResult<PageResult<YxgqtyForm>> userPage(YxgqtyFormParam param) {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<YxgqtyForm, YxgqtyFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(new PageResult<>(yxgqtyFormService.page(page,
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "college_major_class", "contact")).getRecords(), page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部优秀共青团员申报表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<YxgqtyForm>> list(YxgqtyFormParam param) {
|
||||
PageParam<YxgqtyForm, YxgqtyFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
return success(yxgqtyFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "college_major_class", "contact"))));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("导出优秀共青团员申报材料")
|
||||
@PostMapping("/export")
|
||||
public ApiResult<?> export(@RequestBody YxgqtyFormParam param, HttpServletRequest request) throws IOException {
|
||||
applyBackendUserScope(param, param::setUserId, param::setUserIds, true);
|
||||
if (param.getUserId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
PageParam<YxgqtyForm, YxgqtyFormParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("id desc");
|
||||
List<YxgqtyForm> records = yxgqtyFormService.list(page.getOrderWrapper(
|
||||
GxmuQueryHelper.applyKeywords(page.getWrapper("keywords"), param.getKeywords(),
|
||||
"name", "college_major_class", "contact")));
|
||||
if (records == null || records.isEmpty()) {
|
||||
return fail("暂无可导出的数据");
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
YxgqtyDocxExportUtil.SummaryMeta summaryMeta = new YxgqtyDocxExportUtil.SummaryMeta();
|
||||
summaryMeta.setYearText(resolveYearText(param, records));
|
||||
summaryMeta.setReporter(loginUser == null ? "" : resolveReporter(loginUser));
|
||||
summaryMeta.setContact(loginUser == null ? "" : valueOf(loginUser.getPhone()));
|
||||
summaryMeta.setOrganizationPartyOpinion(resolveOrganizationPartyOpinion(loginUser));
|
||||
|
||||
String relativePath = "file/docx/优秀共青团员申报材料_" + System.currentTimeMillis() + ".zip";
|
||||
File targetFile = new File(uploadPath + relativePath);
|
||||
File parentFile = targetFile.getParentFile();
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
|
||||
try (FileOutputStream outputStream = new FileOutputStream(targetFile);
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {
|
||||
YxgqtyDocxExportUtil.writeExportZip(zipOutputStream, records, summaryMeta);
|
||||
zipOutputStream.finish();
|
||||
}
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(targetFile.getName());
|
||||
result.setPath(targetFile.getAbsolutePath());
|
||||
result.setContentType("application/zip");
|
||||
result.setUrl(requestURL + "/" + relativePath);
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询优秀共青团员申报表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<YxgqtyForm> get(@PathVariable("id") Integer id) {
|
||||
return success(yxgqtyFormService.getById(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("添加优秀共青团员申报表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody YxgqtyForm yxgqtyForm) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
yxgqtyForm.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (yxgqtyFormService.save(yxgqtyForm)) {
|
||||
reviewFlowStarterService.startReview("gxmu_yxgqty", yxgqtyForm.getId());
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("修改优秀共青团员申报表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody YxgqtyForm yxgqtyForm) {
|
||||
if (yxgqtyFormService.updateById(yxgqtyForm)) {
|
||||
reviewFlowStarterService.restartReviewWhenLastRejected("gxmu_yxgqty", yxgqtyForm.getId());
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("删除优秀共青团员申报表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
return yxgqtyFormService.removeById(id) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改优秀共青团员申报表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> updateBatch(@RequestBody BatchParam<YxgqtyForm> batchParam) {
|
||||
return batchParam.update(yxgqtyFormService, "id") ? success("修改成功") : fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除优秀共青团员申报表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
return yxgqtyFormService.removeByIds(ids) ? success("删除成功") : fail("删除失败");
|
||||
}
|
||||
|
||||
private String resolveYearText(YxgqtyFormParam param, List<YxgqtyForm> records) {
|
||||
if (param.getYear() != null) {
|
||||
return String.valueOf(param.getYear());
|
||||
}
|
||||
if (records != null && !records.isEmpty() && records.get(0).getYear() != null) {
|
||||
return String.valueOf(records.get(0).getYear());
|
||||
}
|
||||
return String.valueOf(java.time.LocalDate.now().getYear());
|
||||
}
|
||||
|
||||
private String resolveReporter(User loginUser) {
|
||||
if (loginUser == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getRealName())) {
|
||||
return loginUser.getRealName().trim();
|
||||
}
|
||||
if (StrUtil.isNotBlank(loginUser.getNickname())) {
|
||||
return loginUser.getNickname().trim();
|
||||
}
|
||||
return valueOf(loginUser.getUsername());
|
||||
}
|
||||
|
||||
private String resolveOrganizationPartyOpinion(User loginUser) {
|
||||
if (loginUser == null || loginUser.getOrganizationId() == null) {
|
||||
return "(盖章)";
|
||||
}
|
||||
Organization organization = organizationService.getByIdRel(loginUser.getOrganizationId());
|
||||
String organizationName = organization == null ? "" : valueOf(organization.getOrganizationName());
|
||||
return organizationName.isEmpty() ? "(盖章)" : organizationName + "(盖章)";
|
||||
}
|
||||
|
||||
private String valueOf(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
}
|
||||
75
src/main/java/com/gxwebsoft/gxmu/entity/ClassInfo.java
Normal file
75
src/main/java/com/gxwebsoft/gxmu/entity/ClassInfo.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.gxwebsoft.gxmu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 班级管理
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "ClassInfo对象", description = "班级管理")
|
||||
@TableName("gxmu_class")
|
||||
public class ClassInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("学院ID")
|
||||
private Integer collegeId;
|
||||
|
||||
@ApiModelProperty("班级编码")
|
||||
private String classCode;
|
||||
|
||||
@ApiModelProperty("班级名称")
|
||||
private String className;
|
||||
|
||||
@ApiModelProperty("年级")
|
||||
private Integer gradeYear;
|
||||
|
||||
@ApiModelProperty("辅导员")
|
||||
private String counselorName;
|
||||
|
||||
@ApiModelProperty("辅导员电话")
|
||||
private String counselorPhone;
|
||||
|
||||
@ApiModelProperty("学生人数")
|
||||
private Integer studentCount;
|
||||
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty("状态:1启用 0停用")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty("删除标记:0未删 1已删")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("学院名称")
|
||||
private String collegeName;
|
||||
}
|
||||
69
src/main/java/com/gxwebsoft/gxmu/entity/College.java
Normal file
69
src/main/java/com/gxwebsoft/gxmu/entity/College.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package com.gxwebsoft.gxmu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 学院管理
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "College对象", description = "学院管理")
|
||||
@TableName("gxmu_college")
|
||||
public class College implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("学院编码")
|
||||
private String collegeCode;
|
||||
|
||||
@ApiModelProperty("学院名称")
|
||||
private String collegeName;
|
||||
|
||||
@ApiModelProperty("学院简称")
|
||||
private String shortName;
|
||||
|
||||
@ApiModelProperty("负责人")
|
||||
private String leaderName;
|
||||
|
||||
@ApiModelProperty("负责人电话")
|
||||
private String leaderPhone;
|
||||
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty("状态:1启用 0停用")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty("删除标记:0未删 1已删")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("班级数量")
|
||||
private Integer classCount;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.gxwebsoft.gxmu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 跨校活动情报文章
|
||||
*
|
||||
* @author Codex
|
||||
* @since 2026-07-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "CrossSchoolActivityArticle对象", description = "跨校活动情报文章")
|
||||
@TableName("gxmu_cross_school_activity_article")
|
||||
public class CrossSchoolActivityArticle implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "来源唯一键")
|
||||
private String sourceKey;
|
||||
|
||||
@ApiModelProperty(value = "文章标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "高校名称")
|
||||
private String schoolName;
|
||||
|
||||
@ApiModelProperty(value = "活动类型")
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty(value = "热度等级")
|
||||
private String heatLevel;
|
||||
|
||||
@ApiModelProperty(value = "来源名称")
|
||||
private String sourceName;
|
||||
|
||||
@ApiModelProperty(value = "发布时间")
|
||||
private LocalDateTime publishTime;
|
||||
|
||||
@ApiModelProperty(value = "摘要")
|
||||
private String summary;
|
||||
|
||||
@ApiModelProperty(value = "标签JSON")
|
||||
private String tags;
|
||||
|
||||
@ApiModelProperty(value = "封面图")
|
||||
private String coverImage;
|
||||
|
||||
@ApiModelProperty(value = "详情链接")
|
||||
private String detailUrl;
|
||||
|
||||
@ApiModelProperty(value = "来源列表页")
|
||||
private String sourceUrl;
|
||||
|
||||
@ApiModelProperty(value = "可借鉴动作")
|
||||
private String highlight;
|
||||
|
||||
@ApiModelProperty(value = "正文文本")
|
||||
private String contentText;
|
||||
|
||||
@ApiModelProperty(value = "最近同步时间")
|
||||
private LocalDateTime lastSyncTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty(value = "删除标记:0未删 1已删")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
}
|
||||
74
src/main/java/com/gxwebsoft/gxmu/entity/Declare.java
Normal file
74
src/main/java/com/gxwebsoft/gxmu/entity/Declare.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package com.gxwebsoft.gxmu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 申报管理
|
||||
*
|
||||
* @author LX
|
||||
* @since 2026-03-28 15:06:52
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Declare对象", description = "申报管理")
|
||||
@TableName("gxmu_declare")
|
||||
public class Declare implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
|
||||
private Integer year;
|
||||
|
||||
private String module;
|
||||
|
||||
@ApiModelProperty(value = "挑战杯项目类型")
|
||||
private String projectType;
|
||||
|
||||
@ApiModelProperty(value = "挑战杯项目分组")
|
||||
private String projectGroup;
|
||||
|
||||
@ApiModelProperty(value = "挑战杯项目申报表项目类型")
|
||||
private String formProjectType;
|
||||
|
||||
@ApiModelProperty(value = "挑战杯项目申报表项目分组")
|
||||
private String formProjectGroup;
|
||||
|
||||
@ApiModelProperty(value = "挑战杯公开展示信息表项目类型")
|
||||
private String publicProjectType;
|
||||
|
||||
@ApiModelProperty(value = "挑战杯公开展示信息表项目分组")
|
||||
private String publicProjectGroup;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private Long tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty(value = "删除标记:0未删 1已删")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
126
src/main/java/com/gxwebsoft/gxmu/entity/QmgcForm.java
Normal file
126
src/main/java/com/gxwebsoft/gxmu/entity/QmgcForm.java
Normal file
@@ -0,0 +1,126 @@
|
||||
package com.gxwebsoft.gxmu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 青年马克思主义者培养工程培训班学员登记表
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "QmgcForm对象", description = "青年马克思主义者培养工程培训班学员登记表")
|
||||
@TableName("gxmu_qmgc_form")
|
||||
public class QmgcForm implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
private String gender;
|
||||
|
||||
@ApiModelProperty("民族")
|
||||
private String nation;
|
||||
|
||||
@ApiModelProperty("电子版照片")
|
||||
private String photo;
|
||||
|
||||
@ApiModelProperty("出生年月")
|
||||
private String birthMonth;
|
||||
|
||||
@ApiModelProperty("政治面貌")
|
||||
private String politics;
|
||||
|
||||
@ApiModelProperty("籍贯")
|
||||
private String nativePlace;
|
||||
|
||||
@ApiModelProperty("手机号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("微信号")
|
||||
private String wechat;
|
||||
|
||||
@ApiModelProperty("电子邮箱")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty("QQ号")
|
||||
private String qq;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String idCardNo;
|
||||
|
||||
@ApiModelProperty("爱好特长")
|
||||
private String hobby;
|
||||
|
||||
@ApiModelProperty("是否有志到基层一线和艰苦边远地区工作")
|
||||
private String willingToWorkInGuangxi;
|
||||
|
||||
@ApiModelProperty("学校、院系、年级、专业")
|
||||
private String schoolInfo;
|
||||
|
||||
@ApiModelProperty("担任团学职务情况")
|
||||
private String leaguePosition;
|
||||
|
||||
@ApiModelProperty("个人简历")
|
||||
private String resume;
|
||||
|
||||
@ApiModelProperty("奖惩情况")
|
||||
private String awards;
|
||||
|
||||
@ApiModelProperty("综合成绩情况")
|
||||
private String academicPerformance;
|
||||
|
||||
@ApiModelProperty("二级团组织意见")
|
||||
private String secondaryLeagueOpinion;
|
||||
|
||||
@ApiModelProperty("二级团组织意见日期")
|
||||
private String secondaryLeagueOpinionDate;
|
||||
|
||||
@ApiModelProperty("二级党组织意见")
|
||||
private String secondaryPartyOpinion;
|
||||
|
||||
@ApiModelProperty("二级党组织意见日期")
|
||||
private String secondaryPartyOpinionDate;
|
||||
|
||||
@ApiModelProperty("学校团委意见")
|
||||
private String schoolLeagueOpinion;
|
||||
|
||||
@ApiModelProperty("学校团委意见日期")
|
||||
private String schoolLeagueOpinionDate;
|
||||
|
||||
@ApiModelProperty("年度")
|
||||
private Integer year;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty("是否删除")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty("租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ReviewList> reviewList;
|
||||
}
|
||||
@@ -1,41 +1,38 @@
|
||||
package com.gxwebsoft.law.entity;
|
||||
package com.gxwebsoft.gxmu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 法律文书配置
|
||||
* 审核流
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-17 19:06:41
|
||||
* @since 2026-03-18 10:37:18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "LawLegalDocConfig对象", description = "法律文书配置")
|
||||
@TableName("law_legal_doc_config")
|
||||
public class LawLegalDocConfig implements Serializable {
|
||||
@ApiModel(value = "ReviewFlow对象", description = "审核流")
|
||||
@TableName("gxmu_review_flow")
|
||||
public class ReviewFlow implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer typeId;
|
||||
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
private String type;
|
||||
private Integer organizationId;
|
||||
|
||||
@ApiModelProperty(value = "内容")
|
||||
private String answer;
|
||||
|
||||
private Integer userId;
|
||||
private Integer level;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
@@ -50,12 +47,16 @@ public class LawLegalDocConfig implements Serializable {
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String userContent;
|
||||
private Integer userId;
|
||||
|
||||
private Integer reviewUserId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String email;
|
||||
private List<ReviewFlow> flows;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String file;
|
||||
private String organizationName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private User reviewUser;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.gxwebsoft.law.entity;
|
||||
package com.gxwebsoft.gxmu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
@@ -10,16 +10,16 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 机构
|
||||
*
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-04-14 00:35:34
|
||||
* @since 2026-03-18 10:37:18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "LawOrg对象", description = "机构")
|
||||
@TableName("law_org")
|
||||
public class LawOrg implements Serializable {
|
||||
@ApiModel(value = "ReviewFlowConfig对象", description = "")
|
||||
@TableName("gxmu_review_flow_config")
|
||||
public class ReviewFlowConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@@ -27,22 +27,16 @@ public class LawOrg implements Serializable {
|
||||
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "0律所 1基层法律服务所 2仲裁机构 3公证处")
|
||||
private String type;
|
||||
@ApiModelProperty(value = "流id")
|
||||
private Integer flowId;
|
||||
|
||||
private Integer provinceId;
|
||||
private Integer organizationId;
|
||||
|
||||
private Integer cityId;
|
||||
@TableField(exist = false)
|
||||
private String organizationName;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String address;
|
||||
|
||||
private Integer areaId;
|
||||
|
||||
private String lat;
|
||||
|
||||
private String lng;
|
||||
@ApiModelProperty(value = "模块")
|
||||
private String module;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
@@ -57,12 +51,11 @@ public class LawOrg implements Serializable {
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String province;
|
||||
private Integer userId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String city;
|
||||
private String flowName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String region;
|
||||
private String moduleName;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.gxwebsoft.law.entity;
|
||||
package com.gxwebsoft.gxmu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
@@ -12,44 +12,33 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 公证列表
|
||||
* 审核列表
|
||||
*
|
||||
* @author LX
|
||||
* @since 2025-05-17 16:10:35
|
||||
* @since 2026-03-18 15:50:51
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "LawNotaryList对象", description = "公证列表")
|
||||
@TableName("law_notary_list")
|
||||
public class LawNotaryList implements Serializable {
|
||||
@ApiModel(value = "ReviewList对象", description = "审核列表")
|
||||
@TableName("gxmu_review_list")
|
||||
public class ReviewList implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer uid;
|
||||
@ApiModelProperty(value = "模块")
|
||||
private String module;
|
||||
|
||||
private String nameList;
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer pk;
|
||||
|
||||
private String type;
|
||||
@ApiModelProperty(value = "状态(0待审核 1通过 2不通过)")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "公证事项")
|
||||
@ApiModelProperty(value = "审核意见")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "用途")
|
||||
private String application;
|
||||
|
||||
@ApiModelProperty(value = "使用地")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "译文")
|
||||
private String translate;
|
||||
|
||||
@ApiModelProperty(value = "文件列表")
|
||||
private String fileList;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
@@ -63,7 +52,16 @@ public class LawNotaryList implements Serializable {
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private Integer sortNumber;
|
||||
|
||||
@TableField(exist = false)
|
||||
private User user;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String moduleName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String businessName;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user