Kaynağa Gözat

fix: es search

Blizzard 1 yıl önce
ebeveyn
işleme
bdc0edbec0
25 değiştirilmiş dosya ile 464 ekleme ve 43 silme
  1. 1 1
      blade-biz-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java
  2. 3 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/Task.java
  3. 44 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/TaskContractPayLog.java
  4. 27 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/TaskContractPayLogVO.java
  5. 4 4
      blade-service/wutong-okr/src/main/java/com/wtkj/controller/FileAndFolderController.java
  6. 48 3
      blade-service/wutong-okr/src/main/java/com/wtkj/controller/TaskController.java
  7. 1 2
      blade-service/wutong-okr/src/main/java/com/wtkj/handler/Schedule.java
  8. 2 2
      blade-service/wutong-okr/src/main/java/com/wtkj/mapper/FileAndFolderMapper.java
  9. 6 0
      blade-service/wutong-okr/src/main/java/com/wtkj/mapper/FileAndFolderMapper.xml
  10. 16 0
      blade-service/wutong-okr/src/main/java/com/wtkj/mapper/TaskContractPayLogMapper.java
  11. 8 0
      blade-service/wutong-okr/src/main/java/com/wtkj/mapper/TaskContractPayLogMapper.xml
  12. 0 2
      blade-service/wutong-okr/src/main/java/com/wtkj/mapper/TaskMapper.java
  13. 0 4
      blade-service/wutong-okr/src/main/java/com/wtkj/mapper/TaskMapper.xml
  14. 2 2
      blade-service/wutong-okr/src/main/java/com/wtkj/service/IFileAndFolderService.java
  15. 20 0
      blade-service/wutong-okr/src/main/java/com/wtkj/service/ITaskContractPayLogService.java
  16. 2 1
      blade-service/wutong-okr/src/main/java/com/wtkj/service/ITaskService.java
  17. 5 4
      blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/AsyncServiceImpl.java
  18. 12 4
      blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/CommonServiceImpl.java
  19. 4 4
      blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/FileAndFolderServiceImpl.java
  20. 1 0
      blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/ProjectServiceImpl.java
  21. 69 0
      blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/TaskContractPayLogServiceImpl.java
  22. 1 1
      blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/TaskLogServiceImpl.java
  23. 26 9
      blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/TaskServiceImpl.java
  24. 93 0
      blade-service/wutong-okr/src/main/java/com/wtkj/wrapper/MyTaskWrapper.java
  25. 69 0
      blade-service/wutong-okr/src/main/java/com/wtkj/wrapper/TaskContractPayLogWrapper.java

+ 1 - 1
blade-biz-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java

