优化:续费模块发现的bug
This commit is contained in:
@@ -49,6 +49,7 @@ public class AppController extends BaseController {
|
||||
if(!StrUtil.equals(d.getRoleCode(),"superAdmin") && !StrUtil.equals(d.getRoleCode(),"admin")){
|
||||
// 非管理员按项目成员权限显示
|
||||
final List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getUserId, userId));
|
||||
System.out.println("list = " + list);
|
||||
final Set<Integer> collect = list.stream().map(AppUser::getAppId).collect(Collectors.toSet());
|
||||
param.setAppIds(collect);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -70,8 +70,13 @@ public class TaskController extends BaseController {
|
||||
@ApiOperation("根据id查询任务记录表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Task> 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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -92,6 +92,9 @@ public class Task implements Serializable {
|
||||
@ApiModelProperty(value = "最后回复人的头像")
|
||||
private String lastAvatar;
|
||||
|
||||
@ApiModelProperty(value = "最后回复人昵称")
|
||||
private String lastNickname;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
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
|
||||
<where>
|
||||
<if test="param.appId != null">
|
||||
AND a.app_id = #{param.appId}
|
||||
@@ -175,6 +176,12 @@
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.appIds != null">
|
||||
AND a.app_id IN
|
||||
<foreach collection="param.appIds" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.organizationId != null">
|
||||
AND a.organization_id = #{param.organizationId}
|
||||
</if>
|
||||
|
||||
@@ -4,8 +4,12 @@
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
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
|
||||
<where>
|
||||
<if test="param.appRenewId != null">
|
||||
AND a.app_renew_id = #{param.appRenewId}
|
||||
@@ -28,6 +32,10 @@
|
||||
<if test="param.appId != null">
|
||||
AND a.app_id = #{param.appId}
|
||||
</if>
|
||||
<if test="param.companyId != null">
|
||||
AND a.company_id = #{param.companyId}
|
||||
</if>
|
||||
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
<if test="param.organizationId != null">
|
||||
AND a.organization_id = #{param.organizationId}
|
||||
</if>
|
||||
<if test="param.companyId != null">
|
||||
AND a.customer_id = #{param.companyId}
|
||||
</if>
|
||||
<if test="param.projectId != null">
|
||||
AND a.project_id = #{param.projectId}
|
||||
</if>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<TaskCountMapper, TaskCount
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
|
||||
System.out.println("response = " + response);
|
||||
|
||||
final ApiResult<PageResult<User>> userResult = JSONObject.parseObject(response, new TypeReference<ApiResult<PageResult<User>>>() {
|
||||
});
|
||||
final Map<Integer, List<User>> collect = userResult.getData().getList().stream().collect(Collectors.groupingBy(User::getUserId));
|
||||
System.out.println("collect = " + collect);
|
||||
|
||||
if (!CollectionUtils.isEmpty(collect)) {
|
||||
taskCountList.forEach(item -> {
|
||||
final List<User> users = collect.get(item.getUserId());
|
||||
@@ -82,6 +78,47 @@ public class TaskCountServiceImpl extends ServiceImpl<TaskCountMapper, TaskCount
|
||||
return result;
|
||||
}
|
||||
|
||||
// 远程同步用户数据
|
||||
private void updateServerUser(TaskCountParam param){
|
||||
// 请求主服务器获取用户信息
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("isStaff", "1");
|
||||
System.out.println("map = " + map);
|
||||
// 链式构建GET请求
|
||||
final String build = UrlBuilder.of("https://server.gxwebsoft.com/api/system/user/page").setQuery(new UrlQuery(map)).build();
|
||||
String response = HttpRequest.get(build)
|
||||
.header("Authorization", param.getToken())
|
||||
.header("Tenantid", param.getTenantId().toString())
|
||||
.body(JSONObject.toJSONString(map))//表单内容
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
|
||||
final ApiResult<PageResult<User>> userResult = JSONObject.parseObject(response, new TypeReference<ApiResult<PageResult<User>>>() {
|
||||
});
|
||||
final Map<Integer, List<User>> collect = userResult.getData().getList().stream().collect(Collectors.groupingBy(User::getUserId));
|
||||
|
||||
final List<User> userList = userResult.getData().getList();
|
||||
TaskCount taskCount = new TaskCount();
|
||||
userList.forEach(user -> {
|
||||
if (count(new LambdaQueryWrapper<TaskCount>().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<TaskCount> listRel(TaskCountParam param) {
|
||||
List<TaskCount> list = baseMapper.selectListRel(param);
|
||||
|
||||
@@ -47,7 +47,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
||||
PageParam<Task, TaskParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<Task> list = baseMapper.selectPageRel(page, param);
|
||||
System.out.println("param2222 = " + param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user