From dd3b51c868f09c1d174defb89aae1fbb0958cdaa Mon Sep 17 00:00:00 2001 From: gxwebsoft Date: Fri, 17 Nov 2023 22:11:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E7=BB=AD=E8=B4=B9?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=8F=91=E7=8E=B0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oa/controller/AppController.java | 1 + .../oa/controller/AppRenewController.java | 1 + .../oa/controller/TaskController.java | 12 ++++- .../oa/controller/TaskRecordController.java | 4 +- .../java/com/gxwebsoft/oa/entity/App.java | 15 ++++-- .../com/gxwebsoft/oa/entity/AppRenew.java | 11 +++- .../java/com/gxwebsoft/oa/entity/Task.java | 3 ++ .../com/gxwebsoft/oa/mapper/xml/AppMapper.xml | 9 +++- .../oa/mapper/xml/AppRenewMapper.xml | 10 +++- .../gxwebsoft/oa/mapper/xml/TaskMapper.xml | 3 ++ .../com/gxwebsoft/oa/param/AppRenewParam.java | 4 ++ .../com/gxwebsoft/oa/param/TaskParam.java | 4 ++ .../oa/service/impl/AppRenewServiceImpl.java | 8 +-- .../oa/service/impl/TaskCountServiceImpl.java | 51 ++++++++++++++++--- .../oa/service/impl/TaskServiceImpl.java | 1 - 15 files changed, 115 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/gxwebsoft/oa/controller/AppController.java b/src/main/java/com/gxwebsoft/oa/controller/AppController.java index b31989c..1b194f9 100644 --- a/src/main/java/com/gxwebsoft/oa/controller/AppController.java +++ b/src/main/java/com/gxwebsoft/oa/controller/AppController.java @@ -49,6 +49,7 @@ public class AppController extends BaseController { if(!StrUtil.equals(d.getRoleCode(),"superAdmin") && !StrUtil.equals(d.getRoleCode(),"admin")){ // 非管理员按项目成员权限显示 final List list = appUserService.list(new LambdaQueryWrapper().eq(AppUser::getUserId, userId)); + System.out.println("list = " + list); final Set collect = list.stream().map(AppUser::getAppId).collect(Collectors.toSet()); param.setAppIds(collect); } diff --git a/src/main/java/com/gxwebsoft/oa/controller/AppRenewController.java b/src/main/java/com/gxwebsoft/oa/controller/AppRenewController.java index f52282b..b864c4d 100644 --- a/src/main/java/com/gxwebsoft/oa/controller/AppRenewController.java +++ b/src/main/java/com/gxwebsoft/oa/controller/AppRenewController.java @@ -63,6 +63,7 @@ public class AppRenewController extends BaseController { if (appRenew.getStatus().equals(0)) { App app = appService.getById(appRenew.getAppId()); app.setExpirationTime(appRenew.getEndTime()); + app.setRenewMoney(appRenew.getMoney()); app.setShowExpiration(true); appService.updateById(app); } diff --git a/src/main/java/com/gxwebsoft/oa/controller/TaskController.java b/src/main/java/com/gxwebsoft/oa/controller/TaskController.java index a9f1304..1aaeac0 100644 --- a/src/main/java/com/gxwebsoft/oa/controller/TaskController.java +++ b/src/main/java/com/gxwebsoft/oa/controller/TaskController.java @@ -70,8 +70,13 @@ public class TaskController extends BaseController { @ApiOperation("根据id查询任务记录表") @GetMapping("/{id}") public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(taskService.getByIdRel(id)); + // 更新阅读状态 + Task task = taskService.getByIdRel(id); + if(!task.getLastReadUser().equals(getLoginUserId())){ + task.setIsRead(1); + taskService.updateById(task); + } + return success(task); } @ApiOperation("添加任务记录表") @@ -86,6 +91,9 @@ public class TaskController extends BaseController { task.setRoleId(role.getRoleId()); task.setRoleCode(role.getRoleCode()); task.setOrganizationId(loginUser.getOrganizationId()); + task.setLastAvatar(loginUser.getAvatar()); + task.setLastReadUser(loginUser.getUserId()); + task.setLastNickname(loginUser.getNickname()); } if (taskService.saveByRel(task)) { return success("添加成功", task); diff --git a/src/main/java/com/gxwebsoft/oa/controller/TaskRecordController.java b/src/main/java/com/gxwebsoft/oa/controller/TaskRecordController.java index 08fb3e9..95a243e 100644 --- a/src/main/java/com/gxwebsoft/oa/controller/TaskRecordController.java +++ b/src/main/java/com/gxwebsoft/oa/controller/TaskRecordController.java @@ -71,12 +71,14 @@ public class TaskRecordController extends BaseController { taskRecord.setUserId(loginUser.getUserId()); // 技术人员更新工单状态 Task task = taskService.getById(taskRecord.getTaskId()); - if (CommonUtil.hasRole(loginUser.getRoles(),"staff") && task.getProgress().equals(PENDING)) { + if (CommonUtil.hasRole(loginUser.getRoles(),"commander") && task.getProgress().equals(PENDING)) { task.setProgress(PROCESSING); } task.setUpdateTime(new Date()); task.setContent(taskRecord.getContent()); task.setLastAvatar(loginUser.getAvatar()); + task.setLastReadUser(loginUser.getUserId()); + task.setLastNickname(loginUser.getNickname()); taskService.updateById(task); } if (taskRecordService.save(taskRecord)) { diff --git a/src/main/java/com/gxwebsoft/oa/entity/App.java b/src/main/java/com/gxwebsoft/oa/entity/App.java index 5fc204b..56b7fb8 100644 --- a/src/main/java/com/gxwebsoft/oa/entity/App.java +++ b/src/main/java/com/gxwebsoft/oa/entity/App.java @@ -52,6 +52,14 @@ public class App implements Serializable { @ApiModelProperty(value = "企业名称") private String companyName; + @ApiModelProperty(value = "企业简称") + @TableField(exist = false) + private String shortName; + + @ApiModelProperty(value = "企业商标") + @TableField(exist = false) + private String companyLogo; + @ApiModelProperty(value = "应用图标") private String appIcon; @@ -181,6 +189,9 @@ public class App implements Serializable { @ApiModelProperty(value = "服务到期时间") private Date expirationTime; + @ApiModelProperty(value = "最近一笔的续费金额") + private BigDecimal renewMoney; + @ApiModelProperty(value = "应用状态") private String appStatus; @@ -236,8 +247,4 @@ public class App implements Serializable { @TableField(exist = false) private String avatar; - @ApiModelProperty(value = "公司简称") - @TableField(exist = false) - private String shortName; - } diff --git a/src/main/java/com/gxwebsoft/oa/entity/AppRenew.java b/src/main/java/com/gxwebsoft/oa/entity/AppRenew.java index 4cbf8f4..795ca6f 100644 --- a/src/main/java/com/gxwebsoft/oa/entity/AppRenew.java +++ b/src/main/java/com/gxwebsoft/oa/entity/AppRenew.java @@ -1,6 +1,7 @@ package com.gxwebsoft.oa.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -68,4 +69,12 @@ public class AppRenew implements Serializable { @ApiModelProperty(value = "注册时间") private Date createTime; -} + @ApiModelProperty(value = "企业名称") + @TableField(exist = false) + private String companyName; + + @ApiModelProperty(value = "应用名称") + @TableField(exist = false) + private String appName; + + } diff --git a/src/main/java/com/gxwebsoft/oa/entity/Task.java b/src/main/java/com/gxwebsoft/oa/entity/Task.java index 7f94eda..22e17ca 100644 --- a/src/main/java/com/gxwebsoft/oa/entity/Task.java +++ b/src/main/java/com/gxwebsoft/oa/entity/Task.java @@ -92,6 +92,9 @@ public class Task implements Serializable { @ApiModelProperty(value = "最后回复人的头像") private String lastAvatar; + @ApiModelProperty(value = "最后回复人昵称") + private String lastNickname; + @ApiModelProperty(value = "排序(数字越小越靠前)") private Integer sortNumber; diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/AppMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/AppMapper.xml index b78dace..cdaf2f9 100644 --- a/src/main/java/com/gxwebsoft/oa/mapper/xml/AppMapper.xml +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/AppMapper.xml @@ -4,8 +4,9 @@ - SELECT a.* + SELECT a.*, b.company_name,b.short_name,b.company_logo FROM oa_app a + LEFT JOIN oa_company b ON a.company_id = b.company_id AND a.app_id = #{param.appId} @@ -175,6 +176,12 @@ AND a.user_id = #{param.userId} + + AND a.app_id IN + + #{item} + + AND a.organization_id = #{param.organizationId} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/AppRenewMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/AppRenewMapper.xml index ddf34d5..5e28ed9 100644 --- a/src/main/java/com/gxwebsoft/oa/mapper/xml/AppRenewMapper.xml +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/AppRenewMapper.xml @@ -4,8 +4,12 @@ - SELECT a.* + SELECT a.*, + b.company_name,b.short_name,b.company_logo, + c.app_name FROM oa_app_renew a + LEFT JOIN oa_company b ON a.company_id = b.company_id + LEFT JOIN oa_app c ON a.app_id = c.app_id AND a.app_renew_id = #{param.appRenewId} @@ -28,6 +32,10 @@ AND a.app_id = #{param.appId} + + AND a.company_id = #{param.companyId} + + AND a.status = #{param.status} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/TaskMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/TaskMapper.xml index ab0769c..14de596 100644 --- a/src/main/java/com/gxwebsoft/oa/mapper/xml/TaskMapper.xml +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/TaskMapper.xml @@ -56,6 +56,9 @@ AND a.organization_id = #{param.organizationId} + + AND a.customer_id = #{param.companyId} + AND a.project_id = #{param.projectId} diff --git a/src/main/java/com/gxwebsoft/oa/param/AppRenewParam.java b/src/main/java/com/gxwebsoft/oa/param/AppRenewParam.java index dfb5699..f41e461 100644 --- a/src/main/java/com/gxwebsoft/oa/param/AppRenewParam.java +++ b/src/main/java/com/gxwebsoft/oa/param/AppRenewParam.java @@ -52,6 +52,10 @@ public class AppRenewParam extends BaseParam { @QueryField(type = QueryType.EQ) private Integer appId; + @ApiModelProperty(value = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + @ApiModelProperty(value = "状态, 0正常, 1待确认") @QueryField(type = QueryType.EQ) private Integer status; diff --git a/src/main/java/com/gxwebsoft/oa/param/TaskParam.java b/src/main/java/com/gxwebsoft/oa/param/TaskParam.java index 707d56e..922eeb8 100644 --- a/src/main/java/com/gxwebsoft/oa/param/TaskParam.java +++ b/src/main/java/com/gxwebsoft/oa/param/TaskParam.java @@ -90,6 +90,10 @@ public class TaskParam extends BaseParam { @QueryField(type = QueryType.EQ) private Integer assetsId; + @ApiModelProperty(value = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + @ApiModelProperty(value = "用户ID") @QueryField(type = QueryType.EQ) private Integer userId; diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/AppRenewServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/AppRenewServiceImpl.java index fd51252..f838475 100644 --- a/src/main/java/com/gxwebsoft/oa/service/impl/AppRenewServiceImpl.java +++ b/src/main/java/com/gxwebsoft/oa/service/impl/AppRenewServiceImpl.java @@ -1,12 +1,12 @@ package com.gxwebsoft.oa.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.oa.mapper.AppRenewMapper; -import com.gxwebsoft.oa.service.AppRenewService; -import com.gxwebsoft.oa.entity.AppRenew; -import com.gxwebsoft.oa.param.AppRenewParam; import com.gxwebsoft.common.core.web.PageParam; import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.AppRenew; +import com.gxwebsoft.oa.mapper.AppRenewMapper; +import com.gxwebsoft.oa.param.AppRenewParam; +import com.gxwebsoft.oa.service.AppRenewService; import org.springframework.stereotype.Service; import java.util.List; diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/TaskCountServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/TaskCountServiceImpl.java index 2bb9408..4a855f0 100644 --- a/src/main/java/com/gxwebsoft/oa/service/impl/TaskCountServiceImpl.java +++ b/src/main/java/com/gxwebsoft/oa/service/impl/TaskCountServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.net.url.UrlQuery; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gxwebsoft.common.core.web.ApiResult; import com.gxwebsoft.common.core.web.PageParam; @@ -19,10 +20,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; /** @@ -60,12 +58,10 @@ public class TaskCountServiceImpl extends ServiceImpl> userResult = JSONObject.parseObject(response, new TypeReference>>() { + }); + final Map> collect = userResult.getData().getList().stream().collect(Collectors.groupingBy(User::getUserId)); + + final List userList = userResult.getData().getList(); + TaskCount taskCount = new TaskCount(); + userList.forEach(user -> { + if (count(new LambdaQueryWrapper().eq(TaskCount::getUserId, user.getUserId())) == 0) { + taskCount.setUserId(user.getUserId()); + taskCount.setOrganizationId(user.getOrganizationId()); + taskCount.setTenantId(user.getTenantId()); + user.getRoles().forEach(role -> { + if(role.getRoleCode().equals("staff") || role.getRoleCode().equals("commander")){ + taskCount.setRoleCode("commander"); + taskCount.setRoleId(role.getRoleId()); + } + if(role.getRoleCode().equals("admin")){ + taskCount.setRoleId(role.getRoleId()); + taskCount.setRoleCode(role.getRoleCode()); + } + }); + save(taskCount); + } + }); + } + @Override public List listRel(TaskCountParam param) { List list = baseMapper.selectListRel(param); diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/TaskServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/TaskServiceImpl.java index 7a3645d..e717922 100644 --- a/src/main/java/com/gxwebsoft/oa/service/impl/TaskServiceImpl.java +++ b/src/main/java/com/gxwebsoft/oa/service/impl/TaskServiceImpl.java @@ -47,7 +47,6 @@ public class TaskServiceImpl extends ServiceImpl implements Ta PageParam page = new PageParam<>(param); page.setDefaultOrder("create_time desc"); List list = baseMapper.selectPageRel(page, param); - System.out.println("param2222 = " + param); return new PageResult<>(list, page.getTotal()); }