|
@@ -0,0 +1,636 @@
|
|
|
+package com.fuzamei.service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Isolation;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import com.fuzamei.dao.BusinessDeclareDao;
|
|
|
+import com.fuzamei.entity.BusinessCheck;
|
|
|
+import com.fuzamei.entity.BusinessDeclare;
|
|
|
+import com.fuzamei.utils.PageDTO;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class BusinessDeclareService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BusinessDeclareDao businessDeclareDao;
|
|
|
+
|
|
|
+ private static final int ROW_NUM = 10; // 分页每页显示数据的数量
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @Title: insertInformationIntoTableByBranchBank
|
|
|
+ * @Description: TODO(对从controller层传进来的数据先进行校验,然后再通过dao层往数据库进行录入)
|
|
|
+ * @param @param map 设定文件
|
|
|
+ * @return void 返回类型
|
|
|
+ * @author ylx
|
|
|
+ * @date 2017年12月19日 下午1:43:33
|
|
|
+ * @throws
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor=Exception.class)
|
|
|
+ public void insertInformationIntoTableByBranchBank(Map<String, Object> map) {
|
|
|
+ Integer businessId=null; //业务申报的id号
|
|
|
+ String bank=""; //银行名称,但是表的字段是银行id?????。。。。。。。TODO
|
|
|
+ String businessName=""; //业务名称
|
|
|
+ Integer busineeApprovalId=null; //业务核准表的id号
|
|
|
+ String busineeApprovalName=""; //业务员核准表的文件名
|
|
|
+ String urlOfBusineeApproval=""; //业务核准表的url地址
|
|
|
+ Integer responsibleInvestigationId=null; //尽职调查表id号
|
|
|
+ String responsibleInvestigationName=""; //尽职调查表的文件名
|
|
|
+ String urlOfResponsibleInvestigation=""; //尽职调查表的url地址
|
|
|
+ Integer productApprovalId=null; //产品核准表的id号
|
|
|
+ String productApprovalName=""; //产品核准表的文件名
|
|
|
+ String urlOfProductApproval=""; //产品核准表的url地址
|
|
|
+ Integer basicDataId=null; //基础性资料的id号
|
|
|
+ String basicDataName=""; //基础性资料的文件名
|
|
|
+ String urlOfBasicData=""; //基础性资料的url地址
|
|
|
+ if (map.get("businessId") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ businessId = (Integer) map.get("businessId");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("businessId类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("业务申报的id号为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("bank")) && map.get("bank") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ bank = (String) map.get("bank");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("bank类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("银行名称为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("businessName")) && map.get("businessName") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ businessName = (String) map.get("businessName");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("businessName类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("业务名称为空");
|
|
|
+ }
|
|
|
+ if (map.get("busineeApprovalId") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ busineeApprovalId = (Integer) map.get("busineeApprovalId");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("busineeApprovalId类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("业务核准表的id号为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("busineeApprovalName")) && map.get("busineeApprovalName") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ busineeApprovalName = (String) map.get("busineeApprovalName");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("busineeApprovalName类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("业务员核准表的文件名为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("urlOfBusineeApproval")) && map.get("urlOfBusineeApproval") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ urlOfBusineeApproval = (String) map.get("urlOfBusineeApproval");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("urlOfBusineeApproval类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("业务核准表的url地址");
|
|
|
+ }
|
|
|
+ if (map.get("responsibleInvestigationId") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ responsibleInvestigationId = (Integer) map.get("responsibleInvestigationId");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("responsibleInvestigationId类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("尽职调查表id号为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("responsibleInvestigationName")) && map.get("responsibleInvestigationName") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ responsibleInvestigationName = (String) map.get("responsibleInvestigationName");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("responsibleInvestigationName类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("尽职调查表的文件名为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("urlOfResponsibleInvestigation")) && map.get("urlOfResponsibleInvestigation") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ urlOfResponsibleInvestigation = (String) map.get("urlOfResponsibleInvestigation");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("urlOfResponsibleInvestigation类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("尽职调查表的url为空");
|
|
|
+ }
|
|
|
+ if (map.get("productApprovalId") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ productApprovalId = (Integer) map.get("productApprovalId");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("productApprovalId类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("产品核准表的id号为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("productApprovalName")) && map.get("productApprovalName") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ productApprovalName = (String) map.get("productApprovalName");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("productApprovalName类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("产品核准表的文件名为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("urlOfProductApproval")) && map.get("urlOfProductApproval") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ urlOfProductApproval = (String) map.get("urlOfProductApproval");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("urlOfProductApproval类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("产品核准表的url为空");
|
|
|
+ }
|
|
|
+ if (map.get("basicDataId") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ basicDataId = (Integer) map.get("basicDataId");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("basicDataId类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("基础性资料的id号为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("basicDataName")) && map.get("basicDataName") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ basicDataName = (String) map.get("basicDataName");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("basicDataName类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("基础性资料的文件名为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("urlOfBasicData")) && map.get("urlOfBasicData") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ urlOfBasicData = (String) map.get("urlOfBasicData");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("urlOfBasicData类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("基础性资料的url为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> mapToDaoForBusinessDeclare = new LinkedHashMap<String,Object>(); //这个map是将数据插入业务申报表中的
|
|
|
+ mapToDaoForBusinessDeclare.put("businessId", businessId); //业务申报id
|
|
|
+ mapToDaoForBusinessDeclare.put("bank", bank); //申报支行名称
|
|
|
+ mapToDaoForBusinessDeclare.put("businessName", businessName); //业务名称
|
|
|
+ mapToDaoForBusinessDeclare.put("busineeApprovalId", busineeApprovalId); //业务核准表id号
|
|
|
+ mapToDaoForBusinessDeclare.put("responsibleInvestigationId", responsibleInvestigationId); //尽职调查报告id号
|
|
|
+ mapToDaoForBusinessDeclare.put("productApprovalId", productApprovalId); //产品核准表id号
|
|
|
+ mapToDaoForBusinessDeclare.put("basicDataId", basicDataId); //基础性资料id号
|
|
|
+ mapToDaoForBusinessDeclare.put("declareTime", System.currentTimeMillis()); //申报时间以系统当前时间为准
|
|
|
+ mapToDaoForBusinessDeclare.put("statusId",1); //刚刚申请的时候状态应该是【待二级分行审核】,这里以1表示,到时候可能还会进行修。。TODO
|
|
|
+ mapToDaoForBusinessDeclare.put("hash", "to be calaulated from file on server"); //hash值先写死,到时候要从文件中获取并计算出来
|
|
|
+ businessDeclareDao.insertBusinessDeclareInformationToDaoByBranchBank(mapToDaoForBusinessDeclare); //将业务申请的数据插入数据库
|
|
|
+
|
|
|
+ Map<String, Object> mapToDaoForAttachmentOfBusineeApproval = new LinkedHashMap<String,Object>(); //这个map是将数据插入业务核准表中的
|
|
|
+ mapToDaoForAttachmentOfBusineeApproval.put("attachmentId", responsibleInvestigationId); //业务核准表id号就是附件的id号
|
|
|
+ mapToDaoForAttachmentOfBusineeApproval.put("attachmentName", responsibleInvestigationName); //业务核准表文件名就当是附件名
|
|
|
+ mapToDaoForAttachmentOfBusineeApproval.put("url", urlOfResponsibleInvestigation); //业务核准表的url地址就是附件url地址
|
|
|
+ mapToDaoForAttachmentOfBusineeApproval.put("userId", 300000001); //上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
|
|
|
+ mapToDaoForAttachmentOfBusineeApproval.put("createTime", mapToDaoForBusinessDeclare.get("declareTime")); //创建时间以插入业务申请表的时间为准
|
|
|
+ businessDeclareDao.insertAttachmentInformationToDaoByBranchBank(mapToDaoForAttachmentOfBusineeApproval); //将附件---【业务核准表】---申请的数据插入数据库
|
|
|
+
|
|
|
+ Map<String, Object> mapToDaoForAttachmentOfResponsibleInvestigation = new LinkedHashMap<String,Object>(); //这个map是将数据插入尽职调查表中的
|
|
|
+ mapToDaoForAttachmentOfResponsibleInvestigation.put("attachmentId", busineeApprovalId); //尽职调查表id号就是附件的id号
|
|
|
+ mapToDaoForAttachmentOfResponsibleInvestigation.put("attachmentName", busineeApprovalName); //尽职调查表文件名就当是附件名
|
|
|
+ mapToDaoForAttachmentOfResponsibleInvestigation.put("url", urlOfBusineeApproval); //尽职调查表的url地址就是附件url地址
|
|
|
+ mapToDaoForAttachmentOfResponsibleInvestigation.put("userId", 300000001); //上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
|
|
|
+ mapToDaoForAttachmentOfResponsibleInvestigation.put("createTime", mapToDaoForBusinessDeclare.get("declareTime")); //创建时间以插入尽职调查表的时间为准
|
|
|
+ businessDeclareDao.insertAttachmentInformationToDaoByBranchBank(mapToDaoForAttachmentOfResponsibleInvestigation); //将附件---【尽职调查表】---申请的数据插入数据库
|
|
|
+
|
|
|
+ Map<String, Object> mapToDaoForAttachmentOfProductApproval = new LinkedHashMap<String,Object>(); //这个map是将数据插入产品核准表中的
|
|
|
+ mapToDaoForAttachmentOfProductApproval.put("attachmentId", productApprovalId); //产品核准表id号就是附件的id号
|
|
|
+ mapToDaoForAttachmentOfProductApproval.put("attachmentName", productApprovalName); //产品核准表文件名就当是附件名
|
|
|
+ mapToDaoForAttachmentOfProductApproval.put("url", urlOfProductApproval); //产品核准表的url地址就是附件url地址
|
|
|
+ mapToDaoForAttachmentOfProductApproval.put("userId", 300000001); //上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
|
|
|
+ mapToDaoForAttachmentOfProductApproval.put("createTime", mapToDaoForBusinessDeclare.get("declareTime")); //创建时间以插入产品核准表的时间为准
|
|
|
+ businessDeclareDao.insertAttachmentInformationToDaoByBranchBank(mapToDaoForAttachmentOfProductApproval); //将附件---【产品核准表】---申请的数据插入数据库
|
|
|
+
|
|
|
+ Map<String, Object> mapToDaoForAttachmentOfBasicData = new LinkedHashMap<String,Object>(); //这个map是将数据插入基础性资料中的
|
|
|
+ mapToDaoForAttachmentOfBasicData.put("attachmentId", basicDataId); //基础性资料id号就是附件的id号
|
|
|
+ mapToDaoForAttachmentOfBasicData.put("attachmentName", basicDataName); //基础性资料文件名就当是附件名
|
|
|
+ mapToDaoForAttachmentOfBasicData.put("url", urlOfBasicData); //基础性资料的url地址就是附件url地址
|
|
|
+ mapToDaoForAttachmentOfBasicData.put("userId", 300000001); //上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
|
|
|
+ mapToDaoForAttachmentOfBasicData.put("createTime", mapToDaoForBusinessDeclare.get("declareTime")); //创建时间以插入基础性资料的时间为准
|
|
|
+ businessDeclareDao.insertAttachmentInformationToDaoByBranchBank(mapToDaoForAttachmentOfBasicData); //将附件---【基础性资料】---申请的数据插入数据库
|
|
|
+
|
|
|
+
|
|
|
+ //此外,还要将业务申报的这个操作信息插入到操作记录表中【】
|
|
|
+ Map<String, Object> mapToOperationHistory = new LinkedHashMap<String,Object>();
|
|
|
+ mapToOperationHistory.put("operatorTypeId", 1001); //刚刚创立业务申报,操作类型为业务申报
|
|
|
+ mapToOperationHistory.put("operatorAccount", 300000001); //操作账号先定死
|
|
|
+ mapToOperationHistory.put("operatorRole", "经办支行"); //创建这个操作的角色只能是经办支行
|
|
|
+ mapToOperationHistory.put("operatorPerson", "张三"); //操作人先写死
|
|
|
+ mapToOperationHistory.put("operatorTime", mapToDaoForBusinessDeclare.get("declareTime"));//操作时间为当前操作时间
|
|
|
+ mapToOperationHistory.put("hash", "to be calculated from operation"); //如何计算操作的hash值????
|
|
|
+ businessDeclareDao.insertOperationHistoryInformationToDaoByBranchBank(mapToOperationHistory);//将操作记录信息插入到操作记录表中
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @Title: queryBusinessDeclareInformation
|
|
|
+ * @Description: TODO(从客户端传过来的数据,进行校验,再将数据传递给Dao层进行查询)
|
|
|
+ * @param @param map
|
|
|
+ * @param @return 设定文件
|
|
|
+ * @return PageDTO 返回类型
|
|
|
+ * @author ylx
|
|
|
+ * @date 2017年12月19日 下午4:05:22
|
|
|
+ * @throws
|
|
|
+ */
|
|
|
+ public PageDTO queryBusinessDeclareInformation(Map<String, Object> map) {
|
|
|
+ int page = 1; // 默认页是第一页
|
|
|
+ String businessName = ""; // 业务名称默认空值
|
|
|
+ long startTime = 0; //开始时间默认0
|
|
|
+ long endTime=Long.MAX_VALUE; //结束时间默认Long最大值
|
|
|
+ if (!"".equals(map.get("page")) && map.get("page") != null) { // 等于空就直接取第一页
|
|
|
+ try {
|
|
|
+ page = Integer.parseInt((String) map.get("page"));
|
|
|
+ if (page < 1) {
|
|
|
+ page = 1;
|
|
|
+ }
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ page = 1; // 数据解析异常page还是1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("businessName")) && map.get("businessName") != null) { // 等于空就直接取空值
|
|
|
+ businessName = (String) map.get("businessName");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("startTime")) && map.get("startTime") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ startTime = Long.parseLong((String) map.get("startTime"));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ startTime = 0; // 数据解析异常startTime还是0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("endTime")) && map.get("endTime") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ endTime = Long.parseLong((String) map.get("endTime"));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ endTime = Long.MAX_VALUE; // 数据解析异常endTime还是9223372036854775807L
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PageDTO pageDTO = new PageDTO();
|
|
|
+ Map<String, Object> mapToDao = new LinkedHashMap<String, Object>();
|
|
|
+ mapToDao.put("startPage", (page - 1) * ROW_NUM);
|
|
|
+ mapToDao.put("businessName", businessName);
|
|
|
+ if (startTime <= endTime) {
|
|
|
+ mapToDao.put("startTime", startTime);
|
|
|
+ mapToDao.put("endTime", endTime);
|
|
|
+ } else {
|
|
|
+ mapToDao.put("startTime", startTime);
|
|
|
+ mapToDao.put("endTime", Long.MAX_VALUE);
|
|
|
+ }
|
|
|
+ mapToDao.put("rowNum", ROW_NUM); // 默认每页显示数据是10条,可根据需求修改分页数量
|
|
|
+ List<BusinessDeclare> informationList=businessDeclareDao.queryBusinessDeclareInformation(mapToDao);
|
|
|
+ int count=businessDeclareDao.findAddInfromations();
|
|
|
+ pageDTO.setRows(informationList);
|
|
|
+ pageDTO.setTotal(count);
|
|
|
+ return pageDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @Title: queryBusinessCheckInformation
|
|
|
+ * @Description: TODO(根据controller层传过来的业务id号去数据库的业务审核总表中进行数据查询)
|
|
|
+ * @param @param map
|
|
|
+ * @param @return 设定文件
|
|
|
+ * @return PageDTO 返回类型
|
|
|
+ * @author ylx
|
|
|
+ * @date 2017年12月19日 下午7:51:16
|
|
|
+ * @throws
|
|
|
+ */
|
|
|
+ public List<BusinessCheck> queryBusinessCheckInformation(Map<String, Object> map) {
|
|
|
+ Integer check_business_id=null; //被审核的业务id号需要先被进行校验
|
|
|
+ if (map.get("businessId") != null) { // 等于空就直接取第一页
|
|
|
+ try {
|
|
|
+ check_business_id = (Integer) map.get("businessId");
|
|
|
+ } catch (Exception e) {
|
|
|
+ check_business_id=null; //如果解析出错或者类型转换异常,还是以null去数据库查询
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> mapToDao =new LinkedHashMap<String, Object>();
|
|
|
+ mapToDao.put("businessId", check_business_id);
|
|
|
+ List<BusinessCheck> businessCheckList = businessDeclareDao.queryBusinessCheckInformation(mapToDao);
|
|
|
+
|
|
|
+ return businessCheckList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @Title: businessDeclareCheckedBy
|
|
|
+ * @Description: TODO(将controller传过来的审核信息传入service层进行校验,然后将审核意见插入到数据库,同时将业务审核表中的审核结果的状态也顺便被更新一份)
|
|
|
+ * 此外,还要在操作记录表中插入一条数据
|
|
|
+ * @param @param map 设定文件
|
|
|
+ * 数据包含organizationName:二级分行或省分行
|
|
|
+ * checkPerson:审核人员
|
|
|
+ * checkResult:结果放入check_result字段
|
|
|
+ * checkOpinion:审核意见
|
|
|
+ * businessId:
|
|
|
+ * @return void 返回类型
|
|
|
+ * @author ylx
|
|
|
+ * @date 2017年12月19日 下午8:58:55
|
|
|
+ * @throws
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor=Exception.class)
|
|
|
+ public void businessDeclareCheckedBy(Map<String, Object> map) {
|
|
|
+ String organizationName=""; //审核部门
|
|
|
+ String checkPerson=""; //审核人
|
|
|
+ Integer checkResult=null; //审核结果
|
|
|
+ String checkOpinion=""; //审核意见
|
|
|
+ Integer businessId=null; //业务申报的id号,要根据这个更新业务审核的状态的
|
|
|
+ Integer statusId=null; //业务申报表中状态id号,这个要根据checkResult审核结果来决定
|
|
|
+
|
|
|
+ Integer operatorTypeId=null; //操作类型id号------>放到操作记录表中去的
|
|
|
+
|
|
|
+ if (!"".equals(map.get("organizationName")) && map.get("organizationName") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ organizationName = (String) map.get("organizationName");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("organizationName类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("审核部门不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("checkPerson")) && map.get("checkPerson") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ checkPerson = (String) map.get("checkPerson");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("checkPerson类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("审人不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("checkResult")) && map.get("checkResult") != null) { // 等于空就直接取空值
|
|
|
+ String result=null;
|
|
|
+ try {
|
|
|
+ result = (String) map.get("checkResult"); //定义一个局部变量result(保存审核结果,以String类型接收),来看是否会出现类型转换异常
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("checkResult类型转换异常");
|
|
|
+ }
|
|
|
+ if("agree".equals(result)){
|
|
|
+ checkResult=5; //5表示审核结果为同意(根据status表决定数字)
|
|
|
+ if("二级分行".equals(organizationName)){
|
|
|
+ statusId=3; //3表示二级分行审核通过 转为【待省分行业务部门审核】(根据status表决定数字)
|
|
|
+ operatorTypeId=1002; //1002在操作类型中表示【业务初审通过】
|
|
|
+ }else if("省分行业务部门".equals(organizationName)){
|
|
|
+ statusId=5; //5表示省分行审核通过 转为【通过】(根据status表决定数字)
|
|
|
+ operatorTypeId=1013; //1013在操作类型中表示【业务复审通过】
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("审核部门参数非法");
|
|
|
+ }
|
|
|
+ }else if("disagree".equals(result)){
|
|
|
+ checkResult=6; //6表示审核结果为不同意(根据status表决定数字)
|
|
|
+ if("二级分行".equals(organizationName)){
|
|
|
+ statusId=2; //2表示二级分行审核不通过(根据status表决定数字)
|
|
|
+ operatorTypeId=1012; //1012在操作类型中表示【业务初审拒绝】
|
|
|
+ }else if("省分行业务部门".equals(organizationName)){
|
|
|
+ statusId=4; //4表示省分行审核不通过(根据status表决定数字)
|
|
|
+ operatorTypeId=1003; //1003在操作类型中表示【业务复审拒绝】
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("审核部门参数非法");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("审核结果参数非法"); //传过来的参数如果不符合要求直接报错给前台
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("审核人不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!"".equals(map.get("checkOpinion")) && map.get("checkOpinion") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ checkOpinion = (String) map.get("checkOpinion");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("checkOpinion类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("审核意见不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("businessId")) && map.get("businessId") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ businessId = Integer.parseInt((String) map.get("businessId"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("businessId解析异常或类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("businessId不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ //将审核已将数据封装到map中
|
|
|
+ Map<String, Object> mapToDaoOfBusinessCheck=new LinkedHashMap<String, Object>();
|
|
|
+ mapToDaoOfBusinessCheck.put("organizationName", organizationName);
|
|
|
+ mapToDaoOfBusinessCheck.put("checkPerson", checkPerson);
|
|
|
+ mapToDaoOfBusinessCheck.put("checkResult", checkResult);
|
|
|
+ mapToDaoOfBusinessCheck.put("checkOpinion", checkOpinion);
|
|
|
+ mapToDaoOfBusinessCheck.put("businessId", businessId);
|
|
|
+ mapToDaoOfBusinessCheck.put("checkTime", System.currentTimeMillis());
|
|
|
+ //将封装到map的审核意见数据传入dao层中将结果导入【业务审核总表】中-------->insert操作
|
|
|
+ businessDeclareDao.businessDeclareCheckedBy(mapToDaoOfBusinessCheck);
|
|
|
+
|
|
|
+ //将审核的结果封装到map中
|
|
|
+ Map<String, Object> mapToDaoOfBusinessDeclare=new LinkedHashMap<String, Object>();
|
|
|
+ mapToDaoOfBusinessDeclare.put("businessId", businessId);
|
|
|
+ mapToDaoOfBusinessDeclare.put("statusId", statusId);
|
|
|
+ //将审核结果更新到【业务申报表】这个businessId的【业务申报结果字段】中去-------->update操作
|
|
|
+ businessDeclareDao.updateBusinessDeclareStatus(mapToDaoOfBusinessDeclare);
|
|
|
+
|
|
|
+
|
|
|
+ //此外,还要将审核的这个操作信息插入到操作记录表中【】
|
|
|
+ Map<String, Object> mapToOperationHistory = new LinkedHashMap<String,Object>();
|
|
|
+ mapToOperationHistory.put("operatorTypeId", operatorTypeId); //operatorTypeId根据前面的判断决定
|
|
|
+ mapToOperationHistory.put("operatorRole", organizationName); //创建这个操作的角色根据前面的organizationName决定
|
|
|
+ mapToOperationHistory.put("operatorAccount", 300000001); //操作账号先定死??????
|
|
|
+ mapToOperationHistory.put("operatorPerson", "张三"); //操作人先写死???????
|
|
|
+ mapToOperationHistory.put("operatorTime", mapToDaoOfBusinessCheck.get("checkTime"));//操作时间为当前操作时间
|
|
|
+ mapToOperationHistory.put("hash", "to be calculated from operation"); //如何计算操作的hash值????
|
|
|
+ businessDeclareDao.insertOperationHistoryInformationToDaoByBranchBank(mapToOperationHistory);//将操作记录信息插入到操作记录表中
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @Title: uploadContractByProvincialBranchBank
|
|
|
+ * @Description: TODO(由省分行业务部门上传的合同,将这个合同信息分别插入【合同提交记录表】、【合同状态跟踪表】、【附件表】)
|
|
|
+ * 修改意见定义为“初始版本合同”
|
|
|
+ * 上传部门为“省分行业务部门”
|
|
|
+ *
|
|
|
+ * @param @param map 设定文件
|
|
|
+ * @return void 返回类型
|
|
|
+ * @author ylx
|
|
|
+ * @date 2017年12月20日 下午3:09:19
|
|
|
+ * @throws
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor=Exception.class)
|
|
|
+ public void uploadContractByProvincialBranchBank(Map<String, Object> map) {
|
|
|
+ Integer businessId=null; //业务的id号
|
|
|
+ Integer contractId=null; //合同id号,当作附件的id号
|
|
|
+ String contractName=""; //合同名,暂时理解为文件名,也当作附件名进行存储
|
|
|
+ String contractParty=""; //签约双方的名字
|
|
|
+ String uploadDepartment=""; //这里暂时写死是省分行业务部门
|
|
|
+ String uploadPerson=""; //上传人
|
|
|
+ String url=""; //合同的url地址
|
|
|
+ String hash=""; //合同的hash值
|
|
|
+ Integer userId=null; //上传人的id号
|
|
|
+ if (!"".equals(map.get("businessId")) && map.get("businessId") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ businessId = Integer.parseInt((String) map.get("businessId"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("业务id解析异常或类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("业务id不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("contractId")) && map.get("contractId") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ contractId = Integer.parseInt((String) map.get("contractId"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("合同id解析异常或类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("合同id不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("contractName")) && map.get("contractName") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ contractName = (String) map.get("contractName");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("contractName类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("合同名不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("contractParty")) && map.get("contractParty") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ contractParty = (String) map.get("contractParty");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("contractParty类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("签约双方的名不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("uploadDepartment")) && map.get("uploadDepartment") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ uploadDepartment = (String) map.get("uploadDepartment");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("uploadDepartment类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("上传部门名不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("uploadPerson")) && map.get("uploadPerson") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ uploadPerson = (String) map.get("uploadPerson");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("uploadPerson类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("上传人不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("url")) && map.get("url") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ url = (String) map.get("url");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("url类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("合同的url地址不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("hash")) && map.get("hash") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ hash = (String) map.get("hash");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("hash类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("合同的hash值不能为空");
|
|
|
+ }
|
|
|
+ if (!"".equals(map.get("userId")) && map.get("userId") != null) { // 等于空就直接取空值
|
|
|
+ try {
|
|
|
+ userId = Integer.parseInt((String) map.get("userId"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException("上传人id解析异常或类型转换异常");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("上传人id不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //将合同信息封装到mapToContractRecord
|
|
|
+ Map<String, Object> mapToContractRecord=new LinkedHashMap<String, Object>();
|
|
|
+ mapToContractRecord.put("businessId", businessId);
|
|
|
+ mapToContractRecord.put("contractId", contractId);
|
|
|
+ mapToContractRecord.put("contractName", contractName);
|
|
|
+ mapToContractRecord.put("version", "v1.0");
|
|
|
+ mapToContractRecord.put("contractParty", contractParty);
|
|
|
+ mapToContractRecord.put("uploadDepartment", uploadDepartment);
|
|
|
+ mapToContractRecord.put("uploadPerson", uploadPerson);
|
|
|
+ mapToContractRecord.put("modifyOpinion", "初始版本合同");
|
|
|
+ mapToContractRecord.put("comfirmDepartment", "管理人");
|
|
|
+ mapToContractRecord.put("commitTime", System.currentTimeMillis());
|
|
|
+ mapToContractRecord.put("hash", hash);
|
|
|
+
|
|
|
+
|
|
|
+ //将合同信息封装到mapToContractStatusTracking
|
|
|
+ Map<String, Object> mapToContractStatusTracking=new LinkedHashMap<String, Object>();
|
|
|
+ mapToContractStatusTracking.put("businessId", businessId);
|
|
|
+ mapToContractStatusTracking.put("contractName", contractName);
|
|
|
+ mapToContractStatusTracking.put("contractParty", contractParty);
|
|
|
+ mapToContractStatusTracking.put("updateTime", mapToContractRecord.get("commitTime"));
|
|
|
+ mapToContractStatusTracking.put("statusId", 7); //省分行刚上传合同状态肯定是将状态变成修订中
|
|
|
+
|
|
|
+
|
|
|
+ //将合同信息封装到mapToAttachment
|
|
|
+ Map<String, Object> mapToAttachment=new LinkedHashMap<String, Object>();
|
|
|
+ mapToAttachment.put("attachmentId", contractId);
|
|
|
+ mapToAttachment.put("attachmentName", contractName);
|
|
|
+ mapToAttachment.put("url", url);
|
|
|
+ mapToAttachment.put("userId", userId);
|
|
|
+ mapToAttachment.put("createTime", mapToContractRecord.get("commitTime"));
|
|
|
+
|
|
|
+ businessDeclareDao.insertContractInformationToContractRecord(mapToContractRecord); //将合同信息插入到【合同提交记录表】
|
|
|
+ businessDeclareDao.insertContractInformationToContractStatusTracking(mapToContractStatusTracking); //将合同信息插入到【合同状态跟踪表】
|
|
|
+ businessDeclareDao.insertContractInformationToAttachment(mapToAttachment); //将信息插入到【附件表】
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //此外,还要将审核的这个操作信息插入到操作记录表中【】
|
|
|
+ Map<String, Object> mapToOperationHistory = new LinkedHashMap<String,Object>();
|
|
|
+ mapToOperationHistory.put("operatorTypeId", 1004); //operatorTypeId=1004表示【合同上传】
|
|
|
+ mapToOperationHistory.put("operatorRole", "省分行业务部门"); //创建这个操作的角色只能是省分行业务部门
|
|
|
+ mapToOperationHistory.put("operatorAccount", 300000001); //操作账号先定死??????
|
|
|
+ mapToOperationHistory.put("operatorPerson", "张三"); //操作人先写死???????
|
|
|
+ mapToOperationHistory.put("operatorTime", mapToContractRecord.get("commitTime"));//操作时间为当前操作时间
|
|
|
+ mapToOperationHistory.put("hash", "to be calculated from operation"); //如何计算操作的hash值????
|
|
|
+ businessDeclareDao.insertOperationHistoryInformationToDaoByBranchBank(mapToOperationHistory);//将操作记录信息插入到操作记录表中
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|