|
@@ -8,6 +8,7 @@ import java.io.InputStream;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.LinkedHashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
|
|
@@ -23,10 +24,20 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.fuzamei.constant.BattleResult;
|
|
|
+import com.fuzamei.constant.HintMSG;
|
|
|
+import com.fuzamei.constant.Role;
|
|
|
+import com.fuzamei.entity.UserDetail;
|
|
|
+import com.fuzamei.entity.ValuationAccount;
|
|
|
+import com.fuzamei.service.AttachmentService;
|
|
|
+import com.fuzamei.service.UserAuthoricationService;
|
|
|
import com.fuzamei.service.ValuationAccountingService;
|
|
|
import com.fuzamei.utils.JSONUtil;
|
|
|
import com.fuzamei.utils.MapUtil;
|
|
|
import com.fuzamei.utils.PageDTO;
|
|
|
+
|
|
|
+import com.fuzamei.utils.ValidationUtil;
|
|
|
|
|
|
|
|
|
* 估值核算模块实现
|
|
@@ -34,20 +45,34 @@ import com.fuzamei.utils.PageDTO;
|
|
|
*
|
|
|
*/
|
|
|
@Controller
|
|
|
-@RequestMapping("valuation_accounting")
|
|
|
+@RequestMapping("/valuation_accounting")
|
|
|
public class ValuationAccountingAction {
|
|
|
|
|
|
@Autowired
|
|
|
private ValuationAccountingService valuationAccountingService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserAuthoricationService userAuthoricationService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AttachmentService attachmentService;
|
|
|
+
|
|
|
private static final String SP = File.separator;
|
|
|
|
|
|
+ private static final int ROW_NUM = 10;
|
|
|
|
|
|
*
|
|
|
* @Title: queryOperationHistoryInformation
|
|
|
* @Description: TODO(估值核算的查询结果,包括所有的查询条件也包括进去了)
|
|
|
- * @param @param data
|
|
|
- * @param @return 设定文件
|
|
|
+ * 前端传过来的json格式为:
|
|
|
+ * {
|
|
|
+ * "userId":"xxx",
|
|
|
+ * "page":"1",
|
|
|
+ * "fundName":"",
|
|
|
+ * "battleResult":"",
|
|
|
+ * "startTime":"",
|
|
|
+ * "endTime":""
|
|
|
+ * }
|
|
|
* @return Map<String,Object> 返回类型
|
|
|
* @author ylx
|
|
|
* @date 2017年12月18日 下午3:17:30
|
|
@@ -56,22 +81,110 @@ public class ValuationAccountingAction {
|
|
|
@RequestMapping(value="/queryValuationAccountingInformation",method=RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public Map<String,Object> queryOperationHistoryInformation(@RequestBody String data){
|
|
|
-
|
|
|
- System.out.println("查询估值核算数据");
|
|
|
-
|
|
|
- Map<String, Object> map = JSONUtil.jsonToMap(data);
|
|
|
-
|
|
|
- PageDTO pageDto = valuationAccountingService.queryValuationAccountingInformation(map);
|
|
|
-
|
|
|
- return JSONUtil.getJsonMap(200, true, "查询成功", pageDto);
|
|
|
+ try {
|
|
|
+ System.out.println("查询估值核算数据");
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Map<String, Object> map = JSON.parseObject(data, Map.class);
|
|
|
+ int userId = ValidationUtil.checkAndAssignInt(map.get("userId"));
|
|
|
+ userAuthoricationService.checkUserAuthority(userId,Role.ADMIN,Role.ACCOUNTING_POS_OF_TBC);
|
|
|
+ int page = ValidationUtil.checkMinAndAssignInt(map.get("page"), 1);
|
|
|
+ String fundName=ValidationUtil.checkBlankStringAndAssignEmptyIfIsBlank(map.get("fundName"));
|
|
|
+ String battleResult=ValidationUtil.checkBlankStringAndAssignEmptyIfIsBlank(map.get("battleResult"));
|
|
|
+ long startTime = ValidationUtil.checkAndAssignDefaultLong(map.get("startTime"), 0L);
|
|
|
+ long endTime = ValidationUtil.checkAndAssignDefaultLong(map.get("endTime"), Long.MAX_VALUE);
|
|
|
+ Map<String, Object> mapToService = new LinkedHashMap<String, Object>();
|
|
|
+ mapToService.put("userId", userId);
|
|
|
+ mapToService.put("startPage", (page - 1) * ROW_NUM);
|
|
|
+ mapToService.put("fundName", fundName);
|
|
|
+ mapToService.put("battleResult", battleResult);
|
|
|
+
|
|
|
+ if (startTime <= endTime) {
|
|
|
+ mapToService.put("startTime", startTime);
|
|
|
+ mapToService.put("endTime", endTime);
|
|
|
+ } else {
|
|
|
+ mapToService.put("startTime", startTime);
|
|
|
+ mapToService.put("endTime", Long.MAX_VALUE);
|
|
|
+ }
|
|
|
+ mapToService.put("rowNum", ROW_NUM);
|
|
|
+ PageDTO pageDto = valuationAccountingService.queryValuationAccountingInformation(mapToService);
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.QUERY_SUCCESS, pageDto);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return JSONUtil.getJsonMap(500, false, HintMSG.QUERY_FAIL+":"+e.getMessage(), null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ *
|
|
|
+ * @Title: queryOperationHistoryInformation
|
|
|
+ * @Description: TODO(查看估值核算基金的下载信息的小弹框)
|
|
|
+ * @param @param data
|
|
|
+ * 前端传过来的json格式
|
|
|
+ * {
|
|
|
+ * userId:"xxx",
|
|
|
+ * fundId:""
|
|
|
+ * }
|
|
|
+ * @param @return 设定文件
|
|
|
+ * @return Map<String,Object> 返回类型
|
|
|
+ * @author ylx
|
|
|
+ * @date 2017年12月28日 下午1:48:43
|
|
|
+ * @throws
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/checkoutDownloadInformation",method=RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Map<String,Object> checkoutDownloadInformation(@RequestBody String data){
|
|
|
+ try {
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Map<String, Object> map = JSON.parseObject(data, Map.class);
|
|
|
+ int userId = ValidationUtil.checkAndAssignInt(map.get("userId"));
|
|
|
+ userAuthoricationService.checkUserAuthority(userId,Role.ADMIN,Role.ACCOUNTING_POS_OF_TBC);
|
|
|
+ int fundId = ValidationUtil.checkAndAssignInt(map.get("fundId"));
|
|
|
+ List<ValuationAccount> listToClient = valuationAccountingService.checkoutDownloadInformation(fundId);
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.CHECK_SUCCESS, listToClient);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return JSONUtil.getJsonMap(500, false, HintMSG.CHECK_FAIL+":"+e.getMessage(), null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ *
|
|
|
+ * @Title: checkoutDownloadInformation
|
|
|
+ * @Description: TODO(管理人首次上传估值报表弹出的界面需要显示的ID号)
|
|
|
+ * 前端传过来的json数据格式
|
|
|
+ * {
|
|
|
+ * "userId":"xxx"
|
|
|
+ * }
|
|
|
+ * @param @return 返回一个fundId的值用于弹框中首次创建基金id的回显
|
|
|
+ * @return Map<String,Object> 返回类型
|
|
|
+ * @author ylx
|
|
|
+ * @date 2017年12月28日 下午3:39:18
|
|
|
+ * @throws
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/fistUploadFundDataByAdmin",method=RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Map<String,Object> fistUploadFundDataByAdmin(@RequestBody String data){
|
|
|
+ try {
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Map<String, Object> map = JSON.parseObject(data, Map.class);
|
|
|
+ int userId = ValidationUtil.checkAndAssignInt(map.get("userId"));
|
|
|
+ userAuthoricationService.checkUserAuthority(userId,Role.ADMIN);
|
|
|
+ Map<String, Object> mapToClient = valuationAccountingService.generateFundId();
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.CHECK_SUCCESS, mapToClient);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return JSONUtil.getJsonMap(500, false, HintMSG.CHECK_FAIL+":"+e.getMessage(), null);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
*
|
|
|
* @Title: download
|
|
|
* @Description: TODO(估值核算界面,下载功能实现)
|
|
|
- * @param @param request
|
|
|
- * @param @param response
|
|
|
+ * 前端通过get或post发来请求
|
|
|
+ * url:链接地址
|
|
|
+ * userId:用户id号
|
|
|
* @param @param url
|
|
|
* @param @return 设定文件
|
|
|
* @return Map<String,Object> 返回类型
|
|
@@ -81,9 +194,18 @@ public class ValuationAccountingAction {
|
|
|
*/
|
|
|
@RequestMapping(value="/downloadValuationPOI")
|
|
|
@ResponseBody
|
|
|
- public Map<String, Object> download(HttpServletRequest request,HttpServletResponse response,@RequestParam("url") String url) {
|
|
|
+ public Map<String, Object> download(HttpServletRequest request,HttpServletResponse response,
|
|
|
+ @RequestParam("url") String url,
|
|
|
+ @RequestParam("userId") Object uId) {
|
|
|
try {
|
|
|
+ int userId=ValidationUtil.checkAndAssignInt(uId);
|
|
|
+ userAuthoricationService.checkUserAuthority(userId,Role.ADMIN,Role.ACCOUNTING_POS_OF_TBC);
|
|
|
+ url=ValidationUtil.checkBlankAndAssignString(url);
|
|
|
String fileName = request.getServletContext().getRealPath("")+url;
|
|
|
+
|
|
|
+ if(!new File(fileName).exists()){
|
|
|
+ throw new RuntimeException(HintMSG.FILE_NOT_FOUND);
|
|
|
+ }
|
|
|
InputStream bis = new BufferedInputStream(new FileInputStream(new File(fileName)));
|
|
|
String filename = url.substring(url.lastIndexOf("/")+1);
|
|
|
filename = URLEncoder.encode(filename,"UTF-8");
|
|
@@ -97,9 +219,9 @@ public class ValuationAccountingAction {
|
|
|
}
|
|
|
out.close();
|
|
|
bis.close();
|
|
|
- return JSONUtil.getJsonMap(200, true, "下载成功",null);
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.DOWNLOAD_SUCCESS,null);
|
|
|
} catch (Exception e) {
|
|
|
- return JSONUtil.getJsonMap(500, false, "下载出现异常:"+e.getMessage(),null);
|
|
|
+ return JSONUtil.getJsonMap(500, false, HintMSG.DOWNLOAD_FAIL+":"+e.getMessage(),null);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -108,47 +230,78 @@ public class ValuationAccountingAction {
|
|
|
* @Title: upload
|
|
|
* @Description: TODO(实现管理员估值核算的报表文件上传功能---------->>暂时按照一次上传一个文件进行实现)
|
|
|
*
|
|
|
- * 如果是管理岗的人员进行上传,则是创建一条新的数据进数据库,同时在附件表中插入一条新的数据
|
|
|
+ * 因为是首次创建,管理岗的人员进行上传,则是创建一条新的数据进数据库,同时在附件表中插入一条新的数据,同时还要在操作记录也要插入一条操作记录,操作记录hash以这个文件的hash为准
|
|
|
+ * @ Attention: 首次上传,所以大部分的信息可以写死
|
|
|
+ * 首次创建基金id号要生成,基金名,托管资产都要从用户这里获取
|
|
|
+ * 传过来的参数以表单形式提交
|
|
|
*
|
|
|
- * @param @param file
|
|
|
- * @param @param request
|
|
|
- * @param @param fundId 基金id号,前端随机生成?????还是说后台生成????TODO
|
|
|
+ *
|
|
|
+ * @param @param userId 用户id号
|
|
|
+ * @param @param fundId 基金id号,前端随机生成?????还是说后台生成????================================>暂时通过打开估值核算弹框自动生成TODO
|
|
|
* @param @param fundName 基金名称,客户端手动输入生成并传输过来
|
|
|
* @param @param assets 托管资产,客户端手动输入生成并传输过来
|
|
|
+ *
|
|
|
+ *
|
|
|
* @param @return 设定文件
|
|
|
* @return Map<String,Object> 返回类型
|
|
|
* @author ylx
|
|
|
* @date 2017年12月18日 下午5:29:38
|
|
|
* @throws
|
|
|
*/
|
|
|
- @RequestMapping(value="/uploadValuationPOIByAdmin",method=RequestMethod.POST)
|
|
|
+ @RequestMapping(value="/uploadValuationPOIByAdminForTheFirstTime",method=RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
- public Map<String, Object> uploadValuationPOIByAdmin(@RequestParam("file") MultipartFile file,HttpServletRequest request,@RequestParam("fundId") String fundId,@RequestParam("fundName") String fundName, @RequestParam("assets") String assets ) {
|
|
|
+ public Map<String, Object> uploadValuationPOIByAdmin(@RequestParam("file") MultipartFile file,HttpServletRequest request,
|
|
|
+ @RequestParam("fundId") String fId,
|
|
|
+ @RequestParam("fundName") String fName,
|
|
|
+ @RequestParam("assets") String ass,
|
|
|
+ @RequestParam("userId") Object uId) {
|
|
|
try {
|
|
|
- String path = request.getServletContext().getRealPath("")+SP+"content";
|
|
|
+ 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);
|
|
|
+ String fundName=ValidationUtil.checkBlankAndAssignString(fName);
|
|
|
+ valuationAccountingService.checkIfHasTheSameFundName(fundName);
|
|
|
+ String assets=ValidationUtil.checkBlankAndAssignString(ass);
|
|
|
+ Integer attachmentId = attachmentService.generateAtachmentId();
|
|
|
+
|
|
|
+ String path = request.getServletContext().getRealPath("");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
File dir=new File(path);
|
|
|
if(!dir.exists()){
|
|
|
dir.mkdirs();
|
|
|
}
|
|
|
-
|
|
|
String filename = file.getOriginalFilename();
|
|
|
+ String url = "/content/"+ValidationUtil.checkBlankAndAssignString(filename);
|
|
|
+ String attachmentName = filename;
|
|
|
String pathFile=path+SP+filename;
|
|
|
File newFile=new File(pathFile);
|
|
|
- file.transferTo(newFile);
|
|
|
|
|
|
- Map<String, Object> map =new LinkedHashMap<String, Object>();
|
|
|
- map.put("fundId", fundId);
|
|
|
- map.put("fundName", fundName);
|
|
|
- map.put("assets", assets);
|
|
|
- map.put("url", "/content/"+filename);
|
|
|
- map.put("attachmentName", filename);
|
|
|
|
|
|
+ Map<String, Object> mapToService =new LinkedHashMap<String, Object>();
|
|
|
+ mapToService.put("userId", userId);
|
|
|
+ mapToService.put("userDetail", userDetail);
|
|
|
+ mapToService.put("fundId", fundId);
|
|
|
+ mapToService.put("fundName", fundName);
|
|
|
+ mapToService.put("assets", assets);
|
|
|
+ mapToService.put("url", url);
|
|
|
+ mapToService.put("attachmentName", attachmentName);
|
|
|
+ mapToService.put("attachmentId", attachmentId);
|
|
|
|
|
|
- valuationAccountingService.insertInformationIntoTableByAdmin(map);
|
|
|
+ valuationAccountingService.insertInformationIntoTableByAdminForTheFirstTime(mapToService);
|
|
|
|
|
|
- return JSONUtil.getJsonMap(200, true, "上传成功",null);
|
|
|
+
|
|
|
+ file.transferTo(newFile);
|
|
|
+
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,null);
|
|
|
} catch (Exception e) {
|
|
|
- return JSONUtil.getJsonMap(500, false, "上传出现异常"+e.getMessage(),null);
|
|
|
+ return JSONUtil.getJsonMap(500, false, HintMSG.UPLOAD_FAIL+":"+e.getMessage(),null);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -156,46 +309,198 @@ public class ValuationAccountingAction {
|
|
|
*
|
|
|
* @Title: upload
|
|
|
* @Description: TODO(实现银行估值核算的报表文件上传功能---------->>暂时按照一次上传一个文件进行实现)
|
|
|
+ *
|
|
|
+ * 上传的时候以表单的形式传过来
|
|
|
* @param @param file
|
|
|
- * @param @param request
|
|
|
* @param @param fundId
|
|
|
* @param @param fundName
|
|
|
- * @param @param assets
|
|
|
- * @param @return 设定文件
|
|
|
+ * @param @param userId
|
|
|
+ *
|
|
|
+ * @param @return 这里上传人有可能是银行也有可能是管理岗的人,这里要进行校验
|
|
|
* @return Map<String,Object> 返回类型
|
|
|
* @author ylx
|
|
|
* @date 2017年12月18日 下午8:17:47
|
|
|
* @throws
|
|
|
*/
|
|
|
- @RequestMapping(value="/uploadValuationPOIByBank",method=RequestMethod.POST)
|
|
|
+ @RequestMapping(value="/uploadValuationPOIByBankOrByAdmin",method=RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
- public Map<String, Object> uploadValuationPOIByBank(@RequestParam("file") MultipartFile file,HttpServletRequest request,@RequestParam("fundId") String fundId,@RequestParam("fundName") String fundName, @RequestParam("assets") String assets ) {
|
|
|
+ public Map<String, Object> uploadValuationPOIByBankOrByAdmin(@RequestParam("file") MultipartFile file,HttpServletRequest request,
|
|
|
+ @RequestParam("fundId") String fId,
|
|
|
+ @RequestParam("fundName") String fName,
|
|
|
+ @RequestParam("userId") Object uId) {
|
|
|
try {
|
|
|
- String path = request.getServletContext().getRealPath("")+SP+"content";
|
|
|
+ if(file.isEmpty()){
|
|
|
+ throw new RuntimeException("上传文件不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ String path = request.getServletContext().getRealPath("")+SP+"content";
|
|
|
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);
|
|
|
+ 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);
|
|
|
+ String fundName=ValidationUtil.checkBlankAndAssignString(fName);
|
|
|
+ ValuationAccount valuationAccount = valuationAccountingService.checkIfFundExists(fundId,fundName);
|
|
|
+
|
|
|
+ String battleResult = valuationAccount.getBattle_result();
|
|
|
+ List<String> roleList=userDetail.getRole_name();
|
|
|
+
|
|
|
+
|
|
|
+ if(BattleResult.CONSISTENT.equals(battleResult)){
|
|
|
+ throw new RuntimeException("对账结果一致,无法继续上传文件");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(roleList.contains(Role.ADMIN)){
|
|
|
+ if(BattleResult.TO_BE_MATCHED.equals(battleResult)){
|
|
|
+ throw new RuntimeException("待对账中无法重复上传");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ String custodianOldFilePath = path+valuationAccount.getUrl_of_custodian();
|
|
|
+
|
|
|
+ File oldFile = new File(custodianOldFilePath);
|
|
|
+ if(!oldFile.exists()){
|
|
|
+ throw new RuntimeException("之前上传的文件丢失");
|
|
|
+ }
|
|
|
+
|
|
|
+ String custodianNewFilePath = custodianOldFilePath.substring(0, custodianOldFilePath.lastIndexOf("/")+1)+filename;
|
|
|
+ File newFile=new File(custodianNewFilePath);
|
|
|
+
|
|
|
+
|
|
|
+ String bankFilePath = path+valuationAccount.getUrl_of_bank();
|
|
|
+
|
|
|
+ * 如过不是excel文件类型,导入也会报错,然后就把这个新上传的文件删了
|
|
|
+ * 这里对两份文件进行估值报价的比对得出比对的结果是一致还是不一致
|
|
|
+ */
|
|
|
+
|
|
|
+ String result = "????";
|
|
|
+ Map<String, Object> mapToService =new LinkedHashMap<String, Object>();
|
|
|
+ mapToService.put("userDetail", userDetail);
|
|
|
+ mapToService.put("fundId", fundId);
|
|
|
+ mapToService.put("url", custodianNewFilePath);
|
|
|
+ mapToService.put("attachmentName", filename);
|
|
|
+ mapToService.put("battleResult", result);
|
|
|
+ mapToService.put("attachmentId", valuationAccount.getAttachment_id_of_custodian());
|
|
|
+ valuationAccountingService.updateInformationByAdmin(mapToService);
|
|
|
+
|
|
|
+
|
|
|
+ oldFile.delete();
|
|
|
+ file.transferTo(newFile);
|
|
|
+
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,null);
|
|
|
+ }
|
|
|
|
|
|
- Map<String, Object> map =new LinkedHashMap<String, Object>();
|
|
|
- map.put("fundId", fundId);
|
|
|
- map.put("fundName", fundName);
|
|
|
- map.put("assets", assets);
|
|
|
- map.put("url", "/content/"+filename);
|
|
|
- map.put("attachmentName", filename);
|
|
|
+
|
|
|
+
|
|
|
+ if(BattleResult.TO_BE_MATCHED.equals(battleResult)){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String custodianOldFilePath = path+SP+valuationAccount.getUrl_of_custodian();
|
|
|
+
|
|
|
+ File oldFile = new File(custodianOldFilePath);
|
|
|
+ if(!oldFile.exists()){
|
|
|
+ throw new RuntimeException("管理员上传的文件丢失");
|
|
|
+ }
|
|
|
+
|
|
|
+ String bankNewFilePath = path + SP + filename;
|
|
|
+ File newFile=new File(bankNewFilePath);
|
|
|
+
|
|
|
+
|
|
|
+ * 如过不是excel文件类型,导入也会报错,然后就把这个新上传的文件删了
|
|
|
+ * 这里对两份文件进行估值报价的比对得出比对的结果是一致还是不一致
|
|
|
+ */
|
|
|
+
|
|
|
+ String result = "????";
|
|
|
+
|
|
|
+ Integer attachmentId = attachmentService.generateAtachmentId();
|
|
|
+
|
|
|
+ Map<String, Object> mapToService =new LinkedHashMap<String, Object>();
|
|
|
+ mapToService.put("userDetail", userDetail);
|
|
|
+ mapToService.put("fundId", fundId);
|
|
|
+ mapToService.put("url", "/content/"+filename);
|
|
|
+ mapToService.put("attachmentName", filename);
|
|
|
+ mapToService.put("battleResult", result);
|
|
|
+ mapToService.put("attachmentId", attachmentId);
|
|
|
+ valuationAccountingService.updateInformationByBank(mapToService);
|
|
|
+
|
|
|
+
|
|
|
+ file.transferTo(newFile);
|
|
|
+
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,null);
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- valuationAccountingService.updateInformationByBank(map);
|
|
|
+
|
|
|
+ if(BattleResult.INCONSISTENT.equals(battleResult)){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String custodianOldFilePath = path+valuationAccount.getUrl_of_custodian();
|
|
|
+
|
|
|
+ File oldCustodianFile = new File(custodianOldFilePath);
|
|
|
+ if(!oldCustodianFile.exists()){
|
|
|
+ throw new RuntimeException("管理员之前上传的文件丢失");
|
|
|
+ }
|
|
|
+
|
|
|
+ String banckOldFilePath = path + valuationAccount.getUrl_of_bank();
|
|
|
+
|
|
|
+ File oldBankFile = new File(banckOldFilePath);
|
|
|
+ if(!oldBankFile.exists()){
|
|
|
+ throw new RuntimeException("银行之前上传的文件丢失");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ String bankNewFilePath = banckOldFilePath.substring(0, banckOldFilePath.lastIndexOf("/")+1)+filename;
|
|
|
+ File newBankFile=new File(bankNewFilePath);
|
|
|
+
|
|
|
+
|
|
|
+ * 如过不是excel文件类型,导入也会报错,然后就把这个新上传的文件删了(这里旧文件不能先删了)
|
|
|
+ * 这里对两份文件进行估值报价的比对得出比对的结果是一致还是不一致
|
|
|
+ */
|
|
|
+
|
|
|
+ String result = "????";
|
|
|
+
|
|
|
+ Map<String, Object> mapToService =new LinkedHashMap<String, Object>();
|
|
|
+ mapToService.put("userDetail", userDetail);
|
|
|
+ mapToService.put("fundId", fundId);
|
|
|
+ mapToService.put("url", "/content/"+filename);
|
|
|
+ mapToService.put("attachmentName", filename);
|
|
|
+ mapToService.put("battleResult", result);
|
|
|
+ mapToService.put("attachmentId", valuationAccount.getAttachment_id_of_bank());
|
|
|
+ valuationAccountingService.updateInformationByBank(mapToService);
|
|
|
+
|
|
|
+
|
|
|
+ oldBankFile.delete();
|
|
|
+ file.transferTo(newBankFile);
|
|
|
+
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,null);
|
|
|
+ }
|
|
|
|
|
|
- return JSONUtil.getJsonMap(200, true, "上传成功",null);
|
|
|
+
|
|
|
+ throw new RuntimeException("你是怎么运行到这里的");
|
|
|
} catch (Exception e) {
|
|
|
- return JSONUtil.getJsonMap(500, false, "上传出现异常"+e.getMessage(),null);
|
|
|
+ return JSONUtil.getJsonMap(500, false, HintMSG.UPLOAD_FAIL+":"+e.getMessage(),null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value="/test",method=RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Map<String, Object> test(@RequestBody String data){
|
|
|
+ try {
|
|
|
+ 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);
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
|
|
|
}
|