1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
package com.vci.ubcs.code.service.impl;
 
import com.alibaba.cloud.commons.lang.StringUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.constant.MdmDuckingConstant;
import com.vci.ubcs.code.dto.CodeOrderDTO;
import com.vci.ubcs.code.dto.CodeOrderSecDTO;
import com.vci.ubcs.code.entity.CodeClassify;
import com.vci.ubcs.code.entity.DockingLog;
import com.vci.ubcs.code.entity.DockingSystemConfig;
import com.vci.ubcs.code.enumpack.CodeDefaultLC;
import com.vci.ubcs.code.enumpack.CodeSecTypeEnum;
import com.vci.ubcs.code.enumpack.SysIntegrationDataFlowTypeEnum;
import com.vci.ubcs.code.enumpack.sysIntegrationPushTypeEnum;
import com.vci.ubcs.code.mapper.CommonsMapper;
import com.vci.ubcs.code.service.*;
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.apply.ApplyDataVO;
import com.vci.ubcs.code.vo.webserviceModel.apply.ApplyDatasVO;
import com.vci.ubcs.code.vo.webserviceModel.apply.ClassfyVO;
import com.vci.ubcs.code.vo.webserviceModel.apply.ProppertyVO;
import com.vci.ubcs.code.vo.webserviceModel.attrmap.*;
import com.vci.ubcs.code.vo.webserviceModel.mdm.MDMParamData;
import com.vci.ubcs.code.vo.webserviceModel.mdm.MdmResultData;
import com.vci.ubcs.code.vo.webserviceModel.person.EnumerableData;
import com.vci.ubcs.code.vo.webserviceModel.person.PersonMasterData;
import com.vci.ubcs.code.vo.webserviceModel.person.ResultMdMapping;
import com.vci.ubcs.code.vo.webserviceModel.result.xml.XMLResultDataObjectDetailDO;
import com.vci.ubcs.code.webService.config.AttributeMapConfig;
import com.vci.ubcs.code.webService.config.ClassifyConfig;
import com.vci.ubcs.code.webService.config.MDMInterFaceConfig;
import com.vci.ubcs.omd.feign.IBtmTypeClient;
import com.vci.ubcs.omd.vo.BtmTypeVO;
import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil;
import com.vci.ubcs.starter.web.util.BeanUtilForVCI;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.BladeUser;
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.http.HttpServletRequest;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
 
import static com.vci.ubcs.code.constant.MdmEngineConstant.CODE_SEC_LENGTH_FIELD;
import static com.vci.ubcs.code.constant.MdmEngineConstant.DEFAULT_SYNC_ATTR_LIST;
import static com.vci.ubcs.code.enumpack.CodeSecTypeEnum.CODE_SERIAL_SEC;
 
/***
 * 统一接口
 */
@Service
@Slf4j
public class CodeMdmInfaceImpl implements CodeMdmInfaceI {
 
 
    @Autowired(required = false)
    private AttributeMapConfig attributeMapConfig;
 
    /****
     * 关于跟MDM集成配置
     */
    @Autowired(required = false)
    private MDMInterFaceConfig mdmInterFaceConfig;
    /**
     * 主题库分类的服务
     */
    @Autowired(required = false)
    private ICodeClassifyService classifyService;
    /**
     * 业务类型的服务
     */
    @Autowired
    private IBtmTypeClient btmTypeClient;
    /**
     * 通用查询
     */
    @Resource
    private CommonsMapper commonsMapper;
 
    /**
     * 主数据引擎的服务
     */
    @Resource
    private MdmEngineService engineService;
 
    /**
     * 密级的服务
     */
    @Resource
    private MdmIOService mdmIOService;
 
    @Resource
    private IDockingSystemConfigService dockingSystemConfigService;
 
 
    /***
     * 集成接口日志服务的配置
     */
    @Resource
    private IDockingLogeService dockingLogeService;
 
    @Resource
    private IPasswordFreeLoginService passwordFreeLoginService;
    /***
     * 是否校验接口管理
     */
    @Value("${code.universalinterface.checkSystemConfig:true}")
    public boolean CODE_CHECKCONFIG;
 
