Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 6 months ago
parent
commit
43c5fe7a56
  1. 3
      zc-business/src/main/java/com/zc/business/controller/StatusController.java
  2. 2
      zc-business/src/main/java/com/zc/business/domain/DcEvent.java
  3. 9
      zc-business/src/main/java/com/zc/business/domain/Status.java
  4. 52
      zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java
  5. 1
      zc-business/src/main/java/com/zc/business/mapper/StatusMapper.java
  6. 4
      zc-business/src/main/java/com/zc/business/service/impl/StatusService.java
  7. 35
      zc-business/src/main/resources/mapper/business/StatusMapper.xml

3
zc-business/src/main/java/com/zc/business/controller/StatusController.java

@ -57,7 +57,8 @@ public class StatusController extends BaseController {
LocalDateTime currentTime = status.getTime().truncatedTo(ChronoUnit.DAYS).plusDays(1);
status.setStartTime(todayStart);
status.setTime(currentTime);
List<Status> listStatus = statusService.list(status);
status.setTypes(status.getType().split(","));
List<Status> listStatus = statusService.listStatusByTypes(status);
return getDataTable(listStatus);
}

2
zc-business/src/main/java/com/zc/business/domain/DcEvent.java

@ -70,7 +70,7 @@ public class DcEvent {
@ApiModelProperty("处理人员")
private Long userId;
@ApiModelProperty("事件子类")
private String eventSubclas;
private String eventSubclassName;
/**
* 开始时间

9
zc-business/src/main/java/com/zc/business/domain/Status.java

@ -232,6 +232,7 @@ public class Status {
//@Excel(name = "类型")
private String type;
private String[] types;
private String orderByField;
private String orderDirection;
@ -267,4 +268,12 @@ public class Status {
public void setOrderByField(String orderByField) {
this.orderByField = orderByField;
}
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}

52
zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java

@ -109,7 +109,6 @@ public class OperationLogAspect {
public void around(ProceedingJoinPoint joinPoint, OperationLog operationLog, String state, Object jsonResult, Exception exception) throws Throwable {
ISysDeptService deptService = SpringUtils.getBean(ISysDeptService.class);
IDcOperLogService dcOperLogService = SpringUtils.getBean(IDcOperLogService.class);
IDcDeviceService dcDeviceService = SpringUtils.getBean(IDcDeviceService.class);
IDcPublishManageService dcPublishManageService = SpringUtils.getBean(IDcPublishManageService.class);
@ -142,7 +141,7 @@ public class OperationLogAspect {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date = df.format(new Date());
String sta = "";
if (Objects.equals(state, "0") && Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("code")), "200") && !Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("msg")), "500") ) {
if (Objects.equals(state, "0") && Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("code")), "200") && !Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("msg")), "500")) {
operLog.setStatus(0);
sta = "成功";
} else {
@ -207,15 +206,14 @@ public class OperationLogAspect {
}
if (Objects.equals(function.getString("functionId"), "13")&&Objects.equals(deviceType,"2")){
if (Objects.equals(function.getString("functionId"), "13") && Objects.equals(deviceType, "2")) {
JSONArray parameters = function.getJSONObject("params").getJSONArray("parameters");
List<String> content = parameters.stream().map(item->((JSONObject)item).getString("CONTENT")).collect(Collectors.toList());
List<String> content = parameters.stream().map(item -> ((JSONObject) item).getString("CONTENT")).collect(Collectors.toList());
contentDetails = content.toString().replace("[", "").replace("]", "");
}
if (Objects.equals(deviceType,"5")){
if (Objects.equals(deviceType, "5")) {
contentDetails = function.getJSONObject("params").getString("text");
}
}
@ -235,20 +233,13 @@ public class OperationLogAspect {
operLog.setOperLocation(loginUser.getLoginLocation());
operLog.setOperType("2");
} else {
operLog.setOperName("服务器");
operLog.setDeptName("服务器");
operLog.setOperLocation("服务器");
operLog.setOperType("1");
}
JSONArray jsonArray = (JSONArray) JSON.toJSON(pointArgs);
operLog.setOperParam(String.valueOf(jsonArray));
operLog.setDcDeviceId(deviceIds.toString());
operLog.setDcDeviceName(deviceNames.toString());
operLog.setOperIp(IpUtils.getIpAddr(request));
operLog.setOperTime(new Date());
operLog.setDcDeviceType(deviceType);
operLog.setRemark(remark.toString());
operLog.setJsonResult(jsonResult.toString());
dcOperLogService.save(operLog);
saveOperLog(jsonResult, operLog, pointArgs, request, deviceIds, deviceNames, deviceType, remark);
if ((Objects.equals(deviceType, "2") || Objects.equals(deviceType, "5")) && Objects.nonNull(operLog.getId())) {
@ -312,17 +303,7 @@ public class OperationLogAspect {
operLog.setOperType("1");
}
JSONArray jsonArray = (JSONArray) JSON.toJSON(pointArgs);
operLog.setOperParam(String.valueOf(jsonArray));
operLog.setDcDeviceId(deviceIds.toString());
operLog.setDcDeviceName(deviceNames.toString());
operLog.setOperIp(IpUtils.getIpAddr(request));
operLog.setOperTime(new Date());
operLog.setDcDeviceType(deviceType);
operLog.setRemark(remark.toString());
operLog.setJsonResult(jsonResult.toString());
dcOperLogService.save(operLog);
saveOperLog(jsonResult, operLog, pointArgs, request, deviceIds, deviceNames, deviceType, remark);
//if ((Objects.equals(deviceType, "2") || Objects.equals(deviceType, "5")) && Objects.nonNull(operLog.getId())) {
@ -360,4 +341,19 @@ public class OperationLogAspect {
throw e;
}
}
private void saveOperLog(Object jsonResult, DcOperLog operLog, Object[] pointArgs, HttpServletRequest request, ArrayList<String> deviceIds, ArrayList<String> deviceNames, String deviceType, StringBuilder remark) {
IDcOperLogService dcOperLogService = SpringUtils.getBean(IDcOperLogService.class);
JSONArray jsonArray = (JSONArray) JSON.toJSON(pointArgs);
operLog.setOperParam(String.valueOf(jsonArray));
operLog.setDcDeviceId(deviceIds.toString());
operLog.setDcDeviceName(deviceNames.toString());
operLog.setOperIp(IpUtils.getIpAddr(request));
operLog.setOperTime(new Date());
operLog.setDcDeviceType(deviceType);
operLog.setRemark(remark.toString());
operLog.setJsonResult(jsonResult.toString());
dcOperLogService.save(operLog);
}
}

1
zc-business/src/main/java/com/zc/business/mapper/StatusMapper.java

@ -20,5 +20,6 @@ public interface StatusMapper {
List<Status> listStatusBySection(@Param("status")Status status);
List<Status> export(@Param("status")Status status);
List<Status> deviceStatusListById(@Param("status")Status status);
List<Status> listStatusByTypes(@Param("status")Status status);
}

4
zc-business/src/main/java/com/zc/business/service/impl/StatusService.java

@ -41,4 +41,8 @@ public class StatusService {
public List<Status> deviceStatusListById(Status status) {
return statusMapper.deviceStatusListById(status);
}
public List<Status> listStatusByTypes(Status status) {
List<Status> list = statusMapper.listStatusByTypes(status);
return list;
}
}

35
zc-business/src/main/resources/mapper/business/StatusMapper.xml

@ -152,6 +152,41 @@
</select>
<select id="listStatusByTypes" parameterType="com.zc.business.domain.Status" resultMap="BaseResultMap">
select s.id, s.device_no, s.device_name, s.device_status,s.time,
d.device_ip,s.success_rate,s.lost_rate,d.direction,e.manufacturer,e.model,d.facilities_type,d.remark,COALESCE(d.child_type,
d.device_type) AS type
from dc_device d
LEFT JOIN status s on (s.device_id=d.id)
LEFT JOIN dc_product e on e.id=d.product_id
<where>
<if test="status.time != null">
AND s.time BETWEEN #{status.startTime,jdbcType=DATE} AND #{status.time,jdbcType=DATE}
</if>
<if test="status.deviceNo != null">
AND s.device_no = #{status.deviceNo}
</if>
<if test="status.type != null">
AND (d.device_type in
<foreach item="typeItem" collection="status.types" open="(" separator="," close=")">
#{typeItem}
</foreach>
or d.child_type in
<foreach item="typeItem" collection="status.types" open="(" separator="," close=")">
#{typeItem}
</foreach>
)
</if>
<if test="status.deviceId != null">
AND s.device_id = #{status.deviceId}
</if>
<if test="status.useState != null and status.useState != 0">
AND d.use_state = #{status.useState}
</if>
</where>
</select>
<select id="listStatusBySection" parameterType="com.zc.business.domain.Status" resultMap="BaseResultMap">
select s.id, s.device_no, s.device_name, s.device_status,s.time,
d.device_ip,s.success_rate,s.lost_rate,d.direction,e.manufacturer,e.model,d.facilities_type,m.section_id,d.remark,COALESCE(d.child_type,

Loading…
Cancel
Save