From 2af4ec653879425abc5873febae74b7bbf9a07e0 Mon Sep 17 00:00:00 2001
From: yuxc <yuxc@vci-tech.com>
Date: 星期五, 20 九月 2024 16:13:10 +0800
Subject: [PATCH] 1、新增日期保存期限接口。 2、新增保存期限设置接口。 3、新增删除日志接口。 4、新增日志查询接口。 5、新增获取操作用户接口。

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/PlatformClientUtil.java          |    2 
 Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/ice.properties                    |    3 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/LogBasicController.java    |  127 ++++++++++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java |    1 
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/LogBasicServiceI.java         |   42 +++
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogPeriodInfoDTO.java             |   26 ++
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogQueryCriteriaDTO.java          |   36 +++
 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogInfoDTO.java                   |   34 ++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LogBasicServiceImpl.java |  390 ++++++++++++++++++++++++++++++++
 9 files changed, 659 insertions(+), 2 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogInfoDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogInfoDTO.java
new file mode 100644
index 0000000..7b432ad
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogInfoDTO.java
@@ -0,0 +1,34 @@
+package com.vci.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 鏃ュ織浼犺緭瀵硅薄
+ * @author yuxc
+ * @date 2024-09-18
+ */
+@Data
+public class LogInfoDTO implements Serializable {
+
+
+    /**
+     * 绂佹淇敼杩欎釜鍊�
+     */
+    private static final long serialVersionUID = 2492852474710986720L;
+    private String puid;
+    private String username;
+    private String truename;
+    private String userIp;
+    private String result;
+    private String content;
+    private String date;
+    private String type;
+    private String moduleName;
+    private String entityDesc;
+    private String property;
+    private String previousVal;
+    private String newVal;
+    private String logType;
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogPeriodInfoDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogPeriodInfoDTO.java
new file mode 100644
index 0000000..606e6a5
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogPeriodInfoDTO.java
@@ -0,0 +1,26 @@
+package com.vci.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 淇濆瓨鏈熼檺浼犺緭瀵硅薄
+ * @author yuxc
+ * @date 2024-09-11
+ */
+@Data
+public class LogPeriodInfoDTO implements Serializable {
+
+
+    /**
+     * 绂佹淇敼杩欎釜鍊�
+     */
+    private static final long serialVersionUID = 2492852474710986720L;
+    //缂栫爜
+    public String code;
+    //鍊�
+    public String value;
+    //鏄惁閫変腑
+    public boolean choose;
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogQueryCriteriaDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogQueryCriteriaDTO.java
new file mode 100644
index 0000000..1e26832
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogQueryCriteriaDTO.java
@@ -0,0 +1,36 @@
+package com.vci.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 鏃ュ織鏌ヨ浼犺緭瀵硅薄
+ * @author yuxc
+ * @date 2024-09-18
+ */
+@Data
+public class LogQueryCriteriaDTO implements Serializable {
+
+
+    /**
+     * 绂佹淇敼杩欎釜鍊�
+     */
+    private static final long serialVersionUID = 2492852474710986720L;
+    //寮�濮嬫椂闂�
+    private String startDate;
+    //缁撴潫鏃ユ湡
+    private String endDate;
+    //鏃ュ織绫诲瀷锛�1锛氱櫥褰曪紱2锛氱櫥鍑猴紱3锛氭巿鏉冿紱4锛氫竴鑸搷浣滐紱5锛氶泦鎴愬簲鐢�
+    int logType;
+    //鐢ㄦ埛IP
+    String ipText;
+    //鎿嶄綔鐢ㄦ埛
+    String userName;
+    //鎿嶄綔绫诲瀷
+    String typeText;
+    //椤电爜
+    int pageNo;
+    //椤甸潰鏉℃暟
+    int pageSize;
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/LogBasicController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/LogBasicController.java
new file mode 100644
index 0000000..f16e2fc
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/LogBasicController.java
@@ -0,0 +1,127 @@
+package com.vci.web.controller;
+import com.vci.corba.common.PLException;
+import com.vci.dto.LogQueryCriteriaDTO;
+import com.vci.starter.web.annotation.log.VciBusinessLog;
+import com.vci.starter.web.exception.VciBaseException;
+import com.vci.starter.web.pagemodel.BaseResult;
+import com.vci.starter.web.util.VciBaseUtil;
+import com.vci.web.service.LogBasicServiceI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 骞冲彴鏃ュ織鎺у埗鍣�
+ * @author yuxc
+ * @date 2024-9-11
+ */
+@Controller
+@RequestMapping("/loginBasicController")
+@VciBusinessLog(modelName="鏃ュ織鏈嶅姟")
+public class LogBasicController {
+
+	/**
+	 * 鐧诲綍鏈嶅姟
+	 */
+	@Autowired
+	private LogBasicServiceI logBasicServiceI;
+
+	/**
+	 * 鏃ュ織
+	 */
+	private Logger logger = LoggerFactory.getLogger(getClass());
+
+	/**
+	 * 鑾峰彇鏃ユ湡淇濆瓨鏈熼檺涓嬫媺鍒楄〃妗�
+	 * @return 鏌ヨ缁撴灉
+	 */
+	@VciBusinessLog(operateName="鏃ユ湡淇濆瓨鏈熼檺")
+	@GetMapping(value = "/getPeroid")
+	@ResponseBody
+	public BaseResult getPeroid(){
+		try {
+			return logBasicServiceI.getPeroid();
+		}catch (Exception e){
+			e.printStackTrace();
+			String errorMsg = "鏌ヨ鍑虹幇閿欒锛屽師鍥狅細"+ VciBaseUtil.getExceptionMessage(e);
+			logger.error(errorMsg);
+			throw new VciBaseException(errorMsg);
+		}
+	}
+
+	/**
+	 * 淇濆瓨鏈熼檺璁剧疆
+	 * period 鏈熼檺缂栫爜
+	 * @return 淇濆瓨缁撴灉
+	 */
+	@VciBusinessLog(operateName="淇濆瓨鏈熼檺璁剧疆")
+	@PostMapping(value = "/savePeriod")
+	@ResponseBody
+	public BaseResult savePeriod(String period){
+		try {
+			return logBasicServiceI.savePeriod(period);
+		}catch (Exception e){
+			e.printStackTrace();
+			String errorMsg = "淇濆瓨鍑虹幇閿欒锛屽師鍥狅細"+ VciBaseUtil.getExceptionMessage(e);
+			logger.error(errorMsg);
+			throw new VciBaseException(errorMsg);
+		}
+	}
+
+	/**
+	 * 鍒犻櫎鏃ュ織
+	 * period 鏈熼檺缂栫爜
+	 * @return 淇濆瓨缁撴灉
+	 */
+	@VciBusinessLog(operateName="鍒犻櫎鏃ュ織")
+	@DeleteMapping(value = "/deleteLog")
+	@ResponseBody
+	public BaseResult deleteLog(String deleteDate){
+		try {
+			return logBasicServiceI.deleteLog(deleteDate);
+		}catch (Exception e){
+			e.printStackTrace();
+			String errorMsg = "鍒犻櫎鍑虹幇閿欒锛屽師鍥狅細"+ VciBaseUtil.getExceptionMessage(e);
+			logger.error(errorMsg);
+			throw new VciBaseException(errorMsg);
+		}
+	}
+	/**
+	 * 鏌ヨ鏃ュ織
+	 * @param dto 鏌ヨ鏉′欢浼犺緭瀵硅薄
+	 * @return 鏌ヨ鏁版嵁
+	 * @throws PLException
+	 */
+	@VciBusinessLog(operateName="鏃ュ織鏌ヨ")
+	@GetMapping(value = "/getLogListByContion")
+	@ResponseBody
+	public BaseResult getLogListByContion(@RequestBody LogQueryCriteriaDTO dto){
+		try {
+			return logBasicServiceI.getLogListByContion(dto);
+		}catch (Exception e){
+			e.printStackTrace();
+			String errorMsg = "鏌ヨ鏃ュ織鍑虹幇閿欒锛屽師鍥狅細"+ VciBaseUtil.getExceptionMessage(e);
+			logger.error(errorMsg);
+			throw new VciBaseException(errorMsg);
+		}
+	}
+
+	/**
+	 * 鎿嶄綔鐢ㄦ埛鑾峰彇
+	 */
+	@VciBusinessLog(operateName="鑾峰彇鎿嶄綔鐢ㄦ埛")
+	@GetMapping(value = "/getOperatingUsers")
+	@ResponseBody
+	public BaseResult getOperatingUsers(){
+		try {
+			return logBasicServiceI.getOperatingUsers();
+		}catch (Exception e){
+			e.printStackTrace();
+			String errorMsg = "鏌ヨ鏃ュ織鍑虹幇閿欒锛屽師鍥狅細"+ VciBaseUtil.getExceptionMessage(e);
+			logger.error(errorMsg);
+			throw new VciBaseException(errorMsg);
+		}
+	}
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/LogBasicServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/LogBasicServiceI.java
new file mode 100644
index 0000000..995a7ce
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/LogBasicServiceI.java
@@ -0,0 +1,42 @@
+package com.vci.web.service;
+
+import com.vci.corba.common.PLException;
+import com.vci.dto.LogQueryCriteriaDTO;
+import com.vci.starter.web.pagemodel.BaseResult;
+
+/**
+ * 骞冲彴鏃ュ織鏈嶅姟
+ * @author yuxc
+ * @date 2024-9-11
+ */
+public interface LogBasicServiceI {
+
+    /**
+     * 鑾峰彇鏃ユ湡淇濆瓨鏈熼檺涓嬫媺鍒楄〃妗�
+     * @return 鏌ヨ缁撴灉
+     */
+    BaseResult getPeroid() throws PLException;
+    /**
+     * 淇濆瓨鏈熼檺璁剧疆
+     * period 鏈熼檺缂栫爜
+     * @return 淇濆瓨缁撴灉
+     */
+    BaseResult savePeriod(String period) throws PLException;
+    /**
+     * 鍒犻櫎鏃ュ織
+     * period 鏈熼檺缂栫爜
+     * @return 淇濆瓨缁撴灉
+     */
+    BaseResult deleteLog(String deleteDate) throws PLException;
+    /**
+     * 鏌ヨ鏃ュ織
+     * @param dto 鏌ヨ鏉′欢浼犺緭瀵硅薄
+     * @return 鏌ヨ鏁版嵁
+     * @throws PLException
+     */
+    BaseResult getLogListByContion(LogQueryCriteriaDTO dto) throws PLException;
+    /**
+     * 鎿嶄綔鐢ㄦ埛鑾峰彇
+     */
+    BaseResult getOperatingUsers() throws PLException;
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LogBasicServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LogBasicServiceImpl.java
new file mode 100644
index 0000000..2392826
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LogBasicServiceImpl.java
@@ -0,0 +1,390 @@
+package com.vci.web.service.impl;
+import com.vci.client.common.objects.UserObject;
+import com.vci.corba.common.PLException;
+import com.vci.corba.common.data.UserEntityInfo;
+import com.vci.corba.framework.data.UserInfo;
+import com.vci.corba.pllog.data.LogInfo;
+import com.vci.corba.pllog.data.LogPeriodInfo;
+import com.vci.corba.pllog.data.LogType;
+import com.vci.dto.LogInfoDTO;
+import com.vci.dto.LogPeriodInfoDTO;
+import com.vci.dto.LogQueryCriteriaDTO;
+import com.vci.starter.web.pagemodel.BaseResult;
+import com.vci.web.service.*;
+import com.vci.web.util.*;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 涓氬姟绫诲瀷鏈嶅姟
+ * @author yuxc
+ * @date 2024-9-11
+ */
+@Service
+public class LogBasicServiceImpl implements LogBasicServiceI {
+
+    /**
+     * 鏃ュ織
+     */
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    /**
+     * 骞冲彴鐨勮皟鐢ㄥ伐鍏风被
+     */
+    @Autowired
+    private PlatformClientUtil platformClientUtil;
+    public static final String UTF8_BOM="\uFEFF";
+    private final String LOG_SAVE_PERIOD = "logSavePeriod";//鏃ュ織淇濆瓨鏈熼檺
+
+    /**
+     * 鑾峰彇鏃ユ湡淇濆瓨鏈熼檺涓嬫媺鍒楄〃妗�
+     * @return 鏌ヨ缁撴灉
+     */
+    @Override
+    public BaseResult getPeroid() throws PLException {
+        //鑾峰彇褰撳墠鏈熼檺璁剧疆
+        int curPeriod = platformClientUtil.getLogService().getCurPeriod();
+        LogPeriodInfo[] periods = platformClientUtil.getLogService().getPeriods();
+        List<LogPeriodInfoDTO> logDTOs = new ArrayList<>();
+        for (LogPeriodInfo period : periods) {
+            LogPeriodInfoDTO dto = new LogPeriodInfoDTO();
+            dto.setValue(period.value);
+            if(period.code.startsWith(UTF8_BOM)) {
+                period.code=period.code.substring(1);
+            }
+            if (Integer.valueOf(period.code) == curPeriod){
+                dto.setChoose(true);
+            }
+            dto.setCode(period.code);
+            logDTOs.add(dto);
+        }
+        return BaseResult.dataList(logDTOs);
+    }
+
+    /**
+     * 淇濆瓨鏈熼檺璁剧疆
+     * period 鏈熼檺缂栫爜
+     * @return 淇濆瓨缁撴灉
+     */
+    @Override
+    public BaseResult savePeriod(String period) throws PLException {
+        UserEntityInfo userEntityInfo = new UserEntityInfo();
+        userEntityInfo.setModules("com.vci.client.log.ui.LogBasicConfPanel");
+        userEntityInfo.setUserName(WebUtil.getCurrentUserId());
+        boolean b = platformClientUtil.getLogService().savePeriod(period, userEntityInfo);
+        if(!b){
+            return BaseResult.fail("淇濆瓨澶辫触锛�");
+        }
+        return BaseResult.success("淇濆瓨鎴愬姛锛�");
+    }
+
+    /**
+     * 鍒犻櫎鏃ュ織
+     * @param deleteDate 鍒犻櫎鐨勬棩鏈�
+     * @return 鍒犻櫎缁撴灉
+     * @throws PLException
+     */
+    @Override
+    public BaseResult deleteLog(String deleteDate) throws PLException {
+        if(StringUtils.isBlank(deleteDate)){
+            throw new PLException("500", new String[]{"鏃ユ湡涓嶈兘涓虹┖锛�"});
+        }
+        //鑾峰彇褰撳墠鏈熼檺璁剧疆
+        int curSavePeriod = platformClientUtil.getLogService().getCurPeriod();
+        int monthSpan = 1;
+        String monthLabel = "";
+        LogPeriodInfo[] periods = platformClientUtil.getLogService().getPeriods();
+        Map<String, String> periodMap = Arrays.stream(periods).collect(Collectors.toMap(e -> e.code, e -> e.value));
+
+
+        if(curSavePeriod <= 0){
+            // 鏈厤缃椂锛屽彧鑳藉垹闄�
+            monthLabel = periods[0].value;
+            monthSpan = Integer.valueOf(periods[0].code);
+        } else {
+            monthSpan = curSavePeriod;//鏈熼檺code
+            monthLabel = periodMap.get(String.valueOf(curSavePeriod));//鏈熼檺鏄剧ず鍊�
+        }
+        //妫�鏌ュ垹闄ら�昏緫
+        checkCanDelete(deleteDate, monthSpan, monthLabel);
+        boolean res = false;
+        res = platformClientUtil.getLogService().deleteLog(getDeleteDateString(deleteDate));//鍒犻櫎鏃ュ織
+        if(!res){
+            return BaseResult.fail("鍒犻櫎澶辫触锛�");
+        }
+        return BaseResult.success("鍒犻櫎鎴愬姛锛�");
+    }
+
+    /**
+     * 鏌ヨ鏃ュ織
+     * @param queryDto 鏌ヨ鏉′欢浼犺緭瀵硅薄
+     * @return 鏌ヨ鏁版嵁
+     * @throws PLException
+     */
+    @Override
+    public BaseResult getLogListByContion(LogQueryCriteriaDTO queryDto) throws PLException {
+        String querySql = getSQL(queryDto);
+        LogInfo[] logInfos = platformClientUtil.getLogService().getLogListByContion(queryDto.getPageNo(),queryDto.getPageSize(),querySql);
+        List<LogInfoDTO> dtos = new ArrayList<>();
+        for (LogInfo logInfo : logInfos) {
+            LogInfoDTO dto = new LogInfoDTO();
+            dto.setLogType(logInfo.logType);
+            dto.setDate(logInfo.date);
+            dto.setContent(logInfo.content);
+            dto.setPuid(logInfo.puid);
+            dto.setModuleName(logInfo.moduleName);
+            dto.setEntityDesc(logInfo.entityDesc);
+            dto.setResult(logInfo.result);
+            dto.setType(logInfo.type);
+            dto.setProperty(logInfo.property);
+            dto.setTruename(logInfo.truename);
+            dto.setNewVal(logInfo.newVal);
+            dto.setUserIp(logInfo.userIp);
+            dto.setUsername(logInfo.username);
+            dto.setPreviousVal(logInfo.previousVal);
+            dtos.add(dto);
+        }
+        long sumLogRows = platformClientUtil.getLogService().getSumLogRows(querySql);
+        BaseResult result = new BaseResult();
+        result.setSuccess(true);
+        result.setCode(200);
+        result.setData(dtos);
+        result.setTotal(sumLogRows);
+        return result;
+    }
+    /**
+     * 鎿嶄綔鐢ㄦ埛鑾峰彇
+     */
+    @Override
+    public BaseResult getOperatingUsers() throws PLException {
+        List<UserObject> users = new ArrayList<UserObject>();
+        if("secAdmin".equals(WebUtil.getCurrentUserId())){
+            users.addAll(getUsersByUserNames(Arrays.asList("auditAdmin")));
+            users.addAll(getUsersByUserNames(getUserNameByUserType(2)));
+        }
+        else if("auditAdmin".equals(WebUtil.getCurrentUserId())){
+            users.addAll(getUsersByUserNames(Arrays.asList("secAdmin", "sysAdmin")));
+        } else if("sysAdmin".equals(WebUtil.getCurrentUserId())){
+
+        }
+        return BaseResult.dataList(users);
+    }
+
+    /**
+     * 鑾峰彇鐢ㄦ埛淇℃伅
+     * @param userNames 鐢ㄦ埛鍚嶇О
+     * @return 鐢ㄦ埛淇℃伅
+     * @throws PLException
+     */
+    private List<UserObject> getUsersByUserNames(List<String> userNames) throws PLException {
+        List<UserObject> userList = new ArrayList<UserObject>();
+        for(String userName : userNames){
+            UserInfo userInfo = platformClientUtil.getFrameworkService().fetchUserInfoByName(userName);
+            UserObject user = new UserObject();
+            user.setId(userInfo.id);
+            user.setUserName(userInfo.userName);
+            user.setPwd(userInfo.pwd);
+            user.setEmail(userInfo.email);
+            user.setTrueName(userInfo.trueName);
+            user.setSpecialties(userInfo.specialties);
+            user.setDesc(userInfo.desc);
+            user.setUserType(userInfo.userType);
+            user.setStatus(userInfo.status);
+            user.setCreateTime(userInfo.createTime);
+            user.setCreateUser(userInfo.createUser);
+            user.setUpdateTime(userInfo.updateTime);
+            user.setUpdateUser(userInfo.updateUser);
+            user.setPwdUpdateTime(userInfo.pwdUpdateTime);
+            user.setGrantor(userInfo.grantor);
+            user.setSecretGrade(userInfo.secretGrade);
+            user.setIsDeptLeader(userInfo.isDeptLeader);
+            userList.add(user);
+        }
+
+        Collections.sort(userList, new Comparator<UserObject>(){
+            @Override
+            public int compare(UserObject o1, UserObject o2) {
+                return o1.getUserName().compareTo(o2.getUserName());
+            }
+        });
+        return userList;
+    }
+
+    /**
+     * 鏍规嵁鐢ㄦ埛绫诲瀷鑾峰彇鐢ㄦ埛鏁版嵁
+     * @param userType 鐢ㄦ埛绫诲瀷
+     * @return 鐢ㄦ埛鏁版嵁
+     * @throws PLException
+     */
+    private List<String> getUserNameByUserType(int userType) throws PLException{
+        List<String> userNames = new ArrayList<String>();
+        String sql = "select plusername,pltruename from pluser u where u.plusertype = " + String.valueOf(userType);
+        String[][] valss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql);
+        for(String[] vals : valss){
+            userNames.add(vals[0]);
+        }
+        return userNames;
+    }
+    /**
+     * 鑾峰彇鏌ヨ鏉′欢骞舵嫾鎴怱QL锛屽彧鎷紈here瀛愬彞鍚庨潰鐨凷QL
+     * @return
+     */
+    public String getSQL(LogQueryCriteriaDTO dto) throws PLException {
+        StringBuffer sql = new StringBuffer("");
+//        int period = getPeriod(LOG_SAVE_PERIOD);//鑾峰彇淇濆瓨鏈熼檺锛屼互鏈堜负鍗曚綅
+        int period = platformClientUtil.getLogService().getCurPeriod();;//鑾峰彇淇濆瓨鏈熼檺锛屼互鏈堜负鍗曚綅
+        //涓嬮潰鏄嫾鍑篠QL
+        if(period != 0){
+            sql.append(" to_date(PLDATE) >= add_months(to_date(sysdate),"+(-period)+")");
+        }
+        if(dto.getStartDate()!=null&&!dto.getStartDate().trim().equals("")&&!dto.getStartDate().equals("null")){//璧峰鏃ユ湡
+            if(!sql.toString().equals("")){
+                sql.append(" and ");
+            }
+            sql.append(" to_date(PLDATE) >= to_date('"+dto.getStartDate().trim()+"','yyyy-MM-dd') ");
+        }
+        if(dto.getEndDate()!=null&&!dto.getEndDate().trim().equals("")&&!dto.getEndDate().equals("null")){//缁撴潫鏃ユ湡
+            if(!sql.toString().equals("")){
+                sql.append(" and ");
+            }
+            sql.append(" trunc(PLDATE) <= to_date('"+dto.getEndDate().trim()+"','yyyy-MM-dd')");
+        }
+
+        if(dto.getLogType() == LogType.Login.value()) {//鐧诲叆鐧诲嚭鏃ュ織
+            if(!sql.toString().equals("")){
+                sql.append(" and ");
+            }
+            sql.append("PLLOGTYPE in ('" + getLogTypeString(LogType.Login) +"','" + getLogTypeString(LogType.Logout)+ "')");
+        } else if(dto.getLogType() == LogType.Grant.value()) {//鎺堟潈鏃ュ織
+            if(!sql.toString().equals("")){
+                sql.append(" and ");
+            }
+            sql.append("PLLOGTYPE in('" + getLogTypeString(LogType.Grant) + "')");
+        } else if(dto.getLogType() == LogType.General.value()) {//涓�鑸搷浣滄棩蹇�
+            if(!sql.toString().equals("")){
+                sql.append(" and ");
+            }
+            sql.append("PLLOGTYPE in('" + getLogTypeString(LogType.General) + "')");
+        }
+        if(StringUtils.isNotBlank(dto.getUserName())){//鎿嶄綔鐢ㄦ埛
+            if(!dto.getUserName().trim().equals("")){//濡傛灉鐢ㄦ埛鍚嶄负绌烘牸鍒欎笉鍔犵敤鎴锋潯浠�
+                if(!sql.toString().equals("")){
+                    sql.append(" and ");
+                }
+                if(dto.getUserName().contains("*")){
+                    dto.setUserName(dto.getUserName().trim().replaceAll("\\*", "%"));
+                    sql.append(" PLUSER like '").append(dto.getUserName().trim()).append("'");
+                }else{
+                    sql.append(" PLUSER = '").append(dto.getUserName().trim()).append("'");
+                }
+            }
+        }
+        //鎸塈P鏌ヨ
+        if(StringUtils.isNotBlank(dto.getIpText())){
+            String ip = dto.getIpText().trim();
+            if(!sql.toString().equals("")){
+                sql.append(" and ");
+            }
+            if(ip.trim().contains("*")){//妯$硦鏌ヨ
+                ip = ip.trim().replaceAll("\\*", "%");
+                sql.append(" PLIP like '").append(ip.trim()).append("'");
+            }else{
+                sql.append(" PLIP = '").append(ip.trim()).append("'");
+            }
+        }
+        if(StringUtils.isNotBlank(dto.getTypeText())){
+            String typeValue = dto.getTypeText();
+            sql.append(" and pltype like '%").append(typeValue).append("%'");
+        }
+        //杩囨护鎺塧dmin鍜宒eveloper鐢ㄦ埛鐨勬棩蹇楄褰�
+        sql.append(" and PLUSER !='admin' and  PLUSER !='developer' ");
+
+        sql.append(" and pluser != '" + WebUtil.getCurrentUserId() + "' ");
+
+
+        // 瀹夊叏淇濆瘑鍛樹笉鐪嬬郴缁熺鐞嗗憳鐨勬棩蹇�
+        if("secAdmin".equals(WebUtil.getCurrentUserId())){
+            sql.append(" and pluser != 'sysAdmin' ");
+        }
+        // 瀹¤绠$悊鍛樺彧鐪嬬郴缁熺鐞嗗憳鍜屽畨鍏ㄤ繚瀵嗗憳鐨勬棩蹇�
+        else if("auditAdmin".equals(WebUtil.getCurrentUserId())){
+            sql.append(" and pluser in ('secAdmin', 'sysAdmin')");
+        }
+        return sql.toString();
+    }
+    protected String getLogTypeString(LogType logType){
+        String res = "";
+        if(logType == LogType.Login) {
+            res = "鐧诲綍";
+        } else if(logType == LogType.Logout) {
+            res = "鐧诲嚭";
+        } else if(logType == LogType.Grant) {
+            res = "鎺堟潈";
+        } else if(logType == LogType.General) {
+            res = "涓�鑸搷浣�";
+        } else if(logType == LogType.Integration) {
+            res = "闆嗘垚搴旂敤";
+        }
+        return res;
+    }
+
+    /**
+     * 鏃ユ湡瀛楃涓插鐞�
+     * @param deleteDate 鏃ユ湡瀛楃涓�
+     * @return 澶勭悊瀹屾垚鐨勬棩鏈熷瓧绗︿覆
+     */
+    protected String getDeleteDateString(String deleteDate){
+        int s = Integer.parseInt(deleteDate.substring(8))+1;
+        StringBuffer buff = new StringBuffer();
+        buff.append(deleteDate.substring(0, 8));
+        if(("0"+s).length()>2){
+            buff.append(s+"");
+        }else{
+            buff.append("0"+s);
+        }
+        return buff.toString();
+    }
+
+    /**
+     * 鍒犻櫎閫昏緫妫�鏌�
+     * @param deleteDate 鏃ユ湡瀛楃涓�
+     * @param monthSpan 鏈熼檺code
+     * @param monthLabel 鏈熼檺鏄剧ず鍊�
+     * @return
+     * @throws PLException
+     */
+    private boolean checkCanDelete(String deleteDate, int monthSpan, String monthLabel) throws PLException {
+        boolean res = false;
+        try {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            sdf.parse(deleteDate);
+        } catch (ParseException  e1) {
+            throw new PLException("500", new String[]{"灏�" + deleteDate + "杞崲鏃ユ湡鏃跺彂鐢熼敊璇紒"});
+        }
+        String sql = "SELECT FLOOR(MONTHS_BETWEEN(SYSDATE, to_date('" + deleteDate + "','yyyy-mm-dd'))) from dual";
+        String[][] vals;
+        try {
+            vals = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql);
+            if(vals != null && vals.length > 0 && vals[0].length > 0){
+                int spval = Integer.valueOf(vals[0][0]);
+                if(spval <= monthSpan){
+                    throw new PLException("500", new String[]{"鍙兘鍒犻櫎 " + monthLabel + " 涔嬪墠鐨勬暟鎹紒"});
+                }
+            }
+        } catch (PLException e) {
+            e.printStackTrace();
+            e.messages[0] += "璁$畻鏄惁鍙互鍒犻櫎鎸囧畾鏃ユ湡涔嬪墠鐨勬暟鎹椂鍙戠敓閿欒锛�";
+            throw new PLException("500", e.messages);
+        }
+        res = true;
+        return res;
+    }
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java
index 80c21c9..6a05746 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java
@@ -98,6 +98,7 @@
         PLActionCls pac = new PLActionCls();
         pac.name = pLActionCls.getName();
         pac.pid = pLActionCls.getPid();
+        pac.id = pLActionCls.getId();
         pac.description = pLActionCls.getDescription() == null ? "" : pLActionCls.getDescription();
         pac.creator = WebUtil.getCurrentUserId();
         pac.createTime = System.currentTimeMillis();
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/PlatformClientUtil.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/PlatformClientUtil.java
index 5798c87..a2e9a69 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/PlatformClientUtil.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/PlatformClientUtil.java
@@ -4,7 +4,6 @@
 import com.vci.corba.bofactory.BOFactoryServicePrx;
 import com.vci.corba.common.PLException;
 import com.vci.corba.framework.FrameworkServicePrx;
-import com.vci.corba.log.LogServicePrx;
 import com.vci.corba.omd.atm.AttPoolServicePrx;
 import com.vci.corba.omd.btm.BTMServicePrx;
 import com.vci.corba.omd.data.AttributeValue;
@@ -14,6 +13,7 @@
 import com.vci.corba.omd.qtm.QTDServicePrx;
 import com.vci.corba.omd.stm.StatePoolServicePrx;
 import com.vci.corba.omd.vrm.VersionRuleServicePrx;
+import com.vci.corba.pllog.LogServicePrx;
 import com.vci.corba.portal.PortalServicePrx;
 import com.vci.corba.query.ObjectQueryServicePrx;
 import com.vci.corba.volume.VolumeServicePrx;
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/ice.properties b/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/ice.properties
index 2fae8b8..3259ca1 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/ice.properties
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/ice.properties
@@ -1,4 +1,5 @@
 #NameService=PLT
 Adapter=PLT
-Endpoints=default -h localhost -p 4601
+Endpoints=default -h localhost -p 4061
+Ice.MessageSizeMax=1048576
 #Endpoints=VCI-PLT/Locator:default -h localhost -p 4601
\ No newline at end of file

--
Gitblit v1.9.3