Commit 6a05b908 by Suvalue

Merge branch 'dev' of http://192.168.18.110:8880/bsoft/sv-springboot into dev

parents a2f600cc e678fd93
......@@ -29,7 +29,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class)
@ResponseBody
public Object defaultErrorHandler(HttpServletRequest request, Exception e){
String url = HttpUtil.getIP(request);
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e.getStackTrace());
return Result.error();
}
......@@ -43,7 +43,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(ExceptionBase.class)
@ResponseBody
public Object BaseErrorHandler(HttpServletRequest request, Exception e){
String url = HttpUtil.getIP(request);
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e.getStackTrace());
return Result.error();
}
......@@ -51,7 +51,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(DBConfigurationError.class)
@ResponseBody
public Object DBConfigurationErrorHandler(HttpServletRequest request, Exception e){
String url = HttpUtil.getIP(request);
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e.getStackTrace());
return Result.error(400, e.getMessage());
}
......@@ -65,7 +65,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(InvalidTokenException.class)
@ResponseBody
public Object InvalidTokenExceptionHandler(HttpServletRequest request, Exception e){
String url = HttpUtil.getIP(request);
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e.getStackTrace());
return Result.error(Result.ErrorCode.INVALID_TOKEN);
}
......
......@@ -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.respmodel.BlockValue;
import com.bsoft.api.service.BlockValuesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@Api(tags = "板块数值Api")
@RestController
......@@ -32,7 +32,7 @@ public class BlockValuesController {
@ApiOperation("根据Page查询板块数值")
public Object getBlockValuesByPageID(@RequestBody BlockValues blockValues) throws InterruptedException {
List<Map<String,Object>> list= blockValuesService.getBlockValuesByPageCode(blockValues.getPageCode(),
List<BlockValue> list= blockValuesService.getBlockValuesByPageCode(blockValues.getPageCode(),
blockValues.getDisease(), blockValues.getDoctor(),blockValues.getDepartment(),blockValues.getTime());
return Result.success(list);
}
......
package com.bsoft.api.controller;
import com.bsoft.api.service.TestService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
@ApiIgnore
@RestController
public class TestController {
@Resource
TestService testServiceImpl;
@GetMapping("test")
public Object test() throws InterruptedException {
// List<Future<String>> list = new ArrayList<>();
// for(int i = 0; i<4;i++){
// Future<String> future = testServiceImpl.test(String.valueOf(i));
// list.add(future);
// }
testServiceImpl.test(1);
return 1;
}
}
......@@ -3,7 +3,6 @@ package com.bsoft.api.controller;
import com.bsoft.api.common.Result;
import com.bsoft.api.common.annotations.CurrentUser;
import com.bsoft.api.common.annotations.Token;
import com.bsoft.api.model.SysRole;
import com.bsoft.api.model.SysUser;
import com.bsoft.api.service.SysMenuService;
import com.bsoft.api.service.SysUserRoleRsService;
......@@ -16,8 +15,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
@Api(tags = "用户API",produces="produces",consumes="consumes",protocols="protocols")
@RequestMapping("/user")
......@@ -45,8 +42,7 @@ public class UserController {
// @Token
@ApiOperation("查询用户角色")
public Object getRoleListByUser(@ApiIgnore@CurrentUser Long userId)throws Exception{
List<SysRole> list = sysUserRoleRsService.getRoleListByUser(userId);
return Result.success(list);
return Result.success(sysUserRoleRsService.getRoleListByUser(userId));
}
/**
......
......@@ -7,17 +7,6 @@ import io.swagger.annotations.ApiModelProperty;
public class BlockValues {
@ApiModelProperty(value = "pageCode",required = true)
private Integer pageCode;
@ApiModelProperty("病组")
private Integer disease;
@ApiModelProperty("科室")
private Integer department;
@ApiModelProperty("医生")
private Integer doctor;
@ApiModelProperty("时间")
private Integer time;
public Integer getPageCode() {
return pageCode;
}
......@@ -57,4 +46,15 @@ public class BlockValues {
public void setTime(Integer time) {
this.time = time;
}
@ApiModelProperty(value = "pageCode",required = true)
private Integer pageCode;
@ApiModelProperty("病组")
private Integer disease;
@ApiModelProperty("科室")
private Integer department;
@ApiModelProperty("医生")
private Integer doctor;
@ApiModelProperty("时间")
private Integer time;
}
package com.bsoft.api.model.respmodel;
import java.util.List;
import java.util.Map;
public class BlockValue {
private long blockId;
private List<Map<String,Object>> body;
public BlockValue(){}
public BlockValue(long blockId, List<Map<String, Object>> body) {
this.blockId = blockId;
this.body = body;
}
public long getBlockId() {
return blockId;
}
public void setBlockId(long blockId) {
this.blockId = blockId;
}
public List<Map<String, Object>> getBody() {
return body;
}
public void setBody(List<Map<String, Object>> body) {
this.body = body;
}
}
package com.bsoft.api.service;
import com.bsoft.api.model.respmodel.BlockValue;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
public interface AsynBlockValuesService {
void getBlockValues(List<Map<String, Object>> list, String blockId, String tableName,
String whereClause, CountDownLatch latch);
void getBlockValues(List<BlockValue> list, Long blockId, String tableName,
String whereClause, CountDownLatch latch);
}
package com.bsoft.api.service;
import com.bsoft.api.model.respmodel.BlockValue;
import java.util.List;
import java.util.Map;
public interface BlockValuesService {
List<Map<String,Object>> getBlockValuesByPageCode(Integer pageId, Integer disease, Integer doctor, Integer department, Integer time) throws InterruptedException;
List<BlockValue> getBlockValuesByPageCode(Integer pageId, Integer disease, Integer doctor, Integer department, Integer time) throws InterruptedException;
}
package com.bsoft.api.service.Impl;
import com.bsoft.api.mapper.BlockValuesMapper;
import com.bsoft.api.model.respmodel.BlockValue;
import com.bsoft.api.service.AsynBlockValuesService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
......@@ -21,18 +22,14 @@ public class AsynBlockValuesServiceImpl implements AsynBlockValuesService {
@Async
@Override
public void getBlockValues(List<Map<String, Object>> list, String blockId, String tableName,
String whereClause, CountDownLatch latch) {
public void getBlockValues(List<BlockValue> list, Long blockId, String tableName,
String whereClause, CountDownLatch latch) {
System.out.println("开始"+tableName);
List<Map<String, Object>> dataList = blockValuesMapper.selectByWhere(tableName, whereClause);
Map<String, Object> map = new HashMap<String,Object>(){
{
put("mdl"+blockId, dataList);
}
};
BlockValue blockValue = new BlockValue(blockId, dataList);
synchronized (obj){
list.add(map);
list.add(blockValue);
}
System.out.println("结束"+tableName);
latch.countDown();
......
......@@ -8,6 +8,7 @@ import com.bsoft.api.mapper.SerPageMapper;
import com.bsoft.api.model.DicDim;
import com.bsoft.api.model.SerPage;
import com.bsoft.api.model.SerPageBlockRs;
import com.bsoft.api.model.respmodel.BlockValue;
import com.bsoft.api.service.AsynBlockValuesService;
import com.bsoft.api.service.BlockValuesService;
import org.apache.ibatis.binding.MapperMethod;
......@@ -37,7 +38,7 @@ public class BlockValuesServiceImpl implements BlockValuesService {
@Override
public List<Map<String, Object>> getBlockValuesByPageCode(Integer pageCode, Integer disease, Integer doctor, Integer department, Integer time) throws InterruptedException {
public List<BlockValue> getBlockValuesByPageCode(Integer pageCode, Integer disease, Integer doctor, Integer department, Integer time) throws InterruptedException {
/**
* 1.根据pageCode,disease,doctor,department,time查询所有对应的pageId
* 查询要求为pageCode为当前pageCode,相同pageId的所有数据有且仅有DIM_ID为
......@@ -45,7 +46,7 @@ public class BlockValuesServiceImpl implements BlockValuesService {
* 2.根据pageId获取所有block
* 3.根据block拼接表名及where语句
*/
List<Map<String, Object>> list = new ArrayList<>();
List<BlockValue> list = new ArrayList<>();
int count = 0;
String inField = "";
......@@ -87,7 +88,7 @@ public class BlockValuesServiceImpl implements BlockValuesService {
CountDownLatch latch = new CountDownLatch(pageBlocklist.size());
for (SerPageBlockRs data : pageBlocklist) {
//获取表名
String blockId = data.getBlockId().toString();
Long blockId = data.getBlockId();
String tableName = "VAL_BLOCK_VALUES_" + blockId;
asynBlockValuesServiceImpl.getBlockValues(list, blockId, tableName, whereClause, latch);
......
......@@ -9,14 +9,6 @@
<result column="USER_ID" jdbcType="DECIMAL" property="userId" />
<result column="ROLE_ID" jdbcType="DECIMAL" property="roleId" />
</resultMap>
<resultMap id="RoleMap" type="com.bsoft.api.model.SysRole">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName" />
<result column="ROLE_CODE" jdbcType="DECIMAL" property="roleCode" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from LL.SYS_USER_ROLE_RS
where ID = #{id,jdbcType=DECIMAL}
......@@ -48,10 +40,9 @@
select ID, CREATE_DATE, CREATE_USERID, STATE, USER_ID, ROLE_ID
from LL.SYS_USER_ROLE_RS
</select>
<select id="selectRoleByUser" resultMap="RoleMap">
select R.*
from LL.SYS_USER_ROLE_RS ur
left join SYS_ROLE r ON ur.role_ID = r.ID
where ur.USER_ID=#{userId,jdbcType=DECIMAL}
<select id="selectRoleByUser" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, USER_ID, ROLE_ID
from LL.SYS_USER_ROLE_RS
where USER_ID=#{userId,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
......@@ -42,14 +42,8 @@
<!-- &lt;!&ndash; 主键生成方式 &ndash;&gt;-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_USER_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="DIC_DIM" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_DIC_DIM_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<table tableName="SER_DISEASE" schema="ll" >
<generatedKey column="id" sqlStatement="select SEQ_SER_DISEASE_ID.nextval from dual" identity="true" />
</table>
<table tableName="SER_DISEASE_DOC_RS" schema="ll" >
<generatedKey column="id" sqlStatement="select SEQ_SER_DISEASE_DOC_RS_ID.nextval from dual" identity="true" />
<table tableName="DIC_DIM" schema="ll" >
<generatedKey column="id" sqlStatement="select SEQ_DIC_DIM_ID.nextval from dual" identity="true" />
</table>
<!-- <table tableName="DIC_IND" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_DIC_IND_ID.nextval from dual" identity="true" />-->
......
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