ludc
2024-07-26 696c68a9f7645bc35a9382a4e2271910b222f7b5
状态池列表查询、查看应用范围接口上传
已修改11个文件
227 ■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsStatusDTO.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsStatusVO.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsStatusDTO.java
@@ -33,10 +33,75 @@
    private String description;
    /**
     * 图片路径
     */
    public String imagePath;
    /**
     * 创建人
     */
    private String creator;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 最后修改人
     */
    private String lastModifier;
    /**
     * 最后修改时间,格式是yyyy-MM-dd HH:mm:ss
     */
    private Date lastModifyTime;
    /**
     * 时间戳,用于校验是否最新数据
     */
    private Date ts;
    public void setCreator(String creator) {
        this.creator = creator;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public void setLastModifier(String lastModifier) {
        this.lastModifier = lastModifier;
    }
    public void setLastModifyTime(Date lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public String getLastModifier() {
        return lastModifier;
    }
    public Date getLastModifyTime() {
        return lastModifyTime;
    }
    public String getCreator() {
        return creator;
    }
    public String getImagePath() {
        return imagePath;
    }
    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }
    public String getOid() {
        return oid;
    }
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsStatusVO.java
@@ -36,6 +36,11 @@
    private String description;
    /**
     * 图片路径
     */
    public String imagePath;
    /**
     * 业务类型名称
     */
    private String btmname;
@@ -70,6 +75,14 @@
     */
    private Date ts;
    public String getImagePath() {
        return imagePath;
    }
    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }
    public String getOid() {
        return oid;
    }
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
@@ -117,7 +117,7 @@
    /**
     * 必填列
     */
    private ArrayList<Integer> ColumnNameisRed = new ArrayList<Integer>();
    private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
    /**
     * 用户分页查询时获取部门放到这里避免重复查询
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
@@ -52,7 +52,7 @@
     * @return 属性的显示对象
     */
    @GetMapping("/gridAttribute")
    @VciUnCheckRight
    @VciBusinessLog(operateName = "属性列表")
    public BaseResult<OsAttributeVO> gridAttribute(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(attributeService.gridAttribute(baseQueryObject));
@@ -107,7 +107,6 @@
     */
    @PutMapping( "/updateAttribute")
    @VciBusinessLog(operateName = "修改属性")
    @VciUnCheckRight
    public BaseResult updateAttribute(@RequestBody OsAttributeDTO osAttributeDTO) {
        try {
            return attributeService.updateAttribute(osAttributeDTO) ? BaseResult.success("属性修改成功!"):BaseResult.fail("属性修改失败!");
@@ -208,7 +207,7 @@
     * @return
     */
    @PostMapping("/importAttributes")
    @VciUnCheckRight
    @VciBusinessLog(operateName = "导入属性")
    public BaseResult importAttributes(MultipartFile file){
        String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
        File file1 = new File(excelFileName);
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java
@@ -1,5 +1,6 @@
package com.vci.web.controller;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.annotation.log.VciBusinessLog;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
@@ -7,8 +8,11 @@
import com.vci.dto.OsStatusDTO;
import com.vci.pagemodel.OsLifeCycleVO;
import com.vci.pagemodel.OsStatusVO;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsLifeCycleServiceI;
import com.vci.web.service.OsStatusServiceI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -35,14 +39,27 @@
    private OsLifeCycleServiceI lifeCycleService;
    /**
     * 日志
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    /**
     * 状态的列表
     * @param queryObject 查询对象
     * @return 显示对象
     */
    @GetMapping("/gridStatus")
    @VciBusinessLog(operateName = "查看状态列表")
    public DataGrid<OsStatusVO> gridStatus(BaseQueryObject queryObject){
        return statusService.gridStatus(queryObject.getConditionMap(),queryObject.getPageHelper());
    @VciUnCheckRight
    public BaseResult<OsStatusVO> gridStatus(BaseQueryObject queryObject){
        try {
            return BaseResult.dataGrid(statusService.gridStatus(queryObject.getConditionMap(),queryObject.getPageHelper()));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "属性管理列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
@@ -51,8 +68,17 @@
     * @return 使用的生命周期的对象
     */
    @GetMapping("/listUsed")
    public DataGrid<OsLifeCycleVO> listUsed(String oid){
        return lifeCycleService.listStatusUsed(oid);
    @VciBusinessLog(operateName = "查询状态池的应用范围")
    @VciUnCheckRight
    public BaseResult<OsLifeCycleVO> listUsed(String oid){
        try {
            return BaseResult.dataGrid(lifeCycleService.listStatusUsed(oid));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "属性管理列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
@@ -61,9 +87,16 @@
     * @return 执行结果
     */
    @PostMapping("/addSave")
    public BaseResult addSave(OsStatusDTO statusDTO){
        statusService.addSave(statusDTO);
        return BaseResult.success();
    @VciUnCheckRight
    public BaseResult addSave(@RequestBody OsStatusDTO statusDTO){
        try {
            return statusService.addSave(statusDTO) ? BaseResult.success("添加状态成功!"):BaseResult.fail("添加状态失败!");
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "添加状态时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
@@ -72,9 +105,15 @@
     * @return 执行结果
     */
    @PutMapping("/editSave")
    public BaseResult editSave(OsStatusDTO statusDTO){
        statusService.editSave(statusDTO);
        return BaseResult.success();
    public BaseResult editSave(@RequestBody OsStatusDTO statusDTO){
        try {
            return statusService.editSave(statusDTO) ? BaseResult.success("修改状态成功!"):BaseResult.fail("修改状态失败!");
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "修改状态时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java
@@ -54,13 +54,13 @@
     * 批量添加状态
     * @param statePoolList 状态内容
     */
    void batchAddStatus(List<StatePool> statePoolList);
    boolean batchAddStatus(List<StatePool> statePoolList) throws Exception;
    /**
     * 批量修改状态
     * @param statePoolList 状态内容
     */
    void batchEditSave(List<StatePool> statePoolList);
    boolean batchEditSave(List<StatePool> statePoolList) throws Exception;
    /**
     * 状态列表
@@ -88,19 +88,19 @@
     * 添加状态
     * @param statusDTO 状态的数据传输对象
     */
    void addSave(OsStatusDTO statusDTO);
    boolean addSave(OsStatusDTO statusDTO) throws Exception;
    /**
     * 编辑状态
     * @param statusDTO 状态的数据传输对象
     */
    void editSave(OsStatusDTO statusDTO);
    boolean editSave(OsStatusDTO statusDTO)throws Exception ;
    /**
     * 删除状态
     * @param oids 主键
     */
    void delete(String oids);
    boolean delete(String oids);
    /**
     * 状态的数据传输对象转换为数据对象
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -511,7 +511,7 @@
        if(hasInstance && !compatible){
            throw new PLException("500",new String[]{"无效变更, 不兼容已产生的数据!"});
        }
        String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        osAttributeDTO.setLastModifier(userId);
        osAttributeDTO.setCreator(osAttributeVO.getCreator());
        osAttributeDTO.setCreateTime(osAttributeVO.getCreateTime());
@@ -557,9 +557,9 @@
            attributeDef.rage = osAttributeDTO.getRange().replace("<","&lt;");
        }
        attributeDef.ts = Func.format((Func.isNotEmpty(osAttributeDTO.getTs()) ? osAttributeDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat);
        attributeDef.creator = "developer";//Func.isBlank(osAttributeDTO.getCreator()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getCreator();
        attributeDef.creator = Func.isBlank(osAttributeDTO.getCreator()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getCreator();
        attributeDef.createTime = Func.isEmpty(osAttributeDTO.getCreateTime()) ? System.currentTimeMillis():osAttributeDTO.getCreateTime().getTime();
        attributeDef.modifier = "developer";//Func.isBlank(osAttributeDTO.getLastModifier()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getLastModifier();
        attributeDef.modifier = Func.isBlank(osAttributeDTO.getLastModifier()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getLastModifier();
        attributeDef.modifyTime = System.currentTimeMillis();
        //other需要自行处理
        StringBuffer sb = new StringBuffer();
@@ -1045,7 +1045,7 @@
                    }
                } catch (PLException e) {
                    e.printStackTrace();
                    throw new VciBaseException("执行保存时出现错误,错误属性对象名为:【" + dto.getId() + "】,原因:"+e.getMessage());
                    throw new VciBaseException("执行保存时出现错误,错误属性对象名为:【" + dto.getId() + "】,原因:"+VciBaseUtil.getExceptionMessage(e));
                }
            });
        }catch (Exception e){
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
@@ -392,7 +392,7 @@
        //界面没传名称,使用默认导出名称
        exportFileName = Func.isBlank(exportFileName) ?  "枚举类型导出_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
        //设置列名
        List<String> columns = new ArrayList<>(Arrays.asList("枚举名称", "标签", "返回类型", "长度", "枚举项名称", "枚举值", "描述"));
        List<String> columns = new ArrayList<>(Arrays.asList("枚举名称", "标签", "返回类型", "长度","创建时间", "枚举项名称", "枚举值", "描述"));
        //写excel
        String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName +  ".xls";
@@ -433,9 +433,9 @@
                //处理枚举项写入
                for (int j = 0; j < enumVOItems.size(); j++) {
                    OsEnumItemVO osEnumItemVO = enumVOItems.get(j);
                    excelDataList.add(new WriteExcelData(startRow+j,7, true,osEnumItemVO.getName()));
                    excelDataList.add(new WriteExcelData(startRow+j,8, true, osEnumItemVO.getValue()));
                    excelDataList.add(new WriteExcelData(startRow+j,9, true, osEnumItemVO.getDescription()));
                    excelDataList.add(new WriteExcelData(startRow+j,5, true,osEnumItemVO.getName()));
                    excelDataList.add(new WriteExcelData(startRow+j,6, true, osEnumItemVO.getValue()));
                    excelDataList.add(new WriteExcelData(startRow+j,7, true, osEnumItemVO.getDescription()));
                }
                startRow += enumVOItems.size();
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java
@@ -483,7 +483,7 @@
    }
    /**
     * 状态在生命周期中使用的勤快
     * 状态在生命周期中使用的范围
     *
     * @param statusOid 状态的主键
     * @return 生命周期的信息
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java
@@ -13,9 +13,11 @@
import com.vci.dto.OsStatusDTO;
import com.vci.model.OsStatusDO;
import com.vci.pagemodel.OsStatusVO;
import com.vci.starter.web.util.WebThreadLocalUtil;
import com.vci.web.service.OsLifeCycleServiceI;
import com.vci.web.service.OsStatusServiceI;
import com.vci.web.service.WebBoServiceI;
import com.vci.web.util.Func;
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
@@ -26,6 +28,7 @@
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.swing.*;
import java.util.*;
import java.util.stream.Collectors;
@@ -78,11 +81,12 @@
     * @return 显示对象
     */
    @Override
    public OsStatusVO statusDO2VO(com.vci.corba.omd.stm.StatePool statePool) {
    public OsStatusVO statusDO2VO(StatePool statePool) {
        OsStatusVO statusVO = new OsStatusVO();
        if(statePool!=null){
            statusVO.setOid(statePool.oid);
            statusVO.setCreator(statePool.creator);
            statusVO.setImagePath(statePool.imagePath);
            statusVO.setLastModifier(statePool.modifier);
            try {
                statusVO.setCreateTime(new Date(statePool.createTime));
@@ -105,7 +109,7 @@
     * @return 显示对象
     */
    @Override
    public List<OsStatusVO> statusDO2VOs(Collection<com.vci.corba.omd.stm.StatePool> statePools) {
    public List<OsStatusVO> statusDO2VOs(Collection<StatePool> statePools) {
        List<OsStatusVO> statusVOS = new ArrayList<>();
        if(!CollectionUtils.isEmpty(statePools)){
            statePools.stream().forEach(statePool -> {
@@ -169,7 +173,7 @@
     * @param statePoolList 状态内容
     */
    @Override
    public void batchAddStatus(List<StatePool> statePoolList) {
    public boolean batchAddStatus(List<StatePool> statePoolList) throws Exception{
        if(!CollectionUtils.isEmpty(statePoolList)){
            for(StatePool statePool : statePoolList) {
                try {
@@ -179,6 +183,7 @@
                }
            }
        }
        return true;
    }
    /**
@@ -186,7 +191,7 @@
     * @param statePoolList 状态内容
     */
    @Override
    public void batchEditSave(List<StatePool> statePoolList) {
    public boolean batchEditSave(List<StatePool> statePoolList) {
        if(!CollectionUtils.isEmpty(statePoolList)){
            for(StatePool statePool : statePoolList) {
                try {
@@ -196,6 +201,7 @@
                }
            }
        }
        return true;
    }
    /**
@@ -255,26 +261,46 @@
     * @param statusDTO 状态的数据传输对象
     */
    @Override
    public void addSave(OsStatusDTO statusDTO) {
        VciBaseUtil.alertNotNull(statusDTO,"状态的信息",statusDTO.getId(),"状态的英文名称",statusDTO.getName(),"状态的中文名称");
    public boolean addSave(OsStatusDTO statusDTO) throws Exception {
        VciBaseUtil.alertNotNull(
            statusDTO,"状态的信息",
            statusDTO.getId(),"状态的英文名称",
            statusDTO.getName(),"状态的中文名称"
        );
        StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getName());
        if (Func.isNotEmpty(dbStatePool) || Func.isNotBlank(dbStatePool.oid)) {
            throw new PLException("500",new String[]{"名称重复请更换名称!"});
        }
        // 状态池名称只能为英文字母
        String regex = "[a-z A-Z]*";
        if ((!dbStatePool.name.matches(regex))) {
            throw new PLException("500",new String[]{"名称只能为英文!"});
        }
        //虽然会自动生成oid,但是这儿设置主键,避免放入缓存的数据是没有oid的
        statusDTO.setOid(VciBaseUtil.getPk());
        StatePool pool = statusDTO2DO(statusDTO);
        List<StatePool> poolList = new ArrayList<>();
        poolList.add(pool);
        batchAddStatus(poolList);
        clearCache();
        //clearCache();
        self.selectAllStatusMap();
        return true;
    }
    /**
     * 编辑状态
     * @param statusDTO 状态的数据传输对象
     */
    @Override
    public void editSave(OsStatusDTO statusDTO){
        VciBaseUtil.alertNotNull(statusDTO,"状态的信息",statusDTO.getId(),"状态的英文名称",statusDTO.getName(),"状态的中文名称",statusDTO.getOid(),"主键");
    public boolean editSave(OsStatusDTO statusDTO) throws Exception {
        VciBaseUtil.alertNotNull(statusDTO,"状态的信息",
                statusDTO.getId(),"状态的英文名称",
                statusDTO.getName(),"状态的中文名称",
                statusDTO.getOid(),"主键");
        OsStatusVO statusVO = getObjectByOid(statusDTO.getOid());
        if(Func.isEmpty(statusVO) || Func.isBlank(statusVO.getOid())){
            throw new PLException("500",new String[]{"修改的状态对象不存在!"});
        }
        StatePool pool = statusDTO2DO(statusDTO);
        pool.creator = statusVO.getCreator();
        pool.createTime = VciDateUtil.getTime(statusVO.getCreateTime());
@@ -283,6 +309,7 @@
        batchEditSave(poolList);
        clearCache();
        self.selectAllStatusMap();
        return true;
    }
    /**
@@ -290,7 +317,7 @@
     * @param oids 主键
     */
    @Override
    public void delete(String oids){
    public boolean delete(String oids){
        VciBaseUtil.alertNotNull(oids,"主键");
        //判断是否被引用
        List<OsStatusVO> statusVOList1 = selectByOidCollection(VciBaseUtil.str2List(oids));
@@ -306,6 +333,7 @@
        });
        clearCache();
        self.selectAllStatusMap();
        return true;
    }
    /**
@@ -319,8 +347,9 @@
        statePool.oid = statusDTO.getOid();
        statePool.id = "";
        statePool.name = statusDTO.getId();
        statePool.imagePath = statusDTO.getImagePath();
        statePool.description = statusDTO.getDescription()==null?"":statusDTO.getDescription();
        String userId = VciBaseUtil.getCurrentUserId();
        String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        long now = VciDateUtil.getNowTime();
        statePool.creator = userId;
        statePool.createTime = now;
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java
@@ -201,7 +201,7 @@
     * @param statusDTOList 要导入的状态的数据传输对象列表
     * @throws VciBaseException 查询或者执行出错的时候会抛出异常
     */
    private void importStatus( Collection<OsStatusDTO> statusDTOList) throws VciBaseException{
    private void importStatus( Collection<OsStatusDTO> statusDTOList) throws Exception {
        //要导入的状态的所有英文名称
        List<String> statusIdList = new ArrayList<String>();
        Iterator<OsStatusDTO> iterator = statusDTOList.iterator();