From 7e52f375aea9e6315625d0ac0f7b69de199f433b Mon Sep 17 00:00:00 2001 From: fhx <308050795@qq.com> Date: 星期四, 01 八月 2024 16:14:50 +0800 Subject: [PATCH] 1.新增处理治疗单项目模式数据逻辑代码 --- phi_platform_user/src/main/java/com/hx/phip/controller/treat/TreatController.java | 22 ++++++++++- phi_platform_user/src/main/java/com/hx/phip/service/treat/TreatV3Service.java | 3 + phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java | 67 +++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 3 deletions(-) diff --git a/phi_platform_user/src/main/java/com/hx/phip/controller/treat/TreatController.java b/phi_platform_user/src/main/java/com/hx/phip/controller/treat/TreatController.java index aaac92d..83262d8 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/controller/treat/TreatController.java +++ b/phi_platform_user/src/main/java/com/hx/phip/controller/treat/TreatController.java @@ -122,9 +122,14 @@ //寮�鍚绾跨▼澶勭悊鐢ㄦ埛绉戝鍏崇郴 ExecutorServiceTool fixedThreadPool = new ExecutorServiceTool(1, 1); try { - fixedThreadPool.getThreadPool().execute(() -> treatV3Service.doctorRoomHandler(treatSingle.getId())); + fixedThreadPool.getThreadPool().execute(() ->{ + //澶勭悊鐢ㄦ埛绉戝鍏崇郴 + treatV3Service.doctorRoomHandler(treatSingle.getId()); + //澶勭悊娌荤枟鍗曢」鐩ā寮忔暟鎹� + treatV3Service.handleModeData(projectList); + }); }catch (Exception e){ - logger.error("寮�鍚绾跨▼澶勭悊鐢ㄦ埛绉戝鍏崇郴澶辫触"+ ExceptionTool.getExceptionInfo(e)); + logger.error("鏂板娌荤枟鍗�-寮�鍚绾跨▼澶勭悊澶辫触锛�"+ ExceptionTool.getExceptionInfo(e)); }finally { fixedThreadPool.shutdown(); } @@ -204,6 +209,19 @@ editSendMsg(treatSingle.getId(), visitOrder.getUserId()); } + //寮�鍚绾跨▼澶勭悊 + ExecutorServiceTool fixedThreadPool = new ExecutorServiceTool(1, 1); + try { + fixedThreadPool.getThreadPool().execute(() ->{ + //澶勭悊娌荤枟鍗曢」鐩ā寮忔暟鎹� + treatV3Service.handleModeData(projectList); + }); + }catch (Exception e){ + logger.error("缂栬緫娌荤枟鍗�-寮�鍚绾跨▼澶勭悊澶辫触锛�"+ ExceptionTool.getExceptionInfo(e)); + }finally { + fixedThreadPool.shutdown(); + } + //杩斿洖id JSONObject data = new JSONObject(); data.put("treatSingleId", treatSingle.getId()); diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/treat/TreatV3Service.java b/phi_platform_user/src/main/java/com/hx/phip/service/treat/TreatV3Service.java index 7e285c7..e9521ba 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/service/treat/TreatV3Service.java +++ b/phi_platform_user/src/main/java/com/hx/phip/service/treat/TreatV3Service.java @@ -26,4 +26,7 @@ /**澶勭悊鐢ㄦ埛绉戝鍏崇郴*/ void doctorRoomHandler(String treatSingleId); + + /** 澶勭悊娌荤枟鍗曟ā寮忔暟鎹� */ + void handleModeData(List<TreatProject> treatProjectList); } diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java b/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java index b376cb6..0b4e5b7 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java +++ b/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java @@ -1,6 +1,8 @@ package com.hx.phip.service.treat.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.hx.common.dao.CommonDao; import com.hx.common.service.CommonService; import com.hx.exception.TipsException; @@ -20,6 +22,7 @@ import com.hx.phiappt.model.*; import com.hx.phiappt.model.guide.VisitOrder; import com.hx.phiappt.model.treat.*; +import com.hx.phiappt.vo.treat.TreatProjectModeDataVo; import com.hx.phip.common.wx.corp.WeiXinCorpMpUtil; import com.hx.phip.common.wx.corp.WeiXinMpUtil; import com.hx.phip.config.CustomParameter; @@ -77,7 +80,8 @@ private UserBeChangeLogMapper userBeChangeLogMapper; @Resource private TreatSingleSignMapper treatSingleSignMapper; - + @Resource + private SystemParameterMapper systemParameterMapper; @@ -558,6 +562,67 @@ } + /** 澶勭悊娌荤枟鍗曟ā寮忔暟鎹� */ + public void handleModeData(List<TreatProject> treatProjectList){ + //鍏堣繃婊ゅ嚭鎵撴硶涓嶄负绌虹殑娌荤枟鍗曢」鐩細椤圭洰鍚嶏紝鎵撴硶 + Map<String, String> dataMap = treatProjectList.stream().filter(s->StringUtils.noNull(s.getItemMode())).collect(Collectors.toMap(TreatProject::getProjectName, TreatProject::getItemMode)); + if(dataMap == null || dataMap.size() < 1){ + return; + } + + SystemParameter sp = systemParameterMapper.selectOneByName(SystemParameter.KEY_ZLD_PROJECT_MODE_DATA); + List<TreatProjectModeDataVo> modeDataVoList = null; + if(sp != null && StringUtils.isEmpty(sp.getParamValue())){ + modeDataVoList = JSONArray.parseArray(sp.getParamValue(), TreatProjectModeDataVo.class); + } + + if(modeDataVoList == null){ + modeDataVoList = new ArrayList<>(); + } + + TreatProjectModeDataVo modeDataVo; + for(Map.Entry<String, String> entry : dataMap.entrySet()){ + //娌℃湁鏃跺垯 + if(modeDataVoList.size() == 0){ + modeDataVoList.add(new TreatProjectModeDataVo(entry.getKey(), entry.getValue())); + continue; + + } + + for(int i = 0; i < modeDataVoList.size(); i++){ + modeDataVo = modeDataVoList.get(i); + //鏈夌浉鍚岀殑椤圭洰鍚嶆暟鎹� + if(modeDataVo.getProjectName().equals(entry.getKey())){ + //鐒跺悗瀵瑰簲鐨勬墦娉曚笉瀛樺湪 + if(!modeDataVo.getModeList().contains(entry.getValue())){ + modeDataVo.getModeList().add(entry.getValue()); + continue; + } + } + + //鏈�鍚庝竴涓椂琛ㄧず娌″尮閰嶅埌锛屽垯鏂板 + if(i == modeDataVoList.size() - 1){ + modeDataVoList.add(new TreatProjectModeDataVo(entry.getKey(), entry.getValue())); + } + } + } + + if(modeDataVoList.size() < 1){ + return; + } + + JSONArray arr = JSONArray.parseArray(JSONObject.toJSONString(modeDataVoList)); + if(sp == null){ + sp = new SystemParameter(); + sp.setParamName(SystemParameter.KEY_ZLD_PROJECT_MODE_DATA); + sp.setParamValue(arr.toString()); + systemParameterMapper.insert(sp); + }else{ + sp.setParamValue(arr.toString()); + systemParameterMapper.updateInfoById(sp); + } + } + /////////////////////////////////////////////////////////////////////////////// //澶勭悊缂栬緫娌荤枟閫氱煡鍗曟椂椤圭洰鍙樺姩閫昏緫 -- Gitblit v1.8.0