架构设计

This commit is contained in:
张博 2024-11-11 16:56:43 +08:00
parent a796a44185
commit 2d69472a04
54 changed files with 311 additions and 546 deletions

View File

@ -30,7 +30,7 @@
<junit.version>4.12</junit.version>
<jedis.version>2.9.0</jedis.version>
<druid.version>1.2.13</druid.version>
<mybatisplus.version>3.1.2</mybatisplus.version>
<mybatisplus.version>3.4.3.2</mybatisplus.version>
<mysql.version>8.0.25</mysql.version>
<mssql.version>4.0</mssql.version>
<oracle.version>11.2.0.3</oracle.version>

View File

@ -2,7 +2,11 @@
package net.shapelight.common.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.DynamicTableNameInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import net.shapelight.common.interceptor.CustomizeTableNameHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -18,16 +22,28 @@ public class MybatisPlusConfig {
/**
* 分页插件
*/
// 最新版
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 分页插件
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
DynamicTableNameInnerInterceptor dynamicTableNameInnerInterceptor = new DynamicTableNameInnerInterceptor();
dynamicTableNameInnerInterceptor.setTableNameHandler(
//可以传多个表名参数指定哪些表使用MonthTableNameHandler处理表名称
new CustomizeTableNameHandler("ten_person_extract")
);
//以拦截器的方式处理表名称
interceptor.addInnerInterceptor(dynamicTableNameInnerInterceptor);
return interceptor;
}
// @Bean
// public ISqlInjector sqlInjector() {
// return new LogicSqlInjector();
// }
// @Bean
/*// @Bean
// public PaginationInterceptor paginationInterceptor() {
// PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
// DynamicTableNameParser dynamicTableNameParser = new DynamicTableNameParser();
@ -81,5 +97,5 @@ public class MybatisPlusConfig {
//// }});
//// paginationInterceptor.setSqlParserList(Collections.singletonList(dynamicTableNameParser));
// return paginationInterceptor;
// }
// }*/
}

View File

