|
@@ -3,6 +3,8 @@ package com.jd.service.impl;
|
|
import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.convert.Convert;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.jd.code.ConstString;
|
|
import com.jd.code.ConstString;
|
|
|
|
+import com.jd.entity.Process;
|
|
|
|
+import com.jd.entity.ProcessPlan;
|
|
import com.jd.entity.SignalSource;
|
|
import com.jd.entity.SignalSource;
|
|
import com.jd.entity.basic.Caption;
|
|
import com.jd.entity.basic.Caption;
|
|
import com.jd.entity.basic.Plan;
|
|
import com.jd.entity.basic.Plan;
|
|
@@ -22,349 +24,413 @@ import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 方案实现类
|
|
|
|
- *
|
|
|
|
- * @author leihy
|
|
|
|
- */
|
|
|
|
|
|
+* 方案实现类
|
|
|
|
+*
|
|
|
|
+* @author leihy
|
|
|
|
+*/
|
|
@Service("planServiceImpl")
|
|
@Service("planServiceImpl")
|
|
public class PlanServiceImpl implements PlanService {
|
|
public class PlanServiceImpl implements PlanService {
|
|
|
|
|
|
- @Resource
|
|
|
|
- private PlanMapper planMapper;
|
|
|
|
- @Resource
|
|
|
|
- private PlanAreaMapper planAreaMapper;
|
|
|
|
- @Resource
|
|
|
|
- private SignalSourceMapper signalSourceMapper;
|
|
|
|
- @Resource
|
|
|
|
- private CaptionMapper captionMapper;
|
|
|
|
- @Resource
|
|
|
|
- private RoleMapper roleMapper;
|
|
|
|
- @Resource
|
|
|
|
- private ProcessMapper processMapper;
|
|
|
|
|
|
+@Resource
|
|
|
|
+private PlanMapper planMapper;
|
|
|
|
+@Resource
|
|
|
|
+private PlanAreaMapper planAreaMapper;
|
|
|
|
+@Resource
|
|
|
|
+private SignalSourceMapper signalSourceMapper;
|
|
|
|
+@Resource
|
|
|
|
+private CaptionMapper captionMapper;
|
|
|
|
+@Resource
|
|
|
|
+private RoleMapper roleMapper;
|
|
|
|
+@Resource
|
|
|
|
+private ProcessMapper processMapper;
|
|
|
|
+@Resource
|
|
|
|
+private ProcessPlanMapper processPlanMapper;
|
|
|
|
|
|
- @Override
|
|
|
|
- public Map<String, Object> getPlanListByPage(Map<String, Object> param) {
|
|
|
|
- // 获取数量
|
|
|
|
- Integer count = planMapper.getCountPlan(param);
|
|
|
|
- if (Blank.isEmpty(count) || count <= 0) {
|
|
|
|
- return SendUtil.layuiTable(0, null);
|
|
|
|
- }
|
|
|
|
- //分页查询所有方案
|
|
|
|
- List<Map<String, Object>> list = planMapper.getPlanListByPage(param);
|
|
|
|
- return SendUtil.layuiTable(count, list);
|
|
|
|
|
|
+@Override
|
|
|
|
+public Map<String, Object> getPlanListByPage(Map<String, Object> param) {
|
|
|
|
+ // 获取数量
|
|
|
|
+ Integer count = planMapper.getCountPlan(param);
|
|
|
|
+ if (Blank.isEmpty(count) || count <= 0) {
|
|
|
|
+ return SendUtil.layuiTable(0, null);
|
|
}
|
|
}
|
|
|
|
+ //分页查询所有方案
|
|
|
|
+ List<Map<String, Object>> list = planMapper.getPlanListByPage(param);
|
|
|
|
+ return SendUtil.layuiTable(count, list);
|
|
|
|
+}
|
|
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public Map<String, Object> savePlan(Plan plan) {
|
|
|
|
- //判断是否是默认方案
|
|
|
|
- if (plan.getDefaultPlan() != null && plan.getDefaultPlan() == 1) {
|
|
|
|
- planMapper.clearDefaultPlan();
|
|
|
|
- }
|
|
|
|
- // 验证编号是否重复
|
|
|
|
- Integer count = planMapper.repeatedVerificationById(plan);
|
|
|
|
- if (count > 0) {
|
|
|
|
- return SendUtil.send(false, ConstString.RESULT_EXIST);
|
|
|
|
- }
|
|
|
|
- boolean result = planMapper.savePlan(plan);
|
|
|
|
- return SendUtil.send(result);
|
|
|
|
|
|
+@Override
|
|
|
|
+@Transactional(rollbackFor = Exception.class)
|
|
|
|
+public Map<String, Object> savePlan(Plan plan) {
|
|
|
|
+ //判断是否是默认方案
|
|
|
|
+ if (plan.getDefaultPlan() != null && plan.getDefaultPlan() == 1) {
|
|
|
|
+ planMapper.clearDefaultPlan();
|
|
}
|
|
}
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public Map<String, Object> updatePlan(Plan plan) {
|
|
|
|
- //判断是否是默认方案
|
|
|
|
- if (plan.getDefaultPlan() != null && plan.getDefaultPlan() == 1) {
|
|
|
|
- planMapper.clearDefaultPlan();
|
|
|
|
- }
|
|
|
|
- // 验证编号是否重复
|
|
|
|
- Integer count = planMapper.repeatedVerificationById(plan);
|
|
|
|
- if (count > 0) {
|
|
|
|
- return SendUtil.send(false, ConstString.RESULT_EXIST);
|
|
|
|
- }
|
|
|
|
- boolean result = planMapper.updatePlan(plan);
|
|
|
|
- return SendUtil.send(result);
|
|
|
|
|
|
+ // 验证编号是否重复
|
|
|
|
+ Integer count = planMapper.repeatedVerificationById(plan);
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ return SendUtil.send(false, ConstString.RESULT_EXIST);
|
|
}
|
|
}
|
|
|
|
+ boolean result = planMapper.savePlan(plan);
|
|
|
|
+ return SendUtil.send(result);
|
|
|
|
+}
|
|
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public Map<String, Object> deletePlan(Integer id) {
|
|
|
|
- // 获取方案下绑定的方案区域
|
|
|
|
- List<Map<String, Object>> planAreaList = planAreaMapper.getPlanAreaListByPlan(id, null);
|
|
|
|
- // 获取方案下绑定的解说词
|
|
|
|
- List<Map<String, Object>> captionList = planAreaMapper.getCaptionByPlanId(id);
|
|
|
|
- if (planAreaList.size() > 0 || captionList.size() > 0) {
|
|
|
|
- return SendUtil.send(false, ConstString.RESULT_EXIST);
|
|
|
|
- }
|
|
|
|
- boolean result = planMapper.deletePlan(id);
|
|
|
|
- //
|
|
|
|
- roleMapper.deleteRolePlanByPlanId(id);
|
|
|
|
- return SendUtil.send(result);
|
|
|
|
|
|
+@Override
|
|
|
|
+@Transactional(rollbackFor = Exception.class)
|
|
|
|
+public Map<String, Object> updatePlan(Plan plan) {
|
|
|
|
+ //判断是否是默认方案
|
|
|
|
+ if (plan.getDefaultPlan() != null && plan.getDefaultPlan() == 1) {
|
|
|
|
+ planMapper.clearDefaultPlan();
|
|
}
|
|
}
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public Map<String, Object> getOnePlanById(Integer id) {
|
|
|
|
- return planMapper.getOnePlanById(id);
|
|
|
|
|
|
+ // 验证编号是否重复
|
|
|
|
+ Integer count = planMapper.repeatedVerificationById(plan);
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ return SendUtil.send(false, ConstString.RESULT_EXIST);
|
|
}
|
|
}
|
|
|
|
+ boolean result = planMapper.updatePlan(plan);
|
|
|
|
+ return SendUtil.send(result);
|
|
|
|
+}
|
|
|
|
|
|
- @Override
|
|
|
|
- public Map<String, Object> getOnePlanByCode(String planCode) {
|
|
|
|
- return planMapper.getOnePlanByCode(planCode);
|
|
|
|
|
|
+@Override
|
|
|
|
+@Transactional(rollbackFor = Exception.class)
|
|
|
|
+public Map<String, Object> deletePlan(Integer id) {
|
|
|
|
+ // 获取方案下绑定的方案区域
|
|
|
|
+ List<Map<String, Object>> planAreaList = planAreaMapper.getPlanAreaListByPlan(id, null);
|
|
|
|
+ // 获取方案下绑定的解说词
|
|
|
|
+ List<Map<String, Object>> captionList = planAreaMapper.getCaptionByPlanId(id);
|
|
|
|
+ if (planAreaList.size() > 0 || captionList.size() > 0) {
|
|
|
|
+ return SendUtil.send(false, ConstString.RESULT_EXIST);
|
|
}
|
|
}
|
|
|
|
+ boolean result = planMapper.deletePlan(id);
|
|
|
|
+ //
|
|
|
|
+ roleMapper.deleteRolePlanByPlanId(id);
|
|
|
|
+ return SendUtil.send(result);
|
|
|
|
+}
|
|
|
|
|
|
- /**
|
|
|
|
- * 查询所有方案列表树
|
|
|
|
- *
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @Override
|
|
|
|
- public List<Map<String, Object>> getPlanTreeList() {
|
|
|
|
- return planMapper.getPlanTreeList();
|
|
|
|
- }
|
|
|
|
|
|
+@Override
|
|
|
|
+public Map<String, Object> getOnePlanById(Integer id) {
|
|
|
|
+ return planMapper.getOnePlanById(id);
|
|
|
|
+}
|
|
|
|
|
|
- @Override
|
|
|
|
- public List<Map<String, Object>> getAllPlan() {
|
|
|
|
- return planMapper.getAllPlan();
|
|
|
|
- }
|
|
|
|
|
|
+@Override
|
|
|
|
+public Map<String, Object> getOnePlanByCode(String planCode) {
|
|
|
|
+ return planMapper.getOnePlanByCode(planCode);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 查询所有方案列表树
|
|
|
|
+ *
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+@Override
|
|
|
|
+public List<Map<String, Object>> getPlanTreeList() {
|
|
|
|
+ return planMapper.getPlanTreeList();
|
|
|
|
+}
|
|
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public Map<String, Object> savePlanAllInfo(Integer roleId, String planName, String params) {
|
|
|
|
- // 创建新方案
|
|
|
|
- Plan plan = new Plan();
|
|
|
|
- int number = planMapper.getAllPlan().size() + 1;
|
|
|
|
- plan.setPlanName(planName).setDefaultPlan(0).setPlanCode(Convert.toStr(number));
|
|
|
|
- // TODO 设置方案编号
|
|
|
|
- planMapper.savePlan(plan);
|
|
|
|
- Integer planId = plan.getId();
|
|
|
|
- // 绑定角色方案关系 并创建
|
|
|
|
- Map<String, Object> rolePlan = new HashMap<>();
|
|
|
|
- rolePlan.put("roleId", roleId);
|
|
|
|
- rolePlan.put("planId", planId);
|
|
|
|
- roleMapper.insertRolePlan(rolePlan);
|
|
|
|
- // 创建方案区域信息
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(params);
|
|
|
|
- List<Map<String, Object>> planAreaList = (List<Map<String, Object>>) jsonObject.get("planAreaList");
|
|
|
|
- List<Map<String, Object>> captionList = (List<Map<String, Object>>) jsonObject.get("captionList");
|
|
|
|
- if (Blank.isNotEmpty(planAreaList)) {
|
|
|
|
- for (Map<String, Object> planAreaInfo : planAreaList) {
|
|
|
|
- // 新增方案区域信息
|
|
|
|
- PlanArea planArea = new PlanArea();
|
|
|
|
- planArea.setPlanId(Convert.toStr(planId))
|
|
|
|
- .setProcessPlanId(Convert.toStr(planAreaInfo.get("process_plan_id")))
|
|
|
|
- .setAreaName(Convert.toStr(planAreaInfo.get("area_name")))
|
|
|
|
- .setAreaCode(Convert.toStr(planAreaInfo.get("area_code")))
|
|
|
|
- .setUrl(Convert.toStr(planAreaInfo.get("url")))
|
|
|
|
- .setYkUrl(Convert.toStr(planAreaInfo.get("yk_url")))
|
|
|
|
- .setSortno(Convert.toInt(planAreaInfo.get("sortno")))
|
|
|
|
- .setSignalSource(Convert.toStr(planAreaInfo.get("signal_source")))
|
|
|
|
- .setDeviceButtons(Convert.toStr(planAreaInfo.get("device_buttons")));
|
|
|
|
- planAreaMapper.insertPlanArea(planArea);
|
|
|
|
|
|
+@Override
|
|
|
|
+public List<Map<String, Object>> getAllPlan() {
|
|
|
|
+ return planMapper.getAllPlan();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+@Override
|
|
|
|
+@Transactional(rollbackFor = Exception.class)
|
|
|
|
+public Map<String, Object> savePlanAllInfo(Integer roleId, String planName, String params) {
|
|
|
|
+ // 创建新方案
|
|
|
|
+ Plan plan = new Plan();
|
|
|
|
+ int number = planMapper.getAllPlan().size() + 1;
|
|
|
|
+ plan.setPlanName(planName).setDefaultPlan(0).setSortno(number).setPlanCode(Convert.toStr(System.currentTimeMillis()));
|
|
|
|
+ planMapper.savePlan(plan);
|
|
|
|
+ Integer planId = plan.getId();
|
|
|
|
+ // 绑定角色方案关系 并创建
|
|
|
|
+ Map<String, Object> rolePlan = new HashMap<>();
|
|
|
|
+ rolePlan.put("roleId", roleId);
|
|
|
|
+ rolePlan.put("planId", planId);
|
|
|
|
+ roleMapper.insertRolePlan(rolePlan);
|
|
|
|
+
|
|
|
|
+ // 创建方案区域信息
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(params);
|
|
|
|
+ List<Map<String, Object>> planAreaList = (List<Map<String, Object>>) jsonObject.get("planAreaList");
|
|
|
|
+ List<Map<String, Object>> captionList = (List<Map<String, Object>>) jsonObject.get("captionList");
|
|
|
|
+ if (Blank.isNotEmpty(planAreaList)) {
|
|
|
|
+ Integer processPlanId;
|
|
|
|
+ int i = 0;
|
|
|
|
+ List list = new ArrayList();
|
|
|
|
+ List processIdList = new ArrayList();
|
|
|
|
+ List<Map<String, Integer>> idList = new ArrayList();
|
|
|
|
+ for (Map<String, Object> planAreaInfo : planAreaList) {
|
|
|
|
+ processPlanId = Convert.toInt(planAreaInfo.get("process_plan_id"));
|
|
|
|
+ if (Blank.isNotEmpty(processPlanId)) {
|
|
|
|
+ // 循环第一次 或者 流程方案id没重复 才新增流程控制方案
|
|
|
|
+ if (i == 0 || !list.contains(processPlanId)) {
|
|
|
|
+ Map<String, Integer> map = new HashMap<>();
|
|
|
|
+ ProcessPlan processPlanInfo = processPlanMapper.selectById(processPlanId);
|
|
|
|
+ // 新增流程控制方案
|
|
|
|
+ ProcessPlan processPlan = new ProcessPlan();
|
|
|
|
+ String timeC = Convert.toStr(System.currentTimeMillis());
|
|
|
|
+ processPlan.setPlanName(processPlanInfo.getPlanName())
|
|
|
|
+ .setPlanCode(processPlanInfo.getPlanCode()+timeC);
|
|
|
|
+ processPlanMapper.insert(processPlan);
|
|
|
|
+ list.add(processPlanId);
|
|
|
|
+ map.put("oldId", processPlanId);
|
|
|
|
+ processPlanId = processPlan.getId();
|
|
|
|
+ map.put("newId", processPlanId);
|
|
|
|
+ idList.add(map);
|
|
|
|
+ } else {
|
|
|
|
+ for (Map<String, Integer> idMap : idList) {
|
|
|
|
+ if (processPlanId.equals(idMap.get("oldId"))) {
|
|
|
|
+ processPlanId = idMap.get("newId");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ processPlanId = null;
|
|
}
|
|
}
|
|
- }
|
|
|
|
- // 获取解说词 更改解说词表
|
|
|
|
- if (Blank.isNotEmpty(captionList)) {
|
|
|
|
- for (Map<String, Object> captionInfo : captionList) {
|
|
|
|
- //解说词id
|
|
|
|
- Caption caption = new Caption();
|
|
|
|
- caption.setPlanId(Convert.toInt(planId))
|
|
|
|
- .setHeaderInfo(Convert.toStr(captionInfo.get("header_info")))
|
|
|
|
- .setLargeScreen(Convert.toStr(captionInfo.get("large_screen")))
|
|
|
|
- .setPropagandaWall(Convert.toStr(captionInfo.get("propaganda_wall")))
|
|
|
|
- .setArcScreen(Convert.toStr(captionInfo.get("arc_screen")))
|
|
|
|
- .setLobbyArea(Convert.toStr(captionInfo.get("lobby_area")))
|
|
|
|
- .setEndInfo(Convert.toStr(captionInfo.get("end_info")));
|
|
|
|
- captionMapper.insertCaption(caption);
|
|
|
|
|
|
+ // 新增方案区域信息
|
|
|
|
+ PlanArea planArea = new PlanArea();
|
|
|
|
+ planArea.setPlanId(Convert.toStr(planId))
|
|
|
|
+ .setProcessPlanId(Convert.toStr(processPlanId))
|
|
|
|
+ .setAreaName(Convert.toStr(planAreaInfo.get("area_name")))
|
|
|
|
+ .setAreaCode(Convert.toStr(planAreaInfo.get("area_code")))
|
|
|
|
+ .setUrl(Convert.toStr(planAreaInfo.get("url")))
|
|
|
|
+ .setYkUrl(Convert.toStr(planAreaInfo.get("yk_url")))
|
|
|
|
+ .setSortno(Convert.toInt(planAreaInfo.get("sortno")))
|
|
|
|
+ .setSignalSource(Convert.toStr(planAreaInfo.get("signal_source")))
|
|
|
|
+ .setDeviceButtons(Convert.toStr(planAreaInfo.get("device_buttons")));
|
|
|
|
+ planAreaMapper.insertPlanArea(planArea);
|
|
|
|
+ // 新增流程控制
|
|
|
|
+ List<Map<String, Object>> processList = (List<Map<String, Object>>) planAreaInfo.get("processList");
|
|
|
|
+ if (Blank.isNotEmpty(processList)) {
|
|
|
|
+ for (Map<String, Object> processInfo : processList) {
|
|
|
|
+ // 判断去重
|
|
|
|
+ if (!processIdList.contains(Convert.toInt(processInfo.get("id")))) {
|
|
|
|
+ Process process = new Process();
|
|
|
|
+ process.setPlanId(processPlanId)
|
|
|
|
+ .setProcessName(Convert.toStr(processInfo.get("process_name")))
|
|
|
|
+ .setProcessImage(Convert.toStr(processInfo.get("process_image")))
|
|
|
|
+ .setSort(Convert.toInt(processInfo.get("sort")))
|
|
|
|
+ .setIntervalTime(Convert.toInt(processInfo.get("interval_time")))
|
|
|
|
+ .setUrl(Convert.toStr(processInfo.get("url")))
|
|
|
|
+ .setCaption(Convert.toStr(processInfo.get("caption")));
|
|
|
|
+ processMapper.addProcessInfo(process);
|
|
|
|
+ processIdList.add(Convert.toInt(processInfo.get("id")));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ i ++ ;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 获取解说词 更改解说词表
|
|
|
|
+ if (Blank.isNotEmpty(captionList)) {
|
|
|
|
+ for (Map<String, Object> captionInfo : captionList) {
|
|
|
|
+ //解说词id
|
|
|
|
+ Caption caption = new Caption();
|
|
|
|
+ caption.setPlanId(Convert.toInt(planId))
|
|
|
|
+ .setHeaderInfo(Convert.toStr(captionInfo.get("header_info")))
|
|
|
|
+ .setLargeScreen(Convert.toStr(captionInfo.get("large_screen")))
|
|
|
|
+ .setPropagandaWall(Convert.toStr(captionInfo.get("propaganda_wall")))
|
|
|
|
+ .setArcScreen(Convert.toStr(captionInfo.get("arc_screen")))
|
|
|
|
+ .setLobbyArea(Convert.toStr(captionInfo.get("lobby_area")))
|
|
|
|
+ .setEndInfo(Convert.toStr(captionInfo.get("end_info")));
|
|
|
|
+ captionMapper.insertCaption(caption);
|
|
}
|
|
}
|
|
- return SendUtil.send(true, ConstString.RESULT_SUCCESS);
|
|
|
|
}
|
|
}
|
|
|
|
+ return SendUtil.send(true, ConstString.RESULT_SUCCESS);
|
|
|
|
+}
|
|
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public Map<String, Object> updatePlanAllInfo(String params) {
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(params);
|
|
|
|
- List<Map<String, Object>> planAreaList = (List<Map<String, Object>>) jsonObject.get("planAreaList");
|
|
|
|
- List<Map<String, Object>> captionList = (List<Map<String, Object>>) jsonObject.get("captionList");
|
|
|
|
- if (Blank.isNotEmpty(planAreaList)) {
|
|
|
|
- for (Map<String, Object> planAreaInfo : planAreaList) {
|
|
|
|
- //方案区域id
|
|
|
|
- Integer planAreaId = Convert.toInt(planAreaInfo.get("id"));
|
|
|
|
- // 根据方案区域id修改方案区域信息 更改方案区域信息
|
|
|
|
- PlanArea planArea = new PlanArea();
|
|
|
|
- planArea.setId(planAreaId).setAreaName(Convert.toStr(planAreaInfo.get("area_name")))
|
|
|
|
- .setProcessPlanId(Convert.toStr(planAreaInfo.get("process_plan_id")))
|
|
|
|
- .setAreaCode(Convert.toStr(planAreaInfo.get("area_code")))
|
|
|
|
- .setUrl(Convert.toStr(planAreaInfo.get("url")))
|
|
|
|
- .setYkUrl(Convert.toStr(planAreaInfo.get("yk_url")))
|
|
|
|
- .setSortno(Convert.toInt(planAreaInfo.get("sortno")))
|
|
|
|
- .setSignalSource(Convert.toStr(planAreaInfo.get("signal_source")))
|
|
|
|
- .setDeviceButtons(Convert.toStr(planAreaInfo.get("device_buttons")));
|
|
|
|
- planAreaMapper.updatePlanArea(planArea);
|
|
|
|
- // 获取信号源列表 更改信号源
|
|
|
|
- List<Map<String, Object>> signalSourceList = (List<Map<String, Object>>) planAreaInfo.get("signalSourceList");
|
|
|
|
- if (Blank.isNotEmpty(signalSourceList)) {
|
|
|
|
- for (Map<String, Object> signalSourceInfo : signalSourceList) {
|
|
|
|
- //信号源id
|
|
|
|
- Integer signalSourceId = Convert.toInt(signalSourceInfo.get("id"));
|
|
|
|
- SignalSource signalSource = new SignalSource();
|
|
|
|
- signalSource.setId(signalSourceId)
|
|
|
|
- .setSignalSourceName(Convert.toStr(signalSourceInfo.get("signal_source_name")))
|
|
|
|
- .setSignalSourceValue(Convert.toStr(signalSourceInfo.get("signal_source_value")))
|
|
|
|
- .setSignalSourceImage(Convert.toStr(signalSourceInfo.get("signal_source_image")));
|
|
|
|
- signalSourceMapper.updateSignalSource(signalSource);
|
|
|
|
- }
|
|
|
|
|
|
+@Override
|
|
|
|
+@Transactional(rollbackFor = Exception.class)
|
|
|
|
+public Map<String, Object> updatePlanAllInfo(String params) {
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(params);
|
|
|
|
+ List<Map<String, Object>> planAreaList = (List<Map<String, Object>>) jsonObject.get("planAreaList");
|
|
|
|
+ List<Map<String, Object>> captionList = (List<Map<String, Object>>) jsonObject.get("captionList");
|
|
|
|
+ if (Blank.isNotEmpty(planAreaList)) {
|
|
|
|
+ for (Map<String, Object> planAreaInfo : planAreaList) {
|
|
|
|
+ //方案区域id
|
|
|
|
+ Integer planAreaId = Convert.toInt(planAreaInfo.get("id"));
|
|
|
|
+ // 根据方案区域id修改方案区域信息 更改方案区域信息
|
|
|
|
+ PlanArea planArea = new PlanArea();
|
|
|
|
+ planArea.setId(planAreaId).setAreaName(Convert.toStr(planAreaInfo.get("area_name")))
|
|
|
|
+ .setProcessPlanId(Convert.toStr(planAreaInfo.get("process_plan_id")))
|
|
|
|
+ .setAreaCode(Convert.toStr(planAreaInfo.get("area_code")))
|
|
|
|
+ .setUrl(Convert.toStr(planAreaInfo.get("url")))
|
|
|
|
+ .setYkUrl(Convert.toStr(planAreaInfo.get("yk_url")))
|
|
|
|
+ .setSortno(Convert.toInt(planAreaInfo.get("sortno")))
|
|
|
|
+ .setSignalSource(Convert.toStr(planAreaInfo.get("signal_source")))
|
|
|
|
+ .setDeviceButtons(Convert.toStr(planAreaInfo.get("device_buttons")));
|
|
|
|
+ planAreaMapper.updatePlanArea(planArea);
|
|
|
|
+ // 获取信号源列表 更改信号源
|
|
|
|
+ List<Map<String, Object>> signalSourceList = (List<Map<String, Object>>) planAreaInfo.get("signalSourceList");
|
|
|
|
+ if (Blank.isNotEmpty(signalSourceList)) {
|
|
|
|
+ for (Map<String, Object> signalSourceInfo : signalSourceList) {
|
|
|
|
+ //信号源id
|
|
|
|
+ Integer signalSourceId = Convert.toInt(signalSourceInfo.get("id"));
|
|
|
|
+ SignalSource signalSource = new SignalSource();
|
|
|
|
+ signalSource.setId(signalSourceId)
|
|
|
|
+ .setSignalSourceName(Convert.toStr(signalSourceInfo.get("signal_source_name")))
|
|
|
|
+ .setSignalSourceValue(Convert.toStr(signalSourceInfo.get("signal_source_value")))
|
|
|
|
+ .setSignalSourceImage(Convert.toStr(signalSourceInfo.get("signal_source_image")));
|
|
|
|
+ signalSourceMapper.updateSignalSource(signalSource);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- // 获取解说词 更改解说词表
|
|
|
|
- if (Blank.isNotEmpty(captionList)) {
|
|
|
|
- for (Map<String, Object> captionInfo : captionList) {
|
|
|
|
- //解说词id
|
|
|
|
- Integer captionId = Convert.toInt(captionInfo.get("id"));
|
|
|
|
- Caption caption = new Caption();
|
|
|
|
- caption.setId(captionId)
|
|
|
|
- .setPlanId(Convert.toInt(captionInfo.get("plan_id")))
|
|
|
|
- .setHeaderInfo(Convert.toStr(captionInfo.get("header_info")))
|
|
|
|
- .setLargeScreen(Convert.toStr(captionInfo.get("large_screen")))
|
|
|
|
- .setPropagandaWall(Convert.toStr(captionInfo.get("propaganda_wall")))
|
|
|
|
- .setArcScreen(Convert.toStr(captionInfo.get("arc_screen")))
|
|
|
|
- .setLobbyArea(Convert.toStr(captionInfo.get("lobby_area")))
|
|
|
|
- .setEndInfo(Convert.toStr(captionInfo.get("end_info")));
|
|
|
|
- captionMapper.updateCaption(caption);
|
|
|
|
|
|
+ // 获取流程控制列表,更改流程控制顺序
|
|
|
|
+ List<Map<String, Object>> processList = (List<Map<String, Object>>) planAreaInfo.get("processList");
|
|
|
|
+ if (Blank.isNotEmpty(processList)) {
|
|
|
|
+ for (Map<String, Object> processInfo : processList) {
|
|
|
|
+ Integer processId = Convert.toInt(processInfo.get("id"));
|
|
|
|
+ Process process = new Process();
|
|
|
|
+ process.setId(processId).setSort(Convert.toInt(processInfo.get("sort")));
|
|
|
|
+ processMapper.editProcess(process);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return SendUtil.send(true, ConstString.RESULT_SUCCESS);
|
|
|
|
}
|
|
}
|
|
|
|
+ // 获取解说词 更改解说词表
|
|
|
|
+ if (Blank.isNotEmpty(captionList)) {
|
|
|
|
+ for (Map<String, Object> captionInfo : captionList) {
|
|
|
|
+ //解说词id
|
|
|
|
+ Integer captionId = Convert.toInt(captionInfo.get("id"));
|
|
|
|
+ Caption caption = new Caption();
|
|
|
|
+ caption.setId(captionId)
|
|
|
|
+ .setPlanId(Convert.toInt(captionInfo.get("plan_id")))
|
|
|
|
+ .setHeaderInfo(Convert.toStr(captionInfo.get("header_info")))
|
|
|
|
+ .setLargeScreen(Convert.toStr(captionInfo.get("large_screen")))
|
|
|
|
+ .setPropagandaWall(Convert.toStr(captionInfo.get("propaganda_wall")))
|
|
|
|
+ .setArcScreen(Convert.toStr(captionInfo.get("arc_screen")))
|
|
|
|
+ .setLobbyArea(Convert.toStr(captionInfo.get("lobby_area")))
|
|
|
|
+ .setEndInfo(Convert.toStr(captionInfo.get("end_info")));
|
|
|
|
+ captionMapper.updateCaption(caption);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return SendUtil.send(true, ConstString.RESULT_SUCCESS);
|
|
|
|
+}
|
|
|
|
|
|
- @Override
|
|
|
|
- public Map<String, Object> getDefaultPlanAreaByRoleId(Integer roleId) {
|
|
|
|
- //根据角色id获取方案列表
|
|
|
|
- List<Map<String, Object>> plansByRoleId = planMapper.getPlanByRoleId(roleId);
|
|
|
|
- if (Blank.isNotEmpty(plansByRoleId)) {
|
|
|
|
- Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
- Map<String, Object> defaultPlan = planMapper.getDefaultPlan();
|
|
|
|
- Integer planId = Convert.toInt(defaultPlan.get("id"));
|
|
|
|
- if (Blank.isNotEmpty(defaultPlan)) {
|
|
|
|
- for (Map<String, Object> map : plansByRoleId) {
|
|
|
|
- if (planId.equals(Convert.toInt(map.get("plan_id")))) {
|
|
|
|
- // 根据方案id获取方案区域列表
|
|
|
|
- List<Map<String, Object>> planAreaList = planMapper.getPlanAreaByPlanId(planId);
|
|
|
|
- // 根据方案id获取解说词列表
|
|
|
|
- List<Map<String, Object>> captionList = planMapper.getCaptionByPlanId(planId);
|
|
|
|
- // 获取信号源
|
|
|
|
- if (Blank.isNotEmpty(planAreaList)) {
|
|
|
|
- for (Map<String, Object> planArea : planAreaList) {
|
|
|
|
- // 信号源id字符串
|
|
|
|
- String signalIds = Convert.toStr(planArea.get("signal_source"));
|
|
|
|
- // 设备按钮
|
|
|
|
- String deviceButtons = Convert.toStr(planArea.get("device_buttons"));
|
|
|
|
- // 流程方案id
|
|
|
|
- Integer processPlanId = Convert.toInt(planArea.get("process_plan_id"));
|
|
|
|
- List<Map<String, Object>> signalSourceList = new ArrayList<>();
|
|
|
|
- List<Map<String, Object>> deviceButtonList = new ArrayList<>();
|
|
|
|
- if (Blank.isNotEmpty(signalIds)) {
|
|
|
|
- String[] ids = signalIds.split(",");
|
|
|
|
- for (String signalId : ids) {
|
|
|
|
- //根据信号id获取信号源信息
|
|
|
|
- Map<String, Object> signalInfo = signalSourceMapper.getSignalInfoById(signalId);
|
|
|
|
- signalSourceList.add(signalInfo);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 获取设备按钮
|
|
|
|
- if (Blank.isNotEmpty(deviceButtons)) {
|
|
|
|
- String[] devices = deviceButtons.split(",");
|
|
|
|
- for (String deviceId : devices) {
|
|
|
|
- //根据设备id获取设备信息
|
|
|
|
- Map<String, Object> deviceInfo = planMapper.getDeviceInfoById(deviceId);
|
|
|
|
- deviceButtonList.add(deviceInfo);
|
|
|
|
- }
|
|
|
|
|
|
+@Override
|
|
|
|
+public Map<String, Object> getDefaultPlanAreaByRoleId(Integer roleId) {
|
|
|
|
+ //根据角色id获取方案列表
|
|
|
|
+ List<Map<String, Object>> plansByRoleId = planMapper.getPlanByRoleId(roleId);
|
|
|
|
+ if (Blank.isNotEmpty(plansByRoleId)) {
|
|
|
|
+ Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
+ Map<String, Object> defaultPlan = planMapper.getDefaultPlan();
|
|
|
|
+ Integer planId = Convert.toInt(defaultPlan.get("id"));
|
|
|
|
+ if (Blank.isNotEmpty(defaultPlan)) {
|
|
|
|
+ for (Map<String, Object> map : plansByRoleId) {
|
|
|
|
+ if (planId.equals(Convert.toInt(map.get("plan_id")))) {
|
|
|
|
+ // 根据方案id获取方案区域列表
|
|
|
|
+ List<Map<String, Object>> planAreaList = planMapper.getPlanAreaByPlanId(planId);
|
|
|
|
+ // 根据方案id获取解说词列表
|
|
|
|
+ List<Map<String, Object>> captionList = planMapper.getCaptionByPlanId(planId);
|
|
|
|
+ // 获取信号源
|
|
|
|
+ if (Blank.isNotEmpty(planAreaList)) {
|
|
|
|
+ for (Map<String, Object> planArea : planAreaList) {
|
|
|
|
+ // 信号源id字符串
|
|
|
|
+ String signalIds = Convert.toStr(planArea.get("signal_source"));
|
|
|
|
+ // 设备按钮
|
|
|
|
+ String deviceButtons = Convert.toStr(planArea.get("device_buttons"));
|
|
|
|
+ // 流程方案id
|
|
|
|
+ Integer processPlanId = Convert.toInt(planArea.get("process_plan_id"));
|
|
|
|
+ List<Map<String, Object>> signalSourceList = new ArrayList<>();
|
|
|
|
+ List<Map<String, Object>> deviceButtonList = new ArrayList<>();
|
|
|
|
+ if (Blank.isNotEmpty(signalIds)) {
|
|
|
|
+ String[] ids = signalIds.split(",");
|
|
|
|
+ for (String signalId : ids) {
|
|
|
|
+ //根据信号id获取信号源信息
|
|
|
|
+ Map<String, Object> signalInfo = signalSourceMapper.getSignalInfoById(signalId);
|
|
|
|
+ signalSourceList.add(signalInfo);
|
|
}
|
|
}
|
|
- // 获取场景方案下的所有流程控制
|
|
|
|
- if (Blank.isNotEmpty(processPlanId)) {
|
|
|
|
- List<Map<String, Object>> processList = processMapper.getProcessListByPlanId(processPlanId);
|
|
|
|
- planArea.put("processList", processList);
|
|
|
|
|
|
+ }
|
|
|
|
+ // 获取设备按钮
|
|
|
|
+ if (Blank.isNotEmpty(deviceButtons)) {
|
|
|
|
+ String[] devices = deviceButtons.split(",");
|
|
|
|
+ for (String deviceId : devices) {
|
|
|
|
+ //根据设备id获取设备信息
|
|
|
|
+ Map<String, Object> deviceInfo = planMapper.getDeviceInfoById(deviceId);
|
|
|
|
+ deviceButtonList.add(deviceInfo);
|
|
}
|
|
}
|
|
- planArea.put("signalSourceList", signalSourceList);
|
|
|
|
- planArea.put("deviceButtonList", deviceButtonList);
|
|
|
|
}
|
|
}
|
|
|
|
+ // 获取场景方案下的所有流程控制
|
|
|
|
+ if (Blank.isNotEmpty(processPlanId)) {
|
|
|
|
+ List<Map<String, Object>> processList = processMapper.getProcessListByPlanId(processPlanId);
|
|
|
|
+ planArea.put("processList", processList);
|
|
|
|
+ }
|
|
|
|
+ planArea.put("signalSourceList", signalSourceList);
|
|
|
|
+ planArea.put("deviceButtonList", deviceButtonList);
|
|
}
|
|
}
|
|
- dataMap.put("planAreaList", planAreaList);
|
|
|
|
- dataMap.put("captionList", captionList);
|
|
|
|
- return dataMap;
|
|
|
|
}
|
|
}
|
|
|
|
+ dataMap.put("planAreaList", planAreaList);
|
|
|
|
+ dataMap.put("captionList", captionList);
|
|
|
|
+ return dataMap;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return null;
|
|
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
|
|
+}
|
|
|
|
|
|
- @Override
|
|
|
|
- public Map<String, Object> getPlanAreaByPlanId(Integer planId) {
|
|
|
|
- // 根据方案id获取方案区域列表
|
|
|
|
- List<Map<String, Object>> planAreaList = planMapper.getPlanAreaByPlanId(planId);
|
|
|
|
- // 根据方案id获取解说词列表
|
|
|
|
- List<Map<String, Object>> captionList = planMapper.getCaptionByPlanId(planId);
|
|
|
|
- Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
- // 获取信号源
|
|
|
|
- if (Blank.isNotEmpty(planAreaList)) {
|
|
|
|
- for (Map<String, Object> planArea : planAreaList) {
|
|
|
|
- // 信号源id字符串
|
|
|
|
- String signalIds = Convert.toStr(planArea.get("signal_source"));
|
|
|
|
- // 设备按钮
|
|
|
|
- String deviceButtons = Convert.toStr(planArea.get("device_buttons"));
|
|
|
|
- // 流程方案id
|
|
|
|
- Integer processPlanId = Convert.toInt(planArea.get("process_plan_id"));
|
|
|
|
- List<Map<String, Object>> signalSourceList = new ArrayList<>();
|
|
|
|
- List<Map<String, Object>> deviceButtonList = new ArrayList<>();
|
|
|
|
- if (Blank.isNotEmpty(signalIds)) {
|
|
|
|
- String[] ids = signalIds.split(",");
|
|
|
|
- for (String signalId : ids) {
|
|
|
|
- //根据信号id获取信号源信息
|
|
|
|
- Map<String, Object> signalInfo = signalSourceMapper.getSignalInfoById(signalId);
|
|
|
|
- signalSourceList.add(signalInfo);
|
|
|
|
- }
|
|
|
|
|
|
+@Override
|
|
|
|
+public Map<String, Object> getPlanAreaByPlanId(Integer planId) {
|
|
|
|
+ // 根据方案id获取方案区域列表
|
|
|
|
+ List<Map<String, Object>> planAreaList = planMapper.getPlanAreaByPlanId(planId);
|
|
|
|
+ // 根据方案id获取解说词列表
|
|
|
|
+ List<Map<String, Object>> captionList = planMapper.getCaptionByPlanId(planId);
|
|
|
|
+ Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
+ // 获取信号源
|
|
|
|
+ if (Blank.isNotEmpty(planAreaList)) {
|
|
|
|
+ for (Map<String, Object> planArea : planAreaList) {
|
|
|
|
+ // 信号源id字符串
|
|
|
|
+ String signalIds = Convert.toStr(planArea.get("signal_source"));
|
|
|
|
+ // 设备按钮
|
|
|
|
+ String deviceButtons = Convert.toStr(planArea.get("device_buttons"));
|
|
|
|
+ // 流程方案id
|
|
|
|
+ Integer processPlanId = Convert.toInt(planArea.get("process_plan_id"));
|
|
|
|
+ List<Map<String, Object>> signalSourceList = new ArrayList<>();
|
|
|
|
+ List<Map<String, Object>> deviceButtonList = new ArrayList<>();
|
|
|
|
+ if (Blank.isNotEmpty(signalIds)) {
|
|
|
|
+ String[] ids = signalIds.split(",");
|
|
|
|
+ for (String signalId : ids) {
|
|
|
|
+ //根据信号id获取信号源信息
|
|
|
|
+ Map<String, Object> signalInfo = signalSourceMapper.getSignalInfoById(signalId);
|
|
|
|
+ signalSourceList.add(signalInfo);
|
|
}
|
|
}
|
|
- // 获取设备按钮
|
|
|
|
- if (Blank.isNotEmpty(deviceButtons)) {
|
|
|
|
- String[] devices = deviceButtons.split(",");
|
|
|
|
- for (String deviceId : devices) {
|
|
|
|
- //根据设备id获取设备信息
|
|
|
|
- Map<String, Object> deviceInfo = planMapper.getDeviceInfoById(deviceId);
|
|
|
|
- deviceButtonList.add(deviceInfo);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 获取场景方案下的所有流程控制
|
|
|
|
- if (Blank.isNotEmpty(processPlanId)) {
|
|
|
|
- List<Map<String, Object>> processList = processMapper.getProcessListByPlanId(processPlanId);
|
|
|
|
- planArea.put("processList", processList);
|
|
|
|
|
|
+ }
|
|
|
|
+ // 获取设备按钮
|
|
|
|
+ if (Blank.isNotEmpty(deviceButtons)) {
|
|
|
|
+ String[] devices = deviceButtons.split(",");
|
|
|
|
+ for (String deviceId : devices) {
|
|
|
|
+ //根据设备id获取设备信息
|
|
|
|
+ Map<String, Object> deviceInfo = planMapper.getDeviceInfoById(deviceId);
|
|
|
|
+ deviceButtonList.add(deviceInfo);
|
|
}
|
|
}
|
|
- planArea.put("signalSourceList", signalSourceList);
|
|
|
|
- planArea.put("deviceButtonList", deviceButtonList);
|
|
|
|
}
|
|
}
|
|
|
|
+ // 获取场景方案下的所有流程控制
|
|
|
|
+ if (Blank.isNotEmpty(processPlanId)) {
|
|
|
|
+ List<Map<String, Object>> processList = processMapper.getProcessListByPlanId(processPlanId);
|
|
|
|
+ planArea.put("processList", processList);
|
|
|
|
+ }
|
|
|
|
+ planArea.put("signalSourceList", signalSourceList);
|
|
|
|
+ planArea.put("deviceButtonList", deviceButtonList);
|
|
}
|
|
}
|
|
- dataMap.put("planAreaList", planAreaList);
|
|
|
|
- dataMap.put("captionList", captionList);
|
|
|
|
- return dataMap;
|
|
|
|
}
|
|
}
|
|
|
|
+ dataMap.put("planAreaList", planAreaList);
|
|
|
|
+ dataMap.put("captionList", captionList);
|
|
|
|
+ return dataMap;
|
|
|
|
+}
|
|
|
|
|
|
- @Override
|
|
|
|
- public List<Map<String, Object>> getPlanByRoleId(Integer roleId) {
|
|
|
|
- return planMapper.getPlanByRoleId(roleId);
|
|
|
|
- }
|
|
|
|
|
|
+@Override
|
|
|
|
+public List<Map<String, Object>> getPlanByRoleId(Integer roleId) {
|
|
|
|
+ return planMapper.getPlanByRoleId(roleId);
|
|
|
|
+}
|
|
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public Boolean switchDefaultPlan(Integer planId) {
|
|
|
|
- Map<String, Object> plan = planMapper.getOnePlanById(planId);
|
|
|
|
- if (!StringUtils.isEmpty(plan.get("default_plan"))
|
|
|
|
- && Integer.parseInt(plan.get("default_plan").toString()) == 0) {
|
|
|
|
- //先把之前默认的方案修改成不默认
|
|
|
|
- planMapper.clearDefaultPlan();
|
|
|
|
- }
|
|
|
|
|
|
+@Override
|
|
|
|
+@Transactional(rollbackFor = Exception.class)
|
|
|
|
+public Boolean switchDefaultPlan(Integer planId) {
|
|
|
|
+ Map<String, Object> plan = planMapper.getOnePlanById(planId);
|
|
|
|
+ if (!StringUtils.isEmpty(plan.get("default_plan"))
|
|
|
|
+ && Integer.parseInt(plan.get("default_plan").toString()) == 0) {
|
|
|
|
+ //先把之前默认的方案修改成不默认
|
|
|
|
+ planMapper.clearDefaultPlan();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- //设置默认方案
|
|
|
|
- return planMapper.switchDefaultPlan(planId) > 0;
|
|
|
|
- }
|
|
|
|
|
|
+ //设置默认方案
|
|
|
|
+ return planMapper.switchDefaultPlan(planId) > 0;
|
|
|
|
+}
|
|
}
|
|
}
|