提交修改

This commit is contained in:
quyixiao 2020-11-06 16:05:31 +08:00
commit 3f8bc27a34
12 changed files with 200 additions and 33 deletions

View File

@ -249,9 +249,10 @@
</dependency>
<dependency>
<artifactId>taobao-sdk-java-auto_1479188381469</artifactId>
<groupId>dingtalk</groupId>
<version>20200811</version>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
<version>1.0.0</version>
<classifier>suibian</classifier>
</dependency>
</dependencies>

View File

@ -266,7 +266,7 @@ public class DingTalkUtil {
String token = dingTalkUtil.getAccessToken("856016278");
}
//发送钉钉消息
public String sendSingleActionCardMSG(String appid, StaffEntity staff, String title, String marDown,
String singleTitle, String singleUrl, String token) {
String msg = "OK";
@ -318,6 +318,59 @@ public class DingTalkUtil {
thirdMsgSendRecordService.insert(thirdMsgSendRecord);
return msg;
}
//发送待办任务
public String sendSingleWorkMSG(String appid, StaffEntity staff, String title, String marDown,
String singleTitle, String singleUrl, String token) {
String msg = "OK";
ThirdMsgSendRecord thirdMsgSendRecord = new ThirdMsgSendRecord();
thirdMsgSendRecord.setMsgType("work_msg");
thirdMsgSendRecord.setStaffId(staff.getId());
thirdMsgSendRecord.setMsgTitle(singleTitle);
thirdMsgSendRecord.setAppId(Long.parseLong(appid));
thirdMsgSendRecord.setHeadText(title);
thirdMsgSendRecord.setMsgContent(marDown);
thirdMsgSendRecord.setMsgUrl(singleUrl);
thirdMsgSendRecord.setStatus(0);
try{
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/workrecord/add");
OapiWorkrecordAddRequest req = new OapiWorkrecordAddRequest();
req.setUserid(staff.getEmployeeId());
req.setCreateTime(System.currentTimeMillis());
req.setTitle(singleTitle);
req.setUrl(singleUrl);
List<OapiWorkrecordAddRequest.FormItemVo> list2 = new ArrayList<OapiWorkrecordAddRequest.FormItemVo>();
OapiWorkrecordAddRequest.FormItemVo obj3 = new OapiWorkrecordAddRequest.FormItemVo();
list2.add(obj3);
obj3.setTitle(title);
obj3.setContent(marDown);
req.setFormItemList(list2);
OapiWorkrecordAddResponse rsp = client.execute(req, token);
logger.info("钉钉待办任务请求返回{}", rsp.getBody());
//插入数据库
JSONObject json = JSONObject.parseObject(rsp.getBody());
if(json.getIntValue("errcode") == 0){
thirdMsgSendRecord.setTaskId(json.getLong("record_id"));
thirdMsgSendRecord.setStatus(1);
}else{
thirdMsgSendRecord.setTaskId(0L);
thirdMsgSendRecord.setStatus(6);
thirdMsgSendRecord.setRemark(json.getString("errmsg"));
msg = thirdMsgSendRecord.getRemark();
}
}catch (ApiException e) {
e.printStackTrace();
thirdMsgSendRecord.setStatus(6);
thirdMsgSendRecord.setRemark(e.getErrMsg());
msg = thirdMsgSendRecord.getRemark();
}
thirdMsgSendRecordService.insert(thirdMsgSendRecord);
return msg;
}
public R getUserIdByCode(String code, String token) {
try {

View File

@ -157,7 +157,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
case 5:
return R.error(groupStaffs.getEvaluationGroup().getName() + "——初始化考核流程失败");
}
dingtalkBusiness.sendWorkMSGWithThread(staffSimpleInfos, WorkMsgTypeEnum.START_WORK.getType());
dingtalkBusiness.sendWorkMSGWithAsyn(staffSimpleInfos, WorkMsgTypeEnum.START_WORK.getType());
}
return R.ok("发起成功").put("data", flowStart);
@ -281,7 +281,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
case 5:
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
}
dingtalkBusiness.sendWorkMSGWithThread(staffIds, WorkMsgTypeEnum.START_WORK.getType());
dingtalkBusiness.sendWorkMSGWithAsyn(staffIds, WorkMsgTypeEnum.START_WORK.getType());
}
return R.ok("发起成功").put("data", flowStart);
}