    /**
     * 自定义并发ForkJoinPool
     */
    private static final ForkJoinPool customForkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors() - 1);
 
    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){
                e.printStackTrace();
                log.error("获取httpServletRequest失败,原因:***********:",e);
                throw new ServiceException("获取httpServletRequest失败,原因:"+e.getMessage());
            }
        }else {
            this.threadLocal.remove();
        }
        return request;
    }
    @Override
    public MdmResultData syncDataForMDM(MDMParamData mdmParamData,String library,String classifyCode) {
        boolean isCodeOrGroupCode=false;
        MdmResultData mdmResultData=new MdmResultData();
        String systemCode=mdmParamData.getSystemCode();
        List<ResultMdMapping> resultMdMappingList=new ArrayList<>();
        String message="";
        AtomicBoolean success = new AtomicBoolean(true);
        List<Map<String,Object>> masterDataList = new ArrayList<>();
        AtomicReference<ClassifyConfig> currentClassifyConfig = new AtomicReference<>(new ClassifyConfig());
        try {
            if (mdmParamData == null) {
                throw new Throwable("传入参数为null");
            }
            try {
                passwordFreeLoginService.pwdFreeLoginByBoolean(systemCode.toLowerCase(), this.getRequest());
            } catch (Throwable e) {
                throw new Throwable("用户鉴权失败");
            }
            List<ClassifyConfig> classifyConfigList=mdmInterFaceConfig.getClassifyconfigs();
            //masterDataList
            String masterDataStr = mdmParamData.getMasterData();
            masterDataList = JSONArray.parseObject(masterDataStr,List.class);
 
            if(StringUtils.isNotBlank(library)&&StringUtils.isNotBlank(classifyCode)){
                String finalLibrary = library;
                classifyConfigList.stream().forEach(classifyConfig -> {
                    String  currentClassifyCode=classifyConfig.getClassCode();
                    String currentLibrary=classifyConfig.getLibrary();
                    if(finalLibrary.equals(currentLibrary)&&classifyCode.equals(currentClassifyCode)){
                        currentClassifyConfig.set(classifyConfig);
                    }
                });
            }else{
                Map<String,List<ClassifyConfig>> fieldClassifyConfigMap=new HashMap<>();
                classifyConfigList.stream().forEach(classifyConfig -> {
                    String sourceKey=classifyConfig.getSourceKey();//分类标识字段
                    //String sourceClassifyCode=classifyConfig.getSourceClassifyCode();//分类标识
                    List<ClassifyConfig> classifyConfigs = new ArrayList<>();
                    if(fieldClassifyConfigMap.containsKey(sourceKey)) {
                        List<ClassifyConfig> oldClassifyConfigs=    fieldClassifyConfigMap.get(sourceKey);
                        classifyConfigs.addAll(oldClassifyConfigs);
                    }
                    classifyConfigs.add(classifyConfig);
                    fieldClassifyConfigMap.put(sourceKey,classifyConfigs);
                });
                masterDataList.stream().forEach(masterData -> {
                        masterData.forEach((field, vaule) -> {
                            String newValue="";
                            if (fieldClassifyConfigMap.containsKey(field)) {
                                //vaule=StringUtils.isBlank(vaule) ? "" : vaule;
                                newValue=objectToStr(vaule);
                                List<ClassifyConfig> classifyConfigs = fieldClassifyConfigMap.get(field);
                                Map<String, ClassifyConfig> classifyConfigMap = classifyConfigs.stream().filter(classify -> classify != null && StringUtils.isNotBlank(classify.getSourceClassifyCode())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getSourceClassifyCode(), t -> t));
                                if (classifyConfigMap.containsKey(newValue)) {
                                    currentClassifyConfig.set(classifyConfigMap.get(newValue));
                                }
                            }
                        });
                });
            }
            library= currentClassifyConfig.get().getLibrary();
            if (StringUtils.isBlank(library)) {
                success.set(false);
                log.info("与MDM集成配置缺少库节点信息,library->" + library);
                throw new Throwable("与MDM集成配置缺少库节点信息,library->" + library);
            }
            String classCode= currentClassifyConfig.get().getClassCode();
            ClassfyVO classfyVO = new ClassfyVO();
            classfyVO.setLibrary(library);
            classfyVO.setClassCode(classCode);
            CodeClassifyVO codeClassifyVO = this.getClassfy(classfyVO, library);
            log.info("end:分类查询完毕");
            //获取分类模板信息
            if (codeClassifyVO == null || StringUtils.isBlank(codeClassifyVO.getOid())) {
                success.set(false);
                throw new Throwable("根据配置分类的分类编号,未获取到分类信息");
            }
            CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyVO.getOid());
            if (templateVO == null || StringUtils.isBlank(templateVO.getOid())) {
                success.set(false);
                throw new Throwable("根据传输的分类,未获取MDM系统中对应模板");
            }
            if(CODE_CHECKCONFIG) {
                //校验是否配置
                DockingSystemConfig dockingSystemConfig=null;
                dockingSystemConfig=checkIspass(systemCode, SysIntegrationDataFlowTypeEnum.ACCEPT.getValue(), sysIntegrationPushTypeEnum.ACCPET_APPCODE.getValue(),codeClassifyVO.getOid());
                if(dockingSystemConfig==null||StringUtils.isBlank(dockingSystemConfig.getOid())){
                    throw new Throwable("系统标识为【"+ systemCode +"】,集成分类为【"+codeClassifyVO.getName()+"】以上分类,"+sysIntegrationPushTypeEnum.ACCPET_APPCODE.getText()+"接口配置已停用或者未配置,请联系编码管理员!");
                }
                isCodeOrGroupCode="true".equals(dockingSystemConfig.getIsGroupCodeFlag())?true:false;
            }
            List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s -> !DEFAULT_SYNC_ATTR_LIST.contains(s.getId()) &&
                ((Func.isNotEmpty(s.getClassifyInvokeAttr()) || Func.isNotEmpty(s.getClassifyInvokeAttrName())) || VciBaseUtil.getBoolean(s.getFormDisplayFlag()))
            ).collect(Collectors.toList());
            R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId());
            if (!r.isSuccess()) {
                throw new Throwable(r.getMsg());
            }
            BtmTypeVO btmTypeVO = r.getData();
            if (btmTypeVO == null) {
                throw new Throwable("根据业务类型未查询到业务类型对象!");
            }
            String tableName = btmTypeVO.getTableName();
            if (com.alibaba.nacos.common.utils.StringUtils.isBlank(tableName)) {
                throw new Throwable("根据业务类型未查询到业务类型相关联的表");
            }
 
            List<String> codeList = new ArrayList<>();
            List<ApplyDataVO> applyDataVOList = new ArrayList<>();
            List<ApplyDataVO> deleteDataVOList = new ArrayList<>();
            List<String> fields = Func.toStrList(currentClassifyConfig.get().getEnumFields());
            masterDataList.stream().forEach(masterData -> {
                ApplyDataVO object = new ApplyDataVO();
                List<ProppertyVO> proppertyVOList = new ArrayList<>();
                masterData.forEach((field, vaule) -> {
                    /***
                     * 根据配置文件获取枚举值
                     */
                    String newValue=objectToStr(vaule);
                    if(fields.contains(field)){//如果是枚举,则需要转换枚举值
                        String enumFiled = newValue;
                        EnumerableData enumerableData = JSONObject.toJavaObject(JSONObject.parseObject(enumFiled), EnumerableData.class);
                        String enumCode = enumerableData.getCode();
                        //String enumCodeValue=enumerableData.getName();
                        ProppertyVO proppertyVO = new ProppertyVO();
                        proppertyVO.setKey(field);
                        proppertyVO.setValue(enumCode);
                        proppertyVOList.add(proppertyVO);
                    }else {
                        ProppertyVO proppertyVO = new ProppertyVO();
                        proppertyVO.setKey(field);
                        proppertyVO.setValue(newValue);
                        proppertyVOList.add(proppertyVO);
                    }
 
                });
 
                Map<String,String> fixedFieldMap = currentClassifyConfig.get().getFixedFieldMap();
                if(fixedFieldMap.containsKey("creator")){
                    String fixedField=fixedFieldMap.getOrDefault("creator","");
                    object.setCreator(masterData.getOrDefault(fixedField,"").toString());//创建者
                }
                if(fixedFieldMap.containsKey("modifier")) {
                    String fixedField=fixedFieldMap.getOrDefault("modifier","");
                    object.setEditor(masterData.getOrDefault(fixedField, "").toString());//修改者
                }
                if(fixedFieldMap.containsKey("id")) {
                    String fixedField=fixedFieldMap.getOrDefault("id","");
                    object.setId(masterData.getOrDefault(fixedField, "").toString());//主键
                }
                object.setStatus(CodeDefaultLC.RELEASED.getValue());//状态则需要判断
                String dr="0";
                if(fixedFieldMap.containsKey("dr")) {
                    String fixedField=fixedFieldMap.getOrDefault("dr","");
                    dr = masterData.getOrDefault(fixedField, "").toString();
                }
                object.setCode(masterData.getOrDefault(currentClassifyConfig.get().getSourceCodeKey(),"").toString());//编码
                object.setProp(proppertyVOList);
 
                if (dr.equals(1)) {
                    //操作类型
                    object.setOperate("delete");
                    deleteDataVOList.add(object);
                } else {
                    //String worker_category=personMasterData.getWorker_category();
                    object.setOperate("create");
                    applyDataVOList.add(object);
                }
                codeList.add(object.getCode());
 
            });
            String targetCodeKey=currentClassifyConfig.get().getTargetCodeKey();
            StringBuffer sb = new StringBuffer();
            sb.append(" select * from ");
            sb.append(tableName);
            sb.append(" where 1=1 ");
            sb.append(" and lastr=1 and lastv=1");
            sb.append(" and "+targetCodeKey+" in (");
            sb.append(VciBaseUtil.toInSql(codeList.toArray(new String[0])));
            sb.append(")");
            List<Map<String, String>> dataMapList = commonsMapper.queryByOnlySqlForMap(sb.toString());
            DefaultAttrAssimtUtil.mapToLowerCase(dataMapList, true);
            List<ClientBusinessObject> cboList = ChangeMapTOClientBusinessObjects(dataMapList);
            ApplyDatasVO applyDatasVO = new ApplyDatasVO();
            ApplyDatasVO editDatasVO = new ApplyDatasVO();
            if (!CollectionUtils.isEmpty(cboList)) {
                //根据MDM编码去判断数据是否重复.
                Map<String, ClientBusinessObject> oldpplyDataVOMap = cboList.stream().filter(data -> data != null && StringUtils.isNotBlank(data.getAttributeValue(targetCodeKey))).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getAttributeValue(targetCodeKey).toLowerCase(Locale.ROOT), t -> t));
                //数据库不存在的
                List<ApplyDataVO> applyApplyDataVOList = applyDataVOList.stream().filter(cbo -> {
                    String code = cbo.getCode();
                    return !oldpplyDataVOMap.containsKey(code);
                }).collect(Collectors.toList());
                applyDatasVO.setObject(applyApplyDataVOList);
                //数据库存在的
                List<ApplyDataVO> editApplyDataVOList = applyDataVOList.stream().filter(cbo -> {
                    String code = cbo.getCode();
                    if (oldpplyDataVOMap.containsKey(code)) {
                        cbo.setOperate("update");
                    }
                    return oldpplyDataVOMap.containsKey(code);
                }).collect(Collectors.toList());
                editApplyDataVOList.addAll(deleteDataVOList);
                editDatasVO.setObject(editApplyDataVOList);
            } else {
                applyDatasVO.setObject(applyDataVOList);
            }
 
            LinkedList<XMLResultDataObjectDetailDO> resultDataObjectDetailDOs = new LinkedList<>();
            if (editDatasVO.getObject() != null && editDatasVO.getObject().size() > 0) {
                DataObjectVO dataObjectVO = new DataObjectVO();
                this.getConfigDatas(systemCode, library, editDatasVO, attrVOS, dataObjectVO);
                log.info("start:修改数据执行完毕");
                //boolean personApplyGroupCode = personAndDeptConfig.isPersonApplyGroupCode();
                mdmIOService.batchSyncEditDatas(codeClassifyVO, dataObjectVO, resultDataObjectDetailDOs, isCodeOrGroupCode);
                log.info("end:修改数据执行完毕");
            }
            if (applyDatasVO.getObject() != null && applyDatasVO.getObject().size() > 0) {
                DataObjectVO dataObjectVO = new DataObjectVO();
                this.getConfigDatas(systemCode, library, applyDatasVO, attrVOS, dataObjectVO);
 
                CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyVO.getOid());
                CodeRuleVO ruleVO = engineService.getCodeRuleByClassifyFullInfo(classifyFullInfo);
                if (ruleVO == null || "".equals(ruleVO.getOid())) {
                    throw new Throwable("编码规则");
                }
                List<XMLResultDataObjectDetailDO> xDOs = new CopyOnWriteArrayList<>();
                final List<RowDatas> rowDatas = dataObjectVO.getRowData();
                boolean finalIsCodeOrGroupCode = isCodeOrGroupCode;
                rowDatas.parallelStream().forEach(rowData -> {
                    String mesg = "";
                    try {
                        CodeOrderDTO orderDTO = new CodeOrderDTO();
                        List<CodeOrderSecDTO> codeOrderSecDTOList = new ArrayList<>();
                        orderDTO.setCodeClassifyOid(codeClassifyVO.getOid());//分类主键
                        orderDTO.setTemplateOid(templateVO.getOid());
                        orderDTO.setCreator(rowData.getCreator());
                        orderDTO.setLastModifier(rowData.getEditor());
                        orderDTO.setLcStatus(rowData.getStatus());
                        if (!CollectionUtils.isEmpty(ruleVO.getSecVOList())) {//算规则
                            boolean usedFlag=currentClassifyConfig.get().isUsedFlag();//是否依据编码规则
                            String codeFilter=currentClassifyConfig.get().getCodeFilter();//根据编码值截取
                            if(usedFlag){//如果依据MDM编码为编码系统编码的话,则根据认为是可变码段
                                if(ruleVO.getSecVOList().size()==1) {
                                    ruleVO.getSecVOList().stream().forEach(codeBasicSecVO -> {
                                        if (codeBasicSecVO.getSecType().equals("codevariablesec")) {//规则之定义为可变码段存储主数据传递过来的数据
                                            CodeOrderSecDTO CodeOrderSecDTO = new CodeOrderSecDTO();
                                            CodeOrderSecDTO.setSecOid(codeBasicSecVO.getOid());
                                            CodeOrderSecDTO.setSecValue(rowData.getCode());
                                            codeOrderSecDTOList.add(CodeOrderSecDTO);
                                        }
                                    });
                                }else{
                                    mesg="根据配置编码依据集成系统:["+systemCode+"]的数据编码为依据,编码规则应为可变码段";
                                    new Throwable("根据配置编码依据集成系统:["+systemCode+"]的数据编码为依据,编码规则应为可变码段");
                                }
                            }else {//如果不依据MDM编码为编码系统编码的话,则根据配置生成编码规则
                                String[] secValues = currentClassifyConfig.get().getSecValueFilter().split("#");
                                final int[] index = {0};
                                try {
                                    ruleVO.getSecVOList().stream().forEach(codeBasicSecVO -> {
                                        if (!CODE_SERIAL_SEC.getValue().equals(codeBasicSecVO.getSecType())) {
                                            CodeOrderSecDTO CodeOrderSecDTO = new CodeOrderSecDTO();
                                            CodeOrderSecDTO.setSecOid(codeBasicSecVO.getOid());
                                            CodeOrderSecDTO.setSecValue(secValues[index[0]]);
                                            codeOrderSecDTOList.add(CodeOrderSecDTO);
                                            index[0]++;
                                        }
                                    });
                                }catch (Throwable e){
                                    mesg="计算码段码值出现异常:"+e.getMessage();
                                    e.printStackTrace();
                                    log.error("计算码段码值出现异常,原因:***********:",e);
                                    new Throwable("计算码段码值出现异常:"+e.getMessage());
                                }
                            }
 
                        }
                        if(CollectionUtils.isEmpty(codeOrderSecDTOList)){
                            throw  new Exception(mesg);
                        }
                        orderDTO.setCodeRuleOid(ruleVO.getOid());
                        orderDTO.setSecDTOList(codeOrderSecDTOList);//存储编码
                        orderDTO.setData(rowData.getFiledValue());
                        String code = engineService.addSaveCodeNotauthUser(orderDTO, false);
                        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 (finalIsCodeOrGroupCode) {
                                    mdmIOService.sendApplyGroupcode(oidList, templateVO.getBtmTypeId(), sysIntegrationPushTypeEnum.ACCPET_APPCODE.getValue());
                                    success.set(true);
                                    mesg = "数据保存成功,等待申请集团码";
                                }
                            }
                        }
                    } catch (Exception e) {
                        log.error("集成系统:【"+systemCode+"】申请编码失败:,原因:***********:",e);
                        mesg="集成系统:【"+systemCode+"】申请编码失败:" + e.getMessage();
                        mesg = e.getMessage();
                        e.printStackTrace();
                        throw new ServiceException(e.getMessage());
                    } finally {
                        XMLResultDataObjectDetailDO x = new XMLResultDataObjectDetailDO();
                        x.setId(rowData.getOid());
                        x.setCode(rowData.getCode());
                        x.setMsg(mesg);
                        x.setErrorid("1");
                        xDOs.add(x);
                    }
                });
                resultDataObjectDetailDOs.addAll(xDOs);
                boolean finalSuccess1 = success.get();
                String finalMessage1 = message;
                // 限制线程并行数量
                customForkJoinPool.submit(() -> {
                    resultDataObjectDetailDOs.stream().forEach(resultDataObjectDetailDO -> {
                        ResultMdMapping resultMdMapping = new ResultMdMapping();
                        resultMdMapping.setBusiDataId(resultDataObjectDetailDO.getId());
                        resultMdMapping.setSuccess(finalSuccess1);
                        resultMdMapping.setEntityCode(" ");
                        resultMdMapping.setMdmCode(resultDataObjectDetailDO.getCode());
                        resultMdMapping.setMessage(finalMessage1);
                        resultMdMapping.setSubMdMappings(null);
                        resultMdMappingList.add(resultMdMapping);
                    });
                }).join();
                log.info("end:申请获取完毕");
            }
        } catch (Throwable e) {
            e.printStackTrace();
            log.error("集成系统:【"+systemCode+"】执行集成失败:",e);
            success.set(false);
            message = "集成系统:【"+systemCode+"】执行集成失败:" + e.getMessage();
            msg ="集成系统:【"+systemCode+"】执行集成失败" + e.getMessage();
            //组织返回结果
            boolean finalSuccess = success.get();
            String finalMessage = message;
            masterDataList.stream().forEach(masterData -> {
                Map<String, String> dataMap = VciBaseUtil.objectToMapString(masterData);
                ResultMdMapping resultMdMapping = new ResultMdMapping();
                resultMdMapping.setBusiDataId(dataMap.getOrDefault("id",""));
                resultMdMapping.setSuccess(finalSuccess);
                resultMdMapping.setEntityCode(" ");
                resultMdMapping.setMdmCode(dataMap.getOrDefault(currentClassifyConfig.get(),""));
                resultMdMapping.setMessage(finalMessage);
                resultMdMapping.setSubMdMappings(null);
            });
        } finally {
            mdmResultData.setMessage(message);
            mdmResultData.setSuccess(success.get());
            mdmResultData.setMdMappings(resultMdMappingList);
            //Object object = JSONObject.toJSON(resultOrgData);
        }
        String resultStr = JSONObject.toJSONString(mdmResultData);
        String data = JSONObject.toJSONString(mdmParamData);
        try {
            //记录日志
            this.saveLogs(systemCode, systemCode, data, resultStr, success.get(), msg, "syncDataForMDM");
        } catch (Throwable e) {
            log.error("保存日志出错,原因:",e);
            e.printStackTrace();
        }
        return mdmResultData;
    }
    private List<ClientBusinessObject> ChangeMapTOClientBusinessObjects(List<Map<String,String>> oldDataMap){
        List<ClientBusinessObject> clientBusinessObjectList=new ArrayList<>();
        DefaultAttrAssimtUtil.mapToLowerCase(oldDataMap,true);
        final BladeUser user = AuthUtil.getUser();
        oldDataMap.stream().forEach(dataMap->{
            ClientBusinessObject clientBusinessObject=new ClientBusinessObject();
            DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(dataMap,clientBusinessObject,false,user);
            for (String key:dataMap.keySet()){
                Object value= dataMap.getOrDefault(key,"");
                clientBusinessObject.setAttributeValue(key.toLowerCase(Locale.ROOT),value==null?"":value.toString());
            }
            clientBusinessObjectList.add(clientBusinessObject);
        });
        return clientBusinessObjectList;
    }
    /***
     * 查询校验分类信息
     * @param classfyVO
     */
    private  CodeClassifyVO getClassfy(ClassfyVO classfyVO,String libray) throws Throwable{
        CodeClassifyVO classifyVO = new CodeClassifyVO();
        try {
            String classCode = classfyVO.getClassCode();
            String className = classfyVO.getFullclsfNamePath();
            //根据分类代号查询分类信息
            if (StringUtils.isNotBlank(classfyVO.getClassCode())) {
                Map<String, String> conditionMap = new HashMap<>();
                List<CodeClassify> codeClassifyList = classifyService.selectByWrapper(Wrappers.<CodeClassify>query().lambda().eq(CodeClassify::getId, classCode));
                final CodeClassify[] newCodeClassify = {new CodeClassify()};
                if (!CollectionUtils.isEmpty(codeClassifyList)) {
                    codeClassifyList.stream().forEach(codeClassify -> {
                        CodeClassifyVO codeClassifyVO=  classifyService.getTopClassifyVO(codeClassify.getOid());
                        if(codeClassifyVO.getId().toUpperCase(Locale.ROOT).equals(libray.toUpperCase(Locale.ROOT))){
                            newCodeClassify[0] =codeClassify;
                        }
                    });
                    classifyVO = new CodeClassifyVO();
                    BeanUtilForVCI.copyPropertiesIgnoreCase(newCodeClassify[0], classifyVO);
                    //将DTO转换为DO
                    if(StringUtils.isBlank(classifyVO.getOid())){
                        throw new  Throwable("申请编码的分类:【"+classCode+"】不属于库节点【"+libray+"】,请检查参数分类节点/库节点信息是否匹配");
                    }
                }else{
                    throw new  Throwable("根据分类代号未查询到相应的分类信息");
                }
            } else {
                classifyVO = classifyService.getObjectByClsfNamePath(className.replace(separator, "/"));
                if(StringUtils.isBlank(classifyVO.getOid())){
                    throw new  Throwable("根据分类名称路径未查询到相应的分类信息");
                }
            }
        }catch (Throwable e){
            objerrorCode="100";
            log.error("获取分类信息失败:",e);
            e.printStackTrace();
            throw     new  Throwable("获取分类信息失败:"+e.getMessage());
        }
        return classifyVO;
    }
    public void getConfigDatas(String systemId,String libray, ApplyDatasVO applyDatasVO,List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrVOList,DataObjectVO dataObjectVO) throws Throwable {
 
        LinkedHashMap<String,LinkedHashMap<String,String>> dataKeyValueMap=new LinkedHashMap<>();
        //如果将数据转换成所需要的数据对象
        Map<String, String> attrMapConfigMap=new HashMap<>();
        Map<String, String> propMaps=new HashMap<>();
        log.info("开始读取系统配置文件 start");
        Map<String, String> stringStringMap=attributeMapConfig.getSystem_attrmap();
        log.info("集成系统属性映射配置文件条目数-》"+stringStringMap.size());
        if(!CollectionUtils.isEmpty(stringStringMap)) {
            List<LibraryClsfDO> libraryClsfDOList=new ArrayList<>();
            try {
                log.info("info:需要读取配置文件");
                LibraryDO libraryDO = gennerAttrMapUtil.getNewInstance().gennerAttrMapBySystem(systemId, stringStringMap);
                libraryClsfDOList = libraryDO.getClsf();
            } catch (Throwable e) {
                objerrorCode = "1";
                e.printStackTrace();
                log.error("集成系统标识为:【" + systemId + "】,分类库为:【" + libray + "】的集成属性配置文件读取失败",e);
                throw new Throwable("集成系统标识为:【" + systemId + "】,分类库为:【" + libray + "】的集成属性配置文件读取失败");
            }
            // String path = stringStringMap.get(systemId);
            // 忽略key大小写,获取配置的映射文件路径
            String path = VciBaseUtil.getMapStrValueIgnoreCase(stringStringMap,systemId);
            if (!CollectionUtils.isEmpty(libraryClsfDOList)) {
                Map<String, List<ClsfAttrMappingDO>> libPropMaps = libraryClsfDOList.stream().collect(Collectors.toMap(LibraryClsfDO::getLibrary, LibraryClsfDO::getProp, (key1, key2) -> key2));
                log.info("根据参数:libray:-》" + libray + "从配置文件中找对应属性映射配置");
                if (libPropMaps.containsKey(libray.toUpperCase(Locale.ROOT))) {
                    log.info("根据参数:libray:-》" + libray + "匹配到相应的属性映射信息");
                    List<ClsfAttrMappingDO> clsfAttrMappingDOList = libPropMaps.get(libray.toUpperCase(Locale.ROOT));
                    propMaps = clsfAttrMappingDOList.stream().collect(Collectors.toMap(ClsfAttrMappingDO::getSourceKey, ClsfAttrMappingDO::getTargetKey, (key1, key2) -> key2));
                    log.info("根据参数:libray:-》" + libray + "匹配到相应的属性映射信息,属性映射条目数+" + clsfAttrMappingDOList.size());
                } else {
                    objerrorCode = "1";
                    throw new Throwable("根据系统标识【" + systemId + "】找到对应的配置文件:【" + path + "】,但未获取到对应的库【" + libray + "】属性映射信息配置");
                }
            }else{
                objerrorCode = "1";
                throw new Throwable("根据系统标识【" + systemId + "】找到对应的配置文件:【" + path + "】,但未获取到对应的库【" + libray + "】属性映射信息配置");
            }
        }else{
            objerrorCode = "1";
            throw new Throwable("未获取到集成属性映射系统配置信息");
        }
        log.info("根据参数:libray:-》"+libray+"从配置文件中找对应属性映射配置 end ");
        LinkedList<String> rowNameList=new LinkedList<>();
        LinkedHashMap<String,Integer> filedIndexMap=new LinkedHashMap<>();
        //根据分类模板组织数据
        final int[] index = {0};
        try {
            //除去默认的属性.还有只有具有分类注入的才过滤出来
            codeClassifyTemplateAttrVOList = codeClassifyTemplateAttrVOList.stream().filter(
                s ->!DEFAULT_SYNC_ATTR_LIST.contains(s.getId()) &&
                    ((Func.isNotEmpty(s.getClassifyInvokeAttr()) || Func.isNotEmpty(s.getClassifyInvokeAttrName())) || VciBaseUtil.getBoolean(s.getFormDisplayFlag()))
            ).collect(Collectors.toList());
            codeClassifyTemplateAttrVOList.stream().forEach(codeClassifyTemplateAttrVO -> {
                String attrName = codeClassifyTemplateAttrVO.getName();
                String field = codeClassifyTemplateAttrVO.getId();
                rowNameList.add(attrName);
                filedIndexMap.put(field, index[0]++);
            });
            dataObjectVO.setColName(rowNameList);//放入属性
            attrMapConfigMap.putAll(propMaps);
            LinkedList<RowDatas> rowDataList = new LinkedList<>();
            List<ApplyDataVO> applyDataVOList=new ArrayList<>();
 
            if(!CollectionUtils.isEmpty(applyDatasVO.getObject())){
                applyDataVOList=applyDatasVO.getObject();
            }
            //Map<String, List<ProppertyVO>> dataPropMap = applyDataVOList.stream().collect(Collectors.toMap(ApplyDataVO::getId, ApplyDataVO::getProp, (key1, key2) -> key2));
            final int[] rowIndex = {0};
            applyDataVOList.stream().forEach(applyDataVO -> {
                rowIndex[0]++;
                RowDatas rowDatas = new RowDatas();
                rowDatas.setOid(applyDataVO.getId());
                rowDatas.setCreator(applyDataVO.getCreator());
                rowDatas.setEditor(applyDataVO.getEditor());
                rowDatas.setCode(applyDataVO.getCode());
                rowDatas.setOperation(applyDataVO.getOperate());
                rowDatas.setStatus(applyDataVO.getStatus());
                rowDatas.setRowIndex(rowIndex[0] + "");
                List<ProppertyVO> proppertyVOList = applyDataVO.getProp();
 
                LinkedHashMap<Integer, String> integerValueMap = new LinkedHashMap<>();
                Map<String, String> filedValueMap = new HashMap<>();
                if (!CollectionUtils.isEmpty(proppertyVOList)) {
                    Map<String, String> sourceKeyValueMap = proppertyVOList.stream().collect(Collectors.toMap(ProppertyVO::getKey, ProppertyVO::getValue, (key1, key2) -> key2));
                    Map<String, String> keyValueMap = new HashMap<>();
                    //判断attrMapConfigMap是否有值,如果没有则说明基础默认的是编码系统字段
                    if (!CollectionUtils.isEmpty(attrMapConfigMap)) {
                        sourceKeyValueMap.keySet().forEach(sourceKey -> {
                            String dataValue = sourceKeyValueMap.get(sourceKey);
                            if (attrMapConfigMap.containsKey(sourceKey)) {
                                String targetKey = attrMapConfigMap.get(sourceKey);
                                keyValueMap.put(targetKey, StringUtils.isBlank(dataValue)?"":dataValue);
                            }
                        });
                    } else {
                        sourceKeyValueMap.forEach((filed,value)->{
                            keyValueMap.put(filed,StringUtils.isBlank(value)?"":value) ;
                        });
                    }
 
                    filedIndexMap.forEach((attrKey, column) -> {
                        String keyValue = "";
                        if (keyValueMap.containsKey(attrKey)) {
                            keyValue =StringUtils.isBlank(keyValueMap.get(attrKey))?"":keyValueMap.get(attrKey);
                        }
                        integerValueMap.put(column, keyValue);
                        filedValueMap.put(attrKey, keyValue);
                    });
                }
                rowDatas.setData(integerValueMap);
                rowDatas.setFiledValue(filedValueMap);
                rowDataList.add(rowDatas);
            });
            dataObjectVO.setRowData(rowDataList);
        }catch (Throwable e){
            objerrorCode="1";
            e.printStackTrace();
            log.error("组织数据映射值失败",e);
            throw new   Throwable("组织数据映射值失败"+e);
        }
    }
    /*private void codeValueList(List<CodeBasicSecVO> secVOList,String codeseclengthfield ){
        if(StringUtils.isNotBlank(codeseclengthfield)) {
 
            String[] secLengths = codeseclengthfield.split("#");
            for (int i = 0; i < secLengths.length; i++) {
                CodeBasicSecVO secVO = secVOList.get(i);
                String thisSecValue = "";
                    *//*if(i == 0){
                        thisSecValue = seclenghStr.contains("#")?code.substring(0,VciBaseUtil.getInt(secLengths[i])):code;
                    } else if(i == secLengths.length-1){
                        //最后
                        thisSecValue =  seclenghStr.contains("#")?code.substring(VciBaseUtil.getInt(secLengths[i-1]),code.length()):code;
                    }else {*//*
                int start = 0;
                for (int j = 0; j < i; j++) {
                    start += VciBaseUtil.getInt(secLengths[j]);
                }
                thisSecValue = code.substring(start, start + VciBaseUtil.getInt(secLengths[i]));
                //    }
                if (VciBaseUtil.getBoolean(secVO.getSerialDependFlag())) {
                    serialUnitList.add(thisSecValue);
                    serialSecOidIndexMap.put(secVO.getOid(), i);
                }
                if (CODE_SERIAL_SEC.getValue().equalsIgnoreCase(secVO.getSecType())) {
                    serialValueMap.put(secVO.getOid(), thisSecValue);
                }
                codeValueList.add(thisSecValue);
            }
        }else{
 
        }
    }*/
    /***
     * 校验是否做了配置
     * @param systemId,系统标识
     * @param type:接口类型
     * @param operationType:接口操作类型
     * @return
     */
    private DockingSystemConfig  checkIspass(String systemId,String type,String operationType,String classOid){
        log.info("systemId:"+systemId+",type:"+SysIntegrationDataFlowTypeEnum.getTextByValue(type)+",operationType:"+sysIntegrationPushTypeEnum.getTextByValue(operationType)+",classOid:"+classOid);
        //CodeClassifyVO codeClassifyVO= classifyService.getObjectByOid(classOid);
        List<CodeClassify> codeClassifyList=  classifyService.selectAllLevelParentByOid(classOid);
        List<String> classifyOids=new ArrayList<>();
        if(!CollectionUtils.isEmpty(codeClassifyList)) {
            classifyOids = codeClassifyList.stream().map(CodeClassify::getOid).collect(Collectors.toList());
        }else{
            return null;
        }
        //classOid=codeClassifyVO.getOid();
        //根据类型去查询需要集成的分类或者数据
        LambdaQueryWrapper<DockingSystemConfig> queryWrapper = Wrappers.<DockingSystemConfig>lambdaQuery();
        queryWrapper.eq(DockingSystemConfig::getUsedFlag, MdmDuckingConstant.SEND_FLAG_TRUE);
        queryWrapper.eq(DockingSystemConfig::getSysBaseId,systemId);
        queryWrapper.eq(DockingSystemConfig::getDataFlowType,type);
        queryWrapper.eq(DockingSystemConfig::getPushType,operationType);
        if(StringUtils.isNotBlank(classOid)){
            queryWrapper.in(DockingSystemConfig::getClassifyOid,classifyOids);
        }
        List<DockingSystemConfig> dockingSystemConfigList=new ArrayList<>();
        dockingSystemConfigList=    dockingSystemConfigList=dockingSystemConfigService.list(queryWrapper);
        if(!CollectionUtils.isEmpty(dockingSystemConfigList)){
            return    dockingSystemConfigList.get(0);
        }else{
            return null;
        }
    }
    /***
     * 记录日志信息
     * @param systemId
     * @param parmaData
     * @param result
     * @return
     */
    private  void saveLogs(String systemId,String systemName,String parmaData, String result,boolean isSucess,String msg,String operation){
        //记录日志信息
        DockingLog dockingLoge=new DockingLog();
        //String oid=redisService.getUUIDEveryDay();
        dockingLoge.setSystemCode(StringUtils.isBlank(systemId)?"-":systemId);//设置系统标识
        dockingLoge.setSystemName(StringUtils.isBlank(systemName)?"-":systemName);
        dockingLoge.setMsg(msg);//日志消息
        dockingLoge.setClassifyId("-");//分类编号
        dockingLoge.setClassifyName("-");//分类名称
        dockingLoge.setClassifyOid("-");//分类主键
        dockingLoge.setUniqueCode("-");//唯一标识
        dockingLoge.setSystemOid("-");//系统标识
//        dockingLogeDO.setName(operation);
        //dockingLogeDO.setOid(oid);//日志主键
        dockingLoge.setParamString(parmaData);//参数信息
        dockingLoge.setReturnString(result);//返回信息
        dockingLoge.setType(operation);//日志操作类型
        dockingLoge.setCreateTime(new Date());
        if(isSucess) {
            dockingLoge.setInterfaceStatus("true");//接口集成状态
        }else{
            dockingLoge.setInterfaceStatus("false");//接口集成状态
        }
        dockingLogeService.save(dockingLoge);
        log.info("集成推送数据,systemId:"+systemId+",systemname:"+systemName+",operation:"+operation+",param:"+parmaData);
    }
 
    /***
     * 属性类型转换
     * @param vaule
     * @return
     */
    private String objectToStr(Object vaule) {
        String newValue="";
        if(vaule ==null||"".equals(vaule)||vaule==""){
            return "";
        }
        try {
            if (vaule instanceof Integer) {
                Integer intValue = (Integer) vaule;
                newValue = String.valueOf(intValue);
            } else if (vaule instanceof Boolean) {
                boolean boolValue = (Boolean) vaule;
                newValue = Boolean.toString(boolValue);
            } else if (vaule instanceof Timestamp) {
                Timestamp timestampValue = (Timestamp) vaule;
                newValue = timestamp2Str(timestampValue);
            } else if (vaule instanceof Date) {
                Date dataValue = (Date) vaule;
                newValue = date2Str(dataValue, "yyyy-MM-dd HH:mm:ss");
            } else {
                return vaule.toString();
            }
        }catch (Throwable e){
            log.error("属性类型转换错误",e);
        }
        return newValue;
    }
 
    private String date2Str(Date date, String format) {
        if (null == date) {
            return null;
        } else {
            if (format == null || format.trim().length() == 0) {
                format = "yyyy-MM-dd HH:mm:ss.SSS";
            }
 
            SimpleDateFormat sdf = new SimpleDateFormat(format);
            return sdf.format(date);
        }
    }
 
    private  String timestamp2Str(Timestamp time) {
        Date date = null;
        if (null == time) {
            return null;
        } else {
            if (null != time) {
                date = new Date(time.getTime());
            }
 
            return date2Str(date, "yyyy-MM-dd HH:mm:ss.SSS");
        }
    }
}