ludc
2024-10-15 aecacfb404d19749260189ab1d4ee90efc92ae24
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
package com.vci.web.controller;
 
import com.vci.corba.common.PLException;
import com.vci.corba.omd.btm.BizType;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.dto.OsBtmTypeDTO;
import com.vci.model.IndexObject;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.annotation.log.VciBusinessLog;
import com.vci.starter.web.enumpck.BooleanEnum;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.Tree;
import com.vci.starter.web.util.BeanUtil;
import com.vci.starter.web.util.ControllerUtil;
import com.vci.starter.web.util.LangBaseUtil;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.pagemodel.OsBtmTypeAttributeVO;
import com.vci.pagemodel.OsBtmTypeVO;
import com.vci.pagemodel.OsERVO;
import com.vci.web.service.OsAttributeServiceI;
import com.vci.web.service.OsBtmServiceI;
import com.vci.web.service.OsLinkTypeServiceI;
import com.vci.web.service.WebBtmIOServiceI;
import feign.Param;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
 
import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST;
 
/**
 * 业务类型的控制器
 * @author weidy
 * @date 2021/8/23
 */
@RequestMapping("/btmTypeController")
@VciBusinessLog(modelName="业务类型")
@RestController
public class WebBtmTypeController {
 
    /**
     * 日志
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
 
    /**
     * 业务类型的服务
     */
    @Autowired
    private OsBtmServiceI btmService;
 
    /**
     * 连接类型的服务
     */
    @Autowired
    private OsLinkTypeServiceI linkTypeService;
 
    /**
     * 业务类型导入导出服务
     */
    @Autowired
    private WebBtmIOServiceI btmIOService;
 
    /**
     * 属性的服务
     */
    @Lazy
    @Autowired(required = false)
    private OsAttributeServiceI attributeService;
 
