Browse Source

修改周报

master
zy_Java 5 years ago
parent
commit
383888a4a6
  1. 4
      game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java
  2. 7
      pims/src/main/java/com/ccsens/pims/bean/dto/CompanyDto.java
  3. 28
      pims/src/main/java/com/ccsens/pims/service/RealExcelService.java
  4. 1
      pims/src/main/resources/mapper_dao/ProducrDao.xml
  5. 35
      tall/src/main/java/com/ccsens/tall/bean/dto/PluginDto.java
  6. 2
      tall/src/main/java/com/ccsens/tall/bean/dto/TaskDto.java
  7. 12
      tall/src/main/java/com/ccsens/tall/bean/dto/WpsDto.java
  8. 4
      tall/src/main/java/com/ccsens/tall/bean/vo/PluginVo.java
  9. 14
      tall/src/main/java/com/ccsens/tall/persist/dao/ProRoleDao.java
  10. 13
      tall/src/main/java/com/ccsens/tall/service/ITaskPluginService.java
  11. 7
      tall/src/main/java/com/ccsens/tall/service/IWpsService.java
  12. 8
      tall/src/main/java/com/ccsens/tall/service/MessageService.java
  13. 273
      tall/src/main/java/com/ccsens/tall/service/TaskPluginService.java
  14. 48
      tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java
  15. 206
      tall/src/main/java/com/ccsens/tall/service/UserService.java
  16. 37
      tall/src/main/java/com/ccsens/tall/service/WpsService.java
  17. 38
      tall/src/main/java/com/ccsens/tall/web/DebugController.java
  18. 31
      tall/src/main/java/com/ccsens/tall/web/PluginController.java
  19. 1
      tall/src/main/java/com/ccsens/tall/web/RoleController.java
  20. 1
      tall/src/main/java/com/ccsens/tall/web/UserController.java
  21. 12
      tall/src/main/java/com/ccsens/tall/web/WpsController.java
  22. 3
      tall/src/main/resources/application-dev.yml
  23. 1
      tall/src/main/resources/application-prod.yml
  24. 2
      tall/src/main/resources/application-test.yml
  25. 19
      tall/src/main/resources/mapper_dao/ProRoleDao.xml
  26. 16
      util/src/main/java/com/ccsens/util/PoiUtil.java
  27. 5
      util/src/main/java/com/ccsens/util/PropUtil.java
  28. 24
      util/src/main/java/com/ccsens/util/SmsUtil.java
  29. 3
      util/src/main/java/com/ccsens/util/WebConstant.java

4
game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java

