Browse Source

导出跳绳比赛总表

tiaosheng
zy_Java 5 years ago
parent
commit
d2157407b5
  1. 2
      cloudutil/src/main/java/com/ccsens/cloudutil/bean/tall/dto/WpsDto.java
  2. 1
      game/src/main/java/com/ccsens/game/service/ScreenService.java
  3. 2
      mt/src/main/java/com/ccsens/mt/api/CompeteController.java
  4. 59
      mt/src/main/java/com/ccsens/mt/service/CompeteService.java
  5. 2
      mt/src/main/java/com/ccsens/mt/service/ICompeteService.java
  6. 4
      mt/src/main/resources/application.yml
  7. 3
      mt/src/main/resources/mapper_dao/CompeteEnrollDao.xml
  8. 4
      pom.xml
  9. 4
      tall/src/main/java/com/ccsens/tall/bean/dto/WpsDto.java
  10. 2
      tall/src/main/java/com/ccsens/tall/persist/dao/ProRoleDao.java
  11. 2
      tall/src/main/java/com/ccsens/tall/service/ExcelService.java
  12. 8
      tall/src/main/java/com/ccsens/tall/service/ProRoleService.java
  13. 1
      tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java
  14. 2
      tall/src/main/java/com/ccsens/tall/service/TaskPluginService.java
  15. 9
      tall/src/main/java/com/ccsens/tall/service/WpsService.java
  16. 6
      tall/src/main/java/com/ccsens/tall/web/FileController.java
  17. 1
      tall/src/main/resources/application-dev.yml
  18. 1
      tall/src/main/resources/application-prod.yml
  19. 1
      tall/src/main/resources/application-test.yml
  20. 4
      tall/src/main/resources/application.yml
  21. 1
      tall/src/main/resources/mapper_dao/ProRoleDao.xml
  22. 1
      tall/src/main/resources/mapper_dao/WpsFileDao.xml

2
cloudutil/src/main/java/com/ccsens/cloudutil/bean/tall/dto/WpsDto.java

