|
@@ -36,6 +36,7 @@ import com.fuzamei.service.ValuationAccountingService;
|
|
|
import com.fuzamei.utils.JSONUtil;
|
|
|
import com.fuzamei.utils.MapUtil;
|
|
|
import com.fuzamei.utils.PageDTO;
|
|
|
+import com.fuzamei.utils.RelativePathUtil;
|
|
|
import com.fuzamei.utils.ValidationUtil;
|
|
|
|
|
|
|
|
@@ -255,17 +256,23 @@ public class ValuationAccountingAction {
|
|
|
@RequestParam("assets") String ass,
|
|
|
@RequestParam("userId") Object uId) {
|
|
|
try {
|
|
|
+ if(file.isEmpty()){
|
|
|
+ throw new RuntimeException("上传文件不能为空");
|
|
|
+ }
|
|
|
int userId=ValidationUtil.checkAndAssignInt(uId);
|
|
|
UserDetail userDetail = userAuthoricationService.checkUserAuthority(userId,Role.ADMIN);
|
|
|
Integer fundId=ValidationUtil.checkAndAssignInt(fId);
|
|
|
- valuationAccountingService.checkIfHasTheSameFundId(fundId);
|
|
|
+ valuationAccountingService.checkIfHasTheSameFundId(fundId);
|
|
|
String fundName=ValidationUtil.checkBlankAndAssignString(fName);
|
|
|
+ valuationAccountingService.checkIfHasTheSameFundName(fundName);
|
|
|
String assets=ValidationUtil.checkBlankAndAssignString(ass);
|
|
|
Integer attachmentId = attachmentService.generateAtachmentId();
|
|
|
- if(file.isEmpty()){
|
|
|
- throw new RuntimeException("上传文件不能为空");
|
|
|
- }
|
|
|
- String path = request.getServletContext().getRealPath("")+SP+"content";
|
|
|
+
|
|
|
+ String path = request.getServletContext().getRealPath("");
|
|
|
+ String relativePath = RelativePathUtil.formatPath("/"+userId,"");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
File dir=new File(path);
|
|
|
if(!dir.exists()){
|
|
|
dir.mkdirs();
|
|
@@ -275,7 +282,7 @@ public class ValuationAccountingAction {
|
|
|
String attachmentName = filename;
|
|
|
String pathFile=path+SP+filename;
|
|
|
File newFile=new File(pathFile);
|
|
|
- file.transferTo(newFile);
|
|
|
+
|
|
|
|
|
|
Map<String, Object> mapToService =new LinkedHashMap<String, Object>();
|
|
|
mapToService.put("userId", userId);
|
|
@@ -289,6 +296,9 @@ public class ValuationAccountingAction {
|
|
|
|
|
|
valuationAccountingService.insertInformationIntoTableByAdminForTheFirstTime(mapToService);
|
|
|
|
|
|
+
|
|
|
+ file.transferTo(newFile);
|
|
|
+
|
|
|
return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,null);
|
|
|
} catch (Exception e) {
|
|
|
return JSONUtil.getJsonMap(500, false, HintMSG.UPLOAD_FAIL+":"+e.getMessage(),null);
|
|
@@ -392,7 +402,7 @@ public class ValuationAccountingAction {
|
|
|
|
|
|
|
|
|
|
|
|
- String custodianOldFilePath = path+valuationAccount.getUrl_of_custodian();
|
|
|
+ String custodianOldFilePath = path+SP+valuationAccount.getUrl_of_custodian();
|
|
|
|
|
|
File oldFile = new File(custodianOldFilePath);
|
|
|
if(!oldFile.exists()){
|
|
@@ -486,10 +496,11 @@ public class ValuationAccountingAction {
|
|
|
Map map= JSON.parseObject(data, Map.class);
|
|
|
int userId=ValidationUtil.checkAndAssignInt(map.get("userId"));
|
|
|
UserDetail userDetail = userAuthoricationService.checkUserAuthority(userId,Role.ADMIN,Role.ACCOUNTING_POS_OF_TBC);
|
|
|
- return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,userDetail);
|
|
|
+ ValuationAccount valuationAccount = valuationAccountingService.checkIfFundExists((Integer)map.get("fundId"), (String)map.get("fundName"));
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,valuationAccount);
|
|
|
} catch (Exception e) {
|
|
|
return JSONUtil.getJsonMap(500, false, HintMSG.UPLOAD_FAIL+":"+e.getMessage(),null);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|