From 52ffefd06e59cbd56c1a919972866592379cfed2 Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期四, 21 九月 2023 11:27:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java |  326 +++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 274 insertions(+), 52 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java
index 58a119c..a5016f5 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java
@@ -17,6 +17,8 @@
 import com.vci.ubcs.code.util.ClientBusinessObject;
 import com.vci.ubcs.code.util.gennerAttrMapUtil;
 import com.vci.ubcs.code.vo.pagemodel.*;
+import com.vci.ubcs.code.vo.webserviceModel.applybz.ApplyBZParamVO;
+import com.vci.ubcs.code.vo.webserviceModel.applybz.ApplyBZVO;
 import com.vci.ubcs.code.vo.webserviceModel.person.*;
 import com.vci.ubcs.code.vo.webserviceModel.apply.*;
 import com.vci.ubcs.code.vo.webserviceModel.attrmap.*;
@@ -53,18 +55,29 @@
 import com.vci.ubcs.system.vo.DeptVO;
 import com.vci.ubcs.system.vo.RoleVO;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.tools.ant.taskdefs.condition.Http;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+
 import javax.annotation.Resource;
+import javax.jws.WebMethod;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Context;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
 import java.util.*;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.Collectors;
 
 import static com.vci.ubcs.code.constant.MdmEngineConstant.DEFAULT_SYNC_ATTR_LIST;
-import static com.vci.ubcs.code.constant.MdmEngineConstant.IMPORT_ROW_INDEX;
 import static com.vci.ubcs.code.enumpack.CodeSecTypeEnum.CODE_CLASSIFY_SEC;
 
 /***
@@ -74,20 +87,25 @@
 @Slf4j
 @VciWebservice(path = "/universalInterface")
 public class UniversalInterfaceImpl<IDockingLogeServiceing> implements UniversalInterfaceI {
+
 	@Value("${code.universalinterface.checkSystemConfig:true}")
 	public boolean CODE_CHECKCONFIG;
+
 	@Autowired(required = false)
 	private AttributeMapConfig attributeMapConfig;
+
 	/***
 	 * 浜哄憳鐩稿叧閰嶇疆鏈嶅姟
 	 */
 	@Autowired(required = false)
 	private PersonAndDeptConfig personAndDeptConfig;
+
 	/**
 	 * 缂撳瓨鏈嶅姟
 	 */
 	//@Autowired
 	//private RedisService redisService;
+
 	/**
 	 * 涓婚搴撳垎绫荤殑鏈嶅姟
 	 */
@@ -127,7 +145,6 @@
 	/**
 	 * 瀵嗙骇鐨勬湇鍔�
 	 */
-
 	@Resource
 	private MdmIOService mdmIOService;
 
@@ -142,12 +159,43 @@
 	 */
 	@Resource
 	private IDockingLogeService dockingLogeService;
+	@Resource
+	private IPasswordFreeLoginService passwordFreeLoginService;
 
 	private  static String separator="##VCI##";
 	private  String errorid="0";
 	private String msg="鎴愬姛";
 	private  String objerrorCode="0";
 	private String objerrorMsg="鎴愬姛";
