|
@@ -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); //基金id号
|
|
|
- valuationAccountingService.checkIfHasTheSameFundId(fundId); //对传过来的基金id进行查重校验
|
|
|
+ valuationAccountingService.checkIfHasTheSameFundId(fundId); //对传过来的基金id(fundId)进行查重校验
|
|
|
String fundName=ValidationUtil.checkBlankAndAssignString(fName); //基金名称===============================>>基金名要不要查重?TODO
|
|
|
+ valuationAccountingService.checkIfHasTheSameFundName(fundName); //对传过来的基金名(fundName)进行查重校验
|
|
|
String assets=ValidationUtil.checkBlankAndAssignString(ass); //托管资产名称============================>>托管资产要不要查重?TODO
|
|
|
Integer attachmentId = attachmentService.generateAtachmentId(); //生成一个不重复的附件Id号==================>>生成id号的机制待定TODO
|
|
|
- if(file.isEmpty()){
|
|
|
- throw new RuntimeException("上传文件不能为空");
|
|
|
- }
|
|
|
- String path = request.getServletContext().getRealPath("")+SP+"content"; //SP是系统分隔符
|
|
|
+
|
|
|
+ String path = request.getServletContext().getRealPath(""); //上传文件顶级父类的绝对路径============================>>路径机制待定TODO
|
|
|
+ String relativePath = RelativePathUtil.formatPath("/"+userId,""); //生成默认的相对路径格式================================>>路径机制待定TODO
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
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); //此时文件已经上传成功---->upload file success
|
|
|
+
|
|
|
|
|
|
Map<String, Object> mapToService =new LinkedHashMap<String, Object>();
|
|
|
mapToService.put("userId", userId); //用户id号
|
|
@@ -289,6 +296,9 @@ public class ValuationAccountingAction {
|
|
|
//这里是以管理岗的身份进行插入的,注意银行的估值报表暂时先不插入数据
|
|
|
valuationAccountingService.insertInformationIntoTableByAdminForTheFirstTime(mapToService); //将获取到的数据插入到表中
|
|
|
|
|
|
+ //文件最后上传到服务器
|
|
|
+ file.transferTo(newFile); //此时文件已经上传成功---->upload file success
|
|
|
+
|
|
|
return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,null); //返回给前端一个map进行前段提示
|
|
|
} catch (Exception e) {
|
|
|
return JSONUtil.getJsonMap(500, false, HintMSG.UPLOAD_FAIL+":"+e.getMessage(),null); //返回给前端一个map进行前段提示
|
|
@@ -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); //返回给前端一个map进行前段提示
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|