diff --git a/pom.xml b/pom.xml index 90bf48d..8d6a3fe 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ 4.12 2.9.0 1.2.13 - 3.1.2 + 3.4.3.2 8.0.25 4.0 11.2.0.3 diff --git a/shapelight-admin/src/main/java/net/shapelight/common/config/MybatisPlusConfig.java b/shapelight-admin/src/main/java/net/shapelight/common/config/MybatisPlusConfig.java index b8f1fb9..cb027f0 100644 --- a/shapelight-admin/src/main/java/net/shapelight/common/config/MybatisPlusConfig.java +++ b/shapelight-admin/src/main/java/net/shapelight/common/config/MybatisPlusConfig.java @@ -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; -// } +// }*/ } diff --git a/shapelight-admin/src/main/java/net/shapelight/common/config/ShiroConfig.java b/shapelight-admin/src/main/java/net/shapelight/common/config/ShiroConfig.java index 35357b2..e025de2 100644 --- a/shapelight-admin/src/main/java/net/shapelight/common/config/ShiroConfig.java +++ b/shapelight-admin/src/main/java/net/shapelight/common/config/ShiroConfig.java @@ -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 diff --git a/shapelight-admin/src/main/java/net/shapelight/common/interceptor/CustomizeTableNameHandler.java b/shapelight-admin/src/main/java/net/shapelight/common/interceptor/CustomizeTableNameHandler.java new file mode 100644 index 0000000..0a3215a --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/common/interceptor/CustomizeTableNameHandler.java @@ -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 tableNames; + + //构造函数,构造动态表名处理器的时候,传递tableNames参数 + public CustomizeTableNameHandler(String ...tableNames) { + this.tableNames = Arrays.asList(tableNames); + } + + //每个请求线程维护一个分表字段数据,避免多线程数据冲突。所以使用ThreadLocal + private static final ThreadLocal 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; //表名原样返回 + } + } +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/app/config/WebMvcConfig.java b/shapelight-admin/src/main/java/net/shapelight/modules/app/config/WebMvcConfig.java index 1bb269b..ddc3c25 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/app/config/WebMvcConfig.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/app/config/WebMvcConfig.java @@ -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 argumentResolvers) { argumentResolvers.add(loginUserHandlerMethodArgumentResolver); + argumentResolvers.add(parentLoginUserHandlerMethodArgumentResolver); } } \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java index 4c38624..0c22742 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java @@ -550,7 +550,7 @@ public class AppApiController { // if(tenPersonIdcard!=null){ // return R.error("身份证在此房间已存在"); // } - List list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId()); + List list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId(),tenPerson.getCellId()); if(list.size()>0){ return R.error("身份证在此组织已存在"); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/config/WebMvcConfig.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/config/WebMvcConfig.java deleted file mode 100644 index 39c54cc..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/config/WebMvcConfig.java +++ /dev/null @@ -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 argumentResolvers) { - argumentResolvers.add(loginUserHandlerMethodArgumentResolver); - } -} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppComm.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppComm.java deleted file mode 100644 index f1fd2f7..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppComm.java +++ /dev/null @@ -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 = "初始导入"; - -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppInfoApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppInfoParentApiController.java similarity index 85% rename from shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppInfoApiController.java rename to shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppInfoParentApiController.java index 24be93e..c012d92 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppInfoApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppInfoParentApiController.java @@ -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 relationList = relationService.list(new LambdaQueryWrapper() - .eq(TenRelation::getParentId,user.getUserId()).eq(TenRelation::getStatus,1)); - if(!relationList.isEmpty()) { - List list = relationList.stream().map(TenRelation::getStudentId).collect(Collectors.toList()); - params.put("cellId",user.getCellId()); - params.put("personIds",list); - PageUtils page = tenRecordService.getByPersonIds(params); - return R.ok().put("data", page); - } - } + params.put("recordTimeEnd", recordTimeEnd); + TenRelation relation = relationService.getOne(new LambdaQueryWrapper() + .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)); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppLoginController.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppLoginParentController.java similarity index 88% rename from shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppLoginController.java rename to shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppLoginParentController.java index 11085d7..3301eb6 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppLoginController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppLoginParentController.java @@ -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); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppParentApiController.java similarity index 94% rename from shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppApiController.java rename to shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppParentApiController.java index c0e311d..93e94ec 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppParentApiController.java @@ -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 = 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 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 list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId()); + List 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 list = relationList.stream().map(TenRelation::getStudentId).collect(Collectors.toList()); - params.put("cellId",user.getCellId()); + List 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 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(); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppRegisterController.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppRegisterParentController.java similarity index 98% rename from shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppRegisterController.java rename to shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppRegisterParentController.java index 459dbb8..6a7f11a 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppRegisterController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/controller/AppRegisterParentController.java @@ -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 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 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"); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/form/LoginForm.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/form/LoginForm.java deleted file mode 100644 index 100e115..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/form/LoginForm.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright 2018 http://www.gfirefly.com - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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; - -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/form/RegisterForm.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/form/RegisterForm.java deleted file mode 100644 index cc5a14d..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/form/RegisterForm.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2018 http://www.gfirefly.com - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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; - -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/form/RegisterSmsForm.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/form/RegisterSmsForm.java deleted file mode 100644 index 245668a..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/form/RegisterSmsForm.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2018 http://www.gfirefly.com - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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; - - -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/interceptor/AuthorizationInterceptor.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/interceptor/ParentAuthorizationInterceptor.java similarity index 65% rename from shapelight-admin/src/main/java/net/shapelight/modules/appparent/interceptor/AuthorizationInterceptor.java rename to shapelight-admin/src/main/java/net/shapelight/modules/appparent/interceptor/ParentAuthorizationInterceptor.java index 6b5a619..74f6583 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/interceptor/AuthorizationInterceptor.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/interceptor/ParentAuthorizationInterceptor.java @@ -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,获取用户信息 diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/resolver/LoginUserHandlerMethodArgumentResolver.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/resolver/ParentLoginUserHandlerMethodArgumentResolver.java similarity index 83% rename from shapelight-admin/src/main/java/net/shapelight/modules/appparent/resolver/LoginUserHandlerMethodArgumentResolver.java rename to shapelight-admin/src/main/java/net/shapelight/modules/appparent/resolver/ParentLoginUserHandlerMethodArgumentResolver.java index 37dd2b9..3cb4b7a 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/resolver/LoginUserHandlerMethodArgumentResolver.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/resolver/ParentLoginUserHandlerMethodArgumentResolver.java @@ -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; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/AliyunSmsUtils.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/AliyunSmsUtils.java deleted file mode 100644 index 298ea8b..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/AliyunSmsUtils.java +++ /dev/null @@ -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()); -// -// }*/ -// -// -// -// } - - -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/MonyunSmsUtils.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/MonyunSmsUtils.java deleted file mode 100644 index 6422423..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/MonyunSmsUtils.java +++ /dev/null @@ -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); - } -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/JwtUtils.java b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/ParentJwtUtils.java similarity index 98% rename from shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/JwtUtils.java rename to shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/ParentJwtUtils.java index a6c6a73..038a503 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/JwtUtils.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/appparent/utils/ParentJwtUtils.java @@ -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; diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java index c8e51ee..5f57509 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java @@ -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); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/systen/controller/SysTenUserController.java b/shapelight-admin/src/main/java/net/shapelight/modules/systen/controller/SysTenUserController.java index 45f66ad..272f880 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/systen/controller/SysTenUserController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/systen/controller/SysTenUserController.java @@ -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(); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCellDeptController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCellDeptController.java index 95060f0..15e93d0 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCellDeptController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCellDeptController.java @@ -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() + long count = tenCellDeptService.count(new QueryWrapper() .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() + long count = tenCellDeptService.count(new QueryWrapper() .eq("cell_id",tenCellDept.getCellId()) .eq("parent_id",tenCellDept.getParentId()) .eq("name",tenCellDept.getName())); @@ -251,7 +251,7 @@ public class TenCellDeptController extends AbstractController { List page = tenCellDeptService.list(new QueryWrapper() .eq("parent_id",cellId)); for(TenCellDeptEntity cellDeptEntity: page){ - int count = tenCellDeptService.count(new QueryWrapper() + long count = tenCellDeptService.count(new QueryWrapper() .eq("parent_id",cellDeptEntity.getDeptId())); if(count > 0){ cellDeptEntity.setHasChildren(true); @@ -274,7 +274,7 @@ public class TenCellDeptController extends AbstractController { List page = tenCellDeptService.list(new QueryWrapper() .eq("parent_id",parentId)); for(TenCellDeptEntity cellDeptEntity: page){ - int count = tenCellDeptService.count(new QueryWrapper() + long count = tenCellDeptService.count(new QueryWrapper() .eq("parent_id",cellDeptEntity.getDeptId())); if(count > 0){ cellDeptEntity.setHasChildren(true); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCompanyTypeController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCompanyTypeController.java index 704f872..cb548af 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCompanyTypeController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCompanyTypeController.java @@ -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() + long c = tenCompanyService.count(new QueryWrapper() .eq("tenant_id",getUser().getTenantId()) .eq("type_id",typeId)); if(c>0){ diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenLabelController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenLabelController.java index 6285d77..01a6b0a 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenLabelController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenLabelController.java @@ -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 tenLabel = tenLabelService.list(new QueryWrapper() - .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().eq(TenUserScopeEntity::getUserId,getUserId())); + int pCount = tenPersonService.getByLabel(id,scopeEntity.getCellId()); if(pCount>0){ return R.error("此标签已使用"); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenParentController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenParentController.java index 6f36669..32c6bc6 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenParentController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenParentController.java @@ -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 params) { + params.put("cellId",getUser().getCellId()); PageUtils page = tenParentService.getParentList(params); return R.ok().put("data",page); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java index aa0da51..99ce537 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java @@ -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 list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId()); + List 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 list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),oldPerson.getDeptId()); + List 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 list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),oldPerson.getDeptId()); + List 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 list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId()); + List list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId(),tenPerson.getCellId()); if(list.size()>0){ return R.error("身份证在此组织已存在"); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonExtractController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonExtractController.java index 48ff6a4..6b172b9 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonExtractController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonExtractController.java @@ -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 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){ - tenPersonExtractService.updateById(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(); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRelationController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRelationController.java index cd3d638..1f285f3 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRelationController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRelationController.java @@ -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 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(); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRoomController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRoomController.java index 71e5cc1..3936153 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRoomController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRoomController.java @@ -141,7 +141,7 @@ public class TenRoomController extends AbstractController { tenRoom.setTenantId(getUser().getTenantId()); tenRoom.setCreateBy(getUser().getUsername()); tenRoom.setCreateTime(new Date()); - Map params = new HashMap<>(); + /*Map 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 params = new HashMap<>(); + /*Map 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 dataInfo = new HashMap<>(); + //TenRoomEntity tenRoom = tenRoomService.getById(roomId,cellId); + /*Map 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 roomParams = new HashMap<>(); + /*Map 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(); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenCellDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenCellDao.java index 3dd4ed6..762c0f2 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenCellDao.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenCellDao.java @@ -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 { List queryAll(Map params); String getCellName(@Param("cellId")String cellId); String getAreaNameByCellId(@Param("cellId")String cellId); + List findByName(String name); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenParentMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenParentMapper.java index a1e78b9..9abc017 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenParentMapper.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenParentMapper.java @@ -18,6 +18,8 @@ import java.util.Map; @Mapper public interface TenParentMapper extends BaseMapper { IPage getParentVoList(Page page,Map params); + + TenParent findByMobile(String mobile); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java index 2612637..ab2c560 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java @@ -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 selectByDeptId(Page page,@Param("deptId")Long deptId, @Param("cellId")Long cellId, @Param("key")String key); IPage selectByDeptIdForGuest(Page page,@Param("deptId")Long deptId, @Param("cellId")Long cellId, @Param("key")String key); @@ -116,13 +116,13 @@ public interface TenPersonDao { IPage findExtractPageAll(Page page, @Param("cellIds") List cellIds,@Param("params") Map params); - List findByIdCardAndDept(@Param("idCard")String idCard, @Param("deptId")Long deptId); + List findByIdCardAndDept(@Param("idCard")String idCard, @Param("deptId")Long deptId,Long cellId); IPage 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 getByPersonIds(Page page,@Param("personIds")List personIds, @Param("cellId")Long cellId); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRelationMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRelationMapper.java index f0420a1..912aeb2 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRelationMapper.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRelationMapper.java @@ -19,7 +19,7 @@ import java.util.Map; @Mapper public interface TenRelationMapper extends BaseMapper { - String getCount(@Param("parentId") Long parentId); + Integer getCount(@Param("parentId") Long parentId,@Param("cellId") Long cellId); IPage getAll(Page page, @Param("params") Map params); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenLabelEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenLabelEntity.java index 4df566f..aa3e6e9 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenLabelEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenLabelEntity.java @@ -32,7 +32,6 @@ public class TenLabelEntity extends BaseEntity implements Serializable { /** * 小区ID */ - @TableId @ApiModelProperty("cellId") @JsonSerialize(using = ToStringSerializer.class) private Long cellId; diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenParent.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenParent.java index 9f99dfa..d75dacf 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenParent.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenParent.java @@ -55,4 +55,6 @@ public class TenParent implements Serializable { private Long cellId; private String userName; + + private String work; } \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRelation.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRelation.java index 2645787..fec8301 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRelation.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRelation.java @@ -47,4 +47,6 @@ public class TenRelation implements Serializable { private Date approvalTime; private String approval; + + private Long cellId; } \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenCellService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenCellService.java index 030d232..f872c43 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenCellService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenCellService.java @@ -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 { int syncRoomAddress(Long cellId,Integer layerFlag); + List findByName(String name); + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenParentService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenParentService.java index 780e26e..35426ed 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenParentService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenParentService.java @@ -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; diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java index cdda19b..6dcbc07 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java @@ -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 params); PageUtils selectByDeptIdForGuestQueryPage(Map params); @@ -146,7 +146,7 @@ public interface TenPersonService { PageUtils queryExtractPage(Map params); List findByIdCardAndDept(String idCard, - Long deptId); + Long deptId,Long cellId); PageUtils selectBypersonIds(Map params); @@ -156,7 +156,7 @@ public interface TenPersonService { List listPage(int start, int count, String cellId); - Integer findByRyId(String ryId); + Integer findByRyId(String ryId,Long cellId); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCellServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCellServiceImpl.java index d6010f6..a274bf3 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCellServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCellServiceImpl.java @@ -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 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 i public int syncRoomAddress(Long cellId,Integer layerFlag) { return tenRoomService.syncAddress(cellId,layerFlag); } + + @Override + public List findByName(String name) { + return tenCellDao.findByName(name); + } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCompanyServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCompanyServiceImpl.java index 8d5f344..57f0de7 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCompanyServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCompanyServiceImpl.java @@ -116,7 +116,7 @@ public class TenCompanyServiceImpl extends ServiceImpl list = new ArrayList<>(); - int count = 0; + long count = 0; if(params.get("typeId")!=null){ count = this.count(new QueryWrapper() .in("cell_id",cellIds) @@ -125,6 +125,6 @@ public class TenCompanyServiceImpl extends ServiceImpl() .in("cell_id",cellIds)); } - return count; + return (int) count; } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCompanyTypeServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCompanyTypeServiceImpl.java index 6531165..18ae8ff 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCompanyTypeServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCompanyTypeServiceImpl.java @@ -32,9 +32,9 @@ public class TenCompanyTypeServiceImpl extends ServiceImpl() + long count = tenCompanyService.count(new QueryWrapper() .eq("type_id",entity.getTypeId())); - entity.setCompanyCount(count); + entity.setCompanyCount((int) count); } return new PageUtils(page); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenLabelServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenLabelServiceImpl.java index 9964e80..8cb42a1 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenLabelServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenLabelServiceImpl.java @@ -23,6 +23,7 @@ public class TenLabelServiceImpl extends ServiceImpl().getPage(params), new QueryWrapper() .eq("tenant_id",tenantId) + .eq(params.get("type")!=null,"type",params.get("type")) ); return new PageUtils(page); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenParentServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenParentServiceImpl.java index 00a3266..b5bdf46 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenParentServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenParentServiceImpl.java @@ -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 page = parentMapper.getParentVoList(pageParam,params); page.getRecords().forEach(item -> { - int count = relationService.count(new LambdaQueryWrapper() - .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 queryWrapper = new QueryWrapper(); - queryWrapper.eq("mobile", mobile); //return baseMapper.selectOne(userEntity); - return baseMapper.selectOne(queryWrapper); + return baseMapper.findByMobile(mobile); } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java index 48534c4..d173bd6 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java @@ -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 extracts = tenPersonExtractService.list( new QueryWrapper() .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 dictList = sysDictService.queryByType("optype"); Map optypeMap = new HashMap<>(); dictList.forEach(dict -> { optypeMap.put(dict.getValue(),dict.getCode()); }); - Map personParams = new HashMap<>(); + *//*Map 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 personParams = new HashMap<>(); + /*Map personParams = new HashMap<>(); personParams.put("operation","delUserData"); personParams.put("accountNumber",globalValue.accountNumber); personParams.put("passKey", KeysEntity.passKey); @@ -918,9 +908,12 @@ public class TenPersonServiceImpl implements TenPersonService { tenRelationMapper.delete(new LambdaQueryWrapper().eq(TenRelation::getStudentId,personId)); personIds.add(personId); } - } + }*/ + tenPersonDao.logicDeleteById(personId, cellId); + tenRelationMapper.delete(new LambdaQueryWrapper().eq(TenRelation::getStudentId,personId)); } + //配置同步信息并推送 List> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds, cellId); @@ -1474,7 +1467,7 @@ public class TenPersonServiceImpl implements TenPersonService { dictList.forEach(dict -> { optypeMap.put(dict.getValue(),dict.getCode()); }); - Map personParams = new HashMap<>(); + /*Map 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 page = tenPersonDao.findPageAll(pageParam, cellIds, params); for (TenPersonEntity personEntity : page.getRecords()) { + CustomizeTableNameHandler.setData(String.valueOf(personEntity.getCellId())); List extracts = tenPersonExtractService.list( new QueryWrapper() .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 findByIdCardAndDept(String idCard, Long deptId) { - return tenPersonDao.findByIdCardAndDept(idCard,deptId); + public List 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); } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/tripartitePlatform/operatorPlatform/DataSync.java b/shapelight-admin/src/main/java/net/shapelight/modules/tripartitePlatform/operatorPlatform/DataSync.java index 47821f0..b309ee2 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/tripartitePlatform/operatorPlatform/DataSync.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/tripartitePlatform/operatorPlatform/DataSync.java @@ -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"); } - } + }*/ } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/vo/SchoolNameVo.java b/shapelight-admin/src/main/java/net/shapelight/modules/vo/SchoolNameVo.java new file mode 100644 index 0000000..47310e2 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/vo/SchoolNameVo.java @@ -0,0 +1,10 @@ +package net.shapelight.modules.vo; + +public class SchoolNameVo { + + //学校ID + private Long cellId; + + //学校名称 + private String name; +} diff --git a/shapelight-admin/src/main/resources/application.yml b/shapelight-admin/src/main/resources/application.yml index fad7dc1..ceeda29 100644 --- a/shapelight-admin/src/main/resources/application.yml +++ b/shapelight-admin/src/main/resources/application.yml @@ -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 diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml index 43099db..6e9c773 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml @@ -156,5 +156,9 @@ where c.cell_id = #{cellId} + + diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenParentMapper.xml b/shapelight-admin/src/main/resources/mapper/ten/TenParentMapper.xml index eeca748..232fd65 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenParentMapper.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenParentMapper.xml @@ -3,15 +3,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - @@ -21,12 +12,30 @@ + + + + + + + + + + + + + + + + - 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 - + + + + + diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml index 1c2feda..dd816af 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml @@ -613,7 +613,7 @@ @@ -622,7 +622,7 @@ - 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} @@ -678,6 +678,9 @@ and r.build_id = #{params.buildId} + + and p.label_id = #{params.labelId} + and r.layer = #{params.layer} diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml index 91e480c..668d7b5 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml @@ -664,9 +664,12 @@ left join ten_person t on r.person_id = t.person_id where 1 = 1 and r.person_id in - + + + and t.`personId` = #{params.personId}) + and t.`name` like CONCAT('%', '${params.name}', '%') diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenRelationMapper.xml b/shapelight-admin/src/main/resources/mapper/ten/TenRelationMapper.xml index 330940b..d05acde 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenRelationMapper.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenRelationMapper.xml @@ -29,10 +29,10 @@ id ,parent_id,student_id,relation,status,create_time,detail - select count(1) from ten_relation - where parent_id = #{parentId} + where parent_id = #{parentId} and status = 1