@ -1,11 +1,9 @@
package com.ccsens.game.bean.vo;
import com.ccsens.game.bean.po.GameUserJoin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ -13,7 +11,7 @@ public class ScreenVo {
@Data
@ApiModel
public static class UrlVo{
@ApiModelProperty("大屏的路径")
@ApiModelProperty("游戏的id")
private Long id;
@ApiModelProperty("大屏的路径")
private String url;

7
pims/src/main/java/com/ccsens/pims/bean/dto/CompanyDto.java

@ -18,9 +18,8 @@ public class CompanyDto {
@NotNull
@ApiModelProperty("项目id")
private Long projectId;
// @NotNull
// @ApiModelProperty("任务id")
// private Long taskId;
@ApiModelProperty("任务id")
private int year;
}
@Data
@ -40,7 +39,7 @@ public class CompanyDto {
}
@Data
@ApiModel("异步通知")
@ApiModel
public static class Async{
@NotNull
@ApiModelProperty("文件ID")

28
pims/src/main/java/com/ccsens/pims/service/RealExcelService.java

@ -230,7 +230,7 @@ public class RealExcelService implements IRealExcelService {
predictIncome = new BigDecimal(predictIncomeCell).multiply(BigDecimal.valueOf(100)).longValue();
}
long realIncome = 0;
XSSFRow realRow = sheet.getRow(i);
XSSFRow realRow = sheet.getRow(i + 1);
if(ObjectUtil.isNotNull(realRow)){
String realIncomeCell = ExcelUtil.getCellValue(realRow.getCell(a));
if(StrUtil.isNotEmpty(realIncomeCell)) {
@ -254,19 +254,19 @@ public class RealExcelService implements IRealExcelService {
@Override
public void realCost(CompanyDto.Async params) throws Exception {
// log.info("wps文件id:{}", params.toString());
// Long wpsId = params.getFileId();
// JsonResponse<WpsVo.BusinessFileIdAndPath> businessFileIdAndPath = tallFeignClient.getPathByWpsId(wpsId);
// log.info("获取文件路径和项目id:{}", businessFileIdAndPath.toString());
// if (ObjectUtil.isNull(businessFileIdAndPath)) {return;}
// WpsVo.BusinessFileIdAndPath fileIdAndPath = businessFileIdAndPath.getData();
// if (ObjectUtil.isNull(fileIdAndPath)) {return;}
// //项目id
// long projectId = fileIdAndPath.getBusinessId();
// //文件路径
// String path = fileIdAndPath.getFilePath();
long projectId = 1289087369240252416L;
String path = "C:\\Users\\逗\\Desktop\\产品成本费用估算表.xlsx";
log.info("wps文件id:{}", params.toString());
Long wpsId = params.getFileId();
JsonResponse<WpsVo.BusinessFileIdAndPath> businessFileIdAndPath = tallFeignClient.getPathByWpsId(wpsId);
log.info("获取文件路径和项目id:{}", businessFileIdAndPath.toString());
if (ObjectUtil.isNull(businessFileIdAndPath)) {return;}
WpsVo.BusinessFileIdAndPath fileIdAndPath = businessFileIdAndPath.getData();
if (ObjectUtil.isNull(fileIdAndPath)) {return;}
//项目id
long projectId = fileIdAndPath.getBusinessId();
//文件路径
String path = fileIdAndPath.getFilePath();
// long projectId = 1289087369240252416L;
// String path = "C:\\Users\\逗\\Desktop\\产品成本费用估算表.xlsx";
//获取excel文件
InputStream is = new FileInputStream(path);

1
pims/src/main/resources/mapper_dao/ProducrDao.xml

@ -271,6 +271,7 @@
p.rec_status = 0
AND
pt.project_id = #{projectId}
ORDER BY p.gross_margin DESC
</select>
<select id="getProductIncome" parameterType="java.util.Map" resultType="com.ccsens.pims.bean.vo.CompanyVo$ProductIncome">

35
tall/src/main/java/com/ccsens/tall/bean/dto/PluginDto.java

@ -7,6 +7,7 @@ import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
@Data
public class PluginDto {
@ -40,4 +41,38 @@ public class PluginDto {
private Integer publicity = 0;
}
@Data
@ApiModel("获取会议记录")
public static class GetMinutes {
@ApiModelProperty("任务id")
@NotNull(message = "任务id为空")
private Long taskId;
@ApiModelProperty("域名")
private String domainName;
@ApiModelProperty("项目id")
private List<Long> projectIdList;
}
@Data
@ApiModel("修改会议记录")
public static class UpdateMinutes {
@ApiModelProperty("wps文件id")
@NotNull(message = "文件id不能为空")
private Long wpsFileId;
@ApiModelProperty("任务id")
private Long taskId;
@ApiModelProperty("域名")
private String domainName;
@ApiModelProperty("项目id")
private List<UpdateMinutesProject> projectList;
}
@Data
@ApiModel("表格内需要修改的项目")
public static class UpdateMinutesProject {
@ApiModelProperty("项目id")
private Long projectId;
@ApiModelProperty("添加还是删除 0添加项目 1删除项目")
private byte type;
}
}

2
tall/src/main/java/com/ccsens/tall/bean/dto/TaskDto.java

@ -118,7 +118,7 @@ public class TaskDto {
private Long roleId;
@ApiModelProperty("任务在当前时间的subTimeId")
@NotNull(message = "taskId is required.")
private Long id;
private Long taskId;
@ApiModelProperty("开始任务的时间 如果为空则为当前时间")
private Long startTime;
}

12
tall/src/main/java/com/ccsens/tall/bean/dto/WpsDto.java

@ -207,4 +207,16 @@ public class WpsDto {
private Map<String, String> params;
}
@Data
@ApiModel("查看用户的读取权限")
public static class WpsPower {
@ApiModelProperty("业务ID")
private Long id;
@ApiModelProperty("业务类型")
private byte type;
@ApiModelProperty("wps文件id")
private Long fileId;
@ApiModelProperty("用户id")
private Long userId;
}
}

4
tall/src/main/java/com/ccsens/tall/bean/vo/PluginVo.java

@ -88,5 +88,9 @@ public class PluginVo {
private String wpsPath;
@ApiModelProperty("下载路径")
private String downloadPath;
@ApiModelProperty("文件id")
private Long wpsFileId;
}
}

14
tall/src/main/java/com/ccsens/tall/persist/dao/ProRoleDao.java

@ -42,4 +42,18 @@ public interface ProRoleDao extends ProRoleMapper{
* @return
*/
Integer isPmByRoleId(@Param("roleId")Long roleId);
/**
* 通过项目id查找成员的名字或者项目经理的名字
* @param projectId 项目id
* @return 返回项目经理的名字
*/
String getMemberNameByProjectId(@Param("projectId")Long projectId,@Param("parentRoleName")String parentRoleName);
// /**
// * 查找项目下的所有成员的名字用“,”分隔
// * @param projectId 项目id
// * @return 返回成员姓名
// */
// String getMemberNameByProjectId(Long projectId);
}

13
tall/src/main/java/com/ccsens/tall/service/ITaskPluginService.java

@ -48,10 +48,17 @@ public interface ITaskPluginService {
/**
* 获取会议纪要表
* @param currentUserId userId
* @param projectId 项目id
* @param taskId 任务di
* @param token token
* @return 返回wps里的文件的路径
*/
List<PluginVo.MinutesInfo> saveMinutes(Long currentUserId, String domainName,Long projectId,Long taskId,String token) throws Exception;
List<PluginVo.MinutesInfo> saveMinutes(Long currentUserId,PluginDto.GetMinutes getMinutes,String token) throws Exception;
/**
* 给周会表添加项目或删除项目
* @param currentUserId userId
* @param updateMinutes 修改的信息
* @param token token
* @return 返回wps里的文件的路径
*/
List<PluginVo.MinutesInfo> updateMinutesProject(Long currentUserId, PluginDto.UpdateMinutes updateMinutes, String token) throws Exception;
}

7
tall/src/main/java/com/ccsens/tall/service/IWpsService.java

@ -102,4 +102,11 @@ public interface IWpsService {
* @return 返回问价路径
*/
WpsVo.BusinessFileIdAndPath getPathById(Long fileId);
/**
*
* @param wpsPower
* @return
*/
String getWpsPower(WpsDto.WpsPower wpsPower);
}

8
tall/src/main/java/com/ccsens/tall/service/MessageService.java

@ -3,7 +3,8 @@ package com.ccsens.tall.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.ccsens.tall.bean.dto.message.*;
import com.ccsens.tall.bean.dto.message.BaseMessageDto;
import com.ccsens.tall.bean.dto.message.SyncMessageWithStartDto;
import com.ccsens.tall.bean.vo.MemberVo;
import com.ccsens.util.JacksonUtil;
import com.ccsens.util.bean.message.common.InMessage;
@ -19,8 +20,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import static io.lettuce.core.pubsub.PubSubOutput.Type.message;
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
@ -107,8 +106,7 @@ public class MessageService implements IMessageService{
inMessage.setToDomain(MessageConstant.DomainType.User);
inMessage.setTos(syncMessage.receiversTransTos());
inMessage.setData(JSONObject.toJSONString(syncMessage));
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME, inMessage);
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME, JacksonUtil.beanToJson(inMessage));
}

273
tall/src/main/java/com/ccsens/tall/service/TaskPluginService.java

@ -24,9 +24,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.*;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
@ -280,63 +278,100 @@ public class TaskPluginService implements ITaskPluginService{
}
@Override
public List<PluginVo.MinutesInfo> saveMinutes(Long currentUserId, String domainName,Long projectId, Long taskId,String token) throws Exception {
public List<PluginVo.MinutesInfo> saveMinutes(Long currentUserId,PluginDto.GetMinutes getMinutes,String token) throws Exception {
log.info("生成会议记录,项目id:{}",getMinutes.toString());
//根据域名查找公司logo
String logo = "/home/staticrec/logo.png";
if(StrUtil.isNotEmpty(domainName)) {
if(StrUtil.isNotEmpty(getMinutes.getDomainName())) {
SysDomainExample domainExample = new SysDomainExample();
domainExample.createCriteria().andDomainNameEqualTo(domainName);
domainExample.createCriteria().andDomainNameEqualTo(getMinutes.getDomainName());
List<SysDomain> sysDomainList = sysDomainDao.selectByExample(domainExample);
if (CollectionUtil.isNotEmpty(sysDomainList)) {
logo = sysDomainList.get(0).getLogo();
}
}
//查找该任务的会议记录文件,有则直接返回
List<PluginVo.MinutesInfo> minutesInfoList = new ArrayList<>();
Map<String,String> params = new HashMap<>();
params.put(WebConstant.Wps._W_URL,PropUtil.domain + "debug");
List<String> wpsPath = wpsService.queryVisitUrls(taskId,(byte) 2,token,params);
List<String> wpsPath = wpsService.queryVisitUrls(getMinutes.getTaskId(),(byte) 2,token,null);
if(CollectionUtil.isNotEmpty(wpsPath)){
wpsPath.forEach(wps->{
PluginVo.MinutesInfo minutesInfo = new PluginVo.MinutesInfo();
minutesInfo.setWpsPath(wps);
//获取下载路径
ProProjectFileExample projectFileExample = new ProProjectFileExample();
projectFileExample.createCriteria().andBusinessIdEqualTo(taskId).andBusinessTypeEqualTo((byte) 2);
projectFileExample.createCriteria().andBusinessIdEqualTo(getMinutes.getTaskId()).andBusinessTypeEqualTo((byte) 2);
List<ProProjectFile> projectFileList = proProjectFileDao.selectByExample(projectFileExample);
if(CollectionUtil.isNotEmpty(projectFileList)){
WpsFile wpsFile = wpsFileDao.selectByPrimaryKey(projectFileList.get(0).getWpsFileId());
minutesInfo.setDownloadPath(wpsFile.getDownloadUrl());
minutesInfo.setWpsFileId(wpsFile.getId());
}
minutesInfoList.add(minutesInfo);
});
return minutesInfoList;
}
log.info("生成会议记录,项目id:{}",projectId);
SysProject sysProject = sysProjectDao.selectByPrimaryKey(projectId);
if(ObjectUtil.isNull(sysProject)){
throw new BaseException(CodeEnum.NOT_PROJECT);
}
//获取本周和上周的时间
//获取本周和上周的开始和结束时间
long thisWeekStartTime = DateUtil.beginOfWeek(new Date()).getTime();
long thisWeekEndTime = DateUtil.endOfWeek(new Date()).getTime();
long lastWeekStartTime = DateUtil.beginOfWeek(new Date(thisWeekStartTime - 1)).getTime();
long lastWeekEndTime = DateUtil.endOfWeek(new Date(thisWeekStartTime - 1)).getTime();
//之前没有会议记录则重新生成
Workbook wb = new XSSFWorkbook();
//excel第一个sheet项目概览
List<List<PoiUtil.PoiUtilCell>> overviewMinutes = writeOverviewMinutes(getMinutes.getProjectIdList());
PoiUtil.exportWB("会议记录", overviewMinutes, wb);
PoiUtil.setImg(wb,"会议记录", logo,0,1,0,1);
if(CollectionUtil.isNotEmpty(getMinutes.getProjectIdList())){
//每个项目一个sheet,循环添加进excel
String finalLogo = logo;
getMinutes.getProjectIdList().forEach(projectId ->{
SysProject sysProject = sysProjectDao.selectByPrimaryKey(projectId);
if(ObjectUtil.isNotNull(sysProject)){
//查找上周任务
List<TaskVo.TaskMinutesWps> lastWeekTask = taskSubTimeDao.queryMinutesTaskByTime(projectId,lastWeekStartTime,lastWeekEndTime);
//查找本周任务
List<TaskVo.TaskMinutesWps> thisWeekTask = taskSubTimeDao.queryMinutesTaskByTime(projectId,thisWeekStartTime,thisWeekEndTime);
//查找项目经理名字和项目成员的名字
String pmName = roleDao.getMemberNameByProjectId(projectId,"PM");
//查找项目内的成员名用“,”分隔
String memberName = roleDao.getMemberNameByProjectId(projectId,"Member");
//生成excel写入的数据
List<List<PoiUtil.PoiUtilCell>> minutes = writeMinutes(lastWeekTask,thisWeekTask,sysProject.getName());
List<List<PoiUtil.PoiUtilCell>> minutes = writeMinutes(lastWeekTask,thisWeekTask,sysProject.getName(),pmName,memberName);
PoiUtil.exportWB(sysProject.getName(), minutes, wb);
try {
PoiUtil.setImg(wb,sysProject.getName(), finalLogo,0,1,0,1);
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
// SysProject sysProject = sysProjectDao.selectByPrimaryKey(projectId);
// if(ObjectUtil.isNull(sysProject)){
// throw new BaseException(CodeEnum.NOT_PROJECT);
// }
// //获取本周和上周的时间
// long thisWeekStartTime = DateUtil.beginOfWeek(new Date()).getTime();
// long thisWeekEndTime = DateUtil.endOfWeek(new Date()).getTime();
// long lastWeekStartTime = DateUtil.beginOfWeek(new Date(thisWeekStartTime - 1)).getTime();
// long lastWeekEndTime = DateUtil.endOfWeek(new Date(thisWeekStartTime - 1)).getTime();
// //查找上周任务
// List<TaskVo.TaskMinutesWps> lastWeekTask = taskSubTimeDao.queryMinutesTaskByTime(projectId,lastWeekStartTime,lastWeekEndTime);
// //查找本周任务
// List<TaskVo.TaskMinutesWps> thisWeekTask = taskSubTimeDao.queryMinutesTaskByTime(projectId,thisWeekStartTime,thisWeekEndTime);
// //生成excel写入的数据
// List<List<PoiUtil.PoiUtilCell>> minutes = writeMinutes(lastWeekTask,thisWeekTask,sysProject.getName());
//写入WBS
// ResourceLoader resourceLoader = new DefaultResourceLoader();
// InputStream is = resourceLoader.getResource("classpath:template/regularMeetingTemplate.xlsx").getInputStream();
// XSSFWorkbook wb = new XSSFWorkbook(is);
Workbook wb = new XSSFWorkbook();
PoiUtil.exportWB("会议记录", minutes, wb);
PoiUtil.setImg(wb,"会议记录",logo,0,1,0,1);
// PoiUtil.exportWB("会议记录", minutes, wb);
// PoiUtil.setImg(wb,"会议记录",logo,0,1,0,1);
//生成文件
String name = sysProject.getName() + "会议记录.xlsx";
String name = "会议记录"+DateUtil.today() + ".xlsx";
String fileName = "minutes/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".xlsx";
String path = WebConstant.UPLOAD_PATH_BASE + File.separator + fileName;
File tmpFile = new File(path);
@ -348,47 +383,129 @@ public class TaskPluginService implements ITaskPluginService{
stream.close();
//关联wps
WpsDto.Business business = new WpsDto.Business();
business.setBusinessId(taskId);
business.setBusinessId(getMinutes.getTaskId());
business.setBusinessType((byte) 2);
business.setUserId(currentUserId);
business.setFileName(name);
business.setFilePath(fileName);
business.setFileSize(tmpFile.length());
business.setOperation(WebConstant.Wps.USER_OPERATION_NEW);
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_WRITE);
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_QUERY);
business.setPrivilegeQueryUrl(PropUtil.domain + "v1/3rd/wpsPower");
wpsService.saveFile(business);
//获取wps文件的路径并返回
wpsPath = wpsService.queryVisitUrls(taskId,(byte) 2,token,params);
wpsPath = wpsService.queryVisitUrls(getMinutes.getTaskId(),(byte) 2,token,null);
if(CollectionUtil.isNotEmpty(wpsPath)){
wpsPath.forEach(wps->{
PluginVo.MinutesInfo minutesInfo = new PluginVo.MinutesInfo();
minutesInfo.setWpsPath(wps);
//获取下载路径
ProProjectFileExample projectFileExample = new ProProjectFileExample();
projectFileExample.createCriteria().andBusinessIdEqualTo(taskId).andBusinessTypeEqualTo((byte) 2);
projectFileExample.createCriteria().andBusinessIdEqualTo(getMinutes.getTaskId()).andBusinessTypeEqualTo((byte) 2);
List<ProProjectFile> projectFileList = proProjectFileDao.selectByExample(projectFileExample);
if(CollectionUtil.isNotEmpty(projectFileList)){
WpsFile wpsFile = wpsFileDao.selectByPrimaryKey(projectFileList.get(0).getWpsFileId());
minutesInfo.setDownloadPath(wpsFile.getDownloadUrl());
minutesInfo.setWpsFileId(wpsFile.getId());
}
minutesInfoList.add(minutesInfo);
});
}
return minutesInfoList;
}
@Override
public List<PluginVo.MinutesInfo> updateMinutesProject(Long currentUserId, PluginDto.UpdateMinutes updateMinutes, String token) throws Exception {
//根据域名差logo
String logo = "/home/staticrec/logo.png";
if(StrUtil.isNotEmpty(updateMinutes.getDomainName())) {
SysDomainExample domainExample = new SysDomainExample();
domainExample.createCriteria().andDomainNameEqualTo(updateMinutes.getDomainName());
List<SysDomain> sysDomainList = sysDomainDao.selectByExample(domainExample);
if (CollectionUtil.isNotEmpty(sysDomainList)) {
logo = sysDomainList.get(0).getLogo();
}
}
//查找到文件信息
WpsFile wpsFile = wpsFileDao.selectByPrimaryKey(updateMinutes.getWpsFileId());
//返回的文件路径信息
List<PluginVo.MinutesInfo> minutesInfoList = new ArrayList<>();
List<String> wpsPath = wpsService.queryVisitUrls(updateMinutes.getTaskId(),(byte) 2,token,null);
if(CollectionUtil.isNotEmpty(wpsPath)){
wpsPath.forEach(wps->{
PluginVo.MinutesInfo minutesInfo = new PluginVo.MinutesInfo();
minutesInfo.setWpsPath(wps);
minutesInfo.setDownloadPath(wpsFile.getDownloadUrl());
minutesInfo.setWpsFileId(wpsFile.getId());
minutesInfoList.add(minutesInfo);
});
}
// WpsFile wpsFile = new WpsFile();
// wpsFile.setSaveUrl("F:\\home\\cloud\\tall\\uploads\\minutes\\2020-08-11\\1597117206328.xlsx");
//获取本周和上周的开始和结束时间
long thisWeekStartTime = DateUtil.beginOfWeek(new Date()).getTime();
long thisWeekEndTime = DateUtil.endOfWeek(new Date()).getTime();
long lastWeekStartTime = DateUtil.beginOfWeek(new Date(thisWeekStartTime - 1)).getTime();
long lastWeekEndTime = DateUtil.endOfWeek(new Date(thisWeekStartTime - 1)).getTime();
//修改文件
if(ObjectUtil.isNotNull(wpsFile)){
InputStream is = new FileInputStream(wpsFile.getSaveUrl());
Workbook wb = new XSSFWorkbook(is);
if(ObjectUtil.isNotNull(wb)){
if(CollectionUtil.isNotEmpty(updateMinutes.getProjectList())){
String finalLogo = logo;
updateMinutes.getProjectList().forEach(project ->{
SysProject sysProject = sysProjectDao.selectByPrimaryKey(project.getProjectId());
if(ObjectUtil.isNotNull(sysProject)) {
if (project.getType() == 1) {
//删除sheet
if(wb.getSheetIndex(sysProject.getName()) != -1){
wb.removeSheetAt(wb.getSheetIndex(sysProject.getName()));
}
}else {
//添加sheet
if(wb.getSheetIndex(sysProject.getName()) == -1){
//查找上周任务
List<TaskVo.TaskMinutesWps> lastWeekTask = taskSubTimeDao.queryMinutesTaskByTime(project.getProjectId(),lastWeekStartTime,lastWeekEndTime);
//查找本周任务
List<TaskVo.TaskMinutesWps> thisWeekTask = taskSubTimeDao.queryMinutesTaskByTime(project.getProjectId(),thisWeekStartTime,thisWeekEndTime);
//查找项目经理名字和项目成员的名字
String pmName = roleDao.getMemberNameByProjectId(project.getProjectId(),"PM");
//查找项目内的成员名用“,”分隔
String memberName = roleDao.getMemberNameByProjectId(project.getProjectId(),"Member");
//生成excel写入的数据
List<List<PoiUtil.PoiUtilCell>> minutes = writeMinutes(lastWeekTask,thisWeekTask,sysProject.getName(),pmName,memberName);
PoiUtil.exportWB(sysProject.getName(), minutes, wb);
try {
PoiUtil.setImg(wb,sysProject.getName(), finalLogo,0,1,0,1);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
});
}
}
OutputStream stream = new FileOutputStream(wpsFile.getSaveUrl());
wb.write(stream);
stream.close();
}
return minutesInfoList;
}
/**
* 生成写入的数据格式
* @param lastWeekTaskList 上周的任务
* @param thisWeekTaskList 本周的任务
* @return 返回写入excel的数据
* 生成excel的首页信息
* @param projectIdList 项目id的集合
* @return 范湖写入的数据
*/
private List<List<PoiUtil.PoiUtilCell>> writeMinutes(List<TaskVo.TaskMinutesWps> lastWeekTaskList, List<TaskVo.TaskMinutesWps> thisWeekTaskList,String name) {
private List<List<PoiUtil.PoiUtilCell>> writeOverviewMinutes(List<Long> projectIdList) {
List<List<PoiUtil.PoiUtilCell>> sheet = new ArrayList<>();
//logo 和标题
List<PoiUtil.PoiUtilCell> headerTitle = new ArrayList<>();
headerTitle.add(new PoiUtil.PoiUtilCell("",1,1,1650,18));
headerTitle.add(new PoiUtil.PoiUtilCell(name+"周例会",7,1));
headerTitle.add(new PoiUtil.PoiUtilCell("周例会",7,1));
sheet.add(headerTitle);
//会议时间和主持人
List<PoiUtil.PoiUtilCell> header1 = new ArrayList<>();
@ -417,20 +534,86 @@ public class TaskPluginService implements ITaskPluginService{
List<PoiUtil.PoiUtilCell> minutesValue = new ArrayList<>();
minutesValue.add(new PoiUtil.PoiUtilCell("会议记录内容",8,1));
sheet.add(minutesValue);
//上周任务表头
List<PoiUtil.PoiUtilCell> projectTitle = new ArrayList<>();
projectTitle.add(new PoiUtil.PoiUtilCell("项目名",1,1));
projectTitle.add(new PoiUtil.PoiUtilCell("关键结果",1,1));
projectTitle.add(new PoiUtil.PoiUtilCell("计划开始时间",1,1));
projectTitle.add(new PoiUtil.PoiUtilCell("计划结束时间",1,1));
projectTitle.add(new PoiUtil.PoiUtilCell("实际开始时间",1,1));
projectTitle.add(new PoiUtil.PoiUtilCell("实际结束时间",1,1));
projectTitle.add(new PoiUtil.PoiUtilCell("PM",1,1));
projectTitle.add(new PoiUtil.PoiUtilCell("进度",1,1));
sheet.add(projectTitle);
if(CollectionUtil.isNotEmpty(projectIdList)){
projectIdList.forEach(projectId ->{
SysProject sysProject = sysProjectDao.selectByPrimaryKey(projectId);
if(ObjectUtil.isNotNull(sysProject)){
List<PoiUtil.PoiUtilCell> project = new ArrayList<>();
project.add(new PoiUtil.PoiUtilCell(sysProject.getName()));
sheet.add(project);
}
});
}
//会议记录人和领导签字
List<PoiUtil.PoiUtilCell> end = new ArrayList<>();
end.add(new PoiUtil.PoiUtilCell("会议记录人",1,1));
end.add(new PoiUtil.PoiUtilCell("",3,1));
end.add(new PoiUtil.PoiUtilCell());
end.add(new PoiUtil.PoiUtilCell());
end.add(new PoiUtil.PoiUtilCell("负责人签字",1,1));
end.add(new PoiUtil.PoiUtilCell("",3,1));
sheet.add(end);
//备注留白
List<PoiUtil.PoiUtilCell> remark = new ArrayList<>();
remark.add(new PoiUtil.PoiUtilCell("",8,8));
sheet.add(remark);
return sheet;
}
/**
* 生成写入的数据格式
* @param lastWeekTaskList 上周的任务
* @param thisWeekTaskList 本周的任务
* @return 返回写入excel的数据
*/
private List<List<PoiUtil.PoiUtilCell>> writeMinutes(List<TaskVo.TaskMinutesWps> lastWeekTaskList,
List<TaskVo.TaskMinutesWps> thisWeekTaskList,
String name,String pmName,String memberName) {
List<List<PoiUtil.PoiUtilCell>> sheet = new ArrayList<>();
//logo 和标题
List<PoiUtil.PoiUtilCell> headerTitle = new ArrayList<>();
headerTitle.add(new PoiUtil.PoiUtilCell("",1,1,1650,18));
headerTitle.add(new PoiUtil.PoiUtilCell(name+"周例会",7,1));
sheet.add(headerTitle);
//会议时间和主持人
List<PoiUtil.PoiUtilCell> header1 = new ArrayList<>();
header1.add(new PoiUtil.PoiUtilCell("会议时间"));
header1.add(new PoiUtil.PoiUtilCell("",3,1));
header1.add(new PoiUtil.PoiUtilCell());
header1.add(new PoiUtil.PoiUtilCell());
header1.add(new PoiUtil.PoiUtilCell("PM"));
header1.add(new PoiUtil.PoiUtilCell(pmName,3,1));
sheet.add(header1);
//参会人员
List<PoiUtil.PoiUtilCell> header2 = new ArrayList<>();
header2.add(new PoiUtil.PoiUtilCell("项目成员",1,1));
header2.add(new PoiUtil.PoiUtilCell(memberName,7,1));
sheet.add(header2);
//主题议题
List<PoiUtil.PoiUtilCell> header3 = new ArrayList<>();
header3.add(new PoiUtil.PoiUtilCell("关键结果KR",1,1));
header3.add(new PoiUtil.PoiUtilCell("",7,1));
sheet.add(header3);
//再空一行
List<PoiUtil.PoiUtilCell> header4 = new ArrayList<>();
header4.add(new PoiUtil.PoiUtilCell("",8,1));
sheet.add(header4);
//会议记录内容
List<PoiUtil.PoiUtilCell> minutesValue = new ArrayList<>();
minutesValue.add(new PoiUtil.PoiUtilCell("会议记录内容",8,1));
sheet.add(minutesValue);
// List<PoiUtil.PoiUtilCell> header1 = new ArrayList<>();
// sheet.add(header1);
// List<PoiUtil.PoiUtilCell> header2 = new ArrayList<>();
// sheet.add(header2);
// List<PoiUtil.PoiUtilCell> header3 = new ArrayList<>();
// sheet.add(header3);
// List<PoiUtil.PoiUtilCell> header4 = new ArrayList<>();
// sheet.add(header4);
// List<PoiUtil.PoiUtilCell> header5 = new ArrayList<>();
// sheet.add(header5);
// List<PoiUtil.PoiUtilCell> header6 = new ArrayList<>();
// sheet.add(header6);
//上周任务
List<PoiUtil.PoiUtilCell> lastWeek = new ArrayList<>();
lastWeek.add(new PoiUtil.PoiUtilCell("上周任务",8,1));
@ -449,7 +632,7 @@ public class TaskPluginService implements ITaskPluginService{
end.add(new PoiUtil.PoiUtilCell("",3,1));
end.add(new PoiUtil.PoiUtilCell());
end.add(new PoiUtil.PoiUtilCell());
end.add(new PoiUtil.PoiUtilCell("领导签字",1,1));
end.add(new PoiUtil.PoiUtilCell("负责人签字",1,1));
end.add(new PoiUtil.PoiUtilCell("",3,1));
sheet.add(end);
//备注留白

48
tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java

@ -12,16 +12,21 @@ import com.ccsens.tall.bean.dto.message.SyncMessageWithStartDto;
import com.ccsens.tall.bean.po.*;
import com.ccsens.tall.bean.vo.TaskVo;
import com.ccsens.tall.persist.dao.*;
import com.ccsens.tall.util.TallConstant;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.JacksonUtil;
import com.ccsens.util.WebConstant;
import com.ccsens.util.bean.message.common.InMessage;
import com.ccsens.util.bean.message.common.MessageConstant;
import com.ccsens.util.config.RabbitMQConfig;
import com.ccsens.util.cron.CronConstant;
import com.ccsens.util.cron.NatureToDate;
import com.ccsens.util.exception.BaseException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -68,6 +73,8 @@ public class TaskSubTimeService implements ITaskSubTimeService {
private IRobotService robotService;
@Resource
private ProRemindDao proRemindDao;
@Autowired
private AmqpTemplate rabbitTemplate;
@Override
public void saveProTaskSubTask(ProTaskSubTime proTaskSubTime) {
@ -217,17 +224,21 @@ public class TaskSubTimeService implements ITaskSubTimeService {
*/
@Override
public void startTask(Long currentUserId, TaskDto.StartTask startTaskDto) throws Exception {
ProTaskSubTime taskSubTime = taskSubTimeDao.selectByPrimaryKey(startTaskDto.getId());
ProTaskSubTime taskSubTime = taskSubTimeDao.selectByPrimaryKey(startTaskDto.getTaskId());
Long now = startTaskDto.getStartTime() == null ? System.currentTimeMillis() : startTaskDto.getStartTime();
if (ObjectUtil.isNotNull(taskSubTime)) {
if (taskSubTime.getComplatedStatus() != 0) {
throw new BaseException(CodeEnum.TASK_PREPARATION);
}
//无论任务是什么状态,都可以重新开始
// if (taskSubTime.getComplatedStatus() != 0) {
// throw new BaseException(CodeEnum.TASK_PREPARATION);
// }
// //结束其他进行中的任务
// completeTask(startTaskDto.getId(), startTaskDto.getRoleId(), now);
//开始指定的任务
taskSubTime.setRealBeginTime(now);
if(taskSubTime.getRealEndTime() != 0){
taskSubTime.setRealEndTime(0L);
}
taskSubTime.setComplatedStatus(1);
taskSubTimeDao.updateByPrimaryKeySelective(taskSubTime);
@ -248,35 +259,48 @@ public class TaskSubTimeService implements ITaskSubTimeService {
//接收者
List<BaseMessageDto.MessageUser> messageUserList = new ArrayList<>();
ProMemberExample memberExample = new ProMemberExample();
memberExample.createCriteria().andProjectIdEqualTo(startTaskDto.getProjectId());
memberExample.createCriteria().andProjectIdEqualTo(startTaskDto.getProjectId()).andUserIdNotEqualTo(0L);
List<ProMember> memberList = proMemberDao.selectByExample(memberExample);
Set<String> userSet = new HashSet<>();
if (CollectionUtil.isNotEmpty(memberList)) {
for (ProMember member : memberList) {
if (ObjectUtil.isNotNull(member.getUserId())) {
BaseMessageDto.MessageUser messageUser = new BaseMessageDto.MessageUser();
messageUser.setUserId(member.getUserId());
messageUserList.add(messageUser);
userSet.add(member.getUserId().toString());
}
}
}
BaseMessageDto.MessageUser messageUser1990 = new BaseMessageDto.MessageUser();
messageUser1990.setUserId(1990L);
messageUserList.add(messageUser1990);
userSet.add("1990");
BaseMessageDto.MessageUser messageUser1991 = new BaseMessageDto.MessageUser();
messageUser1991.setUserId(1991L);
messageUserList.add(messageUser1991);
BaseMessageDto.MessageUser messageUser1996 = new BaseMessageDto.MessageUser();
messageUser1996.setUserId(1996L);
messageUserList.add(messageUser1996);
userSet.add("1991");
BaseMessageDto.MessageUser messageUser1995 = new BaseMessageDto.MessageUser();
messageUser1995.setUserId(1995L);
messageUserList.add(messageUser1995);
userSet.add("1995");
BaseMessageDto.MessageUser messageUser1998 = new BaseMessageDto.MessageUser();
messageUser1998.setUserId(1998L);
messageUserList.add(messageUser1998);
userSet.add("1998");
Long duration = taskSubTime.getEndTime() - taskSubTime.getBeginTime();
SyncMessageWithStartDto syncMessage = new SyncMessageWithStartDto(startTaskDto.getProjectId(),null,messageUserList,
SyncMessageWithStartDto syncMessage = new SyncMessageWithStartDto(startTaskDto.getProjectId(),null,null,
startTaskDto.getRoleId(),taskSubTime.getTaskDetailId(),null,now,duration,player);
messageService.sendStartTaskMessage(syncMessage);
// messageService.sendStartTaskMessage(syncMessage);
InMessage inMessage = new InMessage();
inMessage.setToDomain(MessageConstant.DomainType.User);
inMessage.setTos(userSet);
inMessage.setData(JacksonUtil.beanToJson(syncMessage));
log.info("开始任务消息,{}",JacksonUtil.beanToJson(inMessage));
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME,
JacksonUtil.beanToJson(inMessage));
//3.添加记录
proLogService.addNewProLog(now, taskSubTime.getId(),
@ -545,7 +569,7 @@ public class TaskSubTimeService implements ITaskSubTimeService {
@Override
public List<TaskVo.RemindInfo> saveRemind(Long userId,TaskDto.TaskRemind taskRemind) throws Exception {
public List<TaskVo.RemindInfo> saveRemind(Long userId,TaskDto.TaskRemind taskRemind) {
ProTaskSubTime proTaskSubTime = taskSubTimeDao.selectByPrimaryKey(taskRemind.getTaskId());
if(ObjectUtil.isNull(proTaskSubTime)){
throw new BaseException(CodeEnum.NOT_TASK);

206
tall/src/main/java/com/ccsens/tall/service/UserService.java

@ -4,8 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.ccsens.cloudutil.feign.HealthFeignClient;
import com.ccsens.tall.bean.dto.ProjectDto;
@ -24,11 +24,11 @@ import com.ccsens.util.wx.WxXcxUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -39,29 +39,29 @@ import java.util.regex.Pattern;
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class UserService implements IUserService {
@Autowired
@Resource
private SysUserDao userDao;
@Autowired
@Resource
private SysAuthDao authDao;
@Autowired
@Resource
private ProMemberDao memberDao;
@Autowired
@Resource
private ProRoleDao proRoleDao;
@Autowired
@Resource
private ProMemberRoleDao memberRoleDao;
@Autowired
@Resource
private SysBalanceLogDao sysBalanceLogDao;
@Autowired
@Resource
private Snowflake snowflake;
@Autowired
@Resource
private RedisUtil redisUtil;
@Autowired
@Resource
private SysWxDao sysWxDao;
@Autowired
@Resource
private SysProjectDao sysProjectDao;
@Autowired
@Resource
private UserAttentionDao userAttentionDao;
@Autowired
@Resource
private HealthFeignClient healthFeignClient;
@ -71,13 +71,13 @@ public class UserService implements IUserService {
@Override
public UserVo.UserSign signin(WebConstant.CLIENT_TYPE clientType, WebConstant.IDENTIFY_TYPE identifyType,
String identifier, String credential, String clientIp, String redirect) throws Exception {
UserVo.UserSign userSignVo = null;
UserVo.UserSign userSignVo;
//1.登陆
userSignVo = __signin(identifyType, identifier, credential, redirect);
if (ObjectUtil.isNotNull(userSignVo) && ObjectUtil.isNotNull(userSignVo.getAuthId())) {
//2.添加登陆记录
__addSigninRecord(clientType, clientIp, userSignVo.getAuthId());
}
// if (ObjectUtil.isNotNull(userSignVo) && ObjectUtil.isNotNull(userSignVo.getAuthId())) {
// //2.添加登陆记录
// __addSigninRecord(clientType, clientIp, userSignVo.getAuthId());
// }
return userSignVo;
}
@ -99,7 +99,7 @@ public class UserService implements IUserService {
case Phone:
return phoneLogin(identifier, credential);
case Email:
return emailLogin(identifier, credential);
// return emailLogin(identifier, credential);
case Account:
return accountLogin(identifier, credential);
default:
@ -110,10 +110,7 @@ public class UserService implements IUserService {
/**
* 企业登录
*
* @param identifier
* @param credential
* @return
* @return 返回用户信息
*/
private UserVo.UserSign wxEnterpriseLogin(String identifier, String credential, String redirect) {
log.info("企业微信登录:{},{}, {}", identifier, credential, redirect);
@ -128,23 +125,21 @@ public class UserService implements IUserService {
if (userInfo == null) {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
UserVo.UserSign userSignVo = getUserSign(userInfo.getUserId(), userInfo.getCorpId(), (byte) WebConstant.IDENTIFY_TYPE.WxEnterprise.value, redirect);
return userSignVo;
return getUserSign(userInfo.getUserId(), userInfo.getCorpId(), (byte) WebConstant.IDENTIFY_TYPE.WxEnterprise.value, redirect);
}
/**
* 微信网页登陆
*
* @param code
* @return
* @param code 微信code
* @return 返回用户信息
*/
private UserVo.UserSign wxH5Login(WebConstant.IDENTIFY_TYPE identifyType, String code) {
UserVo.UserSign userSignVo = null;
UserVo.UserSign userSignVo;
//获取微信信息
WxOauth2UserInfo wxOauth2UserInfo = WxGzhUtil.getOauth2UserInfo(identifyType, code);
SysAuth theAuth = null;
SysAuth theAuth;
if (ObjectUtil.isNotNull(wxOauth2UserInfo)) {
// //查找有无保存的信息
// SysWxExample sysWxExample = new SysWxExample();
@ -228,17 +223,16 @@ public class UserService implements IUserService {
/**
* 微信公众号登陆
*
* @param code
* @return
* @throws Exception
* @param code 微信code
* @return 返回用户信息
*/
private UserVo.UserSign wxLogin(WebConstant.IDENTIFY_TYPE identifyType, String code) throws Exception {
UserVo.UserSign userSignVo = null;
private UserVo.UserSign wxLogin(WebConstant.IDENTIFY_TYPE identifyType, String code) {
UserVo.UserSign userSignVo;
//获取微信信息并保存
log.info("公众号登陆,{}", code);
WxOauth2UserInfo wxOauth2UserInfo = WxGzhUtil.getOauth2UserInfo(identifyType, code);
SysAuth theAuth = null;
SysAuth theAuth;
if (ObjectUtil.isNotNull(wxOauth2UserInfo)) {
SysAuthExample authExample = new SysAuthExample();
authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.OAUTH2_Wx.value)
@ -303,7 +297,7 @@ public class UserService implements IUserService {
return userSignVo;
}
public void __addSigninRecord(WebConstant.CLIENT_TYPE clientType, String clientIp, Long authId) {
// public void __addSigninRecord(WebConstant.CLIENT_TYPE clientType, String clientIp, Long authId) {
// SigninLog siginLog = new SigninLog();
// siginLog.setId(snowflake.nextId());
// siginLog.setAuthId(authId);
@ -311,18 +305,17 @@ public class UserService implements IUserService {
// siginLog.setSigninIp(clientIp);
// siginLog.setSigninTime(DateUtil.date());
// signinLogDao.insertSelective(siginLog);
}
// }
/**
* 手机号登陆
*
* @param phone
* @param smsVerifyCode
* @return
* @throws Exception
* @param phone 手机号
* @param smsVerifyCode 验证码
* @return 返回用户信息
*/
private UserVo.UserSign phoneLogin(String phone, String smsVerifyCode) throws Exception {
UserVo.UserSign userSignVo = null;
private UserVo.UserSign phoneLogin(String phone, String smsVerifyCode) {
UserVo.UserSign userSignVo;
if (isSmsCodeCorrect(phone, smsVerifyCode)) {
//1.查找对应账户,不存在则注册
List<SysAuth> authList = null;
@ -345,17 +338,17 @@ public class UserService implements IUserService {
return userSignVo;
}
private UserVo.UserSign emailLogin(String phone, String emailVerifyCode) {
return null;
}
// private UserVo.UserSign emailLogin(String phone, String emailVerifyCode) {
// return null;
// }
/**
* 账号登录
*/
private UserVo.UserSign accountLogin(String username, String password) throws Exception {
UserVo.UserSign userSignVo = null;
List<SysAuth> authList = null;
SysAuth theAuth = null;
UserVo.UserSign userSignVo;
List<SysAuth> authList;
SysAuth theAuth;
SysAuthExample authExample = new SysAuthExample();
authExample.createCriteria()
@ -386,8 +379,7 @@ public class UserService implements IUserService {
String openId = wechatUser.openid;
String unionId = wechatUser.unionid;
log.info("小程序登录,openid:{} ,unionId:{}", openId, unionId);
UserVo.UserSign userSignVo = getUserSign(openId, unionId, (byte) WebConstant.IDENTIFY_TYPE.Wxmp.value, null);
return userSignVo;
return getUserSign(openId, unionId, (byte) WebConstant.IDENTIFY_TYPE.Wxmp.value, null);
}
@ -400,9 +392,9 @@ public class UserService implements IUserService {
/**
* @param openId
* @param unionId
* @return
* @param openId openId
* @param unionId unionId
* @return 返回认证信息
*/
private UserVo.UserSign getUserSign(String openId, String unionId,
byte identifyType, String redirect) {
@ -535,7 +527,7 @@ public class UserService implements IUserService {
* 获取token
*/
@Override
public UserVo.TokenBean generateToken(WebConstant.CLIENT_TYPE clientType, Object subject, Map<String, Object> payLoads) throws Exception {
public UserVo.TokenBean generateToken(WebConstant.CLIENT_TYPE clientType, Object subject, Map<String, Object> payLoads){
UserVo.TokenBean tokenBean = new UserVo.TokenBean();
Long tokenExpired = null;
@ -543,24 +535,16 @@ public class UserService implements IUserService {
switch (clientType) {
case Wxmp:
//tokenExpired = 3600 * 1000L * 2;
tokenExpired = 3600 * 1000L * 24;
break;
case WxEnterprise:
case H5:
//tokenExpired = 3600 * 1000L * 2;
tokenExpired = 3600 * 1000L * 24;
break;
case Android:
tokenExpired = 3600 * 1000L * 2;
refreshTokenExpired = 3600 * 1000L * 24 * 30;
break;
case IOS:
tokenExpired = 3600 * 1000L * 2;
refreshTokenExpired = 3600 * 1000L * 24 * 30;
break;
case WxEnterprise:
tokenExpired = 3600 * 1000L * 24;
break;
default:
}
@ -571,19 +555,19 @@ public class UserService implements IUserService {
JwtUtil.createJWT(subject + "",
payLoads, tokenExpired,
WebConstant.JWT_ACCESS_TOKEN_SECERT);
redisUtil.set(RedisKeyManager.getTokenCachedKey((Long) subject),
redisUtil.set(RedisKeyManager.getTokenCachedKey(subject),
token, tokenExpired / 1000);
tokenBean.setToken(token);
}
if (ObjectUtil.isNotNull(refreshTokenExpired)) {
String refresh_token =
String refreshToken =
JwtUtil.createJWT(subject + "",
payLoads, refreshTokenExpired,
WebConstant.JWT_ACCESS_TOKEN_SECERT);
redisUtil.set(RedisKeyManager.getRefreshTokenCachedKey(subject),
refresh_token, refreshTokenExpired / 1000);
tokenBean.setRefresh_token(refresh_token);
refreshToken, refreshTokenExpired / 1000);
tokenBean.setRefresh_token(refreshToken);
}
//2.返回
@ -627,19 +611,22 @@ public class UserService implements IUserService {
throw new SmsException(SmsException.Error_SendTooFast);
}
//2.生成随机验证码
// String verifyCode = RandomUtil.randomNumbers(4);
//2.生成随机验证码 默认1111,生产开启验证码则获取随机数
String verifyCode = "1111";
if("1".equalsIgnoreCase(PropUtil.smsCode)){
verifyCode = RandomUtil.randomNumbers(4);
}
//3.保存到redis中
Integer codeValidInSeconds = WebConstant.Expired_Verify_Code_In_Seconds;
Integer codeExistINSeconds = WebConstant.Exist_Verify_Code_In_Seconds;
Integer codeExistInSeconds = WebConstant.Exist_Verify_Code_In_Seconds;
redisUtil.set(RedisKeyManager.getSigninSmsKey(phone), verifyCode, codeValidInSeconds);
redisUtil.set(RedisKeyManager.getSigninSmsExistKey(phone), verifyCode, codeExistINSeconds);
redisUtil.set(RedisKeyManager.getSigninSmsExistKey(phone), verifyCode, codeExistInSeconds);
//5.发送验证码
// SmsUtil.sendSms(phone, verifyCode, client_type.phase, codeValidInSeconds);
if("1".equalsIgnoreCase(PropUtil.smsCode)) {
SmsUtil.sendSms(phone, verifyCode,"", codeValidInSeconds);
}
//6.返回
smsCodeVo = new UserVo.SmsCode();
smsCodeVo.setPhone(phone);
@ -652,8 +639,8 @@ public class UserService implements IUserService {
* 通过id找用户
*/
@Override
public SysUser getUserById(Long userId) throws Exception {
SysUser theUser = null;
public SysUser getUserById(Long userId) {
SysUser theUser;
theUser = userDao.selectByPrimaryKey(userId);
if (ObjectUtil.isNull(theUser)) {
throw new BaseException(406, "找不到对应Id用户: " + userId);
@ -665,8 +652,8 @@ public class UserService implements IUserService {
* 注册
*/
@Override
public UserVo.UserSign registerUser(UserDto.UserSignup userSignup) throws Exception {
UserVo.UserSign userSignVo = null;
public UserVo.UserSign registerUser(UserDto.UserSignup userSignup){
UserVo.UserSign userSignVo;
//验证码是否合格
if (isSmsCodeCorrect(userSignup.getPhone(), userSignup.getSmsCode())) {
//检查手机号是否已被注册
@ -759,7 +746,6 @@ public class UserService implements IUserService {
*/
@Override
public Boolean findAccount(String account) {
Boolean flag = false;
SysAuthExample authExample = new SysAuthExample();
authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value)
.andIdentifierEqualTo(account);
@ -782,7 +768,6 @@ public class UserService implements IUserService {
throw new BaseException(CodeEnum.PHONE_ERR);
}
Boolean flag = false;
SysAuthExample authExample = new SysAuthExample();
authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value)
.andIdentifierEqualTo(phone);
@ -836,7 +821,6 @@ public class UserService implements IUserService {
} else {
//改手机对应账户,如果有,提示
List<SysAuth> phoneList;
SysAuth theAuth = null;
SysAuthExample phoneExample = new SysAuthExample();
phoneExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value)
.andIdentifierEqualTo(wxPhone.getPhone());
@ -1146,7 +1130,7 @@ public class UserService implements IUserService {
}
@Override
public UserVo.TokenBean getUserInfoAndToken(WebConstant.CLIENT_TYPE clientType, WebConstant.IDENTIFY_TYPE identifyType,UserVo.UserSign userSignVo, Map<String, Object> theMap) throws Exception {
public UserVo.TokenBean getUserInfoAndToken(WebConstant.CLIENT_TYPE clientType, WebConstant.IDENTIFY_TYPE identifyType,UserVo.UserSign userSignVo, Map<String, Object> theMap) {
UserVo.TokenBean tokenBean = generateToken(clientType, userSignVo.getUserId(), theMap);
//获取手机号
@ -1203,21 +1187,20 @@ public class UserService implements IUserService {
return null;
}
}
private SysWx getSysWx(String unionId) {
SysWx sysWx = null;
SysWxExample sysWxExample = new SysWxExample();
sysWxExample.createCriteria().andUnionIdEqualTo(unionId);
List<SysWx> sysWxList = sysWxDao.selectByExample(sysWxExample);
if (CollectionUtil.isNotEmpty(sysWxList)) {
sysWx = sysWxList.get(0);
}
return sysWx;
}
//
// private SysWx getSysWx(String unionId) {
// SysWx sysWx = null;
// SysWxExample sysWxExample = new SysWxExample();
// sysWxExample.createCriteria().andUnionIdEqualTo(unionId);
// List<SysWx> sysWxList = sysWxDao.selectByExample(sysWxExample);
// if (CollectionUtil.isNotEmpty(sysWxList)) {
// sysWx = sysWxList.get(0);
// }
// return sysWx;
// }
/**
* 合并账号
*
* @param currentUserId userId
* @param wxPhone 手机号和合并方式
* @return 用户id
@ -1336,8 +1319,7 @@ public class UserService implements IUserService {
/**
* 修改用户信息添加微信信息
*
* @return
* @return 返回信息
*/
@Override
public UserVo.WxInfo updateUserInfo(Long currentUserId, UserDto.WxInfo userInfo) {
@ -1407,7 +1389,7 @@ public class UserService implements IUserService {
*/
@Override
public UserVo.UserSign changePhoneNotPassword(Long userId, UserDto.WxBindingPhone phoneInfo) {
UserVo.UserSign userSign = null;
UserVo.UserSign userSign;
if (isSmsCodeCorrect(phoneInfo.getPhone(), phoneInfo.getSmsCode())) {
//查找新手机号的的绑定信息
Long newPhoneUserId = selectUserIdByPhone(phoneInfo.getPhone());
@ -1455,8 +1437,8 @@ public class UserService implements IUserService {
/**
* 通过userId获取token
*
* @param userId
* @return
* @param userId userId
* @return token
*/
@Override
public UserVo.TokenBean getTokenByUserId(Long userId) {
@ -1465,7 +1447,7 @@ public class UserService implements IUserService {
if (ObjectUtil.isNull(userId)) {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
Object tokenR = redisUtil.get(RedisKeyManager.getTokenCachedKey(userId));
Object tokenRe = redisUtil.get(RedisKeyManager.getTokenCachedKey(userId));
//获取认证信息
UserVo.UserSign userSignVo = null;
SysAuthExample authExample = new SysAuthExample();
@ -1498,23 +1480,23 @@ public class UserService implements IUserService {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
//如果token为空重新生成一份
if (ObjectUtil.isNull(tokenR)) {
if (ObjectUtil.isNull(tokenRe)) {
//3.生成token(access_token,refresh_token)
if (ObjectUtil.isNotNull(userSignVo)) {
Map<String, Object> theMap = CollectionUtil.newHashMap();
theMap.put("authId", String.valueOf(userSignVo.getAuthId()));
Long tokenExpired = 3600 * 1000L * 24 * 100;
long tokenExpired = 3600 * 1000L * 24 * 100;
String token =
JwtUtil.createJWT(userId + "",
theMap, tokenExpired,
WebConstant.JWT_ACCESS_TOKEN_SECERT).toString();
redisUtil.set(RedisKeyManager.getTokenCachedKey((Long) userId),
WebConstant.JWT_ACCESS_TOKEN_SECERT);
redisUtil.set(RedisKeyManager.getTokenCachedKey(userId),
token, tokenExpired / 1000);
tokenR = token;
tokenRe = token;
}
}
tokenBean.setToken(tokenR.toString());
tokenBean.setToken(tokenRe.toString());
return tokenBean;
}
@ -1526,8 +1508,8 @@ public class UserService implements IUserService {
user.setId(snowflake.nextId());
userDao.insertSelective(user);
//自动添加账号密码
String accountName = null;
String password = null;
String accountName;
String password;
if(StrUtil.isNotEmpty(userSignup.getAccount())){
accountName = userSignup.getAccount();
SysAuthExample sysAuthExample = new SysAuthExample();
@ -1584,9 +1566,7 @@ public class UserService implements IUserService {
@Override
public List<UserVo.UserInfo> queryUserInfos(Long[] ids) {
List<UserVo.UserInfo> infos = userDao.queryUserInfos(ids);
return infos;
return userDao.queryUserInfos(ids);
}
@Override

37
tall/src/main/java/com/ccsens/tall/service/WpsService.java

@ -11,6 +11,8 @@ import com.ccsens.tall.bean.po.*;
import com.ccsens.tall.bean.vo.UserVo;
import com.ccsens.tall.bean.vo.WpsVo;
import com.ccsens.tall.persist.dao.SysUserDao;
import com.ccsens.tall.persist.dao.TaskDetailDao;
import com.ccsens.tall.persist.dao.TaskSubTimeDao;
import com.ccsens.tall.persist.dao.WpsFileDao;
import com.ccsens.tall.persist.mapper.ProProjectFileMapper;
import com.ccsens.tall.persist.mapper.WpsFileUserMapper;
@ -57,6 +59,12 @@ public class WpsService implements IWpsService {
private Snowflake snowflake;
@Resource
private IAsyncService asyncService;
@Resource
private IProRoleService proRoleService;
@Resource
private TaskSubTimeDao taskSubTimeDao;
@Resource
private TaskDetailDao taskDetailDao;
@Override
public List<String> queryVisitUrls(long businessId, byte businessType, String token, Map<String, String> params) {
@ -210,7 +218,7 @@ public class WpsService implements IWpsService {
* @param fileId 文件ID
* @param ext 后缀
* @param token token
* @param params
* @param params 保存时回访的路径
* @return wps访问路径
*/
private String getUrl(String fileId, String ext, String token, Map<String, String> params) {
@ -228,9 +236,7 @@ public class WpsService implements IWpsService {
String newSignature = WpsSignature.getSignature(paramMap, WebConstant.Wps.APPKEY);
StringBuilder fileUrl = new StringBuilder("https://wwo.wps.cn/office/{}/{}?_w_appid=" + WebConstant.Wps.APPID + "&_w_signature={}&_w_token={}");
if (CollectionUtil.isNotEmpty(params)) {
params.forEach((k,v) -> {
fileUrl.append("&").append(k).append("=").append(v);
});
params.forEach((k,v) -> fileUrl.append("&").append(k).append("=").append(v));
}
@ -295,6 +301,7 @@ public class WpsService implements IWpsService {
json.put("id", projectFile.getBusinessId());
json.put("type", projectFile.getBusinessType());
json.put("fileId", projectFile.getWpsFileId());
json.put("userId", userId );
String result = RestTemplateUtil.postBody(projectFile.getPrivilegeQueryUrl(), json);
user.setPermission(result);
}
@ -445,4 +452,26 @@ public class WpsService implements IWpsService {
}
return fileIdAndPath;
}
@Override
public String getWpsPower(WpsDto.WpsPower wpsPower) {
log.info("查看该用户的操作权限:{}",wpsPower.toString());
Long projectId = wpsPower.getId();
if(wpsPower.getType() == 2){
ProTaskSubTime proTaskSubTime = taskSubTimeDao.selectByPrimaryKey(wpsPower.getId());
if(ObjectUtil.isNotNull(proTaskSubTime)){
ProTaskDetail taskDetail = taskDetailDao.selectByPrimaryKey(proTaskSubTime.getTaskDetailId());
if(ObjectUtil.isNotNull(taskDetail)){
projectId = taskDetail.getProjectId();
}
}
}
int power = proRoleService.selectPowerByRoleName(wpsPower.getUserId(),projectId);
if (power > 1) {
log.info("权限为可写");
return WebConstant.Wps.PERMISSION_WRITE;
}
log.info("权限为只读");
return WebConstant.Wps.PERMISSION_READ;
}
}

38
tall/src/main/java/com/ccsens/tall/web/DebugController.java

@ -1,15 +1,11 @@
package com.ccsens.tall.web;
import cn.hutool.core.lang.UUID;
import com.ccsens.util.ImageCodeGeneratorUtil;
import com.ccsens.tall.bean.dto.message.SyncMessageWithStartDto;
import com.ccsens.util.JacksonUtil;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.TransactionUtil;
import com.ccsens.util.bean.message.client.AuthMessage;
import com.ccsens.util.bean.message.common.InMessage;
import com.ccsens.util.bean.message.common.MessageConstant;
import com.ccsens.util.bean.message.common.MessageRule;
import com.ccsens.util.bean.message.common.ServerMessage;
import com.ccsens.util.config.RabbitMQConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
@ -18,7 +14,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@ -26,10 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.FileOutputStream;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@Slf4j
@Api(tags = "DEBUG" , description = "DebugController | ")
@ -53,8 +45,6 @@ public class DebugController {
}
@ApiOperation(value = "消息测试",notes = "")
@ApiImplicitParams({
})
@ -93,4 +83,30 @@ public class DebugController {
// ImageCodeGeneratorUtil.generateCodeImage(response.getOutputStream(), codeMap.get("imageCode"), 200, 70);
}
@ApiOperation(value = "测试开始任务发送消息")
@ApiImplicitParams({
})
@RequestMapping(value = "/start", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public void startTask() throws Exception {
SyncMessageWithStartDto syncMessage = new SyncMessageWithStartDto(1267279600455651328L,null,null,
1267279601034465281L,1267279603261640704L,null, System.currentTimeMillis(),300000L,"测试");
Set<String> userSet = new HashSet<>();
userSet.add("1995");
InMessage inMessage = new InMessage();
inMessage.setToDomain(MessageConstant.DomainType.User);
inMessage.setTos(userSet);
inMessage.setData(JacksonUtil.beanToJson(syncMessage));
log.info("开始任务消息,{}",JacksonUtil.beanToJson(inMessage));
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME,
JacksonUtil.beanToJson(inMessage));
}
}

31
tall/src/main/java/com/ccsens/tall/web/PluginController.java

@ -143,17 +143,42 @@ public class PluginController {
return JsonResponse.newInstance().ok();
}
// @ApiOperation(value = "会议纪要表", notes = "")
// @ApiImplicitParams({
// })
// @RequestMapping(value = "/minutes", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
// public JsonResponse<List<PluginVo.MinutesInfo>> saveMinutes(HttpServletRequest request,
// @RequestParam(required = false)String domainName, @RequestParam(required = true)Long projectId,Long taskId) throws Exception {
// Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
// String authHeader = request.getHeader(WebConstant.HEADER_KEY_TOKEN);
// String token = authHeader.substring(WebConstant.HEADER_KEY_TOKEN_PREFIX.length());
// List<PluginVo.MinutesInfo> wpsPath = taskPluginService.saveMinutes(currentUserId,domainName,projectId,taskId,token);
// return JsonResponse.newInstance().ok(wpsPath);
// }
@ApiOperation(value = "会议纪要表", notes = "")
@ApiImplicitParams({
})
@RequestMapping(value = "/minutes", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
@RequestMapping(value = "/minutes", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<PluginVo.MinutesInfo>> saveMinutes(HttpServletRequest request,
@RequestParam(required = false)String domainName, @RequestParam(required = true)Long projectId,Long taskId) throws Exception {
@ApiParam @Validated @RequestBody PluginDto.GetMinutes getMinutes) throws Exception {
Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
String authHeader = request.getHeader(WebConstant.HEADER_KEY_TOKEN);
String token = authHeader.substring(WebConstant.HEADER_KEY_TOKEN_PREFIX.length());
List<PluginVo.MinutesInfo> wpsPath = taskPluginService.saveMinutes(currentUserId,domainName,projectId,taskId,token);
List<PluginVo.MinutesInfo> wpsPath = taskPluginService.saveMinutes(currentUserId,getMinutes,token);
return JsonResponse.newInstance().ok(wpsPath);
}
@ApiOperation(value = "修改周会表", notes = "")
@ApiImplicitParams({
})
@RequestMapping(value = "/minutes/project", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<PluginVo.MinutesInfo>> updateMinutesProject(HttpServletRequest request,
@ApiParam @Validated @RequestBody PluginDto.UpdateMinutes updateMinutes) throws Exception {
Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
String authHeader = request.getHeader(WebConstant.HEADER_KEY_TOKEN);
String token = authHeader.substring(WebConstant.HEADER_KEY_TOKEN_PREFIX.length());
List<PluginVo.MinutesInfo> wpsPath = taskPluginService.updateMinutesProject(currentUserId,updateMinutes,token);
return JsonResponse.newInstance().ok(wpsPath);
}
}

1
tall/src/main/java/com/ccsens/tall/web/RoleController.java

@ -78,4 +78,5 @@ public class RoleController {
proRoleService.deleteMemberByRole(currentUserId,saveMember);
return JsonResponse.newInstance().ok();
}
}

1
tall/src/main/java/com/ccsens/tall/web/UserController.java

@ -353,6 +353,7 @@ public class UserController {
})
@RequestMapping(value = "claims",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
public String getNodeMessage(@RequestParam(required = true) String token) throws Exception {
log.info("根据token获取userId,token:{}",token);
//验证token是否有效
String userId = null;
Claims claims = null;

12
tall/src/main/java/com/ccsens/tall/web/WpsController.java

@ -16,11 +16,9 @@ import com.ccsens.util.exception.BaseException;
import io.swagger.annotations.*;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.repository.query.Param;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -173,6 +171,14 @@ public class WpsController {
return JsonResponse.newInstance().ok();
}
@ApiOperation(value = "查看wps时查询角色的读取权限",notes = "")
@ApiImplicitParams({
})
@RequestMapping(value = "/wpsPower", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public String getWpsPower(HttpServletRequest request,
@ApiParam @Validated @RequestBody WpsDto.WpsPower wpsPower){
return wpsService.getWpsPower(wpsPower);
}
@Data
@ApiModel("wps通用请求头参数")

3
tall/src/main/resources/application-dev.yml

@ -11,7 +11,7 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
host: api.ccsens.com
host: 81.70.54.64
password: 111111
port: 5672
username: admin
@ -32,6 +32,7 @@ swagger:
gatewayUrl: https://test.tall.wiki/gateway/
notGatewayUrl: /home/staticrec/logo.png
smsCode: 0
wx:
prefixUrl: https://test.tall.wiki/wxconfigurer-api/
file:

1
tall/src/main/resources/application-prod.yml

@ -37,6 +37,7 @@ eureka:
gatewayUrl: https://www.tall.wiki/gateway/
notGatewayUrl: https://www.tall.wiki/
smsCode: 1
wx:
prefixUrl: https://www.tall.wiki/wxconfigurer-api/
file:

2
tall/src/main/resources/application-test.yml

@ -38,11 +38,13 @@ eureka:
#notGatewayUrl: http://192.168.0.99/
gatewayUrl: https://test.tall.wiki/gateway/
notGatewayUrl: https://test.tall.wiki/
smsCode: 0
wx:
prefixUrl: https://www.tall.wiki/wxconfigurer-api/
file:
domain: https://test.tall.wiki/gateway/tall/v1.0/
imgDomain: https://test.tall.wiki/gateway/tall/v1.0/uploads
#file:
# domain: http://192.168.0.99/gateway/tall/v1.0/
# imgDomain: http://192.168.0.99/gateway/tall/v1.0/uploads

19
tall/src/main/resources/mapper_dao/ProRoleDao.xml

@ -187,4 +187,23 @@
id = #{roleId}
)
</select>
<select id="getMemberNameByProjectId" resultType="String" parameterType="java.util.Map">
SELECT
GROUP_CONCAT(DISTINCT m.nickname ORDER BY m.id) as memberName
FROM
t_pro_member m LEFT JOIN t_pro_member_role mr on m.id = mr.member_id
LEFT JOIN t_pro_role r on mr.role_id = r.id
LEFT JOIN t_pro_role r1 on r.parent_id = r1.id
WHERE
r.rec_status = 0
AND
m.rec_status = 0
AND
m.project_id = #{projectId}
AND
r1.`name` = #{parentRoleName}
</select>
</mapper>

16
util/src/main/java/com/ccsens/util/PoiUtil.java

@ -162,6 +162,7 @@ public class PoiUtil {
font.setColor(Font.COLOR_RED);
style.setFont(font);
}
style.setFillForegroundColor(IndexedColors.RED.getIndex());
newCell.setCellStyle(style);
}
}
@ -443,7 +444,6 @@ public class PoiUtil {
}
/**
*
* @param ImgPath:图片路径
* @param row1起始行
* @param row2终止行
* @param col1起始列
@ -493,10 +493,17 @@ public class PoiUtil {
}
public static void main(String[] args) throws Exception {
InputStream inputStream = new FileInputStream("D:\\1.xlsx");
Workbook workbook = new XSSFWorkbook(inputStream);
workbook.removeSheetAt(workbook.getSheetIndex("bbb"));
OutputStream stream = new FileOutputStream(new File("D:\\1.xlsx"));
workbook.write(stream);
stream.close();
// List<List<PoiUtilCell>> list = new ArrayList<>();
// List<PoiUtilCell> cells = new ArrayList<>();
// cells.add(new PoiUtilCell("1", 5, 1));
// cells.add(new PoiUtilCell("1", 2, 1));
// cells.add(new PoiUtilCell());
// cells.add(new PoiUtilCell());
// cells.add(new PoiUtilCell());
@ -506,6 +513,7 @@ public class PoiUtil {
// List<PoiUtilCell> cells2 = new ArrayList<>();
// cells2.add(new PoiUtilCell("3", 1, 2));
// cells2.add(new PoiUtilCell("4"));
// cells2.add(new PoiUtilCell("",3,1));
// list.add(cells2);
// List<PoiUtilCell> cells3 = new ArrayList<>();
// cells3.add(new PoiUtilCell("5"));
@ -517,8 +525,8 @@ public class PoiUtil {
// cells5.add(new PoiUtilCell("9", 2, 2));
// cells5.add(new PoiUtilCell("9"));
// list.add(cells5);
//
// Workbook wbs = exportWB("wbs", list, null);
// Workbook wbs = exportWB("wbs", list, workbook);
// OutputStream stream = new FileOutputStream(new File("D:\\1.xlsx"));
// wbs.write(stream);
// stream.close();

5
util/src/main/java/com/ccsens/util/PropUtil.java

@ -20,6 +20,7 @@ public class PropUtil {
public static String notGatewayUrl;
public static String qrCode;
public static String wxPrefix;
public static String smsCode;
@Value("${gatewayUrl:}")
public void setGatewayUrl(String gatewayUrl) {
@ -58,4 +59,8 @@ public class PropUtil {
public void setWxPrefix(String wxPrefix) {
PropUtil.wxPrefix = wxPrefix;
}
@Value("${smsCode:}")
public void setSmsCode(String smsCode) {
PropUtil.smsCode = smsCode;
}
}

24
util/src/main/java/com/ccsens/util/SmsUtil.java

@ -12,20 +12,32 @@ import java.io.IOException;
@Slf4j
@Component
public class SmsUtil {
private static final int appid = 1400188778; // 1400开头
// 1400开头
private static final int appid = 1400188778;
private static final String appkey = "c86ca104521ab2e28e1d4b558fdd665e";
private static final int templateId = 286731; //{1} 验证码{1}, 您正在通过{2}登录传控科技“时物链条”会议管理系统,请与{3}分钟内填写,如非本人操作,请忽略本短信。
private static final int templateId1 = 286682; //{1} 您正在通过{2}登录传控科技“时物链条”会议管理系统,请与{2}分钟内填写,如非本人操作,请忽略本短信。
/**
* {1} 验证码{1} 您正在通过{2}登录传控科技时物链条会议管理系统请与{3}分钟内填写如非本人操作请忽略本短信\
*/
private static final int templateId = 286731;
/**
* {1} 您正在通过{2}登录传控科技时物链条会议管理系统请与{2}分钟内填写如非本人操作请忽略本短信
*/
private static final int templateId1 = 286682;
/**验证码{1},{2}分钟内有效,如非本人操作请忽略
*
*/
private static final int templateId2 = 686476;
private static final String smsSign = "传控科技";
public static void sendSms(String phone,String code,String appName,Integer seconds){
String phoneNumbers[] = {phone};
Integer minutes = (seconds - 1) / 60 + 1;
try {
String[] params = {code,appName,String.valueOf(minutes)};//数组具体的元素个数和模板中变量个数必须一致,例如事例中templateId:5678对应一个变量,参数数组中元素个数也必须是一个
SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
//数组具体的元素个数和模板中变量个数必须一致,例如事例中templateId:5678对应一个变量,参数数组中元素个数也必须是一个
String[] params = {code,String.valueOf(minutes)}; SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
// 签名参数未提供或者为空时,会使用默认签名发送短信
SmsSingleSenderResult result = ssender.sendWithParam("86", phoneNumbers[0],
templateId, params, smsSign, "", ""); // 签名参数未提供或者为空时,会使用默认签名发送短信
templateId2, params, smsSign, "", "");
log.info(String.valueOf(result));
} catch (HTTPException e) {
// HTTP响应码错误

3
util/src/main/java/com/ccsens/util/WebConstant.java

@ -506,7 +506,8 @@ public class WebConstant {
// }
public enum Message_Type{
Heart(0x00,"Heart"),Ack(0x01,"Ack"),Auth(0x02,"Auth"),Channel(0x03,"Channel"),Sync(0x04,"Sync")
Heart(0x00,"Heart"),Ack(0x01,"Ack"),Auth(0x02,"Auth"),Channel(0x03,"Channel")
,Sync(0x04,"Sync")
,Node(0x05,"Node"),User(0x06,"User"), Timer(0x07,"Timer")
,Error(0x99,"Error")
,MasterStatus(0x10,"MasterStatus")

Loading…
Cancel
Save