View File

@ -193,13 +193,9 @@ public class DingtalkBusiness {
return sendWorkMSGByEntity(appid, fromStaffEntity, toStaffEntity, workMsgTypeEnum, "https://www.baidu.com");
}
public String sendWorkMSGWithAsyn(List<Long> toStaffids, int type) {
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(toStaffids);
return sendWorkMSGWithThread(staffSimpleInfos, type);
}
public String sendWorkMSGWithThread(List<StaffSimpleInfo> toStaffids, int type) {
public String sendWorkMSGWithAsyn(List<StaffSimpleInfo> toStaffids, int type) {
if(toStaffids.get(0).getEmployeeId() == null || toStaffids.get(0).getEmployeeId().length() == 0){
//查询第三方id
@ -293,7 +289,7 @@ public class DingtalkBusiness {
List<StaffSimpleInfo> toStaffids;
WorkMsgTypeEnum workMsgTypeEnum;
String appid;
String url = "";
String hostUrl = "https://lzmanagement.ldxinyong.com/digitization/dingTalkLogin";
public ThreadSendMessage(List<StaffSimpleInfo> toStaffids, WorkMsgTypeEnum typeEnum, String appid){
this.toStaffids = toStaffids;
workMsgTypeEnum = typeEnum;
@ -309,14 +305,15 @@ public class DingtalkBusiness {
) {
if(token != null && token.length() > 0){
//下面防止第二次发送消息时钉钉不推送
String url = hostUrl;
if(url.contains("?")){
url += "&halokit=" + System.currentTimeMillis();
}else{
url += "?halokit=" + System.currentTimeMillis();
}
url += ("&detail=1&id=" + info.getRecordId());
url = URLEncoder.encode(url);
/* url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
"&container_type=work_platform&app_id=0_" + appid + "&redirect_type=jump&redirect_url=" + url;*/
url = "dingtalk://dingtalkclient/page/link?pc_slide=true&url=" + url;
@ -324,7 +321,7 @@ public class DingtalkBusiness {
StaffEntity entity = new StaffEntity();
entity.setId(info.getId());
entity.setEmployeeId(info.getEmployeeId());
dingTalkUtil.sendSingleActionCardMSG(appid, entity, workMsgTypeEnum.getTitle(),
dingTalkUtil.sendSingleWorkMSG(appid, entity, workMsgTypeEnum.getTitle(),
content, workMsgTypeEnum.getBtnText(), url, token);
}else{
logger.info("ThreadSendMessage token无效"); ;

View File

@ -2,6 +2,7 @@ package com.lz.modules.performance.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.lz.common.emun.WorkMsgTypeEnum;
import com.lz.common.exception.RRException;
@ -96,7 +97,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
@Override
public PageUtils assessList(AssessListReq req) {
List<AssessManagerListRes> data = new ArrayList<>();
List<AssessManagerListRes> data = Lists.newArrayList();
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
page -> flowStartMapper.selectListByTime(page,req.getCycleType(),req.getName())
);
@ -183,7 +184,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
if(req.getChangeType() == 0){
//获取所有考核人员
List<String> all = new ArrayList<>();
List<String> all = Lists.newArrayList();
//根据组id成员分组
Map<Long,List<String>> map = Maps.newHashMap();
@ -209,7 +210,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
}
//初始化添加用户的数据
List<GroupStaffs> groupS = new ArrayList<>();
List<GroupStaffs> groupS = Lists.newArrayList();
//排除已发起过的
List<Long> longs = evaluationStartStaffMapper.selectStaffIdsByStart(req.getStartId());
@ -310,7 +311,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
//通知评分
try {
dingtalkBusiness.sendWorkMSGWithThread(toStaffids, WorkMsgTypeEnum.START_SCORE.getType());
dingtalkBusiness.sendWorkMSGWithAsyn(toStaffids, WorkMsgTypeEnum.START_SCORE.getType());
} catch (Exception e) {
log.error("通知评分异常:",e);
}

View File

@ -1,6 +1,7 @@
package com.lz.modules.performance.service.impl;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.lz.common.utils.DateUtils;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.StringUtil;
@ -55,7 +56,7 @@ public class AssessServiceImpl implements AssessService {
@Override
public PageUtils userTaskList(AssessTaskReq req,Long userId) {
PageUtils data = new PageUtils();
List<TaskListRes> list = new ArrayList<>();
List<TaskListRes> list = Lists.newArrayList();
PageUtils pageUtils = flowRecordService.selectTaskListByApprovalStaffId(req,userId);
if(CollectionUtils.isEmpty(pageUtils.getList())){
return data;

View File

@ -2,6 +2,7 @@ package com.lz.modules.performance.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
@ -89,7 +90,7 @@ public class ChartResultServiceImpl implements ChartResultService {
}
//自己管理的部门
List<String> mandepartmentIds = assessService.roleDepartments(staffId);
List<ChartStatisticalRes> data = new ArrayList<>();
List<ChartStatisticalRes> data = Lists.newArrayList();
ChartStatisticalRes res;
List<ChartStatistical> process = resultRecordService.countNumByFlowProcess(startId,null,mandepartmentIds);
@ -153,7 +154,7 @@ public class ChartResultServiceImpl implements ChartResultService {
return Collections.EMPTY_LIST;
}
List<ChartStatistical> data = new ArrayList<>();
List<ChartStatistical> data = Lists.newArrayList();
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
.eq("is_delete", 0)
.in("staff_id", staffIds));
@ -195,7 +196,7 @@ public class ChartResultServiceImpl implements ChartResultService {
@Override
public PageUtils chartStarts(ChartStartsReq req) {
List<ChartStartsRes> data = new ArrayList<>();
List<ChartStartsRes> data = Lists.newArrayList();
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize()).doSelect(
page -> flowStartMapper.selectListByPage(page,req.getCycleType())
);
@ -230,7 +231,7 @@ public class ChartResultServiceImpl implements ChartResultService {
//构建流程默认人数
private List<ChartStatistical> buildProcess(List<ChartStatistical> process,Long startId,List<String> mandepartmentIds){
List<ChartStatistical> data = new ArrayList<>();
List<ChartStatistical> data = Lists.newArrayList();
Map map = Maps.newHashMap();
int count = resultRecordService.count(new QueryWrapper<ResultRecord>()
.eq("is_delete", 0)

View File

@ -19,12 +19,14 @@ import com.lz.common.validator.group.AddGroup;
import com.lz.common.validator.group.UpdateGroup;
import com.lz.modules.app.entity.UserEntity;
import com.lz.modules.sys.entity.SysUserEntity;
import com.lz.modules.sys.entity.SysUserEntityDto;
import com.lz.modules.sys.form.PasswordForm;
import com.lz.modules.sys.service.SysUserRoleService;
import com.lz.modules.sys.service.SysUserService;
import org.apache.commons.lang.ArrayUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -67,7 +69,10 @@ public class SysUserController extends AbstractController {
*/
@GetMapping("/info")
public R info() {
return R.ok().put("user", getUser());
SysUserEntity sysUserEntity = getUser();
SysUserEntityDto entityDto = new SysUserEntityDto();
BeanUtils.copyProperties(sysUserEntity, entityDto);
return R.ok().put("user", entityDto);
}
/**

View File

@ -49,12 +49,19 @@ public class SysUserEntity implements Serializable {
@NotBlank(message="工号不能为空", groups = AddGroup.class)
private String userNo;
/**
* 用户名
*/
@NotBlank(message="账号不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String username;
/**
* 头像
*/
@TableField(exist = false)
private String avatar;
/**
* 密码
*/

View File

@ -0,0 +1,97 @@
/**
* Copyright (c) 2020 fumeiai All rights reserved.
*
*
*
* 版权所有侵权必究
*/
package com.lz.modules.sys.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lz.common.validator.group.AddGroup;
import com.lz.common.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 系统用户
*
* @author Mark sunlightcs@gmail.com
*/
@Data
@TableName("sys_user")
public class SysUserEntityDto implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
@TableId
private Long userId;
/**
* 员工姓名
*/
@NotBlank(message="员工姓名不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String realName;
/**
* 员工工号
*/
@NotBlank(message="工号不能为空", groups = AddGroup.class)
private String userNo;
/**
* 头像
*/
@TableField(exist = false)
private String avatar;
/**
* 用户名
*/
@NotBlank(message="账号不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String username;
/**
* 手机号
*/
@NotBlank(message="手机号不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String mobile;
// /**
// * 邮箱
// */
// @NotBlank(message="邮箱不能为空", groups = {AddGroup.class, UpdateGroup.class})
@Email(message="邮箱格式不正确", groups = {AddGroup.class, UpdateGroup.class})
private String email;
/**
* 状态 0禁用 1正常
*/
private Integer status;
private int type ;// 0 表示系统用户1 表示普通员工
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}

View File

@ -11,6 +11,7 @@ package com.lz.modules.sys.oauth2;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.sys.entity.SysUserEntity;
import com.lz.modules.sys.entity.SysUserEntityDto;
import com.lz.modules.sys.entity.SysUserTokenEntity;
import com.lz.modules.sys.service.ShiroService;
import org.apache.shiro.authc.*;
@ -71,16 +72,19 @@ public class OAuth2Realm extends AuthorizingRealm {
//查询用户信息
SysUserEntity user = null;
StaffEntity staffEntity = staffService.selectStaffById(tokenEntity.getUserId());
if(tokenEntity.getType() == 0){ //如果是系统用户
user = shiroService.queryUser(tokenEntity.getUserId());
if(staffEntity != null){
user.setAvatar(staffEntity.getAvatar());
}
}else{
user = new SysUserEntity();//如果是普通用户
StaffEntity staffEntity = staffService.selectStaffById(tokenEntity.getUserId());
user.setPassword(staffEntity.getPassword());
user = new SysUserEntity();
user.setMobile(staffEntity.getMobile());
user.setAvatar(staffEntity.getAvatar());
user.setUserId(staffEntity.getId());
user.setEmail(staffEntity.getEmail());
user.setSalt(staffEntity.getSalt());
user.setStatus(1);
user.setType(1);
user.setUsername(staffEntity.getMobile());

View File

@ -67,7 +67,7 @@ public class ChartServiceImpl implements ChartService {
//如果多次提交会统计有问题
@Override
public List<GraphicsStatisticalDto> resultProgressDistribution(int type, String monthTime,String departmentId) {
List<GraphicsStatisticalDto> dtos = new ArrayList<>();
List<GraphicsStatisticalDto> dtos = Lists.newArrayList();
//获取所有人员总数
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(departmentId);
@ -129,8 +129,8 @@ public class ChartServiceImpl implements ChartService {
List<String> staffIds = staffService.staffsByAllDeparmentIds(allDeparmentIds);
int total = staffIds.size();
List<GraphicsStatisticalDto> staffLevels = resultRecordService.staffDistribution(selectMonthTime,staffIds);
List<String> names = new ArrayList<>();
List<Double> datas = new ArrayList<>();
List<String> names = Lists.newArrayList();
List<Double> datas = Lists.newArrayList();
int konwn = 0;
for (GraphicsStatisticalDto staffLevel : staffLevels) {
names.add(staffLevel.getCategory());
@ -398,7 +398,7 @@ public class ChartServiceImpl implements ChartService {
private PageUtils buildPages( List<String> departments,ResultDistributionReq req, int totalSize){
List<ReportDistributionDto> data = new ArrayList<>();
List<ReportDistributionDto> data = Lists.newArrayList();
if(CollectionUtils.isEmpty(departments)){
return new PageUtils();
}