|
@ -1,13 +1,19 @@ |
|
|
package com.zc.business.service.impl; |
|
|
package com.zc.business.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
|
|
import com.zc.business.domain.*; |
|
|
|
|
|
import com.zc.business.enums.ValueConverter; |
|
|
|
|
|
import com.zc.business.utils.diff.Diff; |
|
|
|
|
|
import com.zc.business.utils.diff.model.Result; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import com.zc.business.mapper.DcEventImportantMapper; |
|
|
import com.zc.business.mapper.DcEventImportantMapper; |
|
|
import com.zc.business.domain.DcEventImportant; |
|
|
|
|
|
import com.zc.business.service.IDcEventImportantService; |
|
|
import com.zc.business.service.IDcEventImportantService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -21,6 +27,8 @@ public class DcEventImportantServiceImpl implements IDcEventImportantService |
|
|
{ |
|
|
{ |
|
|
@Autowired |
|
|
@Autowired |
|
|
private DcEventImportantMapper dcEventImportantMapper; |
|
|
private DcEventImportantMapper dcEventImportantMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private DcEventProcessServiceImpl dcEventProcessService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询事件侧重要素 |
|
|
* 查询事件侧重要素 |
|
@ -70,10 +78,23 @@ public class DcEventImportantServiceImpl implements IDcEventImportantService |
|
|
if (StringUtils.isEmpty(dcEventImportant.getEventId())){ |
|
|
if (StringUtils.isEmpty(dcEventImportant.getEventId())){ |
|
|
return AjaxResult.error("事件id不能为空"); |
|
|
return AjaxResult.error("事件id不能为空"); |
|
|
} |
|
|
} |
|
|
int i = dcEventImportantMapper.updateDcEventImportant(dcEventImportant); |
|
|
DcEventImportant oldData = dcEventImportantMapper.selectDcEventImportantByEventId(dcEventImportant.getEventId()); |
|
|
if (i < 1){ |
|
|
if (oldData != null){ |
|
|
|
|
|
dcEventImportantMapper.updateDcEventImportant(dcEventImportant); |
|
|
|
|
|
} else { |
|
|
dcEventImportantMapper.insertDcEventImportant(dcEventImportant); |
|
|
dcEventImportantMapper.insertDcEventImportant(dcEventImportant); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String context = comparisonInfo(oldData,dcEventImportant); |
|
|
|
|
|
if (context.length() > 0) { |
|
|
|
|
|
//事件处置流程记录
|
|
|
|
|
|
DcEventProcess dcEventProcess = new DcEventProcess(); |
|
|
|
|
|
dcEventProcess.setEventId(dcEventImportant.getEventId()); |
|
|
|
|
|
dcEventProcess.setSource(1); |
|
|
|
|
|
dcEventProcess.setContext(context); |
|
|
|
|
|
dcEventProcessService.insertDcEventProcess(dcEventProcess); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return AjaxResult.success("侧重要素添加成功"); |
|
|
return AjaxResult.success("侧重要素添加成功"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -100,4 +121,40 @@ public class DcEventImportantServiceImpl implements IDcEventImportantService |
|
|
{ |
|
|
{ |
|
|
return dcEventImportantMapper.deleteDcEventImportantByEventId(id); |
|
|
return dcEventImportantMapper.deleteDcEventImportantByEventId(id); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String comparisonInfo(DcEventImportant oldData, DcEventImportant newData) { |
|
|
|
|
|
String context = "上报侧重要素,"; |
|
|
|
|
|
if (oldData == null ) { |
|
|
|
|
|
oldData = new DcEventImportant(); |
|
|
|
|
|
} |
|
|
|
|
|
Diff diff = new Diff(); |
|
|
|
|
|
List<Result> diffList = diff.diff(JSON.toJSON(oldData).toString(), JSON.toJSON(newData).toString()); |
|
|
|
|
|
for (Result result : diffList) { |
|
|
|
|
|
if ("ADD".equals(result.getDiffType()) || "MODIFY".equals(result.getDiffType())) { |
|
|
|
|
|
if ("planStatus".equals(result.getRightPath()) |
|
|
|
|
|
|| "trafficPoliceStatus".equals(result.getRightPath()) |
|
|
|
|
|
|| "medicalStatus".equals(result.getRightPath()) |
|
|
|
|
|
|| "boardStatus".equals(result.getRightPath()) |
|
|
|
|
|
|| "chemicalsStatus".equals(result.getRightPath()) |
|
|
|
|
|
|| "fireStatus".equals(result.getRightPath())) { |
|
|
|
|
|
if ("0".equals(result.getRight())) { |
|
|
|
|
|
result.setRight("否"); |
|
|
|
|
|
} else if ("1".equals(result.getRight())) { |
|
|
|
|
|
result.setRight("是"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
String label = ValueConverter.eventImportantLabel(result.getRightPath()); |
|
|
|
|
|
if (StringUtils.isNotEmpty(label)) { |
|
|
|
|
|
context = context + label + "修改为:" + result.getRight() + ","; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (context.length() > 0) { |
|
|
|
|
|
context = context.substring(0, context.length() - 1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return context; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|