|
@@ -1,5 +1,6 @@
|
1
|
1
|
package com.lqkj.link.module.zone.service;
|
2
|
2
|
|
|
3
|
+import com.lqkj.link.module.authority.domain.UserInfo;
|
3
|
4
|
import com.lqkj.link.module.authority.repository.UserInfoRepository;
|
4
|
5
|
import com.lqkj.link.module.zone.domain.ModelCategory;
|
5
|
6
|
import com.lqkj.link.module.zone.domain.ModelInfo;
|
|
@@ -15,10 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
15
|
16
|
|
16
|
17
|
import java.io.File;
|
17
|
18
|
import java.io.IOException;
|
18
|
|
-import java.util.ArrayList;
|
19
|
|
-import java.util.List;
|
20
|
|
-import java.util.Map;
|
21
|
|
-import java.util.UUID;
|
|
19
|
+import java.util.*;
|
22
|
20
|
import java.util.stream.Collectors;
|
23
|
21
|
|
24
|
22
|
@Service
|
|
@@ -150,22 +148,29 @@ public class ResourceService {
|
150
|
148
|
return infoRepository.listWitUserCode(userCode);
|
151
|
149
|
}
|
152
|
150
|
|
153
|
|
- public String savePersonal(ModelCategory modelCategory, String userCode) {
|
|
151
|
+ public Map<String, Object> savePersonal(ModelCategory modelCategory, String userCode) {
|
|
152
|
+ Map<String, Object> result = new HashMap<>();
|
154
|
153
|
if (modelCategory.getCategoryId() == 0) {
|
155
|
154
|
modelCategory.setCategoryId(null);
|
156
|
155
|
}
|
157
|
156
|
Integer userId = userInfoRepository.findByUserCode(userCode).getUserId();
|
158
|
157
|
if ((modelCategory.getCategoryId() != null && categoryRepository.hasSameNameByUserWithoutOne(modelCategory.getCategoryName(), modelCategory.getCategoryId(), userId))
|
159
|
158
|
|| (modelCategory.getCategoryId() == null && categoryRepository.hasSameNameByUser(modelCategory.getCategoryName(), userId))) {
|
160
|
|
- return "不能与已有文件夹重名!";
|
|
159
|
+ result.put("msg", "不能与已有文件夹重名!");
|
|
160
|
+ return result;
|
161
|
161
|
}
|
162
|
162
|
modelCategory.setUserId(userId);
|
163
|
|
- categoryRepository.save(modelCategory);
|
164
|
|
- return null;
|
|
163
|
+ modelCategory = categoryRepository.save(modelCategory);
|
|
164
|
+ result.put("category", modelCategory);
|
|
165
|
+ return result;
|
165
|
166
|
}
|
166
|
167
|
|
167
|
168
|
public ModelInfo saveModel(ModelInfo modelInfo) {
|
168
|
169
|
return infoRepository.save(modelInfo);
|
169
|
170
|
}
|
170
|
171
|
|
|
172
|
+ public Boolean needRefreshResource(String userCode) {
|
|
173
|
+ UserInfo userInfo = userInfoRepository.findByUserCode(userCode);
|
|
174
|
+ return userInfo.getRefreshResource() != null && userInfo.getRefreshResource();
|
|
175
|
+ }
|
171
|
176
|
}
|