|
@@ -60,6 +60,13 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
@Autowired
|
|
|
private LawenforcementUserMapper userMapper;
|
|
|
|
|
|
+ private final static String DAI_ZHI_FA = "lawenforcement_type_1";
|
|
|
+ private final static String ZHI_FA_WAN_CHENG = "lawenforcement_type_2";
|
|
|
+ private final static String ZHI_FA_ZHONG = "lawenforcement_type_6";
|
|
|
+ private final static String ZHI_FA_YI_CHANG = "lawenforcement_type_3";
|
|
|
+ private final static String ER_CI_ZHI_FA = "lawenforcement_type_4";
|
|
|
+ private final static String ER_CI_ZHI_FA_WAN_CHENG = "lawenforcement_type_5";
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 对接省平台数据
|
|
@@ -92,8 +99,13 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
recordMapper.removePersonInfoById(remoteRecord.getId());
|
|
|
recordMapper.updateRecord(remoteRecord);
|
|
|
} else {
|
|
|
- remoteRecord.setRecordStatus("lawenforcement_type_1");
|
|
|
+ if(StringUtils.isNotEmpty(remoteRecord.getStatus()) && "3".equals(remoteRecord.getStatus())){
|
|
|
+ remoteRecord.setRecordStatus(ZHI_FA_WAN_CHENG);
|
|
|
+ }else{
|
|
|
+ remoteRecord.setRecordStatus(DAI_ZHI_FA);
|
|
|
+ }
|
|
|
recordAddList.add(remoteRecord);
|
|
|
+
|
|
|
}
|
|
|
//将工单子表信息整理
|
|
|
JSONObject dataList = addRecordByRemote(remoteRecord);
|
|
@@ -173,7 +185,7 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
record.setCreatorName(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
|
|
record.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId().toString());
|
|
|
record.setDeptName(SecurityUtils.getLoginUser().getSysUser().getDeptNames());
|
|
|
- record.setRecordStatus("lawenforcement_type_1");
|
|
|
+ record.setRecordStatus(DAI_ZHI_FA);
|
|
|
record.setCreateTime(String.valueOf(System.currentTimeMillis()));
|
|
|
record.setIsLast(0);
|
|
|
return recordMapper.insertLawenforcementRecord(record);
|
|
@@ -218,14 +230,16 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
*/
|
|
|
@Override
|
|
|
public int addRecordLog(LawenforcementBindDeviceBO record) {
|
|
|
+ //查询人员id
|
|
|
if (null == record.getUserId() || record.getUserId().isEmpty()) {
|
|
|
record.setUserId(SecurityUtils.getLoginUser().getSysUser().getUserId().toString());
|
|
|
}
|
|
|
+ //查询执法编号
|
|
|
Map<String, Object> userCodeByUserId = userMapper.getUserCodeByUserId(record.getUserId());
|
|
|
record.setPersonCode(MapUtils.getString(userCodeByUserId, "personCode"));
|
|
|
|
|
|
//检查当前绑定设备的执法人是否为主办人
|
|
|
- Map<String, Object> isMainPerson = recordMapper.getIsMainPerson(record);
|
|
|
+// Map<String, Object> isMainPerson = recordMapper.getIsMainPerson(record);
|
|
|
//将设备与人员绑定
|
|
|
int i = recordMapper.bindDeviceToPerson(record);
|
|
|
|
|
@@ -233,12 +247,12 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
//将工单执行记录,写入到日志表中:数据id、任务id、执法人编号、设备编号、开始时间
|
|
|
recordMapper.addRecordLog(lawenforcementRecordLog);
|
|
|
//判断是否为主办人,如果是主办人则开始工单
|
|
|
- if ("1".equals(MapUtils.getString(isMainPerson, "mainPerson"))) {
|
|
|
- recordMapper.startRecord(record);
|
|
|
- //绑定设备后关闭定时任务
|
|
|
- deviceService.cancelTask(lawenforcementRecordLog.getDeviceId());
|
|
|
- deviceService.setOpenedDevice(lawenforcementRecordLog.getDeviceId());
|
|
|
- }
|
|
|
+// if ("1".equals(MapUtils.getString(isMainPerson, "mainPerson"))) {
|
|
|
+ recordMapper.startRecord(record);
|
|
|
+ //绑定设备后关闭定时任务
|
|
|
+ deviceService.cancelTask(lawenforcementRecordLog.getDeviceId());
|
|
|
+ deviceService.setOpenedDevice(lawenforcementRecordLog.getDeviceId());
|
|
|
+// }
|
|
|
return i;
|
|
|
}
|
|
|
|
|
@@ -312,11 +326,11 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
record.setPersonCode(MapUtils.getString(userCodeByUserId, "personCode"));
|
|
|
|
|
|
//检查当前绑定设备的执法人是否为主办人
|
|
|
- Map<String, Object> isMainPerson = recordMapper.getIsMainPerson(record);
|
|
|
- if ("1".equals(MapUtils.getString(isMainPerson, "mainPerson"))) {
|
|
|
+// Map<String, Object> isMainPerson = recordMapper.getIsMainPerson(record);
|
|
|
+// if ("1".equals(MapUtils.getString(isMainPerson, "mainPerson"))) {
|
|
|
//设置任务完成状态
|
|
|
recordMapper.updateRecordStatus(record);
|
|
|
- }
|
|
|
+// }
|
|
|
|
|
|
//设置任务结束时间
|
|
|
int i = recordMapper.updateRecordLogEndTime(record);
|
|
@@ -336,7 +350,31 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
}
|
|
|
Map<String, Object> userCodeByUserId = userMapper.getUserCodeByUserId(record.getCreatorId());
|
|
|
record.setPersonCode(MapUtils.getString(userCodeByUserId, "personCode"));
|
|
|
+ //查询任务集合
|
|
|
List<LawenforcementRecord> recordList = recordMapper.getRecordList(record);
|
|
|
+ //处理工单状态
|
|
|
+ recordList.forEach(data->{
|
|
|
+ if(StringUtils.isNotEmpty(record.getRecordStatus())){
|
|
|
+ //查询带执法
|
|
|
+ if(DAI_ZHI_FA.equals(record.getRecordStatus())){
|
|
|
+ //查询结果中可能存在已经进行中的任务;需要修改为带执法状态
|
|
|
+ if(ZHI_FA_ZHONG.equals(data.getRecordStatus())){
|
|
|
+ data.setRecordStatus(DAI_ZHI_FA);
|
|
|
+ }else if(ER_CI_ZHI_FA.equals(data.getRecordStatus())){
|
|
|
+ data.setRecordStatus(ZHI_FA_YI_CHANG);
|
|
|
+ }
|
|
|
+ //查询执法进行中
|
|
|
+ }else if(ZHI_FA_ZHONG.equals(record.getRecordStatus())){
|
|
|
+ if(ZHI_FA_WAN_CHENG.equals(data.getRecordStatus())){
|
|
|
+ data.setRecordStatus(ZHI_FA_ZHONG);
|
|
|
+ }else if(ER_CI_ZHI_FA_WAN_CHENG.equals(data.getRecordStatus())){
|
|
|
+ data.setRecordStatus(ER_CI_ZHI_FA);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //查询执法完成 不需要处理
|
|
|
+ }
|
|
|
+ });
|
|
|
return recordList;
|
|
|
}
|
|
|
|
|
@@ -360,12 +398,10 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
//设置父id
|
|
|
if (StringUtils.isNotEmpty(standards)) {
|
|
|
setSubItemId(subitem.getId(), standards);
|
|
|
- log.info("放入standards =》 {}", standards);
|
|
|
standardAddList.addAll(standards);
|
|
|
}
|
|
|
});
|
|
|
setRecordIdToItems(record.getId(), subitems);
|
|
|
- log.info("放入subitems =》 {}", subitems);
|
|
|
subitemAddList.addAll(subitems);
|
|
|
}
|
|
|
|
|
@@ -374,7 +410,6 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
if (StringUtils.isNotEmpty(persons)) {
|
|
|
setRecordIdToItems(record.getId(), persons);
|
|
|
setDeptId(persons);
|
|
|
- log.info("放入persons =》 {}", persons);
|
|
|
personAddList.addAll(persons);
|
|
|
}
|
|
|
//创建返回对象
|
|
@@ -405,9 +440,14 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
//获取persons中的deptName放入到deptNames中
|
|
|
Set<String> deptNameSet = new HashSet<>();
|
|
|
for (LawenforcementPersonDetailVO person : persons) {
|
|
|
- deptNameSet.add(person.getDeptName());
|
|
|
+ if (StringUtils.isNotEmpty(person.getDeptName())) {
|
|
|
+ deptNameSet.add(person.getDeptName());
|
|
|
+ } else {
|
|
|
+ String deptName = "未确定行政所属";
|
|
|
+ person.setDeptName(deptName);
|
|
|
+ deptNameSet.add(deptName);
|
|
|
+ }
|
|
|
}
|
|
|
-// deptNameSet.add("四平市");
|
|
|
String[] deptNames = deptNameSet.toArray(new String[0]);
|
|
|
|
|
|
//根据部门名称查询部门id
|
|
@@ -430,27 +470,28 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
|
|
|
|
|
|
private void insertJsonData(JSONArray array) {
|
|
|
List<Map<String, Object>> listToInsert = new ArrayList<>();
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
- for (int i = 0; i < array.size(); i++) {
|
|
|
- JSONObject jsonObject = array.getJSONObject(i);
|
|
|
- String id = jsonObject.getString("id");
|
|
|
- int count = recordMapper.selectJsonDataById(id);
|
|
|
- if (count > 0) {
|
|
|
- //更新
|
|
|
- recordMapper.updateJsonData(id, jsonObject.toString(), new Date());
|
|
|
- } else {
|
|
|
- // id 不存在,放入 List<Map>
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("id", id);
|
|
|
- map.put("jsonData", jsonObject.toString());
|
|
|
- map.put("createTime", new Date());
|
|
|
-
|
|
|
- listToInsert.add(map);
|
|
|
+ try {
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
+ JSONObject jsonObject = array.getJSONObject(i);
|
|
|
+ String id = jsonObject.getString("id");
|
|
|
+ int count = recordMapper.selectJsonDataById(id);
|
|
|
+ if (count > 0) {
|
|
|
+ //更新
|
|
|
+ recordMapper.updateJsonData(id, jsonObject.toString(), new Date());
|
|
|
+ } else {
|
|
|
+ // id 不存在,放入 List<Map>
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", id);
|
|
|
+ map.put("jsonData", jsonObject.toString());
|
|
|
+ map.put("createTime", new Date());
|
|
|
+ listToInsert.add(map);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.isNotEmpty(listToInsert)) {
|
|
|
- recordMapper.batchInsert(listToInsert);
|
|
|
+ if (StringUtils.isNotEmpty(listToInsert)) {
|
|
|
+ recordMapper.batchInsert(listToInsert);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("省平台对接数据,报文异常====>{}", e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|