@@ -33,7 +33,7 @@ import java.util.Properties;
 @AutoService(LauncherService.class)
 public class LauncherServiceImpl implements LauncherService {
 
-	private final String activeProfile = "dev";
+	private final String activeProfile = "prod";
 
 	@Override
 	public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) {

+ 3 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/Task.java

@@ -53,6 +53,9 @@ public class Task extends BaseEntity {
 	@ApiModelProperty("任务状态:1.待确认 2.进行中 3.已提交 4.已完成 5.已取消")
 	private Integer taskStatus = 1;
 
+	@TableField("is_expire")
+	private Integer isExpire = 0;
+
 	@TableField("level")
 	@ApiModelProperty("优先级")
 	private Integer level;

+ 44 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/TaskContractPayLog.java

@@ -0,0 +1,44 @@
+package com.wtkj.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author Blizzard
+ * @create at 2023-10-12 15:12
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_task_contract_pay_log")
+@Data
+public class TaskContractPayLog extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	@TableField("contract_id")
+	@JsonSerialize(using = ToStringSerializer.class)
+	@NotNull(message = "contractId can't be null")
+	private Long contractId;
+
+	@TableField("pay_amount")
+	private BigDecimal payAmount = BigDecimal.valueOf(0);
+
+	@TableField("pay_time")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	private Date payTime;
+
+	@TableField("blade_file_ids")
+	private String bladeFileIds;
+}

+ 27 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/TaskContractPayLogVO.java

@@ -0,0 +1,27 @@
+package com.wtkj.vo;
+
+import com.wtkj.entity.TaskContractPayLog;
+import com.wutong.file.vo.FileVO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-10-12 15:43
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class TaskContractPayLogVO extends TaskContractPayLog {
+
+	private static final long serialVersionUID = 1L;
+
+	private List<FileVO> files;
+
+	private String createUserName;
+
+	private String createDeptName;
+
+}

+ 4 - 4
blade-service/wutong-okr/src/main/java/com/wtkj/controller/FileAndFolderController.java

@@ -114,8 +114,8 @@ public class FileAndFolderController {
 	@GetMapping("/page-by-stage")
 	@ApiOperationSupport(order = 4)
 	@ApiOperation(value = "阶段下的顶级文件和文件夹", notes = "")
-	public R<IPage<FileAndFolderVO>> pageByStage(@RequestParam("stageId") Long stageId, Query query) {
-		IPage<FileAndFolder> page = fileAndFolderService.pageByStageId(stageId, Condition.getPage(query));
+	public R<IPage<FileAndFolderVO>> pageByStage(@RequestParam("stageId") Long stageId, @RequestParam Integer type, Query query) {
+		IPage<FileAndFolder> page = fileAndFolderService.pageByStageId(stageId, type, Condition.getPage(query));
 		return R.data(FileAndFolderWrapper.build().pageVO(page));
 	}
 
@@ -125,8 +125,8 @@ public class FileAndFolderController {
 	@GetMapping("/page-by-parent")
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "文件夹下的文件和文件夹", notes = "")
-	public R<IPage<FileAndFolderVO>> pageByParentId(@RequestParam("parentId") Long parentId, Query query) {
-		IPage<FileAndFolder> page = fileAndFolderService.pageByParentId(parentId, Condition.getPage(query));
+	public R<IPage<FileAndFolderVO>> pageByParentId(@RequestParam("parentId") Long parentId, @RequestParam Integer type, Query query) {
+		IPage<FileAndFolder> page = fileAndFolderService.pageByParentId(parentId, type, Condition.getPage(query));
 		return R.data(FileAndFolderWrapper.build().pageVO(page));
 	}
 

+ 48 - 3
blade-service/wutong-okr/src/main/java/com/wtkj/controller/TaskController.java

@@ -46,6 +46,8 @@ public class TaskController {
 
 	private final ITaskCostService taskCostService;
 
+	private final ITaskContractPayLogService payLogService;
+
 	/**
 	 * 我的任务分页
 	 */
@@ -58,7 +60,7 @@ public class TaskController {
 		query.setCurrent(dto.getCurrent());
 		query.setSize(dto.getSize());
 		IPage<Task> page = taskService.myTaskPage(dto, Condition.getPage(query));
-		return R.data(TaskWrapper.build().pageVO(page));
+		return R.data(MyTaskWrapper.build().pageVO(page));
 	}
 
 	/**
@@ -102,7 +104,7 @@ public class TaskController {
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "删除项目任务", notes = "传入ids")
 	public R<Boolean> deleteTask(String ids) {
-		return R.status(taskService.removeByIds(Func.toLongList(ids)));
+		return R.status(taskService.delete(Func.toLongList(ids)));
 	}
 
 	/**
@@ -225,7 +227,7 @@ public class TaskController {
 	@PostMapping("/submit-task-cost")
 	@ApiOperationSupport(order = 16)
 	@ApiOperation(value = "新增或修改任务成本", notes = "")
-	public R<Boolean> submitCost(@RequestBody TaskCost cost) {
+	public R<Boolean> submitCost(@RequestBody @Valid TaskCost cost) {
 		return R.data(taskCostService.saveOrUpdate(cost));
 	}
 
@@ -303,5 +305,48 @@ public class TaskController {
 	}
 
 
+	/**
+	 * 修改、添加合同付款记录
+	 */
+	@PostMapping("/submit-pay-log")
+	@ApiOperationSupport(order = 24)
+	@ApiOperation(value = "添加付款记录", notes = "")
+	public R submitPayLog(@RequestBody @Valid TaskContractPayLog payLog) {
+		return R.status(payLogService.submit(payLog));
+	}
+
+	/**
+	 * 删除付款记录
+	 */
+	@GetMapping("/delete-pay-log")
+	@ApiOperationSupport(order = 25)
+	@ApiOperation(value = "删除付款记录", notes = "")
+	public R deletePayLog(@RequestParam String ids, @RequestParam Long contractId) {
+		return R.status(payLogService.delete(Func.toLongList(ids), contractId));
+	}
+
+	/**
+	 * 付款记录详情
+	 */
+	@GetMapping("/pay-log-page")
+	@ApiOperationSupport(order = 26)
+	@ApiOperation(value = "付款记录分页", notes = "")
+	public R payLogPage(@RequestParam Long contractId, Query query) {
+		IPage<TaskContractPayLog> page = payLogService.pageByContractId(contractId, Condition.getPage(query));
+		return R.data(TaskContractPayLogWrapper.build().pageVO(page));
+	}
+
+
+	/**
+	 * 付款记录详情
+	 */
+	@GetMapping("/pay-log-detail")
+	@ApiOperationSupport(order = 27)
+	@ApiOperation(value = "付款记录详情", notes = "")
+	public R payLogDetail(@RequestParam Long id) {
+		TaskContractPayLog byId = payLogService.getById(id);
+		return R.data(TaskContractPayLogWrapper.build().entityVO(byId));
+	}
+
 }
 

+ 1 - 2
blade-service/wutong-okr/src/main/java/com/wtkj/handler/Schedule.java

@@ -45,6 +45,7 @@ public class Schedule {
 		if (!CollectionUtils.isEmpty(tasks)) {
 			tasks.forEach(task -> {
 				task.setTaskStatus(6);
+				task.setIsExpire(1);
 				Long projectId = task.getProjectId();
 				Project byId = projectService.getById(projectId);
 				if (byId != null) {
@@ -59,8 +60,6 @@ public class Schedule {
 	@Scheduled(cron = "0 0 4 * * ?")
 	private void stageStatusTask() {
 		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 设置日期格式
-		String now = LocalDate.now().format(formatter);
-
 		//1.是否有逾期任务
 		List<Task> tasks = taskService.getByStatus(6);
 		if (!CollectionUtils.isEmpty(tasks)) {

+ 2 - 2
blade-service/wutong-okr/src/main/java/com/wtkj/mapper/FileAndFolderMapper.java

@@ -12,13 +12,13 @@ import java.util.List;
  * @describe
  */
 public interface FileAndFolderMapper extends BaseMapper<FileAndFolder> {
-	List<FileAndFolder> selectByStage(Long stageId, IPage<FileAndFolder> page);
+	List<FileAndFolder> selectByStage(Long stageId, Integer type, IPage<FileAndFolder> page);
 
 	Integer getFileAmountByFolderId(Long stageId, Long folderId);
 
 	List<FileAndFolder> getChildrenFolderList(Long stageId, Long folderId);
 
-	List<FileAndFolder> selectByParent(Long parentId, IPage<FileAndFolder> page);
+	List<FileAndFolder> selectByParent(Long parentId, Integer type, IPage<FileAndFolder> page);
 
 	List<FileAndFolder> getChildrenFileList(Long stageId, Long parentId);
 

+ 6 - 0
blade-service/wutong-okr/src/main/java/com/wtkj/mapper/FileAndFolderMapper.xml

@@ -5,6 +5,9 @@
 
     <select id="selectByStage" resultType="com.wtkj.entity.FileAndFolder">
         select * from blade_file_and_folder where is_deleted = 0 and parent_id = 0 and stage_id = #{param1}
+        <if test="param2 != null and param2 !=''">
+            and type = #{param2}
+        </if>
         order by type desc,create_time desc, is_private
     </select>
 
@@ -30,6 +33,9 @@
 
     <select id="selectByParent" resultType="com.wtkj.entity.FileAndFolder">
         select * from blade_file_and_folder where is_deleted = 0 and parent_id = #{param1}
+        <if test="param2 != null and param2 !=''">
+            and type = #{param2}
+        </if>
         order by type desc, create_time desc,is_private
     </select>
 

+ 16 - 0
blade-service/wutong-okr/src/main/java/com/wtkj/mapper/TaskContractPayLogMapper.java

@@ -0,0 +1,16 @@
+package com.wtkj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.wtkj.entity.TaskContractPayLog;
+
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-10-12 15:17
+ * @describe
+ */
+public interface TaskContractPayLogMapper extends BaseMapper<TaskContractPayLog> {
+	List<TaskContractPayLog> pageByContractId(Long contractId, IPage<TaskContractPayLog> page);
+}

+ 8 - 0
blade-service/wutong-okr/src/main/java/com/wtkj/mapper/TaskContractPayLogMapper.xml

@@ -0,0 +1,8 @@
+<?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.wtkj.mapper.TaskContractPayLogMapper">
+
+    <select id="pageByContractId" resultType="com.wtkj.entity.TaskContractPayLog">
+        select * from blade_task_contract_pay_log where is_deleted = 0 and contract_id = #{param1}
+    </select>
+</mapper>

+ 0 - 2
blade-service/wutong-okr/src/main/java/com/wtkj/mapper/TaskMapper.java

@@ -22,8 +22,6 @@ public interface TaskMapper extends BaseMapper<Task> {
 
 	List<Task> getByDeptAndDate(Long topDept, Long executeDept, String user, String date);
 
-	List<Task> getByExecuteDept(Long deptId);
-
 	List<Task> selectByCompetentUnit(Long deptId);
 
 	List<Task> getTodayTodoByOrgDeptId(Long topDept, String date);

+ 0 - 4
blade-service/wutong-okr/src/main/java/com/wtkj/mapper/TaskMapper.xml

@@ -52,10 +52,6 @@
         order by create_time
     </select>
 
-    <select id="getByExecuteDept" resultType="com.wtkj.entity.Task">
-        select * from blade_task where is_deleted = 0 and execute_dept = #{param}
-        order by create_time
-    </select>
 
     <select id="selectByCompetentUnit" resultType="com.wtkj.entity.Task">
         select * from blade_task where is_deleted = 0 and competent_unit = #{param}

+ 2 - 2
blade-service/wutong-okr/src/main/java/com/wtkj/service/IFileAndFolderService.java

@@ -16,14 +16,14 @@ import java.util.List;
 public interface IFileAndFolderService extends BaseService<FileAndFolder> {
 	boolean isExistSameName(List<UploadFileDTO> files);
 
-	IPage<FileAndFolder> pageByStageId(Long stageId, IPage<FileAndFolder> page);
+	IPage<FileAndFolder> pageByStageId(Long stageId, Integer type, IPage<FileAndFolder> page);
 
 	/**
 	 * 文件夹下的文件数量
 	 */
 	Integer getFileAmountByFolderId(Long stageId, Long parentId);
 
-	IPage<FileAndFolder> pageByParentId(Long parentId, IPage<FileAndFolder> page);
+	IPage<FileAndFolder> pageByParentId(Long parentId, Integer type, IPage<FileAndFolder> page);
 
 	JSONObject getPageAndFileAmount(Long stageId, Long parentId);
 

+ 20 - 0
blade-service/wutong-okr/src/main/java/com/wtkj/service/ITaskContractPayLogService.java

@@ -0,0 +1,20 @@
+package com.wtkj.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.wtkj.entity.TaskContractPayLog;
+import org.springblade.core.mp.base.BaseService;
+
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-10-12 15:18
+ * @describe
+ */
+public interface ITaskContractPayLogService extends BaseService<TaskContractPayLog> {
+	boolean submit(TaskContractPayLog payLog);
+
+	boolean delete(List<Long> ids, Long contractId);
+
+	IPage<TaskContractPayLog> pageByContractId(Long contractId, IPage<TaskContractPayLog> page);
+}

+ 2 - 1
blade-service/wutong-okr/src/main/java/com/wtkj/service/ITaskService.java

@@ -94,11 +94,12 @@ public interface ITaskService extends BaseService<Task> {
 
 	void export(List<Workload> list, HttpServletResponse response) throws IOException;
 
-	List<Task> getByExecuteDept(Long deptId);
 
 	List<Task> getByCompetentUnit(Long deptId);
 
 	List<Task> getByStatus(Integer status);
 
 	List<Dept> taskCops(Long projectId);
+
+	boolean delete(List<Long> ids);
 }

+ 5 - 4
blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/AsyncServiceImpl.java

@@ -159,8 +159,9 @@ public class AsyncServiceImpl implements IAsyncService {
 							taskLog.setCreateDept(task.getCreateDept());
 							taskLog.setCreateUser(task.getCreateUser());
 							taskLog.setUpdateUser(task.getUpdateUser());
-							taskLog.setCreateTime(DateUtil.now());
-							taskLog.setUpdateTime(DateUtil.now());
+							time.setTime(time.getTime() + 2000);
+							taskLog.setCreateTime(time);
+							taskLog.setUpdateTime(time);
 							taskLogService.save(taskLog);
 
 							//项目权限
@@ -389,7 +390,7 @@ public class AsyncServiceImpl implements IAsyncService {
 			}
 
 			//5.指定任务审查者
-			if ((beforeUpdate.getFirstCheckUser() == null && afterUpdate.getFirstCheckUser() != null) || (beforeUpdate.getSecondCheckUser() == null && afterUpdate.getSecondCheckUser() != null)) {
+			if (((beforeUpdate.getFirstCheckUser() == null || beforeUpdate.getFirstCheckUser() < 0L) && afterUpdate.getFirstCheckUser() != null) || ((beforeUpdate.getSecondCheckUser() == null || beforeUpdate.getSecondCheckUser() < 0L) && afterUpdate.getSecondCheckUser() != null)) {
 				Long first = afterUpdate.getFirstCheckUser();
 				Long second = afterUpdate.getSecondCheckUser();
 				List<Long> checkUsers = new ArrayList<>();
@@ -674,7 +675,7 @@ public class AsyncServiceImpl implements IAsyncService {
 		if (userR.isSuccess() && project != null) {
 			String name = userR.getData().getName();
 			users.forEach(user -> {
-				R<User> rpc = userClient.userInfoById(userId);
+				R<User> rpc = userClient.userInfoById(user);
 				if (rpc.isSuccess()) {
 					String phone = rpc.getData().getPhone();
 					if (StringUtil.isNotBlank(name) && StringUtil.isNotBlank(phone)) {

+ 12 - 4
blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/CommonServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.wtkj.dto.SearchProjectFileDTO;
 import com.wtkj.dto.UploadFileDTO;
 import com.wtkj.dto.UploadInnerFileDTO;
@@ -260,7 +261,7 @@ public class CommonServiceImpl implements ICommonService {
 	@SneakyThrows
 	@Override
 	public IPage<FileAndFolder> esSearch(SearchProjectFileDTO dto, IPage<FileAndFolder> page) {
-		LambdaQueryWrapper<FileAndFolder> lqw = new LambdaQueryWrapper<>();
+		IPage<FileAndFolder> res = new Page<>();
 		Long deptId = dto.getTopDeptId();
 		String text = dto.getText();
 		Long projectId = dto.getProjectId();
@@ -271,7 +272,7 @@ public class CommonServiceImpl implements ICommonService {
 		} else {
 			//如果projectId为空 则查询机构下所有项目
 			//此机构下的项目
-			List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(deptId, null, null);
+			List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(deptId, null, AuthUtil.getUserId());
 			if (!CollectionUtils.isEmpty(auths)) {
 				Set<Long> ids = auths.stream().map(ProjectAuth::getProjectId).filter(Objects::nonNull).collect(Collectors.toSet());
 				projectIds.addAll(ids);
@@ -315,11 +316,18 @@ public class CommonServiceImpl implements ICommonService {
 			}
 		}
 		if (!CollectionUtils.isEmpty(set)) {
+			LambdaQueryWrapper<FileAndFolder> lqw = new LambdaQueryWrapper<>();
+			lqw.eq(FileAndFolder::getType, 1);
 			Set<Long> fileIds = set.stream().map(Document::getFileId).collect(Collectors.toSet());
 			lqw.in(FileAndFolder::getBladeFileId, fileIds);
+			res = fileAndFolderService.page(page, lqw);
+		} else {
+			LambdaQueryWrapper<FileAndFolder> lqw = new LambdaQueryWrapper<>();
+			lqw.eq(FileAndFolder::getType, 1);
+			lqw.in(FileAndFolder::getProjectId, projectIds);
+			res = fileAndFolderService.page(page, lqw);
 		}
-		lqw.eq(FileAndFolder::getType, 1);
-		return fileAndFolderService.page(page, lqw);
+		return res;
 	}
 
 	@SneakyThrows

+ 4 - 4
blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/FileAndFolderServiceImpl.java

@@ -58,8 +58,8 @@ public class FileAndFolderServiceImpl extends BaseServiceImpl<FileAndFolderMappe
 	}
 
 	@Override
-	public IPage<FileAndFolder> pageByStageId(Long stageId, IPage<FileAndFolder> page) {
-		return page.setRecords(baseMapper.selectByStage(stageId, page));
+	public IPage<FileAndFolder> pageByStageId(Long stageId, Integer type, IPage<FileAndFolder> page) {
+		return page.setRecords(baseMapper.selectByStage(stageId, type, page));
 	}
 
 	@Override
@@ -69,8 +69,8 @@ public class FileAndFolderServiceImpl extends BaseServiceImpl<FileAndFolderMappe
 	}
 
 	@Override
-	public IPage<FileAndFolder> pageByParentId(Long parentId, IPage<FileAndFolder> page) {
-		return page.setRecords(baseMapper.selectByParent(parentId, page));
+	public IPage<FileAndFolder> pageByParentId(Long parentId, Integer type, IPage<FileAndFolder> page) {
+		return page.setRecords(baseMapper.selectByParent(parentId, type, page));
 	}
 
 	@Override

+ 1 - 0
blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/ProjectServiceImpl.java

@@ -206,6 +206,7 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project>
 				lqw.orderByDesc(Project::getTodoTask);
 			} else {
 				lqw.orderByAsc(Project::getTodoTask);
+				lqw.orderByDesc(Project::getCreateTime);
 			}
 			// todo 截至时间降序
 			projectIPage = this.page(page, lqw);

+ 69 - 0
blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/TaskContractPayLogServiceImpl.java

@@ -0,0 +1,69 @@
+package com.wtkj.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.wtkj.entity.TaskContract;
+import com.wtkj.entity.TaskContractPayLog;
+import com.wtkj.mapper.TaskContractPayLogMapper;
+import com.wtkj.service.ITaskContractPayLogService;
+import com.wtkj.service.ITaskContractService;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-10-12 15:19
+ * @describe
+ */
+@Service
+@AllArgsConstructor
+public class TaskContractPayLogServiceImpl extends BaseServiceImpl<TaskContractPayLogMapper, TaskContractPayLog> implements ITaskContractPayLogService {
+
+	private final ITaskContractService taskContractService;
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean submit(TaskContractPayLog payLog) {
+		Long contractId = payLog.getContractId();
+		TaskContract contract = taskContractService.getById(contractId);
+		if (contract != null) {
+			BigDecimal amount = contract.getAmount();
+
+			BigDecimal payAmount = payLog.getPayAmount();
+			//如果支付金额大于0
+			if (payAmount.compareTo(BigDecimal.ZERO) > 0) {
+				BigDecimal subtract = amount.subtract(payAmount);
+				contract.setUnpaidAmount(subtract);
+				taskContractService.updateById(contract);
+			}
+		}
+		return this.saveOrUpdate(payLog);
+	}
+
+	@Override
+	public boolean delete(List<Long> ids, Long contractId) {
+		TaskContract contract = taskContractService.getById(contractId);
+		if (contract != null) {
+			BigDecimal unpaidAmount = contract.getUnpaidAmount();
+			for (Long id : ids) {
+				TaskContractPayLog payLog = this.getById(id);
+				if (payLog != null) {
+					BigDecimal payAmount = payLog.getPayAmount();
+					unpaidAmount = unpaidAmount.add(payAmount);
+				}
+			}
+			contract.setUnpaidAmount(unpaidAmount);
+			taskContractService.updateById(contract);
+		}
+		return this.removeByIds(ids);
+	}
+
+	@Override
+	public IPage<TaskContractPayLog> pageByContractId(Long contractId, IPage<TaskContractPayLog> page) {
+		return page.setRecords(baseMapper.pageByContractId(contractId, page));
+	}
+}

+ 1 - 1
blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/TaskLogServiceImpl.java

@@ -35,7 +35,7 @@ public class TaskLogServiceImpl extends BaseServiceImpl<TaskLogMapper, TaskLog>
 		List<User> res = new ArrayList<>();
 		List<TaskLog> logs = this.listByTaskId(id);
 		if (!CollectionUtils.isEmpty(logs)) {
-			Set<String> collect = logs.stream().filter(Objects::nonNull).map(TaskLog::getRelatedUser).collect(Collectors.toSet());
+			Set<String> collect = logs.stream().map(TaskLog::getRelatedUser).filter(Objects::nonNull).collect(Collectors.toSet());
 			if (!CollectionUtils.isEmpty(collect)) {
 				Set<String> idStr = collect.stream().flatMap(s -> Arrays.stream(s.split(","))).collect(Collectors.toSet());
 				idStr.forEach(userId -> {

+ 26 - 9
blade-service/wutong-okr/src/main/java/com/wtkj/service/impl/TaskServiceImpl.java

@@ -36,6 +36,7 @@ import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import javax.servlet.http.HttpServletResponse;
@@ -238,7 +239,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 					}
 				} else if (role.contains(STAFF_SECOND_ADMIN)) {
 					// 2.2 次级机构主管  ---> 任务是派遣给自己部门的
-					List<Task> list = this.getByExecuteDept(deptId);
+					List<Task> list = this.getByDeptAndDate(dto.getTopDept(), deptId, null, null);
 					if (!CollectionUtils.isEmpty(list)) {
 						Set<Long> taskIds = list.stream().map(Task::getId).collect(Collectors.toSet());
 						ids.addAll(taskIds);
@@ -278,7 +279,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 					}
 				} else if (role.contains(STAFF_SECOND_ADMIN)) {
 					// 2.2 次级机构主管  ---> 任务是派遣给自己部门的
-					List<Task> list = this.getByExecuteDept(deptId);
+					List<Task> list = this.getByDeptAndDate(dto.getTopDept(), deptId, null, null);
 					if (!CollectionUtils.isEmpty(list)) {
 						Set<Long> taskIds = list.stream().map(Task::getId).collect(Collectors.toSet());
 						lqw.in(Task::getId, taskIds);
@@ -324,6 +325,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 				}
 				Date now = DateUtil.now();
 				Date endTime = task.getEndTime();
+				Integer isExpire = task.getIsExpire();
 				if (endTime != null) {
 					//2.已逾期
 					if (taskStatus.equals(6)) {
@@ -342,8 +344,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 						statistics.setTodayToExpire(statistics.getTodayToExpire() + 1);
 					}
 
-					//5.逾期完成
-					if (endTime.before(now) && taskStatus.equals(4)) {
+					//5.逾期完成 isExpire = 1 且taskStatus = 4
+					if (isExpire.equals(1) && taskStatus.equals(4)) {
 						statistics.setOverdueComplete(statistics.getOverdueComplete() + 1);
 					}
 				}
@@ -744,11 +746,6 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 		}
 	}
 
-	@Override
-	public List<Task> getByExecuteDept(Long deptId) {
-		return baseMapper.getByExecuteDept(deptId);
-	}
-
 	@Override
 	public List<Task> getByCompetentUnit(Long deptId) {
 		return baseMapper.selectByCompetentUnit(deptId);
@@ -778,6 +775,26 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 		return res;
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean delete(List<Long> ids) {
+		ids.forEach(id -> {
+			Task task = this.getById(id);
+			if (task != null) {
+				Long projectId = task.getProjectId();
+				Project project = projectMapper.selectById(projectId);
+				if (project != null) {
+					Integer todoTask = project.getTodoTask();
+					todoTask = todoTask - 1;
+					project.setTodoTask(todoTask < 0 ? 0 : todoTask);
+					projectMapper.updateById(project);
+				}
+			}
+		});
+
+		return removeByIds(ids);
+	}
+
 
 	private List<Task> getListByDateAndStageAndStatus(Long stageId, String formatDate, Integer taskStatus) {
 		return baseMapper.selectByDateAndStageAndStatus(stageId, formatDate, taskStatus);

+ 93 - 0
blade-service/wutong-okr/src/main/java/com/wtkj/wrapper/MyTaskWrapper.java

@@ -0,0 +1,93 @@
+package com.wtkj.wrapper;
+
+import com.wtkj.entity.Project;
+import com.wtkj.entity.Task;
+import com.wtkj.service.IProjectService;
+import com.wtkj.vo.TaskVO;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.system.entity.DictBiz;
+import org.springblade.system.feign.IDictBizClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author Blizzard
+ * @create at 2023-10-13 09:51
+ * @describe
+ */
+public class MyTaskWrapper extends BaseEntityWrapper<Task, TaskVO> {
+
+	private static IUserClient userClient;
+
+	private static IDictBizClient dictBizClient;
+	private static IProjectService projectService;
+
+
+	public static MyTaskWrapper build() {
+		userClient = SpringUtil.getBean(IUserClient.class);
+		dictBizClient = SpringUtil.getBean(IDictBizClient.class);
+		projectService = SpringUtil.getBean(IProjectService.class);
+		return new MyTaskWrapper();
+	}
+
+	@Override
+	public TaskVO entityVO(Task entity) {
+		TaskVO vo = Objects.requireNonNull(BeanUtil.copy(entity, TaskVO.class));
+		Long projectId = entity.getProjectId();
+		if (projectId != null) {
+			Project byId = projectService.getById(projectId);
+			if (byId != null) {
+				vo.setProjectName(byId.getName());
+			}
+		}
+
+
+		//任务执行人
+		String executeUser = entity.getExecuteUser();
+		if (executeUser != null) {
+			List<String> execUsers = new ArrayList<>();
+			List<Long> userIds = Func.toLongList(executeUser);
+			userIds.forEach(userId -> {
+				R<User> userR = userClient.userInfoById(userId);
+				if (userR.isSuccess()) {
+					execUsers.add(userR.getData().getName());
+				}
+			});
+			vo.setExecuteUsers(execUsers);
+		}
+
+		//任务标签的数组
+		String tags = entity.getTags();
+		String category = entity.getCategory();
+		List<String> dictBizs = new ArrayList<>();
+		if (StringUtil.isNotBlank(tags)) {
+			List<Long> intList = Func.toLongList(tags);
+			intList.forEach(f -> {
+				R<DictBiz> byId = dictBizClient.getById(f);
+				if (byId.isSuccess()) {
+					dictBizs.add(byId.getData().getDictValue());
+				}
+			});
+		}
+		if (StringUtil.isNotBlank(category)) {
+			List<Long> intList = Func.toLongList(category);
+			intList.forEach(f -> {
+				R<DictBiz> byId = dictBizClient.getById(f);
+				if (byId.isSuccess()) {
+					dictBizs.add(byId.getData().getDictValue());
+				}
+			});
+		}
+		vo.setTagsArray(dictBizs);
+		return vo;
+	}
+}

+ 69 - 0
blade-service/wutong-okr/src/main/java/com/wtkj/wrapper/TaskContractPayLogWrapper.java

@@ -0,0 +1,69 @@
+package com.wtkj.wrapper;
+
+import com.wtkj.entity.TaskContractPayLog;
+import com.wtkj.vo.TaskContractPayLogVO;
+import com.wutong.file.feign.IFileClient;
+import com.wutong.file.vo.FileVO;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.system.entity.Dept;
+import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author Blizzard
+ * @create at 2023-10-12 15:44
+ * @describe
+ */
+public class TaskContractPayLogWrapper extends BaseEntityWrapper<TaskContractPayLog, TaskContractPayLogVO> {
+
+	private static IFileClient fileClient;
+	private static ISysClient sysClient;
+	private static IUserClient userClient;
+
+
+	public static TaskContractPayLogWrapper build() {
+		fileClient = SpringUtil.getBean(IFileClient.class);
+		sysClient = SpringUtil.getBean(ISysClient.class);
+		userClient = SpringUtil.getBean(IUserClient.class);
+		return new TaskContractPayLogWrapper();
+	}
+
+	@Override
+	public TaskContractPayLogVO entityVO(TaskContractPayLog entity) {
+		TaskContractPayLogVO vo = Objects.requireNonNull(BeanUtil.copy(entity, TaskContractPayLogVO.class));
+		String bladeFileIds = entity.getBladeFileIds();
+		if (StringUtil.isNotBlank(bladeFileIds)) {
+			List<FileVO> fileVOS = new ArrayList<>();
+			List<Long> fileIds = Func.toLongList(bladeFileIds);
+			fileIds.forEach(fileId -> {
+				R<FileVO> rpc = fileClient.findById(fileId);
+				if (rpc.isSuccess()) {
+					fileVOS.add(rpc.getData());
+				}
+			});
+			vo.setFiles(fileVOS);
+		}
+		Long createDept = entity.getCreateDept();
+		R<Dept> deptR = sysClient.getDept(createDept);
+		if (deptR.isSuccess()) {
+			vo.setCreateDeptName(deptR.getData().getDeptName());
+		}
+
+		Long createUser = entity.getCreateUser();
+		R<User> userR = userClient.userInfoById(createUser);
+		if (userR.isSuccess()) {
+			vo.setCreateUserName(userR.getData().getName());
+		}
+		return vo;
+	}
+}