@ -24,6 +24,8 @@ public class WpsDto {
private String fileName;
@ApiModelProperty("文件路径,默认在WebConstant.UPLOAD_PATH_BASE下")
private String filePath;
@ApiModelProperty("文件实际存储路径")
private String realFilePath;
@ApiModelProperty("文件大小")
private Long fileSize;
@ApiModelProperty("操作类型 值:WebConstant Wps USER_OPERATION... ")

1
game/src/main/java/com/ccsens/game/service/ScreenService.java

@ -1456,6 +1456,7 @@ public class ScreenService implements IScreenService {
business.setUserId(params.getUserId());
business.setFileName(name);
business.setFilePath(fileName);
business.setRealFilePath(path);
business.setFileSize(tmpFile.length());
business.setOperation(WebConstant.Wps.USER_OPERATION_NEW);
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_WRITE);

2
mt/src/main/java/com/ccsens/mt/api/CompeteController.java

@ -166,7 +166,7 @@ public class CompeteController {
@RequestMapping(value = "/enroll", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse enrollPlayInfo(@ApiParam @Validated @RequestBody QueryDto<CompeteDto.CompeteType> params) throws IOException {
log.info("查询各个项目报名人员信息:{}",params);
List<CompeteVo.EnrollPlayInfo> enrollPlayInfoList= competeService.enrollPlayInfo(params);
String enrollPlayInfoList= competeService.enrollPlayInfo(params);
return JsonResponse.newInstance().ok(enrollPlayInfoList);
}

59
mt/src/main/java/com/ccsens/mt/service/CompeteService.java

@ -596,8 +596,21 @@ public class CompeteService implements ICompeteService{
}
@Override
public List<CompeteVo.EnrollPlayInfo> enrollPlayInfo(QueryDto<CompeteDto.CompeteType> params) {
public String enrollPlayInfo(QueryDto<CompeteDto.CompeteType> params) {
CompeteDto.CompeteType competeType = params.getParam();
List<String> filePath = new ArrayList<>();
//查询大赛id
CompeteVo.CompeteTime competeTimeByType = competeTimeDao.getCompeteTimeByType(competeType.getType(), System.currentTimeMillis());
// //查询此大赛是否关联wps
// WpsDto.VisitWpsUrl visitWpsUrl = new WpsDto.VisitWpsUrl();
// visitWpsUrl.setBusinessId(competeTimeByType.getId());
// visitWpsUrl.setBusinessType((byte) 11);
// visitWpsUrl.setUserId(params.getUserId());
// filePath = tallFeignClient.queryVisitUrls(visitWpsUrl);
// if(CollectionUtil.isNotEmpty(filePath)){
// //TODO 删除以前的关联信息
// }
//查询报名信息
int typeId = competeType.getType();
ArrayList<CompeteVo.EnrollPlayInfo> arrayList = new ArrayList();
//1:查询该类型下所有项目的id,name,team信息,排除level为1的
@ -622,20 +635,31 @@ public class CompeteService implements ICompeteService{
for (CompeteVo.Team team1 : teamList){
//6:获取团队下队员的详细信息
CompeteVo.EnrollPlayInfo enrollPlayInfo = competeEnrollDao.getPlayerAndProjectForTeam(team1.getPlayer_id());
enrollPlayInfo.setName(projectInfo.getName());
arrayList.add(enrollPlayInfo);
if(ObjectUtil.isNotNull(enrollPlayInfo)) {
enrollPlayInfo.setName(projectInfo.getName());
arrayList.add(enrollPlayInfo);
}
}
}
}
//7:将数据放入excel表格
InputStream inputStream = null;
//excel表格行列对象
List<List<PoiUtil.PoiUtilCell>> list = new ArrayList<>();
List<PoiUtil.PoiUtilCell> title = new ArrayList<>();
title.add(new PoiUtil.PoiUtilCell());
title.add(new PoiUtil.PoiUtilCell("比赛项目名称"));
title.add(new PoiUtil.PoiUtilCell("组别"));
title.add(new PoiUtil.PoiUtilCell("报名人姓名"));
title.add(new PoiUtil.PoiUtilCell("身份证号"));
title.add(new PoiUtil.PoiUtilCell("手机号"));
title.add(new PoiUtil.PoiUtilCell("其他参赛人员"));
list.add(title);
try {
Workbook workbook = new XSSFWorkbook();
int i = 1;
for (CompeteVo.EnrollPlayInfo enrollPlayInfo : arrayList){
//行对象
List<PoiUtil.PoiUtilCell> cells = new ArrayList<>();
cells.add(new PoiUtil.PoiUtilCell(i+"",1,1,300,18));
//单元格对象
PoiUtil.PoiUtilCell poiUtilCel = new PoiUtil.PoiUtilCell(enrollPlayInfo.getName());
cells.add(poiUtilCel);
@ -650,40 +674,47 @@ public class CompeteService implements ICompeteService{
PoiUtil.PoiUtilCell poiUtilCel5 = new PoiUtil.PoiUtilCell(enrollPlayInfo.getOthersName());
cells.add(poiUtilCel5);
list.add(cells);
i++;
}
//生成excel表格对象,并将数据放入
Workbook wbs = PoiUtil.exportWB("Sheet1", list, workbook);
Workbook wbs = PoiUtil.exportWB("总表", list, workbook);
//8:关联金山在线文档
String name = "报名表" + ".xlsx";
String name = "跳绳比赛报名表" + ".xlsx";
String filepath = "mt/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".xlsx";
String path = PropUtil.path + filepath;
File tmpFile = new File(path);
if (!tmpFile.getParentFile().exists()) {
tmpFile.getParentFile().mkdirs();
}
//PropUtil.path获取配置文件中的path属性,拼接生成写入信息的文件名,
String path = PropUtil.path + File.separator + filepath;
File file = new File(path);
OutputStream stream = new FileOutputStream(file);
wbs.write(stream);
stream.close();
//获取比赛的第几届信息
CompeteVo.CompeteTime competeTimeByType = competeTimeDao.getCompeteTimeByType(competeType.getType(), System.currentTimeMillis());
//关联wps
WpsDto.Business business = new WpsDto.Business();
business.setBusinessId(competeTimeByType.getId());
business.setBusinessType((byte) 11);
business.setFileName(name);
business.setFilePath(filepath);
business.setFilePath(path);
business.setRealFilePath(path);
business.setFileSize(file.length());
business.setUserId(params.getUserId());
business.setOperation(WebConstant.Wps.USER_OPERATION_NEW);
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_READ);
log.info("跳绳比赛报名表关联wps:{}",business);
tallFeignClient.saveWpsFile(business);
//查询wps
WpsDto.VisitWpsUrl visitWpsUrl = new WpsDto.VisitWpsUrl();
visitWpsUrl.setBusinessId(competeTimeByType.getId());
visitWpsUrl.setBusinessType((byte) 11);
visitWpsUrl.setUserId(params.getUserId());
tallFeignClient.queryVisitUrls(visitWpsUrl);
filePath = tallFeignClient.queryVisitUrls(visitWpsUrl);
} catch (IOException e) {
e.printStackTrace();
}
return arrayList;
return filePath.get(0);
}

2
mt/src/main/java/com/ccsens/mt/service/ICompeteService.java

@ -120,5 +120,5 @@ public interface ICompeteService {
* @param params 项目类型信息
* @return 返回参赛者的详细信息
*/
List<CompeteVo.EnrollPlayInfo> enrollPlayInfo(QueryDto<CompeteDto.CompeteType> params) throws IOException;
String enrollPlayInfo(QueryDto<CompeteDto.CompeteType> params) throws IOException;
}

4
mt/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: test
include: common, util-test
active: prod
include: common, util-prod

3
mt/src/main/resources/mapper_dao/CompeteEnrollDao.xml

@ -56,6 +56,9 @@
a.id = #{playerId}
AND b.id = c.compete_group_id
AND a.id = c.player_id
and a.rec_status = 0
and c.rec_status = 0
GROUP BY a.id
</select>
<select id="getPlayerAndProjectForTeam" parameterType="java.util.Map" resultMap="getPlayerAndProject">
SELECT

4
pom.xml

@ -9,10 +9,10 @@
<module>cloudutil</module>
<module>util</module>
<module>tall</module>
<module>ht</module>
<!-- <module>ht</module>-->
<module>game</module>
<module>mt</module>
<module>pims</module>
<!-- <module>pims</module>-->
<!-- <module>health</module>-->
<!-- <module>ct</module>-->

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

@ -174,8 +174,10 @@ public class WpsDto {
private Long userId;
@ApiModelProperty("文件名")
private String fileName;
@ApiModelProperty("文件路径,默认在WebConstant.UPLOAD_PATH_BASE下")
@ApiModelProperty("文件路径")
private String filePath;
@ApiModelProperty("文件实际存储路径")
private String realFilePath;
@ApiModelProperty("文件大小")
private Long fileSize;
@ApiModelProperty("操作类型 值:WebConstant Wps USER_OPERATION... ")

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

@ -50,6 +50,8 @@ public interface ProRoleDao extends ProRoleMapper{
*/
String getMemberNameByProjectId(@Param("projectId")Long projectId,@Param("parentRoleName")String parentRoleName);
// ProjectVo.RoleInfo getRoleInfoByRoleId(Long roleId);
// /**
// * 查找项目下的所有成员的名字用“,”分隔
// * @param projectId 项目id

2
tall/src/main/java/com/ccsens/tall/service/ExcelService.java

@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.*;
@ -1230,6 +1231,7 @@ public class ExcelService implements IExcelService {
business.setUserId(userId);
business.setFileName(fileName);
business.setFilePath(filePath);
business.setRealFilePath(PropUtil.path + File.separator + filePath);
business.setFileSize(fileSize);
business.setOperation(WebConstant.Wps.USER_OPERATION_NEW);
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_READ);

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

@ -473,10 +473,10 @@ public class ProRoleService implements IProRoleService {
}
return taskList;
}
private ProjectVo.RoleInfo getRoleInfoByRoleId(Long roleId){
}
//
// private ProjectVo.RoleInfo getRoleInfoByRoleId(Long roleId){
// return proRoleDao.getRoleInfoByRoleId(roleId);
// }
// @Override
// public RoleVo.RoleByProjectId queryRoleByProjectId(Long projectId) {

1
tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java

@ -308,6 +308,7 @@ public class TaskDeliverService implements ITaskDeliverService {
business.setUserId(currentUserId);
business.setFileName(fileInfo.getName());
business.setFilePath(fileInfo.getUrl());
business.setRealFilePath(PropUtil.path + File.separator + fileInfo.getUrl());
business.setFileSize(file.length());
business.setOperation(WebConstant.Wps.USER_OPERATION_NEW);
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_READ);

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

@ -391,6 +391,7 @@ public class TaskPluginService implements ITaskPluginService{
business.setUserId(currentUserId);
business.setFileName(name);
business.setFilePath(fileName);
business.setRealFilePath(PropUtil.path + File.separator + fileName);
business.setFileSize(tmpFile.length());
business.setOperation(WebConstant.Wps.USER_OPERATION_NEW);
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_QUERY);
@ -521,6 +522,7 @@ public class TaskPluginService implements ITaskPluginService{
business.setUserId(currentUserId);
business.setFileName(name);
business.setFilePath(fileName);
business.setRealFilePath(PropUtil.path + File.separator + fileName);
business.setFileSize(tmpFile.length());
business.setOperation(WebConstant.Wps.USER_OPERATION_NEW);
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_QUERY);

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

@ -101,7 +101,7 @@ public class WpsService implements IWpsService {
// 保存文件版本信息
WpsFile wpsFile = saveWpsFile(business.getWpsFileId() == null ? null : String.valueOf(business.getWpsFileId()),
business.getFileSize(), business.getUserId(), business.getFilePath(),
business.getFileSize(), business.getUserId(), business.getFilePath(),business.getRealFilePath(),
business.getFileName());
// 更新文件记录
WpsFileVersion version = saveVersion(wpsFile);
@ -353,7 +353,7 @@ public class WpsService implements IWpsService {
String filePath = WebConstant.UPLOAD_PATH_WPS + File.separator + path;
String name = UploadFileUtil_Servlet3.getFileNameByPart(file);
// 保存文件版本信息
WpsFile wpsFile = saveWpsFile(fileId, file.getSize(), userId, filePath, name);
WpsFile wpsFile = saveWpsFile(fileId, file.getSize(), userId, filePath,PropUtil.path + File.separator + filePath, name);
// 更新文件记录
WpsFileVersion version = saveVersion(wpsFile);
// 调用接口,更新数据项目接口(异步调用)
@ -389,10 +389,11 @@ public class WpsService implements IWpsService {
* @param fileSize 文件大小
* @param userId 用户id
* @param filePath 文件位置默认在WebConstant.UPLOAD_PATH_BASE
* @param realFilePath 文件真正路径
* @param name 文件名字
* @return wpsFile
*/
private WpsFile saveWpsFile(String fileId, Long fileSize, Long userId, String filePath, String name) {
private WpsFile saveWpsFile(String fileId, Long fileSize, Long userId, String filePath,String realFilePath, String name) {
WpsFile wpsFile;
if (StrUtil.isEmpty(fileId)) {
// 创建文件ID
@ -412,7 +413,7 @@ public class WpsService implements IWpsService {
wpsFile.setName(name);
wpsFile.setSize(fileSize);
wpsFile.setDownloadUrl(PropUtil.domain + "file/download/" + name + "?path=" + filePath);
wpsFile.setSaveUrl(WebConstant.UPLOAD_PATH_BASE + File.separator + filePath);
wpsFile.setSaveUrl(realFilePath);
wpsFile.setModifier(userId);
if (StrUtil.isEmpty(fileId)) {

6
tall/src/main/java/com/ccsens/tall/web/FileController.java

@ -24,7 +24,11 @@ public class FileController {
@ApiOperation(value = "文件下载")
@GetMapping(value = "download/{fileName}")
public void download(HttpServletResponse response, @PathVariable("fileName")String fileName, String path) throws Exception {
String parentPath = WebConstant.UPLOAD_PATH_BASE + File.separator + path;
String ch = "/";
String parentPath = path;
if(!path.startsWith(ch)) {
parentPath = WebConstant.UPLOAD_PATH_BASE + File.separator + path;
}
UploadFileUtil_Servlet3.download(response, parentPath, fileName);
}

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

@ -36,5 +36,6 @@ smsCode: 0
wx:
prefixUrl: https://test.tall.wiki/wxconfigurer-api/
file:
path: /home/cloud/tall/uploads/
domain: http://localhost:7030/v1.0/
imgDomain: http://localhost:7030/v1.0/uploads

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

@ -43,5 +43,6 @@ smsCode: 1
wx:
prefixUrl: https://www.tall.wiki/wxconfigurer-api/
file:
path: /home/cloud/tall/uploads/
domain: https://www.tall.wiki/gateway/tall/v1.0/
imgDomain: https://www.tall.wiki/gateway/tall/v1.0/uploads

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

@ -42,6 +42,7 @@ smsCode: 0
wx:
prefixUrl: https://www.tall.wiki/wxconfigurer-api/
file:
path: /home/cloud/tall/uploads/
domain: https://test.tall.wiki/gateway/tall/v1.0/
imgDomain: https://test.tall.wiki/gateway/tall/v1.0/uploads

4
tall/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: dev
include: util-dev,common
active: prod
include: util-prod,common

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

@ -210,4 +210,5 @@
r1.`name` = #{parentRoleName}
</select>
</mapper>

1
tall/src/main/resources/mapper_dao/WpsFileDao.xml

@ -92,5 +92,6 @@
AND p.business_type = #{businessType}
AND p.rec_status = 0
AND f.rec_status = 0
order by p.id DESC
</select>
</mapper>
Loading…
Cancel
Save