Commit 3ee317d5 authored by 高建强's avatar 高建强

item:三维值班修改

parent ce900365
package com.yeejoin.amos.fas.common.enums;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*0、运行中,1、完毕,3、中断
* @author suhg
*/
public enum DutyPersonEnum {
FIRE_PERSON("驻站消防","fire"),
OPS_PERSON("运维人员","ops"),
REAL_PERSON("物业安保","realEstate");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
/**
* 颜色
*/
private String color;
private DutyPersonEnum(String name, String code){
this.name = name;
this.code = code;
}
public static DutyPersonEnum getEnum(String code) {
DutyPersonEnum checkStatusEnum = null;
for(DutyPersonEnum type: DutyPersonEnum.values()) {
if (type.getCode().equals(code)) {
checkStatusEnum = type;
break;
}
}
return checkStatusEnum;
}
public static List<Map<String,Object>> getEnumList() {
List<Map<String,Object>> nameList = new ArrayList<>();
for (DutyPersonEnum c: DutyPersonEnum.values()) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", c.getName());
map.put("code", c.getCode());
nameList.add(map);
}
return nameList;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
......@@ -180,13 +180,7 @@ public class View3dController extends BaseController {
@ApiOperation(value = "今日值班统计",notes = "今日值班统计")
@GetMapping(value = "statistics/duty")
public CommonResponse getStatisticsDuty(){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
appKey = getAppKey();
product = getProduct();
staticOrgCode = orgCode;
token = getToken();
return view3dService.getStatisticsDuty(getAppKey(),getProduct(),token,orgCode);
return CommonResponseUtil.success(view3dService.getStatisticsDuty());
}
@Permission
......
package com.yeejoin.amos.fas.business.feign;
import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* 消息推送
* @author maoying
*
*/
@FeignClient(name = "${Jcs.fegin.name}", configuration={MultipartSupportConfig.class})
public interface JcsFeign {
/**
* 新值班月视图
* @param dutyDay
* @param shiftId
* @param postType
* @return
*/
@RequestMapping(value = "/jcs/common/duty-person/new-duty-detail", method = RequestMethod.GET,consumes = "application/json")
ResponseModel dutyStatisticsByDate(
@RequestParam String beginDate,
@RequestParam String endDate,
@RequestParam(required = false) String fieldCode);
/**
* 查询当前值班人信息列表
* @return
*/
@RequestMapping(value = "/jcs/common/duty-person/person/on_duty/list", method = RequestMethod.GET,consumes = "application/json")
ResponseModel dutyPersonList();
}
......@@ -18,6 +18,7 @@ import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao;
import com.yeejoin.amos.fas.business.dao.repository.ISafetyIndexChangeLogDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
import com.yeejoin.amos.fas.business.feign.JcsFeign;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService;
import com.yeejoin.amos.fas.business.service.intfc.IView3dService;
......@@ -30,6 +31,7 @@ import com.yeejoin.amos.fas.core.common.response.Node3DVoResponse;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.RiskLevel;
......@@ -87,6 +89,9 @@ public class View3dServiceImpl implements IView3dService {
@Autowired
private IDutyModeServer dutyModeServer;
@Autowired
private JcsFeign jcsFeign;
@Value("${param.system.online.date}")
private String onLineDate;
......@@ -495,12 +500,36 @@ public class View3dServiceImpl implements IView3dService {
}
@Override
public CommonResponse getStatisticsDuty(String appKey, String product, String token, String orgCode) {
Date curDate = new Date();
public Map<String, Object> getStatisticsDuty() {
Map<String, Object> map = new HashMap<>();
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
JSONObject param = new JSONObject();
param.put("dutyDate", curDate);
return dutyModeServer.dutyListByDay(appKey, product, token, orgCode, param.toJSONString());
String dateStr = format.format(date);
ResponseModel responseModel = jcsFeign.dutyStatisticsByDate(dateStr, dateStr, "personType");
if ("SUCCESS".equals(responseModel.getDevMessage())) {
String JSONStr = JSON.toJSONString(responseModel.getResult());
JSONArray dataList = JSONObject.parseArray(JSONStr);
if (!ObjectUtils.isEmpty(dataList)) {
for (Object x : dataList) {
Map<String, Object> resultMap = new HashMap<>();
String json = JSON.toJSONString(((JSONObject) x).get("data"));
JSONArray array = JSONObject.parseArray(json);
if (!ObjectUtils.isEmpty(array)) {
Map<String, String> result = (Map<String, String>) array.get(0);
String total = result.get("total");
String postTypeName = result.get("postTypeName");
if (DutyPersonEnum.FIRE_PERSON.getName().equals(postTypeName)) {
map.put("firePersonNumber", total);
} else if (DutyPersonEnum.OPS_PERSON.getName().equals(postTypeName)) {
map.put("dutyPersonNumber", total);
} else if (DutyPersonEnum.REAL_PERSON.getName().equals(postTypeName)) {
map.put("securityPersonNumber", total);
}
}
}
}
}
return map;
}
@Override
......@@ -659,79 +688,26 @@ public class View3dServiceImpl implements IView3dService {
@Override
public List<Map<String, Object>> dutyList(String orgCode) {
Date curDate = new Date();
JSONObject param = new JSONObject();
param.put("dutyDate", curDate);
Toke toke = remoteSecurityService.getServerToken();
ArrayList<Map<String, Object>> list = new ArrayList<>();
CommonResponse commonResponse = dutyModeServer.dutyListByDate(toke.getAppKey(), toke.getProduct(), toke.getToke(), orgCode, param.toJSONString());
if ("SUCCESS".equals(commonResponse.getResult())) {
String JSONStr = JSON.toJSONString(commonResponse.getDataList());
ResponseModel responseModel = jcsFeign.dutyPersonList();
if ("SUCCESS".equals(responseModel.getDevMessage())) {
String JSONStr = JSON.toJSONString(responseModel.getResult());
JSONArray dataList = JSONObject.parseArray(JSONStr);
if (!ObjectUtils.isEmpty(dataList)) {
dataList.forEach(
x -> {
dataList.forEach(x -> {
Map<String, Object> resultMap = new HashMap<>();
JSONObject obj = (JSONObject) x;
String postType = obj.getString("postType");
resultMap.put("postName", findPostName(postType));
resultMap.put("name", obj.getString("dutyName"));
resultMap.put("phone", obj.getString("mobile"));
resultMap.put("postName", obj.getString("postTypeName"));
resultMap.put("name", obj.getString("userName"));
resultMap.put("phone", obj.getString("telephone"));
list.add(resultMap);
}
);
});
}
}
return list;
}
private String findPostName(String postType) {
String postName ;
switch (postType) {
case "dutyLeader":
postName = "值班站长";
break;
case "deputyDutyLeader":
postName = "副值班长";
break;
case "dutyCivilian":
postName = "值班员";
break;
case "fireLeader":
postName = "驻站消防站长";
break;
case "firePerson":
postName = "消防员";
break;
case "safePerson":
postName = "保安";
break;
case "deputyDutyCivilian":
postName = "副值班员";
break;
case "fireDriver":
postName = "司机";
break;
case "fireSafetyPerson":
postName = "消防安全负责人";
break;
case "fireManagementPerson":
postName = "消防安全管理人";
break;
case "fireBrigadeLeader":
postName = "消防专职队队长";
break;
case "fireBrigadeMember":
postName = "消防专职队队员";
break;
default:
postName = "";
break;
}
return postName;
}
private List<Map<String, Object>> getPointsByRegionIds(List<Long> ids) {
return view3dMapper.getAllPointInRegions(ids);
}
......
......@@ -104,7 +104,7 @@ public interface IView3dService {
* 今日值班统计
* @return
*/
CommonResponse getStatisticsDuty(String appKey, String product, String token, String orgCode);
Map<String, Object> getStatisticsDuty();
/**
* 设备状态消息最新5条
......
......@@ -52,6 +52,10 @@ equipManage.fegin.name=AMOS-EQUIPMANAGE
#jpush 服务名称
Push.fegin.name=AMOS-JPUSH
#JCS 服务名称
Jcs.fegin.name=JCS
#feginName
number.plan.projectName=换流站消防专项预案
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment