Commit 18b7910e by Suvalue

维度板块数值接口修改

parent 69accf28
......@@ -3,6 +3,7 @@ package com.bsoft.api.controller;
import com.bsoft.api.common.Result;
import com.bsoft.api.common.annotations.Token;
import com.bsoft.api.model.reqmodel.BlockValues;
import com.bsoft.api.model.reqmodel.BlockValuesNew;
import com.bsoft.api.model.respmodel.BlockValue;
import com.bsoft.api.service.BlockValuesService;
import io.swagger.annotations.Api;
......@@ -37,4 +38,18 @@ public class BlockValuesController {
blockValues.getDisease(), blockValues.getDoctor(),blockValues.getDepartment(),blockValues.getTime());
return Result.success(list);
}
/**
* 根据pageId查询板块数值
* @return
* @throws Exception
*/
@PostMapping("blockValuesNew")
@Token
@ApiOperation("根据Page查询板块数值")
public Object getBlockValuesByPageIDNew(@RequestBody BlockValuesNew blockValues) throws InterruptedException {
List<BlockValue> list= blockValuesService.getBlockValuesByPageCodeNew(blockValues.getPageCode(),blockValues.getDim());
return Result.success(list);
}
}
\ No newline at end of file
package com.bsoft.api.controller;
import com.bsoft.api.common.Result;
import com.bsoft.api.common.annotations.Token;
import com.bsoft.api.model.reqmodel.ReqDimValue;
import com.bsoft.api.model.respmodel.DimValue;
import com.bsoft.api.service.DicDimService;
......@@ -25,7 +26,7 @@ public class DimController {
* @throws Exception
*/
@PostMapping("dimValue")
// @Token
@Token
@ApiOperation("根据pageCode查询维度数值")
public Object getdimValueByPageCode(@RequestBody ReqDimValue reqDimValue) {
List<DimValue> dimValueList = dicDimService.getByPageCode(reqDimValue.getPageCode(), reqDimValue.getOrgId(), reqDimValue.getDate());
......
......@@ -8,9 +8,10 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore;
@ApiIgnore
@RequestMapping("ind")
@Controller
public class IndController {
......
......@@ -22,7 +22,7 @@ public class SerDiseaseDocController {
private SerDiseaseDocService serDiseaseDocService;
@PostMapping("diseaseDoc")
// @Token
@Token
@ApiOperation("根据Code查询疾病关系信息")
public Object getDiseaseDoc(@RequestBody DiseaseDoc disease) throws InterruptedException {
List<SerDiseaseDocRs> list = serDiseaseDocService.getDiseaseDoc(disease.getDocCode(),disease.getMdcCode(),
......
package com.bsoft.api.model.reqmodel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Map;
public class BlockValuesNew {
@ApiModelProperty(value = "pageCode",required = true)
private Integer pageCode;
@ApiModelProperty("维度查询值")
private Map<String,String> dim;
public Integer getPageCode() {
return pageCode;
}
public void setPageCode(Integer pageCode) {
this.pageCode = pageCode;
}
public Map<String, String> getDim() {
return dim;
}
public void setDim(Map<String, String> dim) {
this.dim = dim;
}
}
......@@ -6,5 +6,7 @@ import java.util.List;
import java.util.Map;
public interface BlockValuesService {
List<BlockValue> getBlockValuesByPageCode(Integer pageId, Integer disease, Integer doctor, Integer department, Integer time) throws InterruptedException;
List<BlockValue> getBlockValuesByPageCode(Integer pageCode, Integer disease, Integer doctor, Integer department, Integer time) throws InterruptedException;
List<BlockValue> getBlockValuesByPageCodeNew(Integer pageCode, Map<String,String> dim) throws InterruptedException;
}
......@@ -97,4 +97,53 @@ public class BlockValuesServiceImpl implements BlockValuesService {
return list;
}
@Override
public List<BlockValue> getBlockValuesByPageCodeNew(Integer pageCode, Map<String, String> dim) throws InterruptedException {
/**
* 1.根据pageCode查询所有对应的pageId
* 查询要求为pageCode为当前pageCode,相同pageId的所有数据有且仅有DIM_ID为
* dim中键值对的数据
* 2.根据pageId获取所有block
* 3.根据block拼接表名及where语句
*/
List<BlockValue> list = new ArrayList<>();
int count = 0;
String inField = "";
String whereClause = "where 1=1";
for (Map.Entry<String, String> entry : dim.entrySet()) {
whereClause += String.format(" and "+entry.getKey()+"='%s'", entry.getValue());
inField += "'"+entry.getKey()+"',";
count++;
}
if(count > 0){
inField = inField.substring(0, inField.length()-1);
}
List<SerPage> pageList = serPageMapper.selectByCodeAndDim(pageCode, inField, count);
if(pageList.size() == 0){
throw new DBConfigurationError("页面维度配置表错误,请联系管理员");
}
SerPage page = pageList.get(0);
//根据pageId查询所有板块
List<SerPageBlockRs> pageBlocklist = serPageBlockRsMapper.selectByPageId(page.getId());
//循环获取数据
CountDownLatch latch = new CountDownLatch(pageBlocklist.size());
for (SerPageBlockRs data : pageBlocklist) {
//获取表名
Long blockId = data.getBlockId();
String tableName = "VAL_BLOCK_VALUES_" + blockId;
asynBlockValuesServiceImpl.getBlockValues(list, blockId, tableName, whereClause, latch);
}
latch.await();
return list;
}
}
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