@ -116,6 +116,7 @@ public class ShiroConfig {
filterMap.put("/webjars/**", "anon");
filterMap.put("/druid/**", "anon");
filterMap.put("/app/**", "anon");
filterMap.put("/parent/app/**", "anon");
filterMap.put("/api/**", "anon");
filterMap.put("/images/**", "anon");//网站上传的图片files
filterMap.put("/files/**", "anon");//网站上传的图片files

View File

@ -0,0 +1,42 @@
package net.shapelight.common.interceptor;
import com.baomidou.mybatisplus.extension.plugins.handler.TableNameHandler;
import java.util.Arrays;
import java.util.List;
/**
* 按自定义字段参数组成动态表名
*/
public class CustomizeTableNameHandler implements TableNameHandler {
//用于记录哪些表可以使用该月份动态表名处理器即哪些表可以分表
private List<String> tableNames;
//构造函数构造动态表名处理器的时候传递tableNames参数
public CustomizeTableNameHandler(String ...tableNames) {
this.tableNames = Arrays.asList(tableNames);
}
//每个请求线程维护一个分表字段数据避免多线程数据冲突所以使用ThreadLocal
private static final ThreadLocal<String> CELL_DATA = new ThreadLocal<>();
//设置请求线程的month数据
public static void setData(String month) {
CELL_DATA.set(month);
}
//删除当前请求线程的month数据
public static void removeData() {
CELL_DATA.remove();
}
//动态表名接口实现方法
@Override
public String dynamicTableName(String sql, String tableName) {
if (this.tableNames.contains(tableName)){
return tableName + "_" + CELL_DATA.get(); //表名增加分表字段后缀
}else{
return tableName; //表名原样返回
}
}
}

View File

@ -2,6 +2,8 @@ package net.shapelight.modules.app.config;
import net.shapelight.modules.app.interceptor.AuthorizationInterceptor;
import net.shapelight.modules.app.resolver.LoginUserHandlerMethodArgumentResolver;
import net.shapelight.modules.appparent.interceptor.ParentAuthorizationInterceptor;
import net.shapelight.modules.appparent.resolver.ParentLoginUserHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
@ -18,15 +20,21 @@ public class WebMvcConfig implements WebMvcConfigurer {
@Autowired
private AuthorizationInterceptor authorizationInterceptor;
@Autowired
private ParentAuthorizationInterceptor parentAuthorizationInterceptor;
@Autowired
private LoginUserHandlerMethodArgumentResolver loginUserHandlerMethodArgumentResolver;
@Autowired
private ParentLoginUserHandlerMethodArgumentResolver parentLoginUserHandlerMethodArgumentResolver;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/app/**");
registry.addInterceptor(parentAuthorizationInterceptor).addPathPatterns("/parent/app/**");
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(loginUserHandlerMethodArgumentResolver);
argumentResolvers.add(parentLoginUserHandlerMethodArgumentResolver);
}
}

View File

@ -550,7 +550,7 @@ public class AppApiController {
// if(tenPersonIdcard!=null){
// return R.error("身份证在此房间已存在");
// }
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId());
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId(),tenPerson.getCellId());
if(list.size()>0){
return R.error("身份证在此组织已存在");
}

View File

@ -1,32 +0,0 @@
package net.shapelight.modules.appparent.config;
import net.shapelight.modules.appparent.interceptor.AuthorizationInterceptor;
import net.shapelight.modules.appparent.resolver.LoginUserHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.List;
/**
* MVC配置
*/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Autowired
private AuthorizationInterceptor authorizationInterceptor;
@Autowired
private LoginUserHandlerMethodArgumentResolver loginUserHandlerMethodArgumentResolver;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/app/**");
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(loginUserHandlerMethodArgumentResolver);
}
}

View File

@ -1,16 +0,0 @@
package net.shapelight.modules.appparent.controller;
public class AppComm {
public static int FLAG_DEVICE_ALART = 2;
public static int FLAG_APP_TO_SERVER = 0;
public static int FLAG_SERVER_TO_DEVICE = 1;
public static int FLAG_RESPONSED = 3;
public static int FLAG_ALERT_MSG_DELETE = 4;
public static String STRING_ALEAM = "告警";
public static String TYPE_MOVECAR = "movecar";
public static String SIGNAL_STATUS_ON = "正常";
public static String SIGNAL_STATUS_OFF = "离线";
public static String SIGNAL_STATUS_ERROR = "异常";
public static String SIGNAL_STATUS_INIT = "初始导入";
}

View File

@ -3,14 +3,10 @@ package net.shapelight.modules.appparent.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.minio.MinioClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.shapelight.common.config.GlobalValue;
import net.shapelight.common.config.MinioConfig;
import net.shapelight.common.utils.Constant;
import net.shapelight.common.utils.MyDateUtils;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.R;
@ -36,7 +32,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/parent/app")
@Api("APP接口")
public class AppInfoApiController {
public class AppInfoParentApiController {
@Autowired
private TenCellService tenCellService;
@ -120,17 +116,14 @@ public class AppInfoApiController {
recordTimeEnd = MyDateUtils.getCurrentMonthEndTime();
}
params.put("recordTimeStart",recordTimeStart);
params.put("recordTimeEnd",recordTimeEnd);
List<TenRelation> relationList = relationService.list(new LambdaQueryWrapper<TenRelation>()
.eq(TenRelation::getParentId,user.getUserId()).eq(TenRelation::getStatus,1));
if(!relationList.isEmpty()) {
List<Long> list = relationList.stream().map(TenRelation::getStudentId).collect(Collectors.toList());
params.put("cellId",user.getCellId());
params.put("personIds",list);
params.put("recordTimeEnd", recordTimeEnd);
TenRelation relation = relationService.getOne(new LambdaQueryWrapper<TenRelation>()
.eq(TenRelation::getParentId, user.getUserId()).eq(TenRelation::getStudentId, params.get("studentId")).eq(TenRelation::getStatus, 1));
params.put("cellId", user.getCellId());
params.put("personId", relation.getStudentId());
PageUtils page = tenRecordService.getByPersonIds(params);
return R.ok().put("data", page);
}
}
return R.ok().put("data",new PageUtils(new ArrayList<>(),0,0,0));
}

View File

@ -1,17 +1,16 @@
package net.shapelight.modules.appparent.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.shapelight.common.utils.IpUtils;
import net.shapelight.common.utils.R;
import net.shapelight.common.utils.ServletUtils;
import net.shapelight.common.validator.ValidatorUtils;
import net.shapelight.modules.app.form.LoginForm;
import net.shapelight.modules.appparent.annotation.Login;
import net.shapelight.modules.appparent.annotation.LoginUser;
import net.shapelight.modules.appparent.form.LoginForm;
import net.shapelight.modules.appparent.utils.JwtUtils;
import net.shapelight.modules.appparent.utils.ParentJwtUtils;
import net.shapelight.modules.ten.entity.TenParent;
import net.shapelight.modules.ten.service.TenParentService;
import net.shapelight.modules.vo.TokenVo;
@ -26,9 +25,9 @@ import java.util.Date;
@RestController
@RequestMapping("/parent/app")
@Api("APP登录接口")
public class AppLoginController {
public class AppLoginParentController {
@Autowired
private JwtUtils jwtUtils;
private ParentJwtUtils parentJwtUtils;
// @Autowired
// PushService pushService;
@Autowired
@ -45,10 +44,10 @@ public class AppLoginController {
//用户登录
TenParent user = parentService.login(form);
//生成token
String token = jwtUtils.generateToken(user.getUserId());
String token = parentJwtUtils.generateToken(user.getId());
TokenVo tokenVo = new TokenVo();
tokenVo.setToken(token);
tokenVo.setExpire((int)jwtUtils.getExpire());
tokenVo.setExpire((int) parentJwtUtils.getExpire());
String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
user.setLoginTime(new Date());
user.setLoginIp(ip);

View File

@ -1,9 +1,6 @@
package net.shapelight.modules.appparent.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.minio.MinioClient;
@ -25,6 +22,7 @@ import net.shapelight.modules.sys.service.SysUserService;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient;
import net.shapelight.modules.vo.SchoolNameVo;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -43,7 +41,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/parent/app")
@Api("APP接口")
public class AppApiController {
public class AppParentApiController {
@Autowired
private TenPersonService tenPersonService;
@ -103,6 +101,12 @@ public class AppApiController {
return R.ok().put("data", list);
}
@GetMapping("school")
public R getAllCell(@RequestParam String name) {
List<SchoolNameVo> schoolNameVo = tenCellService.findByName(name);
return R.ok().put("data",schoolNameVo);
}
@PostMapping("checkCellAdmin")
@ApiOperation("验证小区管理员是否正确")
@ -113,7 +117,7 @@ public class AppApiController {
String adminMobile = (String) params.get("adminMobile");
String cellId = appUserService.checkCellAdmin(adminMobile);
String tenantId = String.valueOf(tenCellService.getById(cellId).getTenantId());
if (cellId != null && !cellId.isEmpty()) {
if (cellId != null && !cellId.isEmpty() ) {
Map<String, Object> cellMap = new HashMap<>();
cellMap.put("cellId", cellId);
cellMap.put("tenantId",tenantId);
@ -139,15 +143,15 @@ public class AppApiController {
return R.error("手机号已经注册");
}
TenParent tenParent = new TenParent();
parent.setUserName(tenPerson.getUsername());
parent.setMobile(tenPerson.getMobile());
tenParent.setUserName(tenPerson.getName());
tenParent.setMobile(tenPerson.getMobile());
//sha256加密
// String salt = RandomStringUtils.randomAlphanumeric(20);
// appUser.setPassword(new Sha256Hash(entity.getPassword(), salt).toHex());
// appUser.setSalt(salt);
parent.setPassword(DigestUtils.sha256Hex(tenPerson.getPassword()));
parent.setCreateTime(new Date());
parent.setCellId(tenPerson.getCellId());
tenParent.setPassword(DigestUtils.sha256Hex(tenPerson.getPassword()));
tenParent.setCreateTime(new Date());
tenParent.setCellId(tenPerson.getCellId());
tenParent.setName(tenPerson.getName());
tenParent.setGender(tenPerson.getGender());
tenParent.setIdCard(tenPerson.getIdCard());
@ -319,7 +323,7 @@ public class AppApiController {
// if(tenPersonIdcard!=null){
// return R.error("身份证在此房间已存在");
// }
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId());
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId(),tenPerson.getCellId());
if(list.size()>0){
return R.error("身份证在此组织已存在");
}
@ -370,12 +374,16 @@ public class AppApiController {
if(!relationList.isEmpty()) {
List<Long> list = relationList.stream().map(TenRelation::getStudentId).collect(Collectors.toList());
params.put("cellId",user.getCellId());
List<TenPersonEntity> personEntityList = new ArrayList<>();
relationList.forEach(relation -> {
personEntityList.add(tenPersonService.getById(relation.getStudentId(),relation.getCellId()));
});
/*params.put("cellId",user.getCellId());
params.put("personIds",list.stream().distinct().collect(Collectors.toList()));
PageUtils page = tenPersonService.selectBypersonIds(params);
return R.ok().put("data",page);
PageUtils page = tenPersonService.selectBypersonIds(params);*/
return R.ok().put("data",personEntityList);
}
return R.ok().put("data",new PageUtils(new ArrayList<>(),0,0,0));
return R.ok().put("data",new ArrayList<>());
}
@ -392,7 +400,7 @@ public class AppApiController {
public R getGuest(@LoginUser TenParent user, @RequestBody Map<String, Object> params) {
String key = (String)params.get("key");
params.put("cellId", user.getCellId().toString());
//params.put("cellId", user.getCellId().toString());
params.put("createBy", user.getId().toString());
PageUtils page = tenPersonService.selectByCreateByQueryPage(params);
return R.ok().put("data", page);
@ -479,10 +487,11 @@ public class AppApiController {
}
}
TenRelation relation = new TenRelation();
relation.setParentId(user.getUserId());
relation.setParentId(user.getId());
relation.setStudentId(entity.getPersonId());
relation.setCreateTime(new Date());
relation.setStatus(2);
relation.setCellId(entity.getCellId());
relation.setRelation(params.get("salutation").toString());
relationService.save(relation);
return R.ok();

View File

@ -9,9 +9,9 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.shapelight.common.utils.R;
import net.shapelight.common.utils.RedisUtils;
import net.shapelight.modules.app.utils.MonyunSmsUtils;
import net.shapelight.modules.appparent.annotation.Login;
import net.shapelight.modules.appparent.annotation.LoginUser;
import net.shapelight.modules.appparent.utils.MonyunSmsUtils;
import net.shapelight.modules.ten.entity.TenParent;
import net.shapelight.modules.ten.service.TenParentService;
import org.apache.commons.codec.digest.DigestUtils;
@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
@ -33,7 +32,7 @@ import java.util.Random;
@RestController
@RequestMapping("/parent/app")
@Api("APP注册接口")
public class AppRegisterController {
public class AppRegisterParentController {
@Autowired
private RedisUtils redisUtils;
@Autowired
@ -49,6 +48,7 @@ public class AppRegisterController {
public R sendsms(@RequestBody Map<String, Object> params) {
//验证手机是否注册
String mobile = (String) params.get("mobile");
Long cellId = (Long) params.get("cellId");
int type = (Integer) params.get("type");
//type=1 //注册
//type=2 //忘记密码
@ -152,6 +152,7 @@ public class AppRegisterController {
public R forgetPassword(HttpServletRequest request, @RequestBody Map<String, Object> map) {
String mobile = (String) map.get("mobile");
String password = (String) map.get("password");
Long cellId = (Long) map.get("cellId");
// String smscode = (String) map.get("smscode");
// JSONObject SessionJson = (JSONObject) request.getSession().getAttribute("verifyCode");

View File

@ -1,43 +0,0 @@
/**
* Copyright 2018 http://www.gfirefly.com
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package net.shapelight.modules.appparent.form;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 登录表单
*
*/
@ApiModel(value = "登录表单")
@Data
public class LoginForm {
@ApiModelProperty(value = "手机号")
@NotBlank(message="手机号不能为空")
private String mobile;
@ApiModelProperty(value = "密码")
@NotBlank(message="密码不能为空")
private String password;
// @ApiModelProperty(value = "推送ID")
// private String registrationId;
}

View File

@ -1,40 +0,0 @@
/**
* Copyright 2018 http://www.gfirefly.com
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package net.shapelight.modules.appparent.form;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 注册表单
*
*/
@Data
@ApiModel(value = "注册表单")
public class RegisterForm {
@ApiModelProperty(value = "手机号")
@NotBlank(message="手机号不能为空")
private String mobile;
@ApiModelProperty(value = "密码")
@NotBlank(message="密码不能为空")
private String password;
}

View File

@ -1,40 +0,0 @@
/**
* Copyright 2018 http://www.gfirefly.com
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package net.shapelight.modules.appparent.form;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 注册表单
*/
@Data
@ApiModel(value = "注册表单")
public class RegisterSmsForm {
@ApiModelProperty(value = "手机号")
@NotBlank(message="手机号不能为空")
private String mobile;
@ApiModelProperty(value = "密码")
@NotBlank(message="密码不能为空")
private String password;
}

View File

@ -4,7 +4,7 @@ package net.shapelight.modules.appparent.interceptor;
import io.jsonwebtoken.Claims;
import net.shapelight.common.exception.RRException;
import net.shapelight.modules.appparent.annotation.Login;
import net.shapelight.modules.appparent.utils.JwtUtils;
import net.shapelight.modules.appparent.utils.ParentJwtUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@ -19,11 +19,11 @@ import javax.servlet.http.HttpServletResponse;
* 权限(Token)验证
*/
@Component
public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
public class ParentAuthorizationInterceptor extends HandlerInterceptorAdapter {
@Autowired
private JwtUtils jwtUtils;
private ParentJwtUtils parentJwtUtils;
public static final String USER_KEY = "userId";
public static final String USER_KEY = "id";
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
@ -39,19 +39,19 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
}
//获取用户凭证
String token = request.getHeader(jwtUtils.getHeader());
String token = request.getHeader(parentJwtUtils.getHeader());
if(StringUtils.isBlank(token)){
token = request.getParameter(jwtUtils.getHeader());
token = request.getParameter(parentJwtUtils.getHeader());
}
//凭证为空
if(StringUtils.isBlank(token)){
throw new RRException(jwtUtils.getHeader() + "不能为空", HttpStatus.UNAUTHORIZED.value());
throw new RRException(parentJwtUtils.getHeader() + "不能为空", HttpStatus.UNAUTHORIZED.value());
}
Claims claims = jwtUtils.getClaimByToken(token);
if(claims == null || jwtUtils.isTokenExpired(claims.getExpiration())){
throw new RRException(jwtUtils.getHeader() + "失效,请重新登录", HttpStatus.UNAUTHORIZED.value());
Claims claims = parentJwtUtils.getClaimByToken(token);
if(claims == null || parentJwtUtils.isTokenExpired(claims.getExpiration())){
throw new RRException(parentJwtUtils.getHeader() + "失效,请重新登录", HttpStatus.UNAUTHORIZED.value());
}
//设置userId到request里后续根据userId获取用户信息

View File

@ -1,7 +1,7 @@
package net.shapelight.modules.appparent.resolver;
import net.shapelight.modules.appparent.annotation.LoginUser;
import net.shapelight.modules.appparent.interceptor.AuthorizationInterceptor;
import net.shapelight.modules.appparent.interceptor.ParentAuthorizationInterceptor;
import net.shapelight.modules.ten.entity.TenParent;
import net.shapelight.modules.ten.service.TenParentService;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,7 +17,7 @@ import org.springframework.web.method.support.ModelAndViewContainer;
* @LoginUser注解的方法参数注入当前登录用户
*/
@Component
public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
public class ParentLoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
@Autowired
private TenParentService parentService;
@ -30,7 +30,7 @@ public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgu
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer container,
NativeWebRequest request, WebDataBinderFactory factory) throws Exception {
//获取用户ID
Object object = request.getAttribute(AuthorizationInterceptor.USER_KEY, RequestAttributes.SCOPE_REQUEST);
Object object = request.getAttribute(ParentAuthorizationInterceptor.USER_KEY, RequestAttributes.SCOPE_REQUEST);
if(object == null){
return null;
}

View File

@ -1,143 +0,0 @@
package net.shapelight.modules.appparent.utils;
/**
* 阿里云短信服务
* 注意需要 签名名称模版CODE 以及 RAM访问控制中的 AccessKeyID AccessKeySecret
*/
public class AliyunSmsUtils {
// protected static final Logger LOG = LoggerFactory.getLogger(JSMSExample.class);
//
// //产品名称:云通信短信API产品,开发者无需替换
// static final String product = "Dysmsapi";
// //产品域名,开发者无需替换
// static final String domain = "dysmsapi.aliyuncs.com";
// // TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
// static final String accessKeyId = "LTAI7uAVsj2pgLJA"; // TODO 修改成自己的
// static final String accessKeySecret = "NjPbUUCruxZIrhDeYBlMi62JKN94pf"; // TODO 修改成自己的
// static final String signName = "智慧挪车";
// static final String templateCode = "SMS_162732858";
//
// public static String sendSms(String telephone, String code) throws ClientException {
// //可自助调整超时时间
// System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
// System.setProperty("sun.net.client.defaultReadTimeout", "10000");
// //初始化acsClient,暂不支持region化
// IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
// DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
// IAcsClient acsClient = new DefaultAcsClient(profile);
// //组装请求对象-具体描述见控制台-文档部分内容
// SendSmsRequest request = new SendSmsRequest();
// //必填:待发送手机号
// request.setPhoneNumbers(telephone);
// //必填:短信签名-可在短信控制台中找到
// request.setSignName(signName);
// //必填:短信模板-可在短信控制台中找到
// request.setTemplateCode(templateCode);
// //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}",此处的值为
//// request.setTemplateParam("{\"name\":\"Tom\", \"code\":\"123\"}");
// request.setTemplateParam("{\"code\":\"" + code + "\"}");
// //选填-上行短信扩展码(无特殊需求用户请忽略此字段)
// //request.setSmsUpExtendCode("90997");
// //可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
// //request.setOutId("90999");
// //hint 此处可能会抛出异常注意catch
// SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
// if(sendSmsResponse.getCode()!= null && sendSmsResponse.getCode().equals("OK")){
// //System.out.println("短信发送成功!");
// return "OK";
// }else {
// //System.out.println("短信发送失败!");
// LOG.error("SMS-Error:"+"Code=" + sendSmsResponse.getCode()+" Message=" + sendSmsResponse.getMessage());
// return sendSmsResponse.getMessage();
// }
// }
// public static void main(String[] args) throws ClientException, InterruptedException {
//
// String verifyCode = String.valueOf(new Random().nextInt(899999) + 100000);
//
// System.out.println("发送的验证码为:"+verifyCode);
//
// //发短信
// String response =sendSms("158",verifyCode); // TODO 填写你需要测试的手机号码
// System.out.println("短信接口返回的数据----------------"+response);
///*
// SendSmsResponse response =sendSms("xxx",verifyCode); // TODO 填写你需要测试的手机号码
//
// System.out.println("短信接口返回的数据----------------");
//
// System.out.println("Code=" + response.getCode());
//
// System.out.println("Message=" + response.getMessage());
//
// System.out.println("RequestId=" + response.getRequestId());
//
// System.out.println("BizId=" + response.getBizId());
//*/
//
//
// /* 不删 留着 以后可能有用
//
// System.out.println(" ============================================== ");
//
// Thread.sleep(3000L);
//
// //查明细
//
// if(response.getCode() != null && response.getCode().equals("OK")) {
//
// QuerySendDetailsResponse querySendDetailsResponse = querySendDetails(response.getBizId());
//
// System.out.println("短信明细查询接口返回数据----------------");
//
// System.out.println("Code=" + querySendDetailsResponse.getCode());
//
// System.out.println("Message=" + querySendDetailsResponse.getMessage());
//
// int i = 0;
//
// for(QuerySendDetailsResponse.SmsSendDetailDTO smsSendDetailDTO : querySendDetailsResponse.getSmsSendDetailDTOs())
//
// {
//
// System.out.println("SmsSendDetailDTO["+i+"]:");
//
// System.out.println("Content=" + smsSendDetailDTO.getContent());
//
// System.out.println("ErrCode=" + smsSendDetailDTO.getErrCode());
//
// System.out.println("OutId=" + smsSendDetailDTO.getOutId());
//
// System.out.println("PhoneNum=" + smsSendDetailDTO.getPhoneNum());
//
// System.out.println("ReceiveDate=" + smsSendDetailDTO.getReceiveDate());
//
// System.out.println("SendDate=" + smsSendDetailDTO.getSendDate());
//
// System.out.println("SendStatus=" + smsSendDetailDTO.getSendStatus());
//
// System.out.println("Template=" + smsSendDetailDTO.getTemplateCode());
//
// }
//
// System.out.println("TotalCount=" + querySendDetailsResponse.getTotalCount());
//
// System.out.println("RequestId=" + querySendDetailsResponse.getRequestId());
//
// }*/
//
//
//
// }
}

View File

@ -1,50 +0,0 @@
package net.shapelight.modules.appparent.utils;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import java.net.URLEncoder;
import static net.shapelight.common.utils.RestTemplateUtils.postHttp;
/**
*/
@Slf4j
public class MonyunSmsUtils {
public static final String apikey = "9fa361745374a7acd777e923fbe564aa";
public static final String URL = "http://api01.monyun.cn:7901/sms/v2/std/single_send";
/**
*
* @param mobile
* @param code
* @return 0 成功 其他失败
*/
public static int sendSms(String mobile, String code) {
JSONObject jsobj1 = new JSONObject();
jsobj1.put("apikey", apikey);
jsobj1.put("mobile", mobile);
String con = "您的验证码是"+code+"在3分钟内输入有效。如非本人操作请忽略此短信。";
try {
jsobj1.put("content",URLEncoder.encode(con, "GBK"));
}catch (Exception e){
e.printStackTrace();
}
String res = postHttp(URL,jsobj1);
JSONObject resObj = JSONObject.parseObject(res);
int r = -1;
if(resObj.get("result")!=null){
r = (Integer)resObj.get("result");
}
log.info(res);
return r;
}
public static void main(String args[]){
int res = sendSms("158290","123456");
log.debug("result:"+res);
}
}

View File

@ -15,7 +15,7 @@ import java.util.Date;
*/
@ConfigurationProperties(prefix = "shapelight.jwt")
@Component
public class JwtUtils {
public class ParentJwtUtils {
private Logger logger = LoggerFactory.getLogger(getClass());
private String secret;

View File

@ -1,16 +1,14 @@
package net.shapelight.modules.nettyapi.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.netty.channel.Channel;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.common.config.GlobalValue;
import net.shapelight.common.config.MinioConfig;
import net.shapelight.common.interceptor.CustomizeTableNameHandler;
import net.shapelight.common.utils.*;
import net.shapelight.modules.nettyapi.config.ClientMap;
import net.shapelight.modules.nettyapi.config.CmdConstant;
@ -20,22 +18,18 @@ import net.shapelight.modules.nettyapi.service.ServerApiService;
import net.shapelight.modules.nettyapi.utils.Result;
import net.shapelight.modules.sys.entity.SysDeviceEntity;
import net.shapelight.modules.sys.entity.SysDeviceTypeEntity;
import net.shapelight.modules.sys.service.SysDeviceAppService;
import net.shapelight.modules.sys.service.SysDeviceService;
import net.shapelight.modules.sys.service.SysDeviceTypeService;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.vo.TenPersonIdUpdateAllVo;
import net.shapelight.modules.vo.TenPersonIdUpdateVo;
import net.shapelight.modules.vo.TenPersonOperationVo;
import net.shapelight.modules.vo.TenUserVo;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.util.*;
@ -639,8 +633,9 @@ public class DeviceApiServiceImpl implements DeviceApiService {
extract.setState(state);
extract.setCellId(cellEntity.getCellId());
extract.setTenantId(cellEntity.getTenantId());
CustomizeTableNameHandler.setData(String.valueOf(cellEntity.getCellId()));
tenPersonExtractService.save(extract);
CustomizeTableNameHandler.removeData();
Result res = new Result();
String resContent = JSONObject.toJSONString(res);

View File

@ -112,14 +112,14 @@ public class SysTenUserController extends AbstractController {
Long role = Long.valueOf(1000L);
roleIdList.add(role);
user.setRoleIdList(roleIdList);
try {
/*try {
sysUserService.saveUserSysTen(user);
}catch (DuplicateKeyException e){
return R.error("数据库中已存在该记录");
}catch (RRException e){
sysUserService.removeById(id);
return R.error("插入失败:"+e.getMessage());
}
}*/
return R.ok();
}

View File

@ -93,7 +93,7 @@ public class TenCellDeptController extends AbstractController {
@PostMapping("/save")
@RequiresPermissions("ten:celldept")
public R save(@RequestBody TenCellDeptEntity tenCellDept){
int count = tenCellDeptService.count(new QueryWrapper<TenCellDeptEntity>()
long count = tenCellDeptService.count(new QueryWrapper<TenCellDeptEntity>()
.eq("cell_id",tenCellDept.getCellId())
.eq("parent_id",tenCellDept.getParentId())
.eq("name",tenCellDept.getName()));
@ -122,7 +122,7 @@ public class TenCellDeptController extends AbstractController {
public R update(@RequestBody TenCellDeptEntity tenCellDept){
TenCellDeptEntity old = tenCellDeptService.getById(tenCellDept.getDeptId());
if(!old.getName().equals(tenCellDept.getName())){
int count = tenCellDeptService.count(new QueryWrapper<TenCellDeptEntity>()
long count = tenCellDeptService.count(new QueryWrapper<TenCellDeptEntity>()
.eq("cell_id",tenCellDept.getCellId())
.eq("parent_id",tenCellDept.getParentId())
.eq("name",tenCellDept.getName()));
@ -251,7 +251,7 @@ public class TenCellDeptController extends AbstractController {
List<TenCellDeptEntity> page = tenCellDeptService.list(new QueryWrapper<TenCellDeptEntity>()
.eq("parent_id",cellId));
for(TenCellDeptEntity cellDeptEntity: page){
int count = tenCellDeptService.count(new QueryWrapper<TenCellDeptEntity>()
long count = tenCellDeptService.count(new QueryWrapper<TenCellDeptEntity>()
.eq("parent_id",cellDeptEntity.getDeptId()));
if(count > 0){
cellDeptEntity.setHasChildren(true);
@ -274,7 +274,7 @@ public class TenCellDeptController extends AbstractController {
List<TenCellDeptEntity> page = tenCellDeptService.list(new QueryWrapper<TenCellDeptEntity>()
.eq("parent_id",parentId));
for(TenCellDeptEntity cellDeptEntity: page){
int count = tenCellDeptService.count(new QueryWrapper<TenCellDeptEntity>()
long count = tenCellDeptService.count(new QueryWrapper<TenCellDeptEntity>()
.eq("parent_id",cellDeptEntity.getDeptId()));
if(count > 0){
cellDeptEntity.setHasChildren(true);

View File

@ -92,7 +92,7 @@ public class TenCompanyTypeController extends AbstractController {
@RequiresPermissions("ten:companytype")
public R delete(@RequestBody Long[] typeIds){
Long typeId = typeIds[0];
int c = tenCompanyService.count(new QueryWrapper<TenCompanyEntity>()
long c = tenCompanyService.count(new QueryWrapper<TenCompanyEntity>()
.eq("tenant_id",getUser().getTenantId())
.eq("type_id",typeId));
if(c>0){

View File

@ -6,13 +6,16 @@ import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.TenPersonService;
import net.shapelight.modules.ten.service.impl.TenUserScopeServiceImpl;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -36,6 +39,8 @@ public class TenLabelController extends AbstractController {
private TenLabelService tenLabelService;
@Autowired
private TenPersonService tenPersonService;
@Autowired
private TenUserScopeServiceImpl tenUserScopeService;
/**
* 列表
@ -69,12 +74,12 @@ public class TenLabelController extends AbstractController {
/**
* 信息
*/
@GetMapping("/select")
@GetMapping("/select/{type}")
// @RequiresPermissions("ten:label")
@ApiOperation(value = "选择标签下拉框",response = TenLabelEntity.class)
public R select(){
public R select(@PathVariable("type") Integer type){
List<TenLabelEntity> tenLabel = tenLabelService.list(new QueryWrapper<TenLabelEntity>()
.eq("tenant_id",getUser().getTenantId()));
.eq("tenant_id",getUser().getTenantId()).eq("type",type));
return R.ok().put("data", tenLabel);
}
@ -95,8 +100,8 @@ public class TenLabelController extends AbstractController {
tenLabel.setCreateTime(new Date());
tenLabel.setTenantId(getUser().getTenantId());
tenLabelService.save(tenLabel);
tenLabel.setType(tenLabel.getLabelId().intValue());
tenLabelService.updateById(tenLabel);
/* tenLabel.setType(tenLabel.getLabelId().intValue());
tenLabelService.updateById(tenLabel);*/
return R.ok();
}
@ -133,7 +138,8 @@ public class TenLabelController extends AbstractController {
@ApiOperation(value = "删除标签")
public R delete(@RequestBody Long[] labelIds){
Long id = labelIds[0];
int pCount = tenPersonService.getByLabel(id);
TenUserScopeEntity scopeEntity = tenUserScopeService.getOne(new LambdaQueryWrapper<TenUserScopeEntity>().eq(TenUserScopeEntity::getUserId,getUserId()));
int pCount = tenPersonService.getByLabel(id,scopeEntity.getCellId());
if(pCount>0){
return R.error("此标签已使用");
}

View File

@ -15,6 +15,7 @@ import net.shapelight.modules.app.entity.AppUserScopeEntity;
import net.shapelight.modules.app.service.impl.AppUserScopeServiceImpl;
import net.shapelight.modules.app.service.impl.AppUserServiceImpl;
import net.shapelight.modules.job.entity.KeysEntity;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.ten.entity.TenParent;
import net.shapelight.modules.ten.entity.TenRelation;
import net.shapelight.modules.ten.service.TenParentService;
@ -36,7 +37,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("ten/parent")
@Api(value="家长信息",tags="家长信息")
public class TenParentController {
public class TenParentController extends AbstractController {
@Autowired
TenParentService tenParentService;
@ -62,6 +63,7 @@ public class TenParentController {
@ApiImplicitParam(name = "mobile", value = "手机号", paramType = "query", dataType = "String", required = true)
})
public R getParentList(@RequestParam Map<String,Object> params) {
params.put("cellId",getUser().getCellId());
PageUtils page = tenParentService.getParentList(params);
return R.ok().put("data",page);

View File

@ -399,7 +399,7 @@ public class TenPersonController extends AbstractController {
/*TenPersonEntity tenPersonEntity = tenPersonService.findByName(tenPerson.getName(),
tenPerson.getRoomId(),tenPerson.getCellId());*/
Integer count = tenPersonService.findByRyId(tenPerson.getRyid());
Integer count = tenPersonService.findByRyId(tenPerson.getRyid(),tenPerson.getCellId());
if(count!=null&&count>=1){
return R.error("当前学号已存在");
}
@ -411,7 +411,7 @@ public class TenPersonController extends AbstractController {
if(tenPersonIdcard!=null){
return R.error("身份证在此班级已存在");
}*/
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId());
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId(),tenPerson.getCellId());
if(list.size()>0){
return R.error("身份证已存在");
}
@ -450,7 +450,7 @@ public class TenPersonController extends AbstractController {
tenPerson.setLastUpdateBy(getUser().getUsername());
tenPerson.setLastUpdateTime(new Date());
tenPerson.setFaceFailure(Constant.FACE_FAILURE_OK);
Integer count = tenPersonService.findByRyId(tenPerson.getRyid());
Integer count = tenPersonService.findByRyId(tenPerson.getRyid(),tenPerson.getCellId());
if(count!=null&&count>=2){
return R.error("当前学号已存在");
}
@ -481,7 +481,7 @@ public class TenPersonController extends AbstractController {
// if(tenPersonEntityIdCard!=null){
// return R.error("身份证在此房间已存在");
// }
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),oldPerson.getDeptId());
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),oldPerson.getDeptId(),tenPerson.getCellId());
if(list.size()>0){
return R.error("身份证在此组织已存在");
}
@ -923,7 +923,7 @@ public class TenPersonController extends AbstractController {
if(tenPerson.getIdCard()!=null){
TenPersonEntity oldPerson = tenPersonService.getById(tenPerson.getPersonId(),tenPerson.getCellId());
if(!tenPerson.getIdCard().equals(oldPerson.getIdCard())){
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),oldPerson.getDeptId());
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),oldPerson.getDeptId(),tenPerson.getCellId());
if(list.size()>0){
return R.error("身份证在此组织已存在");
}
@ -1185,7 +1185,7 @@ public class TenPersonController extends AbstractController {
// if(tenPersonIdcard!=null){
// return R.error("身份证在此房间已存在");
// }
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId());
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId(),tenPerson.getCellId());
if(list.size()>0){
return R.error("身份证在此组织已存在");
}

View File

@ -5,6 +5,7 @@ import java.util.Map;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import net.shapelight.common.interceptor.CustomizeTableNameHandler;
import net.shapelight.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@ -39,7 +40,9 @@ public class TenPersonExtractController extends AbstractController {
})
public R list(@RequestParam Map<String, Object> params){
params.put("tenantId",getUser().getTenantId());
CustomizeTableNameHandler.setData(String.valueOf(getUser().getCellId()));
PageUtils page = tenPersonExtractService.queryPage(params);
CustomizeTableNameHandler.removeData();
return R.ok().put("data", page);
}
@ -51,8 +54,9 @@ public class TenPersonExtractController extends AbstractController {
@GetMapping("/info/{extractId}")
@RequiresPermissions("ten:personextract:info")
public R info(@PathVariable("extractId") Long extractId){
CustomizeTableNameHandler.setData(String.valueOf(getUser().getCellId()));
TenPersonExtractEntity tenPersonExtract = tenPersonExtractService.getById(extractId);
CustomizeTableNameHandler.removeData();
return R.ok().put("data", tenPersonExtract);
}
@ -62,7 +66,9 @@ public class TenPersonExtractController extends AbstractController {
@PostMapping("/save")
@RequiresPermissions("ten:personextract:save")
public R save(@RequestBody TenPersonExtractEntity tenPersonExtract){
CustomizeTableNameHandler.setData(String.valueOf(getUser().getCellId()));
tenPersonExtractService.save(tenPersonExtract);
CustomizeTableNameHandler.removeData();
return R.ok();
}
@ -73,7 +79,9 @@ public class TenPersonExtractController extends AbstractController {
@PostMapping("/update")
@RequiresPermissions("ten:personextract:update")
public R update(@RequestBody TenPersonExtractEntity tenPersonExtract){
CustomizeTableNameHandler.setData(String.valueOf(getUser().getCellId()));
tenPersonExtractService.updateById(tenPersonExtract);
CustomizeTableNameHandler.removeData();
return R.ok();
}
@ -84,8 +92,9 @@ public class TenPersonExtractController extends AbstractController {
@PostMapping("/delete")
@RequiresPermissions("ten:personextract:delete")
public R delete(@RequestBody Long[] extractIds){
CustomizeTableNameHandler.setData(String.valueOf(getUser().getCellId()));
tenPersonExtractService.removeByIds(Arrays.asList(extractIds));
CustomizeTableNameHandler.removeData();
return R.ok();
}

View File

@ -63,8 +63,8 @@ public class TenRelationController extends AbstractController {
tenRelation.setStatus(Integer.parseInt(item.get("status").toString()));
tenRelation.setApprovalTime(new Date());
tenRelation.setApproval(getUser().getRealName());
AppUserEntity appUser = appUserService.getById(tenRelation.getParentId());
if(tenRelation.getStatus().equals(1)) {
//AppUserEntity appUser = appUserService.getById(tenRelation.getParentId());
/*if(tenRelation.getStatus().equals(1)) {
Map<String,Object> opParams = new HashMap<>();
opParams.put("operation","editUserContactData");
opParams.put("accountNumber",globalValue.accountNumber);
@ -89,7 +89,8 @@ public class TenRelationController extends AbstractController {
}
} else {
relationService.updateById(tenRelation);
}
}*/
relationService.updateById(tenRelation);
});
if (errMsg.isEmpty()) {
return R.ok();

View File

@ -141,7 +141,7 @@ public class TenRoomController extends AbstractController {
tenRoom.setTenantId(getUser().getTenantId());
tenRoom.setCreateBy(getUser().getUsername());
tenRoom.setCreateTime(new Date());
Map<String,Object> params = new HashMap<>();
/*Map<String,Object> params = new HashMap<>();
params.put("operation","editClassData");
params.put("accountNumber", globalValue.accountNumber);
params.put("passKey", KeysEntity.passKey);
@ -157,7 +157,7 @@ public class TenRoomController extends AbstractController {
JSONObject jsonObject = opFeignClient.submitData(params);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error(jsonObject.getString("shrgMsg"));
}
}*/
tenRoomService.save(tenRoom);
return R.ok();
@ -174,7 +174,7 @@ public class TenRoomController extends AbstractController {
tenRoom0.setTenantId(getUser().getTenantId());
tenRoom0.setLastUpdateBy(getUser().getUsername());
tenRoom0.setLastUpdateTime(new Date());
Map<String,Object> params = new HashMap<>();
/*Map<String,Object> params = new HashMap<>();
params.put("operation","editClassData");
params.put("accountNumber",globalValue.accountNumber);
params.put("passKey", KeysEntity.passKey);
@ -193,7 +193,7 @@ public class TenRoomController extends AbstractController {
}
if(!jsonObject.getJSONArray("errInfo").isEmpty()) {
return R.error("同步联系人失败");
}
}*/
tenRoomService.updateById(tenRoom0);
return R.ok();
@ -375,15 +375,15 @@ public class TenRoomController extends AbstractController {
if (pCount>0) {
return R.error("当前班级有"+pCount+"个学生,请先删除完学生");
}
TenRoomEntity tenRoom = tenRoomService.getById(roomId,cellId);
Map<String, Object> dataInfo = new HashMap<>();
//TenRoomEntity tenRoom = tenRoomService.getById(roomId,cellId);
/*Map<String, Object> dataInfo = new HashMap<>();
dataInfo.put("objectUuid",String.valueOf(tenRoom.getRoomId()));
dataInfo.put("classCode",tenRoom.getRoomNumber());
dataInfo.put("className",tenRoom.getRoomName());
dataInfo.put("gradeCode",tenRoom.getBuildNumber());
jsonArray.add(dataInfo);
jsonArray.add(dataInfo);*/
}
Map<String,Object> roomParams = new HashMap<>();
/*Map<String,Object> roomParams = new HashMap<>();
roomParams.put("operation","delClassData");
roomParams.put("accountNumber",globalValue.accountNumber);
roomParams.put("passKey", KeysEntity.passKey);
@ -392,7 +392,7 @@ public class TenRoomController extends AbstractController {
JSONObject jsonObject = opFeignClient.submitData(roomParams);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error("班级添加失败");
}
}*/
tenRoomService.removeByIdList(params);
return R.ok();
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.shapelight.modules.ten.entity.TenCellEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.vo.SchoolNameVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -36,5 +37,6 @@ public interface TenCellDao extends BaseMapper<TenCellEntity> {
List<TenCellEntity> queryAll(Map params);
String getCellName(@Param("cellId")String cellId);
String getAreaNameByCellId(@Param("cellId")String cellId);
List<SchoolNameVo> findByName(String name);
}

View File

@ -18,6 +18,8 @@ import java.util.Map;
@Mapper
public interface TenParentMapper extends BaseMapper<TenParent> {
IPage<ParentVo> getParentVoList(Page page,Map<String, Object> params);
TenParent findByMobile(String mobile);
}

View File

@ -107,7 +107,7 @@ public interface TenPersonDao {
int checkByIdCardCell(@Param("idCard")String idCard, @Param("cellId")Long cellId);
int getByLabel(@Param("labelId")Long labelId);
int getByLabel(@Param("labelId")Long labelId,@Param("cellId")Long cellId);
IPage<TenPersonEntity> selectByDeptId(Page page,@Param("deptId")Long deptId, @Param("cellId")Long cellId, @Param("key")String key);
IPage<TenPersonEntity> selectByDeptIdForGuest(Page page,@Param("deptId")Long deptId, @Param("cellId")Long cellId, @Param("key")String key);
@ -116,13 +116,13 @@ public interface TenPersonDao {
IPage<TenPersonEntity> findExtractPageAll(Page page, @Param("cellIds") List<Long> cellIds,@Param("params") Map params);
List<TenPersonEntity> findByIdCardAndDept(@Param("idCard")String idCard, @Param("deptId")Long deptId);
List<TenPersonEntity> findByIdCardAndDept(@Param("idCard")String idCard, @Param("deptId")Long deptId,Long cellId);
IPage<TenPersonEntity> selectByCreateBy(Page page,@Param("createBy")String createBy, @Param("cellId")Long cellId, @Param("key")String key, @Param("status") String status);
TenPersonEntity findByRyId(@Param("ryId")String ryId, @Param("cellId")Long cellId,@Param("idCard") String idCard);
Integer getCountByRyId(String ryId);
Integer getCountByRyId(String ryId,Long cellId);
IPage<TenPersonEntity> getByPersonIds(Page page,@Param("personIds")List<Long> personIds, @Param("cellId")Long cellId);

View File

@ -19,7 +19,7 @@ import java.util.Map;
@Mapper
public interface TenRelationMapper extends BaseMapper<TenRelation> {
String getCount(@Param("parentId") Long parentId);
Integer getCount(@Param("parentId") Long parentId,@Param("cellId") Long cellId);
IPage<ParentAndStudentVo> getAll(Page page, @Param("params") Map<String,Object> params);

View File

@ -32,7 +32,6 @@ public class TenLabelEntity extends BaseEntity implements Serializable {
/**
* 小区ID
*/
@TableId
@ApiModelProperty("cellId")
@JsonSerialize(using = ToStringSerializer.class)
private Long cellId;

View File

@ -55,4 +55,6 @@ public class TenParent implements Serializable {
private Long cellId;
private String userName;
private String work;
}

View File

@ -47,4 +47,6 @@ public class TenRelation implements Serializable {
private Date approvalTime;
private String approval;
private Long cellId;
}

View File

@ -3,6 +3,7 @@ package net.shapelight.modules.ten.service;
import com.baomidou.mybatisplus.extension.service.IService;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.vo.SchoolNameVo;
import java.util.List;
import java.util.Map;
@ -32,5 +33,7 @@ public interface TenCellService extends IService<TenCellEntity> {
int syncRoomAddress(Long cellId,Integer layerFlag);
List<SchoolNameVo> findByName(String name);
}

View File

@ -2,7 +2,7 @@ package net.shapelight.modules.ten.service;
import com.baomidou.mybatisplus.extension.service.IService;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.modules.appparent.form.LoginForm;
import net.shapelight.modules.app.form.LoginForm;
import net.shapelight.modules.ten.entity.TenParent;
import java.util.Map;

View File

@ -136,7 +136,7 @@ public interface TenPersonService {
int checkByIdCardCell(String idCard, Long cellId);
int getByLabel(Long labelId);
int getByLabel(Long labelId,Long cellId);
PageUtils selectByDeptIdQueryPage(Map<String, Object> params);
PageUtils selectByDeptIdForGuestQueryPage(Map<String, Object> params);
@ -146,7 +146,7 @@ public interface TenPersonService {
PageUtils queryExtractPage(Map<String, Object> params);
List<TenPersonEntity> findByIdCardAndDept(String idCard,
Long deptId);
Long deptId,Long cellId);
PageUtils selectBypersonIds(Map<String, Object> params);
@ -156,7 +156,7 @@ public interface TenPersonService {
List<TenPersonEntity> listPage(int start, int count, String cellId);
Integer findByRyId(String ryId);
Integer findByRyId(String ryId,Long cellId);
}

View File

@ -10,6 +10,7 @@ import net.shapelight.modules.sys.service.SysUserService;
import net.shapelight.modules.ten.entity.TenRoomEntity;
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.vo.SchoolNameVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
@ -87,8 +88,8 @@ public class TenCellServiceImpl extends ServiceImpl<TenCellDao, TenCellEntity> i
// tenCellDao.createTenPackRecord(cellId);
tenCellDao.createTenPersonExtract(cellId);
tenCellDao.createTenPersonSync(cellId);
tenCellDao.createTenParent(cellId);
tenCellDao.createTenRelation(cellId);
// tenCellDao.createTenParent(cellId);
//tenCellDao.createTenRelation(cellId);
//tenCellDao.createTenCellDept(cellId);
return super.save(entity);
@ -187,4 +188,9 @@ public class TenCellServiceImpl extends ServiceImpl<TenCellDao, TenCellEntity> i
public int syncRoomAddress(Long cellId,Integer layerFlag) {
return tenRoomService.syncAddress(cellId,layerFlag);
}
@Override
public List<SchoolNameVo> findByName(String name) {
return tenCellDao.findByName(name);
}
}

View File

@ -116,7 +116,7 @@ public class TenCompanyServiceImpl extends ServiceImpl<TenCompanyDao, TenCompany
return 0;
}
// List<TenCompanyEntity> list = new ArrayList<>();
int count = 0;
long count = 0;
if(params.get("typeId")!=null){
count = this.count(new QueryWrapper<TenCompanyEntity>()
.in("cell_id",cellIds)
@ -125,6 +125,6 @@ public class TenCompanyServiceImpl extends ServiceImpl<TenCompanyDao, TenCompany
count = this.count(new QueryWrapper<TenCompanyEntity>()
.in("cell_id",cellIds));
}
return count;
return (int) count;
}
}

View File

@ -32,9 +32,9 @@ public class TenCompanyTypeServiceImpl extends ServiceImpl<TenCompanyTypeDao, Te
);
for(TenCompanyTypeEntity entity: page.getRecords()){
int count = tenCompanyService.count(new QueryWrapper<TenCompanyEntity>()
long count = tenCompanyService.count(new QueryWrapper<TenCompanyEntity>()
.eq("type_id",entity.getTypeId()));
entity.setCompanyCount(count);
entity.setCompanyCount((int) count);
}
return new PageUtils(page);

View File

@ -23,6 +23,7 @@ public class TenLabelServiceImpl extends ServiceImpl<TenLabelDao, TenLabelEntity
new Query<TenLabelEntity>().getPage(params),
new QueryWrapper<TenLabelEntity>()
.eq("tenant_id",tenantId)
.eq(params.get("type")!=null,"type",params.get("type"))
);
return new PageUtils(page);

View File

@ -8,8 +8,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.shapelight.common.exception.RRException;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.validator.Assert;
import net.shapelight.modules.appparent.form.LoginForm;
import net.shapelight.modules.app.form.LoginForm;
import net.shapelight.modules.ten.dao.TenParentMapper;
import net.shapelight.modules.ten.dao.TenRelationMapper;
import net.shapelight.modules.ten.entity.TenParent;
import net.shapelight.modules.ten.entity.TenRelation;
import net.shapelight.modules.ten.service.TenParentService;
@ -34,6 +35,8 @@ public class TenParentServiceImpl extends ServiceImpl<TenParentMapper, TenParent
TenParentMapper parentMapper;
@Autowired
TenRelationService relationService;
@Autowired
TenRelationMapper relationMapper;
@Override
@ -43,8 +46,7 @@ public class TenParentServiceImpl extends ServiceImpl<TenParentMapper, TenParent
pageParam.setSize(Long.parseLong((String) params.get("limit")));
IPage<ParentVo> page = parentMapper.getParentVoList(pageParam,params);
page.getRecords().forEach(item -> {
int count = relationService.count(new LambdaQueryWrapper<TenRelation>()
.eq(TenRelation::getParentId,item.getUserId()).eq(TenRelation::getStatus,1));
int count = relationMapper.getCount(item.getId(), (Long) params.get("cellId"));
item.setCount(count);
});
return new PageUtils(page);
@ -63,10 +65,8 @@ public class TenParentServiceImpl extends ServiceImpl<TenParentMapper, TenParent
@Override
public TenParent findByMobile(String mobile) {
QueryWrapper<TenParent> queryWrapper = new QueryWrapper<TenParent>();
queryWrapper.eq("mobile", mobile);
//return baseMapper.selectOne(userEntity);
return baseMapper.selectOne(queryWrapper);
return baseMapper.findByMobile(mobile);
}
}

View File

@ -3,8 +3,6 @@ package net.shapelight.modules.ten.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.metadata.Sheet;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.arcsoft.face.FaceInfo;
import com.arcsoft.face.enums.ExtractType;
import com.arcsoft.face.toolkit.ImageFactory;
@ -14,9 +12,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import lombok.extern.slf4j.Slf4j;
import net.coobird.thumbnailator.Thumbnails;
import net.shapelight.common.config.GlobalValue;
import net.shapelight.common.config.MinioConfig;
import net.shapelight.common.interceptor.CustomizeTableNameHandler;
import net.shapelight.common.utils.*;
import net.shapelight.commons.engine.sdk.PicSDK;
import net.shapelight.modules.app.entity.AppUserEntity;
@ -24,14 +22,11 @@ import net.shapelight.modules.app.entity.AppUserScopeEntity;
import net.shapelight.modules.app.service.AppUserScopeService;
import net.shapelight.modules.app.service.AppUserService;
//import net.shapelight.modules.dev.mqtt.CmdProcess;
import net.shapelight.modules.app.service.impl.AppUserScopeServiceImpl;
import net.shapelight.modules.excel.listener.PersonExcelListener;
import net.shapelight.modules.excel.model.PersonModel;
import net.shapelight.modules.face.dto.FaceRecognitionResDTO;
import net.shapelight.modules.face.service.FaceEngineService;
import net.shapelight.modules.job.entity.KeysEntity;
import net.shapelight.modules.nettyapi.service.ServerApiService;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.sys.entity.SysDictEntity;
import net.shapelight.modules.sys.service.impl.SysDictServiceImpl;
import net.shapelight.modules.ten.dao.TenRelationMapper;
@ -40,16 +35,10 @@ import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient;
import net.shapelight.modules.vo.*;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
@ -60,7 +49,6 @@ import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.shapelight.modules.ten.dao.TenPersonDao;
import org.springframework.transaction.annotation.Transactional;
@ -166,6 +154,7 @@ public class TenPersonServiceImpl implements TenPersonService {
}
for (TenPersonEntity personEntity : page.getRecords()) {
CustomizeTableNameHandler.setData(String.valueOf(personEntity.getCellId()));
List<TenPersonExtractEntity> extracts = tenPersonExtractService.list(
new QueryWrapper<TenPersonExtractEntity>()
.eq("person_id", personEntity.getPersonId())
@ -186,6 +175,7 @@ public class TenPersonServiceImpl implements TenPersonService {
personEntity.setDeptAllName(deptAllName);
}
}
CustomizeTableNameHandler.removeData();
}
return new PageUtils(page);
}
@ -505,13 +495,13 @@ public class TenPersonServiceImpl implements TenPersonService {
serverApiService.personOperation(dev.getSn(), list);*/
}
}
if(entity.getPersonType()==Constant.PERSON_TYPE_OWNER) {
/*if(entity.getPersonType()==Constant.PERSON_TYPE_OWNER) {
List<SysDictEntity> dictList = sysDictService.queryByType("optype");
Map<String,Object> optypeMap = new HashMap<>();
dictList.forEach(dict -> {
optypeMap.put(dict.getValue(),dict.getCode());
});
Map<String,Object> personParams = new HashMap<>();
*//*Map<String,Object> personParams = new HashMap<>();
personParams.put("operation","editUserData");
personParams.put("accountNumber",globalValue.accountNumber);
personParams.put("passKey", KeysEntity.passKey);
@ -540,8 +530,8 @@ public class TenPersonServiceImpl implements TenPersonService {
log.error(jsonObject.toJSONString());
new SyncFailedException(entity.getPersonId()+","+entity.getName()+"青桔同步失败");
return jsonObject.getJSONArray("errInfo").toJSONString();
}
}
}*//*
}*/
}
//删除临时文件oss
@ -901,7 +891,7 @@ public class TenPersonServiceImpl implements TenPersonService {
//记录所有人员id
Map<String,Object> personParams = new HashMap<>();
/*Map<String,Object> personParams = new HashMap<>();
personParams.put("operation","delUserData");
personParams.put("accountNumber",globalValue.accountNumber);
personParams.put("passKey", KeysEntity.passKey);
@ -918,8 +908,11 @@ public class TenPersonServiceImpl implements TenPersonService {
tenRelationMapper.delete(new LambdaQueryWrapper<TenRelation>().eq(TenRelation::getStudentId,personId));
personIds.add(personId);
}
}*/
tenPersonDao.logicDeleteById(personId, cellId);
tenRelationMapper.delete(new LambdaQueryWrapper<TenRelation>().eq(TenRelation::getStudentId,personId));
}
}
//配置同步信息并推送
@ -1474,7 +1467,7 @@ public class TenPersonServiceImpl implements TenPersonService {
dictList.forEach(dict -> {
optypeMap.put(dict.getValue(),dict.getCode());
});
Map<String,Object> personParams = new HashMap<>();
/*Map<String,Object> personParams = new HashMap<>();
personParams.put("operation","editUserData");
personParams.put("accountNumber",globalValue.accountNumber);
personParams.put("passKey", KeysEntity.passKey);
@ -1499,7 +1492,7 @@ public class TenPersonServiceImpl implements TenPersonService {
}
if(jsonObject.getJSONArray("errInfo")!=null && !jsonObject.getJSONArray("errInfo").isEmpty()) {
throw new SyncFailedException(entity.getPersonId()+","+entity.getName()+"青桔同步失败");
}
}*/
}
return "OK";
}
@ -2439,8 +2432,8 @@ public class TenPersonServiceImpl implements TenPersonService {
}
@Override
public int getByLabel(Long labelId) {
return tenPersonDao.getByLabel(labelId);
public int getByLabel(Long labelId,Long cellId) {
return tenPersonDao.getByLabel(labelId,cellId);
}
@Override
@ -2510,6 +2503,7 @@ public class TenPersonServiceImpl implements TenPersonService {
pageParam.setSize(Long.parseLong((String) params.get("limit")));
IPage<TenPersonEntity> page = tenPersonDao.findPageAll(pageParam, cellIds, params);
for (TenPersonEntity personEntity : page.getRecords()) {
CustomizeTableNameHandler.setData(String.valueOf(personEntity.getCellId()));
List<TenPersonExtractEntity> extracts = tenPersonExtractService.list(
new QueryWrapper<TenPersonExtractEntity>()
.eq("person_id", personEntity.getPersonId())
@ -2530,13 +2524,14 @@ public class TenPersonServiceImpl implements TenPersonService {
personEntity.setDeptAllName(deptAllName);
}
}
CustomizeTableNameHandler.removeData();
}
return new PageUtils(page);
}
@Override
public List<TenPersonEntity> findByIdCardAndDept(String idCard, Long deptId) {
return tenPersonDao.findByIdCardAndDept(idCard,deptId);
public List<TenPersonEntity> findByIdCardAndDept(String idCard, Long deptId,Long cellId) {
return tenPersonDao.findByIdCardAndDept(idCard,deptId,cellId);
}
@ -2574,7 +2569,7 @@ public class TenPersonServiceImpl implements TenPersonService {
}
@Override
public Integer findByRyId(String ryId) {
return tenPersonDao.getCountByRyId(ryId);
public Integer findByRyId(String ryId,Long cellId) {
return tenPersonDao.getCountByRyId(ryId,cellId);
}
}

View File

@ -17,7 +17,7 @@ import java.util.Map;
@Component
@Slf4j
public class DataSync {
@Autowired
/*@Autowired
OpFeignClient opFeignClient;
@Value("${global.qingju.accountNumber}")
public String accountNumber;
@ -34,5 +34,5 @@ public class DataSync {
KeysEntity.passKey = json.getString("passKey");
KeysEntity.empowerText = json.getString("empowerText");
}
}
}*/
}

View File

@ -0,0 +1,10 @@
package net.shapelight.modules.vo;
public class SchoolNameVo {
//学校ID
private Long cellId;
//学校名称
private String name;
}

View File

@ -138,9 +138,9 @@ config:
arcface-sdk:
version: 4.1
app-id: SUQLGn78W5o7StEEbm6WTTfaMgAxSsN8HwJziApVyNN
sdk-key: 7dJ9RqEhc3mPCatuUceKjgYwRR6QtyMsxLUiL7JYAkrt
#active-key: 82K1-11TT-K136-FFVW
active-key: 82K1-11TT-K11Y-BHQE
sdk-key: 7dJ9RqEhc3mPCatuUceKjgYwZXfX83n3QHz4xb6biPiG
active-key: 86L1-11TK-313B-Y8KG
#active-key: 82K1-11TT-K11Y-BHQE
active-file:
detect-pool-size: 16
compare-pool-size: 16

View File

@ -156,5 +156,9 @@
where c.cell_id = #{cellId}
</select>
<select id="findByName" resultType="net.shapelight.modules.vo.SchoolNameVo">
select a.cell_id, a.name from ten_cell a where a.name like CONCAT('%', '${name}', '%')
</select>
</mapper>

View File

@ -3,15 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.shapelight.modules.ten.dao.TenParentMapper">
<resultMap id="BaseResultMap" type="net.shapelight.modules.ten.entity.TenParent">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="gender" column="grade" jdbcType="TINYINT"/>
<result property="idCard" column="id_card" jdbcType="VARCHAR"/>
<result property="registerType" column="register_type" jdbcType="TINYINT"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
</resultMap>
<resultMap id="BaseVoMap" type="net.shapelight.modules.vo.ParentVo">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
@ -21,12 +12,30 @@
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
</resultMap>
<resultMap id="BaseResultMap" type="net.shapelight.modules.ten.entity.TenParent">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="gender" column="gender" jdbcType="TINYINT"/>
<result property="idCard" column="id_card" jdbcType="VARCHAR"/>
<result property="registerType" column="register_type" jdbcType="TINYINT"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="work" column="work" jdbcType="VARCHAR"/>
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="loginTime" column="login_time" jdbcType="TIMESTAMP"/>
<result property="loginIp" column="login_ip" jdbcType="VARCHAR"/>
<result property="cellId" column="cell_id" jdbcType="BIGINT"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,name,
gender,id_card,register_type
id,name,gender,
id_card,register_type,user_id,
work,mobile,password,
create_time,login_time,login_ip,
cell_id,user_name
</sql>
<select id="getParentVoList" resultType="net.shapelight.modules.vo.ParentVo">
select t.*,a.* from ten_parent t left join app_user a on t.user_id = a.user_id
where 1=1
@ -37,4 +46,11 @@
and t.mobile = #{params.mobile}
</if>
</select>
<select id="findByMobile" resultType="net.shapelight.modules.ten.entity.TenParent">
select t.* from ten_parent t where t.mobile = #{mobile}
</select>
<insert id="save">
</insert>
</mapper>

View File

@ -613,7 +613,7 @@
</delete>
<select id="selectById" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r
select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room_${cellId} r
on p.room_id = r.room_id where person_id = #{personId}
</select>
@ -622,7 +622,7 @@
</select>
<select id="selectByRoomId" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r
select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room_${cellId} r
on p.room_id = r.room_id where p.room_id = #{roomId} and p.delete_flag = 0
<if test="key != null and key!=''">
and (p.name like CONCAT('%', '${key}', '%')
@ -633,7 +633,7 @@
</select>
<select id="selectByRoomIdForGuest" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r
select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room_${cellId} r
on p.room_id = r.room_id where p.room_id = #{roomId} and p.delete_flag = 0
and p.person_type = 5005
<if test="key != null and key!=''">
@ -659,7 +659,7 @@
<select id="selectByCellId" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r
select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room_${cellId} r
on p.room_id = r.room_id where p.delete_flag = 0
and p.cell_id = #{cellId}
<if test="key != null and key!=''">
@ -678,6 +678,9 @@
<if test="params.buildId != null and params.buildId!=''">
and r.build_id = #{params.buildId}
</if>
<if test="params.labelId != null and params.labelId!=''">
and p.label_id = #{params.labelId}
</if>
<if test="params.layer != null and params.layer!=''">
and r.layer = #{params.layer}
</if>

View File

@ -664,9 +664,12 @@
left join ten_person t on r.person_id = t.person_id
</if>
where 1 = 1 and r.person_id in
<foreach item="params.personId" collection="params.personIds" open="(" separator="," close=")">
<!--<foreach item="params.personId" collection="params.personIds" open="(" separator="," close=")">
#{params.personId}
</foreach>
</foreach>-->
<if test="params.personId != null and params.personId != ''">
and t.`personId` = #{params.personId})
</if>
<if test="params.name != null and params.name != ''">
and t.`name` like CONCAT('%', '${params.name}', '%')
</if>

View File

@ -29,10 +29,10 @@
id
,parent_id,student_id,relation,status,create_time,detail
</sql>
<select id="getCount" resultType="java.lang.String">
<select id="getCount" resultType="Integer">
select count(1)
from ten_relation
where parent_id = #{parentId}
where parent_id = #{parentId} and status = 1
</select>
<select id="getAll" resultType="net.shapelight.modules.vo.ParentAndStudentVo">
@ -54,8 +54,7 @@
t.approval
FROM
ten_relation t
LEFT JOIN app_user a ON t.parent_id = a.user_id
LEFT JOIN ten_parent f ON t.parent_id = f.user_id
LEFT JOIN ten_parent f ON t.parent_id = f.id
LEFT JOIN ten_person p ON t.student_id = p.person_id
left join ten_room r on p.room_id = r.room_id
where 1=1