|
@@ -315,6 +315,16 @@ public class ValuationAccountingAction {
|
|
|
if(file.isEmpty()){
|
|
|
throw new RuntimeException("上传文件不能为空");
|
|
|
}
|
|
|
+ //确定好上传的文件的顶级父级路径=======================================================================>>待定TODO
|
|
|
+ String path = request.getServletContext().getRealPath("")+SP+"content"; //SP是系统分隔符
|
|
|
+ File dir=new File(path);
|
|
|
+ if(!dir.exists()){
|
|
|
+ dir.mkdirs();
|
|
|
+ }
|
|
|
+ String filename = file.getOriginalFilename();
|
|
|
+ if(!(filename.endsWith(".xls")||filename.endsWith("xlsx"))){
|
|
|
+ throw new RuntimeException("上传文件格式不对");
|
|
|
+ }
|
|
|
int userId=ValidationUtil.checkAndAssignInt(uId);
|
|
|
UserDetail userDetail = userAuthoricationService.checkUserAuthority(userId,Role.ADMIN,Role.ACCOUNTING_POS_OF_TBC);//查看用户非空和权限(管理员创建并上传的权限)
|
|
|
Integer fundId=ValidationUtil.checkAndAssignInt(fId); //基金id号
|
|
@@ -335,12 +345,51 @@ public class ValuationAccountingAction {
|
|
|
throw new RuntimeException("待对账中无法重复上传");
|
|
|
}
|
|
|
//接下来肯定是对账结果不一致,说明可以上传文件===================>>待做TODO
|
|
|
+ //先获取自己之前上传的文件路径
|
|
|
+ String custodianOldFilePath = path+valuationAccount.getUrl_of_custodian();
|
|
|
+ //核查文件是否还在
|
|
|
+ File oldFile = new File(custodianOldFilePath);
|
|
|
+ if(!oldFile.exists()){
|
|
|
+ throw new RuntimeException("之前上传的文件丢失");
|
|
|
+ }
|
|
|
+ oldFile.delete();
|
|
|
+ //切断旧路径,拼接成新路径
|
|
|
+ String custodianNewFilePath = custodianOldFilePath.substring(0, custodianOldFilePath.lastIndexOf("/")+1)+filename;
|
|
|
+ File newFile=new File(custodianNewFilePath);
|
|
|
+ file.transferTo(newFile);
|
|
|
+
|
|
|
+ //再获取银行之前上传的文件路径
|
|
|
+ String bankFilePath = path+valuationAccount.getUrl_of_bank();
|
|
|
+ /*
|
|
|
+ * 这里对两份文件进行估值报价的比对得出比对的结果是一致还是不一致
|
|
|
+ */
|
|
|
+ //获取比对结果
|
|
|
+ String result = "????";
|
|
|
+ Map<String, Object> map =new LinkedHashMap<String, Object>();
|
|
|
+ map.put("fundId", fundId);
|
|
|
+ map.put("fundName", fundName);
|
|
|
+ map.put("url", "/content/"+filename); //将文件下载路径url通过map传到service层进行校验
|
|
|
+ map.put("attachmentName", filename); //将文件以附件名的形式通过map传递到service层中进行校验
|
|
|
+ map.put("battleResult", result); //将文件比对结果封装进去
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //如果不是管理岗,那接下来的业务肯定是银行
|
|
|
+ //银行待对账操作
|
|
|
+ if(BattleResult.TO_BE_MATCHED.equals(battleResult)){
|
|
|
|
|
|
}
|
|
|
|
|
|
- //接下来的业务肯定是银行
|
|
|
|
|
|
|
|
|
+ //银行对账不一致操作
|
|
|
+ if(BattleResult.INCONSISTENT.equals(battleResult)){
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -348,12 +397,9 @@ public class ValuationAccountingAction {
|
|
|
|
|
|
|
|
|
|
|
|
- String path = request.getServletContext().getRealPath("")+SP+"content"; //SP是系统分隔符
|
|
|
- File dir=new File(path);
|
|
|
- if(!dir.exists()){
|
|
|
- dir.mkdirs();
|
|
|
- }
|
|
|
- String filename = file.getOriginalFilename();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
String pathFile=path+SP+filename;
|
|
|
File newFile=new File(pathFile);
|
|
|
file.transferTo(newFile); //这里已经完成银行估值文件的上传,后续需要对该文件和管理岗上传文件中的报价信息进行比对,在Service层中进行校验
|
|
@@ -371,5 +417,8 @@ public class ValuationAccountingAction {
|
|
|
return JSONUtil.getJsonMap(500, false, HintMSG.UPLOAD_FAIL+":"+e.getMessage(),null); //返回给前端一个map进行前段提示
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String str="sdasdhu/dhuasdahu";
|
|
|
+ System.out.println(str.substring(0, str.lastIndexOf("/")));
|
|
|
+ }
|
|
|
}
|