Commit 18bc050e by whl

Merge remote-tracking branch 'origin/future-page-ywd' into dev

# Conflicts:
#	bsoft-api/src/main/java/com/bsoft/api/controller/LoginController.java
#	bsoft-api/src/main/java/com/bsoft/api/controller/UserController.java
#	bsoft-api/src/main/java/com/bsoft/api/mapper/DicDimMapper.java
#	bsoft-api/src/main/resources/mapper/DicDimMapper.xml
#	bsoft-api/src/main/resources/mapper/DicIndMapper.xml
#	bsoft-api/src/main/resources/mapper/DicOrgMapper.xml
#	bsoft-api/src/main/resources/mapper/SysMenuMapper.xml
#	bsoft-api/src/main/resources/mapper/SysOrgMapper.xml
#	bsoft-api/src/main/resources/mapper/SysRoleMapper.xml
#	bsoft-api/src/main/resources/mapper/SysUserMapper.xml
parents e51979f8 a37a68b5
......@@ -2,8 +2,8 @@ package com.bsoft.api.common.aspect;
import com.bsoft.api.common.Constants;
import com.bsoft.api.common.exceptions.InvalidTokenException;
import com.bsoft.api.common.utils.StringUtil;
import com.bsoft.api.common.utils.TokenUtil;
import com.bsoft.common.utils.StringUtil;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
......
package com.bsoft.api.controller;
import com.bsoft.api.common.Result;
import com.bsoft.api.common.annotations.Token;
import com.bsoft.api.common.base.RequestResult;
import com.bsoft.api.mapper.BlockValuesMapper;
import com.bsoft.api.model.requmodel.BlockValues;
import com.bsoft.api.service.BlockValuesService;
import com.bsoft.api.service.Impl.BlockValuesServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
@Api(tags = "板块数值Api")
@RestController
public class BlockValuesController {
@Autowired
private BlockValuesService blockValuesService;
/**
* 根据pageId查询板块数值
* @return
* @throws Exception
*/
@GetMapping("blockValues")
// @Token
public Object getBlockValuesByPageID(@RequestBody BlockValues blockValues){
return Result.success(blockValuesService.getBlockValuesByPageID(blockValues.getPageId(),blockValues.getDisease(),
blockValues.getDoctor(),blockValues.getDepartment(),blockValues.getTime()));
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.bsoft.api.controller;
import com.bsoft.api.common.Result;
import com.bsoft.api.service.LoginService;
import com.bsoft.common.utils.HttpUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -26,13 +27,14 @@ public class LoginController {
@ApiImplicitParam(value = "登录名", name="loginName", required=true,paramType="query"),
@ApiImplicitParam(value = "密码", name="password", required = true,paramType="query")})
public Result<LoginService.LoginInfo> login(String loginName, String password){
LoginService.LoginInfo loginInfo = loginServiceImpl.login(loginName, password);
String ip = HttpUtil.getIP(request);
LoginService.LoginInfo loginInfo = loginServiceImpl.login(loginName, password,ip);
return Result.success(loginInfo);
}
@GetMapping("token")
@ApiOperation("刷新TOKEN")
public Result<String> refresh(@ApiIgnore HttpServletRequest request){
public Object refresh(@ApiIgnore HttpServletRequest request){
String oldToken = request.getHeader("Authorization");
String token = loginServiceImpl.refreshToken(oldToken);
return Result.success(token);
......
package com.bsoft.api.mapper;
import java.util.List;
import java.util.Map;
public interface BlockValuesMapper {
List<Map<String,Object>> selectByWhere(String tableName,String whereSql);
}
package com.bsoft.api.mapper;
import com.bsoft.api.model.DicDim;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DicDimMapper {
......@@ -12,5 +14,7 @@ public interface DicDimMapper {
List<DicDim> selectAll();
List<DicDim> selectByPageid(@Param("pageID") Integer pageID);
int updateByPrimaryKey(DicDim record);
}
\ No newline at end of file
package com.bsoft.api.mapper;
import com.bsoft.api.model.SerPageBlockRs;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SerPageBlockRsMapper {
......@@ -13,4 +15,6 @@ public interface SerPageBlockRsMapper {
List<SerPageBlockRs> selectAll();
int updateByPrimaryKey(SerPageBlockRs record);
List<SerPageBlockRs> selectByPageId(Integer pageID);
}
\ No newline at end of file
package com.bsoft.api.model.requmodel;
import io.swagger.annotations.ApiModel;
import java.util.Date;
@ApiModel("调用blockValues请求的数据")
public class BlockValues {
public Integer getPageId() {
return pageId;
}
public void setPageId(Integer pageId) {
this.pageId = pageId;
}
public Integer getDisease() {
return disease;
}
public void setDisease(Integer disease) {
this.disease = disease;
}
public Integer getDepartment() {
return department;
}
public void setDepartment(Integer department) {
this.department = department;
}
public Integer getDoctor() {
return doctor;
}
public void setDoctor(Integer doctor) {
this.doctor = doctor;
}
public Integer getTime() {
return time;
}
public void setTime(Integer time) {
this.time = time;
}
private Integer pageId;
private Integer disease;
private Integer department;
private Integer doctor;
private Integer time;
}
package com.bsoft.api.service;
import java.util.List;
import java.util.Map;
public interface BlockValuesService {
List<Map<String,Object>> getBlockValuesByPageID(Integer pageId, Integer disease, Integer doctor, Integer department, Integer time);
}
package com.bsoft.api.service.Impl;
import com.bsoft.api.mapper.BlockValuesMapper;
import com.bsoft.api.mapper.DicDimMapper;
import com.bsoft.api.mapper.SerPageBlockRsMapper;
import com.bsoft.api.model.DicDim;
import com.bsoft.api.model.SerPageBlockRs;
import com.bsoft.api.service.BlockValuesService;
import org.apache.ibatis.binding.MapperMethod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class BlockValuesServiceImpl implements BlockValuesService {
@Resource
private SerPageBlockRsMapper serPageBlockRsMapper;
@Resource
private DicDimMapper dicDimMapper;
@Resource
private BlockValuesMapper blockValuesMapper;
@Override
public List<Map<String,Object>> getBlockValuesByPageID(Integer pageId,Integer disease,Integer doctor,Integer department,Integer time){
Boolean isDisease = false;
Boolean isDoctor = false;
Boolean isDepartment = false;
Boolean isTime = false;
List<Map<String,Object>> list = new ArrayList<>();
//根据pageId查询所有板块
List<SerPageBlockRs> pageBlocklist =serPageBlockRsMapper.selectByPageId(pageId);
//根据pageId查询所有维度
List<DicDim> dimList = dicDimMapper.selectByPageid(pageId);
//循环获取需要添加的维度查询条件
for (DicDim data : dimList) {
if(data.getDimField().equalsIgnoreCase("disease")){
isDisease=true;
}
if(data.getDimField().equalsIgnoreCase("doctor")){
isDoctor=true;
}
if(data.getDimField().equalsIgnoreCase("department")){
isDepartment=true;
}
if(data.getDimField().equalsIgnoreCase("time")){
isTime=true;
}
}
//循环获取数据
for (SerPageBlockRs data : pageBlocklist) {
//获取表名
String tableName = "VAL_BLOCK_VALUES_"+data.getBlockId();
String whereSql = "where 1=1";
//添加查询条件
if(disease!=null&&isDisease){
whereSql+=String.format(" and disease='%s'",disease);
}
if(doctor!=null&&isDoctor){
whereSql+=String.format(" and doctor='%s'",doctor);
}
if(department!=null&&isDepartment){
whereSql+=String.format(" and department='%s'",department);
}
if(time!=null&&isTime){
whereSql+=String.format(" and time='%s'",time);
}
List<Map<String,Object>> dataList =blockValuesMapper.selectByWhere(tableName,whereSql);
list.add(new HashMap<String,Object>(){
{
put(data.getBlockId().toString(),dataList);
}
});
}
return list;
}
}
package com.bsoft.api.service.Impl;
import com.bsoft.api.common.utils.TokenUtil;
import com.bsoft.api.mapper.SysUserMapper;
import com.bsoft.api.model.SysUser;
import com.bsoft.api.service.LoginService;
import com.bsoft.api.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.lang.annotation.Retention;
import java.util.Date;
@Service
public class LoginServiceImpl implements LoginService {
@Autowired
private UserService userServiceImpl;
@Resource
private SysUserMapper sysUserMapper;
@Override
public LoginInfo login(String logName, String password) {
public LoginInfo login(String logName, String password,String ip) {
LoginInfo loginInfo = new LoginInfo();
......@@ -24,6 +33,12 @@ public class LoginServiceImpl implements LoginService {
user.setPassword(null);
loginInfo.setToken(token);
loginInfo.setUser(user);
//修改ip以及最后登录时间
SysUser sysUser = loginInfo.getUser();
sysUser.setLastIp(ip);
sysUser.setLastTime(new Date());
sysUserMapper.updateByPrimaryKey(sysUser);
}
return loginInfo;
}
......
......@@ -7,7 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
public interface LoginService {
LoginInfo login(String loginName, String password);
LoginInfo login(String loginName, String password,String ip);
String refreshToken(String oldToken);
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsoft.api.mapper.BlockValuesMapper">
<select id="selectByWhere" resultType="java.util.Map">
select * from ${tableName}
${whereSql}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsoft.api.mapper.DicDimMapper">
<resultMap id="BaseResultMap" type="com.bsoft.api.model.DicDim">
<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="DIM_NAME" jdbcType="VARCHAR" property="dimName"/>
<result column="DIM_FIELD" jdbcType="VARCHAR" property="dimField"/>
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from LL.DIC_DIM
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.api.model.DicDim">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
select SEQ_DIC_DIM_ID.nextval from dual
</selectKey>
insert into LL.DIC_DIM (CREATE_DATE, CREATE_USERID, STATE,
DIM_NAME, DIM_FIELD)
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{dimName,jdbcType=VARCHAR}, #{dimField,jdbcType=VARCHAR})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.DicDim">
update LL.DIC_DIM
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
STATE = #{state,jdbcType=DECIMAL},
DIM_NAME = #{dimName,jdbcType=VARCHAR},
DIM_FIELD = #{dimField,jdbcType=VARCHAR}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, DIM_NAME, DIM_FIELD
from LL.DIC_DIM
where ID = #{id,jdbcType=DECIMAL}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, DIM_NAME, DIM_FIELD
from LL.DIC_DIM
<resultMap id="BaseResultMap" type="com.bsoft.api.model.DicDim">
<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="DIM_NAME" jdbcType="VARCHAR" property="dimName" />
<result column="DIM_FIELD" jdbcType="VARCHAR" property="dimField" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from LL.DIC_DIM
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.api.model.DicDim">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
select SEQ_DIC_DIM_ID.nextval from dual
</selectKey>
insert into LL.DIC_DIM (CREATE_DATE, CREATE_USERID, STATE,
DIM_NAME, DIM_FIELD)
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{dimName,jdbcType=VARCHAR}, #{dimField,jdbcType=VARCHAR})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.DicDim">
update LL.DIC_DIM
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
STATE = #{state,jdbcType=DECIMAL},
DIM_NAME = #{dimName,jdbcType=VARCHAR},
DIM_FIELD = #{dimField,jdbcType=VARCHAR}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, DIM_NAME, DIM_FIELD
from LL.DIC_DIM
where ID = #{id,jdbcType=DECIMAL}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, DIM_NAME, DIM_FIELD
from LL.DIC_DIM
</select>
<select id="selectByPageid" resultMap="BaseResultMap">
select dd.* from SER_PAGE_DIM_RS spdr,DIC_DIM dd
where spdr.DIM_ID=dd.ID and spdr.PAGE_ID=#{pageID,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
......@@ -31,6 +31,9 @@
#{orgCode,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, #{orgNo,jdbcType=VARCHAR},
#{orgShortName,jdbcType=VARCHAR}, #{orgGroup,jdbcType=VARCHAR}, #{orgType,jdbcType=VARCHAR},
#{orgAddress,jdbcType=VARCHAR}, #{parentId,jdbcType=DECIMAL})
#{orgCode,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, #{orgNo,jdbcType=VARCHAR},
#{orgShortName,jdbcType=VARCHAR}, #{orgGroup,jdbcType=VARCHAR}, #{orgType,jdbcType=VARCHAR},
#{orgAddress,jdbcType=VARCHAR}, #{parentId,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.DicOrg">
update LL.DIC_ORG
......
......@@ -40,4 +40,9 @@
select ID, CREATE_DATE, CREATE_USERID, STATE, BLOCK_ID, PAGE_ID
from LL.SER_PAGE_BLOCK_RS
</select>
<select id="selectByPageId" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, BLOCK_ID, PAGE_ID
from LL.SER_PAGE_BLOCK_RS
where PAGE_ID=#{pageID,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
......@@ -25,6 +25,8 @@
PARENT_ID)
values (#{createData,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, #{menuImage,jdbcType=VARCHAR},
values (#{createData,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, #{menuImage,jdbcType=VARCHAR},
#{parentId,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SysMenu">
......
......@@ -27,9 +27,9 @@
ORG_CODE, ORG_NAME, ORG_NO,
ORG_SHORT_NAME, ORG_GROUP, ORG_TYPE,
ORG_ADDRESS, PARENT_ID)
values (#{createData,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=VARCHAR}, #{state,jdbcType=DECIMAL},
#{orgCode,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, #{orgNo,jdbcType=VARCHAR},
#{orgShortName,jdbcType=VARCHAR}, #{orgGroup,jdbcType=VARCHAR}, #{orgType,jdbcType=VARCHAR},
values (#{createData,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=VARCHAR}, #{state,jdbcType=DECIMAL},
#{orgCode,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, #{orgNo,jdbcType=VARCHAR},
#{orgShortName,jdbcType=VARCHAR}, #{orgGroup,jdbcType=VARCHAR}, #{orgType,jdbcType=VARCHAR},
#{orgAddress,jdbcType=VARCHAR}, #{parentId,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SysOrg">
......@@ -58,5 +58,4 @@
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID
from LL.SYS_ORG
</select>
</mapper>
\ No newline at end of file
......@@ -2,11 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsoft.api.mapper.SysUserMapper">
<resultMap id="BaseResultMap" type="com.bsoft.api.model.SysUser">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Oct 22 14:44:12 CST 2019.
-->
<id column="ID" jdbcType="DECIMAL" property="id"/>
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate"/>
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid"/>
......@@ -24,20 +19,10 @@
<result column="LAST_IP" jdbcType="VARCHAR" property="lastIp"/>
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Oct 22 14:44:12 CST 2019.
-->
delete from LL.SYS_USER
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.api.model.SysUser">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Oct 22 14:44:12 CST 2019.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
select SEQ_SYS_USER_ID.nextval from dual
</selectKey>
......@@ -53,11 +38,6 @@
#{lastTime,jdbcType=TIMESTAMP}, #{lastIp,jdbcType=VARCHAR})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SysUser">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Oct 22 14:44:12 CST 2019.
-->
update LL.SYS_USER
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
......
......@@ -42,5 +42,10 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0-b07</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.bsoft.common.utils;
import javax.servlet.http.HttpServletRequest;
public class HttpUtil {
/**
* 获取IP
* @param request
* @return
*/
public static String getIP(HttpServletRequest request){
String ip = request.getRemoteAddr();
String headerIP = request.getHeader("x-real-ip");
if(headerIP == null || "".equals(headerIP) || "null".equals(headerIP)){
headerIP = request.getHeader("x-forwarded-for");
}
if(headerIP !=null && !"".equals(headerIP) && !"null".equals(headerIP)){
ip = headerIP;
}
return ip;
}
}
package com.bsoft.api.common.utils;
package com.bsoft.common.utils;
public class StringUtil {
public static boolean isNullOrEmpty(String str){
......
......@@ -8,7 +8,7 @@ import java.sql.Types;
public class JavaTypeResolverImpl extends JavaTypeResolverDefaultImpl {
public JavaTypeResolverImpl(){
super();
this.typeMap.put(Types.OTHER, new JdbcTypeInformation("NVARCHAR2", //$NON-NLS-1$
this.typeMap.put(Types.OTHER, new JdbcTypeInformation("VARCHAR", //$NON-NLS-1$
new FullyQualifiedJavaType(String.class.getName())));
}
}
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
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