+
+	private final ThreadLocal<HttpServletRequest> threadLocal = new ThreadLocal<>();
+
+	@Resource
+	private WebServiceContext webServiceContext;
+
+	@Override
+	public void setThreadLocal(ThreadLocal<HttpServletRequest> requestThreadLocal){
+		this.threadLocal.set(requestThreadLocal.get());
+		requestThreadLocal.remove();
+	}
+
+	@WebMethod
+	private HttpServletRequest getRequest() {
+		//rest璇锋眰鏂瑰紡鑾峰彇request
+		HttpServletRequest request = this.threadLocal.get();
+		if(Func.isEmpty(request)){
+			try {
+				// webservice璇锋眰鏂瑰紡鑾峰彇HttpServletRequest瀵硅薄
+				request = (HttpServletRequest)webServiceContext.getMessageContext().get(MessageContext.SERVLET_REQUEST);
+			}catch (Exception e){
+				throw new ServiceException("鑾峰彇httpServletRequest澶辫触锛屽師鍥�:"+e.getMessage());
+			}
+		}else {
+			this.threadLocal.remove();
+		}
+		return request;
+	}
+
 	/***
 	 * 鐢宠缂栫爜鎺ュ彛
 	 * @param data 浼犻�掔殑鏁版嵁鍙傛暟
@@ -190,9 +238,11 @@
 			ClassfysVO classfysVO = interParameterVO.getData().getClassifys();
 			systemId = interParameterVO.getData().getSystemId();
 			UserVO userVo = interParameterVO.getData().getUser();
+			//鍏嶅瘑鐧诲綍鐢宠token锛宺equest涓坊鍔犵敤鎴蜂俊鎭�
+			passwordFreeLoginService.pwdFreeLoginByBoolean(userVo.getUserName(),this.getRequest());
+			AuthUtil.getUser();
 			List<ClassfyVO> classVOList = classfysVO.getClassify();
 			InterParameterVO finalInterParameterVO = interParameterVO;
-
 			//杩欐槸璐﹀彿淇℃伅
 			SessionInfo sessionInfo = new SessionInfo();
 			sessionInfo.setUserId(userVo.getUserName());
@@ -342,8 +392,6 @@
 		return resultStr;
 	}
 
-
-
 	/****
 	 * 浜哄憳鏁版嵁鍚屾
 	 * @param personData
@@ -359,9 +407,9 @@
 		boolean isPersonApplyGroupCode= personAndDeptConfig.isPersonApplyGroupCode();
 		String systemCode=personData.getSystemCode();
 		List<ResultMdMapping> resultMdMappingList=new ArrayList<>();
-		boolean success=true;
 		String message="";
 		if(isUsedFlag){
+			AtomicBoolean success= new AtomicBoolean(true);
 			List<PersonMasterData> masterDataList=new ArrayList<>();
 			List<String> fields= VciBaseUtil.str2List(personAndDeptConfig.getPersonFields());
 			try {
@@ -371,7 +419,7 @@
 				masterDataList = personData.getMasterData();
 				String personLibrary = personAndDeptConfig.getPersonLibrary();
 				if (StringUtils.isBlank(personLibrary)) {
-					success=false;
+					success.set(false);
 					log.info("闆嗘垚閰嶇疆缂哄皯浜哄憳搴撹妭鐐逛俊鎭�,personLibrary->" + personLibrary);
 					throw  new Throwable("闆嗘垚閰嶇疆缂哄皯浜哄憳搴撹妭鐐逛俊鎭�,personLibrary->" + personLibrary);
 				}
@@ -383,12 +431,12 @@
 				log.info("end锛氬垎绫绘煡璇㈠畬姣�");
 				//鑾峰彇鍒嗙被妯℃澘淇℃伅
 				if(codeClassifyVO==null || StringUtils.isBlank(codeClassifyVO.getOid())){
-					success=false;
+					success.set(false);
 					throw  new  Throwable ("鏍规嵁閰嶇疆鍒嗙被鐨勫垎绫荤紪鍙凤紝鏈幏鍙栧埌鍒嗙被淇℃伅");
 				}
 				CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyVO.getOid());
 				if(templateVO==null||StringUtils.isBlank(templateVO.getOid())){
-					success=false;
+					success.set(false);
 					throw  new  Throwable ("鏍规嵁浼犺緭鐨勫垎绫伙紝鏈幏鍙朚DM绯荤粺涓搴旀ā鏉�");
 				}
 
@@ -440,10 +488,11 @@
 						deleteDataVOList.add(object);
 					}else{
 						String worker_category=personMasterData.getWorker_category();
-						codeList.add(personMasterData.getLm_code());
+
 						object.setOperate("create");
 						applyDataVOList.add(object);
 					}
+					codeList.add(personMasterData.getLm_code());
 				});
 
 				R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId());
@@ -532,10 +581,31 @@
 							orderDTO.setCodeRuleOid(ruleVO.getOid());
 							orderDTO.setSecDTOList(codeOrderSecDTOList);//瀛樺偍缂栫爜
 							orderDTO.setData(rowData.getFiledValue());
-							engineService.addSaveCode(orderDTO);
+							String code=engineService.addSaveCode(orderDTO);
+							if(StringUtils.isNotBlank(code)) {
+								StringBuffer sqlsb = new StringBuffer();
+								sqlsb.append(" select * from ");
+								sqlsb.append(tableName);
+								sqlsb.append(" where 1=1 ");
+								sqlsb.append(" and lastr=1 and lastv=1");
+								sqlsb.append(" and id in (");
+								sqlsb.append(VciBaseUtil.toInSql(code));
+								sqlsb.append(")");
+								List<Map<String, String>> newDataMapList = commonsMapper.queryByOnlySqlForMap(sqlsb.toString());
+								if (!CollectionUtils.isEmpty(newDataMapList)) {
+									String oid = StringUtils.isBlank(newDataMapList.get(0).get("OID")) ? "" : newDataMapList.get(0).get("OID");
+									List<String> oidList = new ArrayList<>();
+									oidList.add(oid);
+									//濡傛灉鏈夌敵璇峰氨鍘昏皟鐢ㄧ敵璇烽泦鍥㈢爜
+									if (isPersonApplyGroupCode) {
+										mdmIOService.sendApplyGroupcode(oidList, templateVO.getBtmTypeId(), sysIntegrationPushTypeEnum.ACCPET_APPCODE.getValue());
+										success.set(true);
+										mesg = "鏁版嵁淇濆瓨鎴愬姛锛岀瓑寰呯敵璇烽泦鍥㈢爜";
+									}
+								}
+							}
 						} catch (Exception e) {
 							mesg=e.getMessage();
-							e.getMessage();
 							e.printStackTrace();
 						}finally {
 							XMLResultDataObjectDetailDO x=new XMLResultDataObjectDetailDO();
@@ -547,7 +617,7 @@
 						}
 					});
 					resultDataObjectDetailDOs.addAll(xDOs);
-					boolean finalSuccess1 = success;
+					boolean finalSuccess1 = success.get();
 					String finalMessage1 = message;
 					resultDataObjectDetailDOs.stream().forEach(resultDataObjectDetailDO->{
 						ResultMdMapping resultMdMapping=new ResultMdMapping();
@@ -560,17 +630,12 @@
 						resultMdMappingList.add(resultMdMapping);
 					});
 					log.info("end锛氱敵璇疯幏鍙栧畬姣�");
-					//濡傛灉鏈夌敵璇峰氨鍘昏皟鐢ㄧ敵璇烽泦鍥㈢爜
-					if(isPersonApplyGroupCode){
-						List<String> oidList=new ArrayList<>();
-						mdmIOService.sendApplyGroupcode(oidList,templateVO.getBtmTypeId(),sysIntegrationPushTypeEnum.ACCPET_APPCODE.getValue());
-					}
 				}
 			}catch (Throwable e){
-				success=false;
+				success.set(false);
 				message="浜哄憳鏁版嵁鎺ュ彈澶辫触:"+e.getMessage();
 				//缁勭粐杩斿洖缁撴灉
-				boolean finalSuccess = success;
+				boolean finalSuccess = success.get();
 				String finalMessage = message;
 				masterDataList.stream().forEach(masterData -> {
 					ResultMdMapping resultMdMapping=new ResultMdMapping();
@@ -583,7 +648,7 @@
 				});
 			}finally {
 				resultOrgData.setMessage(message);
-				resultOrgData.setSuccess(success);
+				resultOrgData.setSuccess(success.get());
 				resultOrgData.setMdMappings(resultMdMappingList);
 				Object object = JSONObject.toJSON(resultOrgData);
 			}
@@ -591,7 +656,7 @@
 			String data = JSONObject.toJSONString(personData);
 			try {
 				//璁板綍鏃ュ織
-				this.saveLogs(systemCode, systemCode, data, resultStr, success, msg, "syncDataForPerson");
+				this.saveLogs(systemCode, systemCode, data, resultStr, success.get(), msg, "syncDataForPerson");
 			}catch (Throwable e){
 				e.printStackTrace();
 			}
@@ -599,6 +664,7 @@
 
 		return resultOrgData;
 	}
+
 	/****
 	 * 閮ㄩ棬鏁版嵁鍚屾
 	 * @param orgData
@@ -609,10 +675,9 @@
 	public ResultOrgData syncDataForOrg(OrgData orgData) {
 		boolean isUsedFlag= personAndDeptConfig.isUsedFlag();
 		ResultOrgData resultOrgData=new ResultOrgData();
-
 		boolean isPersonApplyGroupCode= personAndDeptConfig.isPersonApplyGroupCode();
 		List<ResultMdMapping> resultMdMappingList=new ArrayList<>();
-		boolean success=true;
+		AtomicBoolean success= new AtomicBoolean(true);
 		String message="";
 		String systemCode="";
 		if(isUsedFlag){
@@ -626,7 +691,7 @@
 				orgMasterDataList = orgData.getMasterData();
 				String personLibrary = personAndDeptConfig.getPersonLibrary();
 				if (StringUtils.isBlank(personLibrary)) {
-					success=false;
+					success.set(false);
 					log.info("闆嗘垚閰嶇疆缂哄皯浜哄憳搴撹妭鐐逛俊鎭�,personLibrary->" + personLibrary);
 					throw  new Throwable("闆嗘垚閰嶇疆缂哄皯浜哄憳搴撹妭鐐逛俊鎭�,personLibrary->" + personLibrary);
 				}
@@ -638,12 +703,12 @@
 				log.info("end锛氬垎绫绘煡璇㈠畬姣�");
 				//鑾峰彇鍒嗙被妯℃澘淇℃伅
 				if(codeClassifyVO==null || StringUtils.isBlank(codeClassifyVO.getOid())){
-					success=false;
+					success.set(false);
 					throw  new  Throwable ("鏍规嵁閰嶇疆鍒嗙被鐨勫垎绫荤紪鍙凤紝鏈幏鍙栧埌鍒嗙被淇℃伅");
 				}
 				CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyVO.getOid());
 				if(templateVO==null||StringUtils.isBlank(templateVO.getOid())){
-					success=false;
+					success.set(false);
 					throw  new  Throwable ("鏍规嵁浼犺緭鐨勫垎绫伙紝鏈幏鍙朚DM绯荤粺涓搴旀ā鏉�");
 				}
 
@@ -653,14 +718,14 @@
 				List<String> codeList=new ArrayList<>();
 				List<ApplyDataVO> applyDataVOList=new ArrayList<>();
 				List<ApplyDataVO> deleteDataVOList=new ArrayList<>();
-				orgMasterDataList.stream().forEach(personMasterData -> {
+				orgMasterDataList.stream().forEach(orgMasterData -> {
 					ApplyDataVO object=new ApplyDataVO();
-					object.setCode(personMasterData.getMdm_code());//缂栫爜
-					object.setCreator(personMasterData.getCreator());//鍒涘缓鑰�
-					object.setEditor(personMasterData.getModifier());//淇敼鑰�
-					object.setId(personMasterData.getPk_mdm());//涓婚敭
+					object.setCode(orgMasterData.getMdm_code());//缂栫爜
+					object.setCreator(orgMasterData.getCreator());//鍒涘缓鑰�
+					object.setEditor(orgMasterData.getModifier());//淇敼鑰�
+					object.setId(orgMasterData.getPk_mdm());//涓婚敭
 					object.setStatus(CodeDefaultLC.RELEASED.getValue());//鐘舵�佸垯闇�瑕佸垽鏂�
-					Map<String,String> dataMap= VciBaseUtil.objectToMapString(personMasterData);
+					Map<String,String> dataMap= VciBaseUtil.objectToMapString(orgMasterData);
 					List<ProppertyVO> proppertyVOList=new ArrayList<>();
 					/***
 					 * 鏍规嵁閰嶇疆鏂囦欢鑾峰彇鏋氫妇鍊�
@@ -686,14 +751,15 @@
 					});
 
 					object.setProp(proppertyVOList);
-					if(personMasterData.getDr()==1){
+					if(orgMasterData.getDr()==1){
 						object.setOperate("delete");//鎿嶄綔绫诲瀷
 						deleteDataVOList.add(object);
 					}else{
-						codeList.add(personMasterData.getMdm_code());
+
 						object.setOperate("create");
 						applyDataVOList.add(object);
 					}
+					codeList.add(orgMasterData.getMdm_code());
 				});
 
 				R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId());
@@ -782,7 +848,29 @@
 							orderDTO.setCodeRuleOid(ruleVO.getOid());
 							orderDTO.setSecDTOList(codeOrderSecDTOList);//瀛樺偍缂栫爜
 							orderDTO.setData(rowData.getFiledValue());
-							engineService.addSaveCode(orderDTO);
+							String code=engineService.addSaveCode(orderDTO);
+							if(StringUtils.isNotBlank(code)) {
+								StringBuffer sqlsb = new StringBuffer();
+								sqlsb.append(" select * from ");
+								sqlsb.append(tableName);
+								sqlsb.append(" where 1=1 ");
+								sqlsb.append(" and lastr=1 and lastv=1");
+								sqlsb.append(" and id in (");
+								sqlsb.append(VciBaseUtil.toInSql(code));
+								sqlsb.append(")");
+								List<Map<String, String>> newDataMapList = commonsMapper.queryByOnlySqlForMap(sqlsb.toString());
+								if (!CollectionUtils.isEmpty(newDataMapList)) {
+									String oid = StringUtils.isBlank(newDataMapList.get(0).get("OID")) ? "" : newDataMapList.get(0).get("OID");
+									List<String> oidList = new ArrayList<>();
+									oidList.add(oid);
+									//濡傛灉鏈夌敵璇峰氨鍘昏皟鐢ㄧ敵璇烽泦鍥㈢爜
+									if (isPersonApplyGroupCode) {
+										mdmIOService.sendApplyGroupcode(oidList, templateVO.getBtmTypeId(), sysIntegrationPushTypeEnum.ACCPET_APPCODE.getValue());
+										success.set(true);
+										mesg = "鏁版嵁淇濆瓨鎴愬姛锛岀瓑寰呯敵璇烽泦鍥㈢爜";
+									}
+								}
+							}
 						} catch (Exception e) {
 							mesg=e.getMessage();
 							e.getMessage();
@@ -797,7 +885,7 @@
 						}
 					});
 					resultDataObjectDetailDOs.addAll(xDOs);
-					boolean finalSuccess1 = success;
+					boolean finalSuccess1 = success.get();
 					String finalMessage1 = message;
 					resultDataObjectDetailDOs.stream().forEach(resultDataObjectDetailDO->{
 						ResultMdMapping resultMdMapping=new ResultMdMapping();
@@ -810,17 +898,12 @@
 						resultMdMappingList.add(resultMdMapping);
 					});
 					log.info("end锛氱敵璇疯幏鍙栧畬姣�");
-					//濡傛灉鏈夌敵璇峰氨鍘昏皟鐢ㄧ敵璇烽泦鍥㈢爜
-					if(isPersonApplyGroupCode){
-						List<String> oidList=new ArrayList<>();
-						mdmIOService.sendApplyGroupcode(oidList,templateVO.getBtmTypeId(),sysIntegrationPushTypeEnum.ACCPET_APPCODE.getValue());
-					}
 				}
 			}catch (Throwable e){
-				success=false;
+				success.set(false);
 				message="浜哄憳鏁版嵁鎺ュ彈澶辫触:"+e.getMessage();
 				//缁勭粐杩斿洖缁撴灉
-				boolean finalSuccess = success;
+				boolean finalSuccess = success.get();
 				String finalMessage = message;
 				orgMasterDataList.stream().forEach(masterData -> {
 					ResultMdMapping resultMdMapping=new ResultMdMapping();
@@ -833,7 +916,7 @@
 				});
 			}finally {
 				resultOrgData.setMessage(message);
-				resultOrgData.setSuccess(success);
+				resultOrgData.setSuccess(success.get());
 				resultOrgData.setMdMappings(resultMdMappingList);
 				Object object = JSONObject.toJSON(resultOrgData);
 			}
@@ -841,13 +924,14 @@
 			String data = JSONObject.toJSONString(orgData);
 			try {
 				//璁板綍鏃ュ織
-				this.saveLogs(systemCode, systemCode, data, resultStr, success, msg, "syncDataForOrg");
+				this.saveLogs(systemCode, systemCode, data, resultStr, success.get(), msg, "syncDataForOrg");
 			}catch (Throwable e){
 				e.printStackTrace();
 			}
 		}
 		return resultOrgData;
 	}
+
 	/***
 	 * 缁熶竴鏇存柊鎺ュ彛锛堟洿鏀圭姸鎬侊紝鏇存敼灞炴�т俊鎭級鎺ュ彛
 	 * @param data
@@ -892,6 +976,8 @@
 			ClassfysVO classfysVO = interParameterVO.getData().getClassifys();
 			systemId = interParameterVO.getData().getSystemId();
 			UserVO userVo = interParameterVO.getData().getUser();
+			//鍏嶅瘑鐧诲綍鐢宠token锛宺equest涓坊鍔犵敤鎴蜂俊鎭�
+			passwordFreeLoginService.pwdFreeLoginByBoolean(userVo.getUserName(),this.getRequest());
 			List<ClassfyVO> classVOList = classfysVO.getClassify();
 			InterParameterVO finalInterParameterVO = interParameterVO;
 			//杩欐槸璐﹀彿淇℃伅
@@ -1063,6 +1149,8 @@
 			}
 			QueryData queryData=queryClassifyVO.getData();
 			UserVO userVo=queryData.getUser();
+			//鍏嶅瘑鐧诲綍鐢宠token锛宺equest涓坊鍔犵敤鎴蜂俊鎭�
+			passwordFreeLoginService.pwdFreeLoginByBoolean(userVo.getUserName(),this.getRequest());
 			systemId=queryData.getSystemId();
 			QueryLibraryVO libraryVO= queryData.getLibrary();
 			String libId= libraryVO.getId();
@@ -1221,6 +1309,8 @@
 			CondtionsVO condtionsVO=dataCondtionsVO.getCondtions();
 			systemId=condtionsVO.getSystemId();
 			UserVO userVo=condtionsVO.getUser();
+			//鍏嶅瘑鐧诲綍鐢宠token锛宺equest涓坊鍔犵敤鎴蜂俊鎭�
+			passwordFreeLoginService.pwdFreeLoginByBoolean(userVo.getUserName(),this.getRequest());
 			CondtionVO condtionVO= condtionsVO.getCondtion();
 			SessionInfo sessionInfo = new SessionInfo();
 			sessionInfo.setUserId(userVo.getUserName());
@@ -1397,11 +1487,8 @@
 		return resultStr;
 	}
 
-
-
 	@Override
 	public String queryClassifyRule(String data, String dataType) throws Throwable {
-
 		boolean issucess=false;
 		String resultStr = "";
 		String errorid="0";
@@ -1437,6 +1524,8 @@
 			}
 			QueryData queryData=queryClassifyVO.getData();
 			UserVO userVo=queryData.getUser();
+			//鍏嶅瘑鐧诲綍鐢宠token锛宺equest涓坊鍔犵敤鎴蜂俊鎭�
+			passwordFreeLoginService.pwdFreeLoginByBoolean(userVo.getUserName(),this.getRequest());
 			systemId=queryData.getSystemId();
 			QueryLibraryVO libraryVO= queryData.getLibrary();
 			String libId= libraryVO.getId();
@@ -1747,10 +1836,10 @@
 									}
 									log.info(libId);
 								}else if(secType.equals("codelevelsec")) {//灞傜骇鐮佹
-									int level = codeBasicSecVO.getCodeLevelValue();
 									CodeClassifyVO levelCodeClassifyVO = new CodeClassifyVO();
 									CodeClassifyFullInfoBO classifyFullInfoBO = this.classifyService.getClassifyFullInfo(codeClassifyDO.getOid());
 									if(codeBasicSecVO.getCodeLevelType().equals("code_level_special")){//鎸囧畾灞傜骇
+										int level = codeBasicSecVO.getCodeLevelValue();
 										List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList());
 										if (classifyVOS.size() >= level && level > 0) {
 											levelCodeClassifyVO = classifyVOS.get(level - 1);
@@ -1849,6 +1938,134 @@
 		return resultStr;
 	}
 
+	public String applyCodeForBZ(String data,String dataType){
+		String resultStr = "";
+//		log.info("鏂规硶->applyCodeForBZ start");
+//
+//		final String[] errorid = {"0"};
+//		msg="鎴愬姛";
+//		objerrorCode="0";
+//		objerrorMsg="鎴愬姛";
+//		log.info("鐢宠缂栫爜鐨勬暟鎹弬鏁�:->"+data);
+//		log.info("鐢宠缂栫爜鐨勬暟鎹被鍨�:->"+dataType);
+//		String systemId="";
+//		List<XMLResultClassfyVO> resultClassfyVOList = new ArrayList<>();
+//		LinkedList<XMLResultDataObjectDetailDO> resultDataObjectDetailDOs = new LinkedList<>();
+//		try{
+//			try {
+//				if(StringUtils.isBlank(data)) {
+//					errorid[0] ="101";
+//					throw new Throwable("鎺ュ彛鍙傛暟锛氫紶閫掍负绌�");
+//				}
+//				ApplyBZParamVO applyBZParamVO  =new ApplyBZParamVO();
+//				//濡傛灉dataType鏄痻ml鍒欙紝閫氳繃xml搴忓垪鍖栨垚瀵硅薄褰㈠紡锛屽鏋滄槸json鍒欓�氳繃json杞崲鎴愬璞℃牸寮�
+//				try {
+//					if ("xml".equals(dataType)) {
+//						XStream xStream = new XStream(new DomDriver());
+//						xStream.processAnnotations(RootDataVO.class);
+//						xStream.autodetectAnnotations(true);
+//						ApplyBZVO rootDataVO = (ApplyBZVO) xStream.fromXML(data);
+//						applyBZParamVO.setData(rootDataVO);
+//					} else {
+//						applyBZParamVO = JSONObject.toJavaObject(JSONObject.parseObject(data), ApplyBZParamVO.class);
+//					}
+//				}catch (Throwable e){
+//					errorid[0] ="101";
+//					throw new Throwable("鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�");
+//				}
+//				ClassfysVO classfysVO = interParameterVO.getData().getClassifys();
+//				systemId = interParameterVO.getData().getSystemId();
+//				UserVO userVo = interParameterVO.getData().getUser();
+//				//鍏嶅瘑鐧诲綍鐢宠token锛宺equest涓坊鍔犵敤鎴蜂俊鎭�
+//				passwordFreeLoginService.passwordFreeLogin(userVo.getUserName(),this.getRequest());
+//				AuthUtil.getUser();
+//				List<ClassfyVO> classVOList = classfysVO.getClassify();
+//				InterParameterVO finalInterParameterVO = interParameterVO;
+//				//杩欐槸璐﹀彿淇℃伅
+//				SessionInfo sessionInfo = new SessionInfo();
+//				sessionInfo.setUserId(userVo.getUserName());
+//				sessionInfo.setUserName(userVo.getTrueName());
+//				sessionInfo.setIp(userVo.getIp());
+//				VciBaseUtil.setCurrentUserSessionInfo(sessionInfo);
+////				List<XMLResultDataObjectDetailDO> allResultDataObjectDetailDOS=new ArrayList<>();
+//				String finalSystemId = systemId;
+//			} catch (Throwable e) {
+//				List<ApplyDataVO> applyDataVOList= classVO.getObjects().getObject();
+//				objerrorCode="1";
+//				if(!CollectionUtils.isEmpty(applyDataVOList)) {
+//					applyDataVOList.stream().forEach(applyDataVO -> {
+//						XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO = new XMLResultDataObjectDetailDO();
+//						xmlResultDataObjectDetailDO.setCode("");
+//						xmlResultDataObjectDetailDO.setId(applyDataVO.getId());
+//						xmlResultDataObjectDetailDO.setErrorid(objerrorCode);
+//						xmlResultDataObjectDetailDO.setMsg("缂栫爜鐢宠澶辫触:" + e.getMessage());
+//						resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO);
+//					});
+//				}else{
+//					XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO = new XMLResultDataObjectDetailDO();
+//					xmlResultDataObjectDetailDO.setCode("");
+//					xmlResultDataObjectDetailDO.setId("");
+//					xmlResultDataObjectDetailDO.setErrorid(objerrorCode);
+//					xmlResultDataObjectDetailDO.setMsg("缂栫爜鐢宠澶辫触:" + e.getMessage());
+//					resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO);
+//				}
+//				e.printStackTrace();
+//			}finally {
+//				XMLResultClassfyVO resultClassfyVO = new XMLResultClassfyVO();
+//				resultClassfyVO.setClassCode(classVO.getClassCode());
+//				resultClassfyVO.setLibrary(classVO.getLibrary());
+//				resultClassfyVO.setFullclsfNamePath(classVO.getFullclsfNamePath());
+//				resultClassfyVO.setObjects(resultDataObjectDetailDOs);
+//				resultClassfyVOList.add(resultClassfyVO);
+//			}
+//			XMLResultSystemVO xmlResultSystemVO=new XMLResultSystemVO();
+//			xmlResultSystemVO.setClassifys(resultClassfyVOList);
+//			xmlResultSystemVO.setMsg(msg);
+//			xmlResultSystemVO.setErrorid(errorid[0]);
+//			resultStr= transferResultXMl(xmlResultSystemVO,dataType);
+//		}catch (Throwable e){
+//			e.printStackTrace();
+//			msg="鐢宠缂栫爜澶辫触:"+e.getMessage();
+//          /*  XMLResultSystemVO XMLResultSystemVO=new XMLResultSystemVO();
+//            XMLResultSystemVO.setErrorid(errorid);
+//            XMLResultSystemVO.setMsg("鐢宠缂栫爜澶辫触锛�->"+e.getMessage());
+//            XMLResultSystemVO.setClassifys(resultClassfyVOList);
+//            resultStr=transferResultXMl(XMLResultSystemVO,dataType);
+//
+//            log.error("鐢宠缂栫爜澶辫触锛�->"+e);
+//            return resultStr;*/
+//		}finally {
+//			XMLResultSystemVO xmlResultSystemVO=new XMLResultSystemVO();
+//			xmlResultSystemVO.setClassifys(resultClassfyVOList);
+//			xmlResultSystemVO.setMsg(msg);
+//			xmlResultSystemVO.setErrorid(errorid[0]);
+//			resultStr= transferResultXMl(xmlResultSystemVO,dataType);
+//			final boolean[] issucess = {true};
+//			if(!errorid[0].equals("0")) {
+//				issucess[0] = false;
+//			}else {
+//				if(!CollectionUtils.isEmpty(resultClassfyVOList)) {
+//					resultClassfyVOList.stream().forEach(xMLResultClassfyVO -> {
+//						xMLResultClassfyVO.getObjects().stream().forEach(objec -> {
+//							if (!(objec.getErrorid().equals("0") || objec.getErrorid().equals("204"))) {
+//								issucess[0] = false;
+//								msg=objec.getMsg();
+//							}
+//						});
+//					});
+//				}
+//			}
+//			try {
+//				//璁板綍鏃ュ織
+//				this.saveLogs(systemId, systemId, data, resultStr, issucess[0], msg, "applyCodeForBZ");
+//			}catch (Throwable e){
+//				e.printStackTrace();
+//			}
+//		}
+//		log.info("杩斿洖鍙傛暟:"+resultStr);
+		//璋冪敤闆嗗洟鐢宠鎺ュ彛鐢宠闆嗗洟鐮�
+		return resultStr;
+	}
 	/***
 	 * 鏌ヨ鏍¢獙鍒嗙被淇℃伅
 	 * @param classfyVO
@@ -2200,7 +2417,8 @@
 		if(StringUtils.isNotBlank(classOid)){
 			queryWrapper.in(DockingSystemConfig::getClassifyOid,classOid);
 		}
-		List<DockingSystemConfig> dockingSystemConfigList=	dockingSystemConfigList=dockingSystemConfigService.list(queryWrapper);
+		List<DockingSystemConfig> dockingSystemConfigList=new ArrayList<>();
+		dockingSystemConfigList=	dockingSystemConfigList=dockingSystemConfigService.list(queryWrapper);
 		if(!CollectionUtils.isEmpty(dockingSystemConfigList)){
 		 return	dockingSystemConfigList.get(0);
 		}else{
@@ -2208,6 +2426,10 @@
 				return checkIspass(systemId, type, operationType, codeClassifyVO.getParentCodeClassifyOid());
 			}
 		}
-		return dockingSystemConfigList.get(0);
+		if(dockingSystemConfigList.size()>0){
+			return dockingSystemConfigList.get(0);
+		}else{
+			return	new DockingSystemConfig();
+		}
 	}
 }

--
Gitblit v1.9.3