    /**
     * 业务类型列表
     * @param baseQueryObject 查询条件
     * @return 列表的内容
     */
    @GetMapping( "/gridBtmType")
    @VciBusinessLog(operateName = "业务类型列表")
    public DataGrid<OsBtmTypeVO> gridBtmType(BaseQueryObject baseQueryObject){
        return btmService.referDataGrid(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
    }
 
    /**
     * 获取名字以filter开始的业务类型(for 查询),主要用于属性池的业务类型选择对话框
     * @param btmName 查询条件
     * @return 列表的内容
     */
    @GetMapping( "/getBizTypes")
    @VciBusinessLog(operateName = "业务类型列表(主要用于对话框使用)")
    public BaseResult getBizTypes(String btmName){
        try {
            return BaseResult.dataList(Arrays.asList(btmService.getBizTypes(btmName)));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "获取业务类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 获取所有业务类型(树形结构)
     * @return 查询结果
     */
    @GetMapping( "/getTreeBizTypes")
    @VciBusinessLog(operateName = "获取所有业务类型(树形结构)")
    public BaseResult<List<Tree>> getTreeBizTypes(){
        try {
            return BaseResult.dataList(btmService.getTreeBizTypes());
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "查询业务类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 获取业务类型使用范围
     * @param btmName
     * @return 查询结果
     */
    @GetMapping( "/getUsedBtmLinkList")
    @VciBusinessLog(operateName = "获取业务类型使用范围")
    public BaseResult<List<String>> getUsedBtmLinkList(String btmName){
        try {
            return BaseResult.dataList(linkTypeService.getUsedBtmLinkList(btmName));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "获取业务类型使用范围时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 创建业务类型
     * btmTypeDTO 链接类型的保存对象
     * @return 保存结果
     */
    @PostMapping("/addBtmType")
    public BaseResult addBtmType(@RequestBody OsBtmTypeDTO btmTypeDTO){
        try {
            return btmService.addBtmType(btmTypeDTO) ? BaseResult.success("业务类型创建成功!"):BaseResult.fail("业务类型创建失败!");
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "创建业务类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 批量创建业务类型
     * btmTypeDTO 链接类型的保存对象
     * @return 保存结果
     */
    /*@PostMapping("/addBtmTypes")
    public BaseResult addBtmTypes(@RequestBody List<BizType> bizTypes){
        try {
            return btmService.addBtmTypes(bizTypes) ? BaseResult.success("业务类型批量创建成功!"):BaseResult.fail("业务类型批量创建失败!");
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "批量创建业务类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }*/
 
    /**
     * 修改业务类型
     * btmTypeDTO 链接类型修改的对象
     * @return 保存结果
     */
    @PutMapping("/updateBtmType")
    public BaseResult updateBtmType(@RequestBody OsBtmTypeDTO btmTypeDTO){
        try {
            return btmService.updateBtmType(btmTypeDTO) ? BaseResult.success("业务类型修改成功!"):BaseResult.fail("业务类型修改失败!");
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "修改业务类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 业务类型删除
     * btmTypeDTO 业务类型对象
     * @return 删除结果
     */
    @DeleteMapping("/deleteBtmType")
    public BaseResult deleteLink(@RequestBody OsBtmTypeDTO btmTypeDTO){
        try {
            return btmService.deleteBtmType(btmTypeDTO) ? BaseResult.success("删除业务类型成功!"):BaseResult.fail("删除业务类型失败!");
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = "删除业务类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 一致性检查
     * @return 检查结果
     */
    @GetMapping("/checkBtmConsistency")
    public BaseResult checkBtmConsistency(){
        try {
            return btmService.checkBtmConsistency();
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = "业务类型一致性检查时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 一致性检查,业务类型修复
     * @return 删除结果
     */
    @PostMapping("/executeRepair")
    public BaseResult executeRepair(@RequestBody String repairData){
        try {
            return btmService.executeRepair(repairData);
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "业务类型修复时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 创建视图
     * @return
     */
    @PostMapping("/createView")
    public BaseResult createView(){
        try {
            return btmService.createView() ? BaseResult.success("创建视图成功!"):BaseResult.fail("创建视图失败!");
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "创建视图时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 删除数据界面的数据查询
     * @return
     */
    @GetMapping("/getObjectData")
    public BaseResult getObjectData(){
        try {
            return btmService.getObjectData();
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "数据对象查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 删除数据
     * @param btmNames 业务类型名
     * @param linkNames 链接类型名
     * @return
     * @throws PLException
     */
    @DeleteMapping("/truncateTable")
    public BaseResult truncateTable(String[] btmNames,String[] linkNames){
        try {
            return BaseResult.dataList(btmService.truncateTable(btmNames,linkNames));
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "删除数据时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 删除全部类型
     * @return
     * @throws PLException
     */
    @DeleteMapping("/deleteAllType")
    public BaseResult deleteAllType(){
        try {
            return BaseResult.dataList(btmService.deleteAllType());
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "删除全部类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 获取当前业务类型下的索引
     * @return
     * @throws PLException
     */
    @GetMapping("/getIndexByCondition")
    public BaseResult getIndexByCondition(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataList(btmService.getIndexByCondition(baseQueryObject.getConditionMap()));
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "查询当前业务类型下的索引时时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 创建索引
     * @param indexObjectList
     * @return
     */
    @PostMapping("/addIndex")
    public BaseResult addIndex(@RequestBody List<IndexObject> indexObjectList){
        try {
            return btmService.addIndex(indexObjectList) ? BaseResult.success("创建索引成功!"):BaseResult.fail("创建索引失败!");
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "创建索引时时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 删除索引
     * @param btmName
     * @param indexName
     * @return
     */
    @DeleteMapping("/delIndex")
    public BaseResult delIndex(String btmName,String indexName){
        try {
            return btmService.delIndex(btmName,indexName) ? BaseResult.success("删除索引成功!"):BaseResult.fail("删除索引失败!");
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "删除索引时时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 导出业务类型
     * name 链接类型名称
     * @return
     */
    @GetMapping("/expData")
    public void expData(String name,HttpServletResponse response) throws PLException, IOException {
        btmService.expData(name, response);
    }
 
    /**
     * 导入业务类型
     * @param file 上传的文件
     * @return
     */
    @PostMapping("/impData")
    public BaseResult impData(MultipartFile file){try {
        return btmService.impData(file);
    }catch (Throwable e) {
        throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
    }
    }
 
    /**
     * 获取业务类型包含的属性全部为小写
     * @param btmId 业务类型名称
     * @return 属性的信息
     */
    @GetMapping(value = "/getAllAttributesByBtmId")
    @VciBusinessLog(operateName = "查看业务类型的属性")
    public BaseResult<List<OsBtmTypeAttributeVO>> getAllAttributesByBtmId(String btmId){
        List<OsBtmTypeAttributeVO> osBtmTypeAttributeVOS = null;
        try {
            osBtmTypeAttributeVOS = btmService.listAttributeByBtmIdHasDefault(btmId);
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            throw new VciBaseException(exceptionMessage);
        }
        return BaseResult.dataList(osBtmTypeAttributeVOS);
    }
 
    /**
     * 获取业务全部属性类型
     * @param btmName 业务类型名称
     * @return 属性的信息
     */
    @GetMapping(value = "/getBizTypeQTDs")
    @VciBusinessLog(operateName = "查看业务类型的属性")
    public BaseResult<List<OsBtmTypeAttributeVO>> getBizTypeQTDs(String btmName){
        try {
            List<OsBtmTypeAttributeVO> osBtmTypeAttributeVOS = btmService.getBizTypeQTDs(btmName);
            return BaseResult.dataList(osBtmTypeAttributeVOS);
        } catch (PLException e) {
            BaseResult objectBaseResult = new BaseResult<>();
            objectBaseResult.setCode(Integer.parseInt(e.code));
            objectBaseResult.setMsg(Arrays.toString(e.messages));
            return objectBaseResult;
        } catch (ParseException e) {
            BaseResult objectBaseResult = new BaseResult<>();
            objectBaseResult.setCode(500);
            objectBaseResult.setMsg(e.getMessage());
            return objectBaseResult;
        }
    }
 
    /**
     * 参照的业务类型
     * @param baseQueryObject 查询条件
     * @return 列表的内容
     */
    @GetMapping( "/referDataGrid")
    @VciBusinessLog(operateName = "参照业务类型")
    public DataGrid<OsBtmTypeVO> referDataGrid(BaseQueryObject baseQueryObject){
        return btmService.referDataGrid(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
    }
 
    /**
     * 获取业务类型包含的属性,不分页
     * @param baseQueryObject 查询对象
     * @return 属性的信息
     */
    @GetMapping(value = "/gridAttributesByBtmId")
    @VciBusinessLog(operateName = "查看业务类型的属性")
    public DataGrid<OsBtmTypeAttributeVO> gridAttributesByBtmId(BaseQueryObject baseQueryObject){
        String btmTypeId = baseQueryObject.getConditionMap().containsKey("btmTypeId")?baseQueryObject.getConditionMap().get("btmTypeId"):"";
        if(StringUtils.isBlank(btmTypeId)){
            return new DataGrid<OsBtmTypeAttributeVO>();
        }
        String hasDefaultAttr = baseQueryObject.getConditionMap().getOrDefault("hasDefaultAttr","false");
        String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):"";
        String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : "";
        List<OsBtmTypeAttributeVO> boAttrs = null;
        try {
            boAttrs = btmService.listAttributeByBtmId(btmTypeId);
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            throw new VciBaseException(exceptionMessage);
        }
        if(boAttrs == null){
            boAttrs = new ArrayList<>();
        }
        if(BooleanEnum.TRUE.getValue().equalsIgnoreCase(hasDefaultAttr)){
            //加默认的属性
            List<OsBtmTypeAttributeVO> finalBoAttrs = boAttrs;
            attributeService.getDefaultAttributeVOs().stream().forEach(attr->{
                OsBtmTypeAttributeVO attributeVO = new OsBtmTypeAttributeVO();
                BeanUtil.convert(attr,attributeVO);
                attributeVO.setAttributeLength(attr.getAttrLength());
                attributeVO.setAttributeDataType(attr.getAttributeDataType());
                attributeVO.setReferBtmTypeId(attr.getBtmTypeId());
                attributeVO.setReferBtmTypeName(attr.getBtmTypeName());
                finalBoAttrs.add(attributeVO);
            });
            boAttrs = finalBoAttrs;
        }
        List<OsBtmTypeAttributeVO> attrList = boAttrs.stream().filter(s->{
            boolean usedFlag = true;
            if(StringUtils.isNotBlank(attrId) && !s.getId().contains(attrId.replace("*",""))){
                usedFlag = false;
            }
            if(StringUtils.isNotBlank(attrName) && !s.getName().contains(attrName.replace("*",""))){
                usedFlag = false;
            }
            return usedFlag;
        }).collect(Collectors.toList());
        DataGrid<OsBtmTypeAttributeVO> dataGrid = new DataGrid<OsBtmTypeAttributeVO>();
        dataGrid.setTotal(attrList.size());;
        dataGrid.setData(attrList);
        return dataGrid;
    }
 
    /**
     * 使用主键获取业务类型包含的属性,不分页
     * @param baseQueryObject 查询对象
     * @return 属性的信息
     */
    @GetMapping(value = "/gridAttributeByBtmTypeOid")
    @VciBusinessLog(operateName = "使用业务类型主键查看包含的属性")
    public DataGrid<OsBtmTypeAttributeVO> gridAttributesByBtmTypeOid(String btmTypeOid,BaseQueryObject baseQueryObject){
        if(StringUtils.isBlank(btmTypeOid)){
            return new DataGrid<OsBtmTypeAttributeVO>();
        }
        String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):"";
        String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : "";
        OsBtmTypeVO btmTypeVO = btmService.selectByOid(btmTypeOid);
        List<OsBtmTypeAttributeVO> boAttrs = null;
        try {
            boAttrs = btmService.listAttributeByBtmId(btmTypeVO.getId());
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            throw new VciBaseException(exceptionMessage);
        }
        List<OsBtmTypeAttributeVO> attrList = boAttrs.stream().filter(s->{
            boolean usedFlag = true;
            if(StringUtils.isNotBlank(attrId) && !s.getId().contains(attrId)){
                usedFlag = false;
            }
            if(StringUtils.isNotBlank(attrName) && !s.getName().contains(attrName)){
                usedFlag = false;
            }
            return usedFlag;
        }).collect(Collectors.toList());
        DataGrid<OsBtmTypeAttributeVO> dataGrid = new DataGrid<OsBtmTypeAttributeVO>();
        dataGrid.setTotal(attrList.size());;
        dataGrid.setData(attrList);
        return dataGrid;
    }
 
    /**
     * 使用主键获取业务类型的对象
     * @param oid 主键
     * @return 业务类型的对象
     */
    @GetMapping("/getBtmTypeByOid")
    public BaseResult<OsBtmTypeVO> getBtmTypeByOid(String oid){
        OsBtmTypeVO btmTypeVO = btmService.selectByOid(oid);
        if(btmTypeVO == null){
            return BaseResult.fail(DATA_OID_NOT_EXIST);
        }
        return BaseResult.success(btmTypeVO);
    }
 
    /**
     * 导出业务类型的信息到word中
     * @param btmTypeIds 业务类型的编号,用逗号分割
     * @param response 响应对象
     * @return 执行结果
     */
    @PostMapping("/exportBtmType2Word")
    @VciBusinessLog(operateName = "导出业务类型到word中")
    public void exportDataBaseToWord(String btmTypeIds, HttpServletResponse response) throws FileNotFoundException, VciBaseException {
        String exportWordFileName = btmIOService.exportBtmTypesToWord(VciBaseUtil.str2List(btmTypeIds));
        if(StringUtils.isNotBlank(exportWordFileName)){
            try {
                ControllerUtil.writeFileToResponse(response, exportWordFileName);
            }catch (FileNotFoundException e){
                try {
                    ControllerUtil.writeDataToResponse(response,LangBaseUtil.getErrorMsg(e).getBytes(StandardCharsets.UTF_8),null);
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            } catch (IOException e) {
                try {
                    ControllerUtil.writeDataToResponse(response,LangBaseUtil.getErrorMsg(e).getBytes(StandardCharsets.UTF_8),null);
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            }
        }
    }
 
    /**
     * 导出数据库的表信息到excel
     * @param response 响应对象
     * @param btmTypeIds 业务类型的编号,用逗号分割
     */
    @PostMapping("/exportBtmType2Excel")
    @VciBusinessLog(operateName = "导出业务类型到excel中")
    public void exportAllTableToExcel(String btmTypeIds,HttpServletResponse response){
        String excelFileName = btmIOService.exportBtmTypesToExcel(VciBaseUtil.str2List(btmTypeIds));
        try {
            ControllerUtil.writeFileToResponse(response,excelFileName);
        } catch (IOException e) {
            try {
                ControllerUtil.writeDataToResponse(response,LangBaseUtil.getErrorMsg(e).getBytes(StandardCharsets.UTF_8),null);
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
 
    /**
     * 根据业务类型生成业务类型使用的ER图
     * @param id 业务类型ID
     * @return 执行结果
     */
    @GetMapping("/createERDiagram")
    public BaseResult createERDiagram(String id){
        OsERVO osERVO = btmService.createERDiagram(id);
        return BaseResult.success(osERVO);
    }
 
    /**
     * 获取使用这个业务类型的E-R图
     * @param id 业务类型编号
     * @return 执行结果
     */
    @GetMapping("/createERUsed")
    public BaseResult createERUsed(String id){
        return BaseResult.success(btmService.createERUsed(id));
    }
 
}