|
@@ -9,6 +9,7 @@ import com.persagy.adm.server.custom.dao.AdmCadMapper;
|
|
|
import com.persagy.adm.server.custom.dao.AdmFileMapper;
|
|
|
import com.persagy.adm.server.custom.dao.AdmProblemMapper;
|
|
|
import com.persagy.adm.server.custom.dao.AdmQrCodeMapper;
|
|
|
+import com.persagy.adm.server.custom.dto.DownLoadData;
|
|
|
import com.persagy.adm.server.custom.entity.Pagination;
|
|
|
import com.persagy.adm.server.custom.entity.db.AdmCad;
|
|
|
import com.persagy.adm.server.custom.entity.db.AdmFile;
|
|
@@ -57,7 +58,7 @@ public class AppDataDownloadController {
|
|
|
* 下载问题数据
|
|
|
*/
|
|
|
@GetMapping("/problems")
|
|
|
- public CommonResult<List<AdmProblem>> problems(@RequestParam String groupCode,@RequestParam String projectId,@RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
|
|
|
+ public CommonResult<DownLoadData<List<AdmProblem>>> problems(@RequestParam String groupCode,@RequestParam String projectId,@RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
|
|
|
LambdaQueryWrapper<AdmProblem> queryWrapper = new LambdaQueryWrapper<AdmProblem>()
|
|
|
.eq(AdmProblem::getGroupCode, groupCode)
|
|
|
.eq(AdmProblem::getProjectId, projectId)
|
|
@@ -66,58 +67,88 @@ public class AppDataDownloadController {
|
|
|
.ne(ts != null && ts != 0,AdmProblem::getModifier,CriteriaUtils.getOperator(clientId,TokenInterceptor.bossAuthUserThreadLocal.get().getId()))
|
|
|
.orderByDesc(AdmProblem::getModifiedTime);
|
|
|
List<AdmProblem> problems = problemMapper.selectList(queryWrapper);
|
|
|
- Long modifiedTime = problems.get(0).getTs().getTime();
|
|
|
+ DownLoadData<List<AdmProblem>> downLoadData = new DownLoadData<>();
|
|
|
+ downLoadData.setData(problems);
|
|
|
|
|
|
- return ResultHelper.multi(problems);
|
|
|
+ if (!problems.isEmpty()){
|
|
|
+ Long modifiedTime = problems.get(0).getTs().getTime();
|
|
|
+ downLoadData.setTs(modifiedTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultHelper.single(downLoadData);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 下载图纸数据
|
|
|
+ * @return
|
|
|
*/
|
|
|
@GetMapping("/cadFiles")
|
|
|
- public CommonResult<List<AdmCad>> cadFiles(@RequestParam String groupCode,@RequestParam String projectId,@RequestParam String buildingId,@RequestParam(required = false) Long ts){
|
|
|
+ public CommonResult<DownLoadData<List<AdmCad>>> cadFiles(@RequestParam String groupCode, @RequestParam String projectId, @RequestParam String buildingId, @RequestParam(required = false) Long ts){
|
|
|
List<AdmCad> admCads = admCadMapper.selectList(new LambdaQueryWrapper<AdmCad>()
|
|
|
.eq(AdmCad::getGroupCode,groupCode)
|
|
|
.eq(AdmCad::getProjectId,projectId)
|
|
|
.eq(AdmCad::getBuildingId,buildingId)
|
|
|
- .gt(ts != null && ts != 0,AdmCad::getTs,ts));
|
|
|
- return ResultHelper.multi(admCads);
|
|
|
+ .gt(ts != null && ts != 0,AdmCad::getTs,ts).orderByDesc(AdmCad::getModifiedTime));
|
|
|
+ DownLoadData<List<AdmCad>> downLoadData = new DownLoadData<>();
|
|
|
+ downLoadData.setData(admCads);
|
|
|
+ if (!admCads.isEmpty()){
|
|
|
+ Long modifiedTime = admCads.get(0).getTs().getTime();
|
|
|
+ downLoadData.setTs(modifiedTime);
|
|
|
+ }
|
|
|
+ return ResultHelper.single(downLoadData);
|
|
|
}
|
|
|
/**
|
|
|
* 下载附件现场照片数据
|
|
|
+ * @return
|
|
|
*/
|
|
|
@GetMapping("/files")
|
|
|
- public CommonResult<List<AdmFile>> attachmentsFiles(@RequestParam String groupCode,@RequestParam String projectId,@RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
|
|
|
+ public CommonResult<DownLoadData<List<AdmFile>>> attachmentsFiles(@RequestParam String groupCode, @RequestParam String projectId, @RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
|
|
|
LambdaQueryWrapper<AdmFile> queryWrapper = Wrappers.lambdaQuery(AdmFile.class)
|
|
|
.eq(AdmFile::getGroupCode,groupCode)
|
|
|
.eq(AdmFile::getProjectId,projectId)
|
|
|
.eq(AdmFile::getBuildingId,buildingId)
|
|
|
.gt(ts != null && ts != 0 ,AdmFile::getTs,ts)
|
|
|
- .ne(ts != null && ts != 0 ,AdmFile::getModifier, CriteriaUtils.getOperator(clientId,TokenInterceptor.bossAuthUserThreadLocal.get().getId()));
|
|
|
+ .ne(ts != null && ts != 0 ,AdmFile::getModifier, CriteriaUtils.getOperator(clientId,TokenInterceptor.bossAuthUserThreadLocal.get().getId())).orderByDesc(AdmFile::getModifiedTime);
|
|
|
List<AdmFile> files = fileMapper.selectList(queryWrapper);
|
|
|
- return ResultHelper.multi(files);
|
|
|
+
|
|
|
+ DownLoadData<List<AdmFile>> downLoadData = new DownLoadData<>();
|
|
|
+ downLoadData.setData(files);
|
|
|
+ if (!files.isEmpty()){
|
|
|
+ Long modifiedTime = files.get(0).getTs().getTime();
|
|
|
+ downLoadData.setTs(modifiedTime);
|
|
|
+ }
|
|
|
+ return ResultHelper.single(downLoadData);
|
|
|
+
|
|
|
}
|
|
|
/**
|
|
|
* 二维码数据
|
|
|
+ * @return
|
|
|
*/
|
|
|
@GetMapping("/qrCodes")
|
|
|
- public CommonResult<List<AdmQrCode>> qrCodes(@RequestParam String groupCode,@RequestParam String projectId,@RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
|
|
|
+ public CommonResult<DownLoadData<List<AdmQrCode>>> qrCodes(@RequestParam String groupCode, @RequestParam String projectId, @RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
|
|
|
LambdaQueryWrapper<AdmQrCode> queryWrapper = Wrappers.lambdaQuery(AdmQrCode.class)
|
|
|
.eq(AdmQrCode::getGroupCode,groupCode)
|
|
|
.eq(AdmQrCode::getProjectId,projectId)
|
|
|
.eq(AdmQrCode::getBuildingId,buildingId)
|
|
|
.gt(ts != null && ts != 0 ,AdmQrCode::getTs,ts)
|
|
|
- .ne(ts != null && ts != 0 ,AdmQrCode::getModifier,CriteriaUtils.getOperator(clientId,TokenInterceptor.bossAuthUserThreadLocal.get().getId()));
|
|
|
+ .ne(ts != null && ts != 0 ,AdmQrCode::getModifier,CriteriaUtils.getOperator(clientId,TokenInterceptor.bossAuthUserThreadLocal.get().getId())).orderByDesc(AdmQrCode::getModifiedTime);
|
|
|
List<AdmQrCode> qrCodes = qrCodeMapper.selectList(queryWrapper);
|
|
|
- return ResultHelper.multi(qrCodes);
|
|
|
+ DownLoadData<List<AdmQrCode>> downLoadData = new DownLoadData<>();
|
|
|
+ downLoadData.setData(qrCodes);
|
|
|
+ if (!qrCodes.isEmpty()){
|
|
|
+ Long modifiedTime = qrCodes.get(0).getTs().getTime();
|
|
|
+ downLoadData.setTs(modifiedTime);
|
|
|
+ }
|
|
|
+ return ResultHelper.single(downLoadData);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 对象数据
|
|
|
+ * @return
|
|
|
*/
|
|
|
@GetMapping("/objects")
|
|
|
- public Object objects(@RequestParam String groupCode,@RequestParam String projectId,@RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
|
|
|
+ public CommonResult<DownLoadData<List<ObjectNode>>> objects(@RequestParam String groupCode, @RequestParam String projectId, @RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
|
|
|
//从bdtp下载对象(空间、竖井、系统、设备、元空间)
|
|
|
QueryCriteria criteria = ServiceUtil.getQueryCriteria(objectMapper, AdmConst.OBJ_TYPE_SPACE, AdmConst.OBJ_TYPE_SHAFT, AdmConst.OBJ_TYPE_SYSTEM, AdmConst.OBJ_TYPE_EQUIPMENT, AdmConst.OBJ_TYPE_ISPACE);
|
|
|
String operator = CriteriaUtils.getOperator(clientId, TokenInterceptor.bossAuthUserThreadLocal.get().getId());
|
|
@@ -137,7 +168,10 @@ public class AppDataDownloadController {
|
|
|
downLoadDataDeal.packInfos(objs);
|
|
|
// 填充ts
|
|
|
downLoadDataDeal.test4Ts(objs);
|
|
|
- return ResultHelper.multi(objs);
|
|
|
+ DownLoadData<List<ObjectNode>> downLoadData = new DownLoadData<>();
|
|
|
+ downLoadData.setData(objs);
|
|
|
+ downLoadData.buildDownloadTs();
|
|
|
+ return ResultHelper.single(downLoadData);
|
|
|
}
|
|
|
|
|
|
}
|