智慧校园

This commit is contained in:
张博 2024-10-29 18:12:13 +08:00
parent 7a60125f71
commit 23f214d1d0
56 changed files with 1669 additions and 294 deletions

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
# 使用官方Java运行环境作为基础镜像
FROM openjdk:1.8-jre-slim
# 指定维护者信息
LABEL maintainer="zhangbo"
# 在镜像中创建一个目录存放我们的Spring Boot应用
VOLUME /tmp
# 将jar包添加到容器中并更名为app.jar
ADD shapelight-admin/target/shapelight-admin.jar app.jar
# 暴露容器内的端口给外部访问
EXPOSE 8018
# 定义环境变量
ENV JAVA_OPTS=""
# 在容器启动时运行jar包
ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./cell -jar /app.jar

View File

@ -23700,7 +23700,7 @@ COMMIT;
-- Table structure for ten_person_sync_823856146077974529
-- ----------------------------
DROP TABLE IF EXISTS `ten_person_sync_823856146077974529`;
CREATE TABLE `ten_person_sync_823856146077974529` (
CREATE TABLE `ten_person_sync_1298283126102949890` (
`person_sync_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`device_id` bigint(20) DEFAULT NULL COMMENT '设备id',
`device_sn` varchar(200) DEFAULT NULL COMMENT '设备sn',
@ -23737,7 +23737,7 @@ COMMIT;
-- ----------------------------
-- Table structure for ten_person_sync_823877891644194818
-- ----------------------------
DROP TABLE IF EXISTS `ten_person_sync_823877891644194818`;
DROP TABLE IF EXISTS `ten_person_sync_1298283126102949890`;
CREATE TABLE `ten_person_sync_823877891644194818` (
`person_sync_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`device_id` bigint(20) DEFAULT NULL COMMENT '设备id',

14
pom.xml
View File

@ -45,8 +45,22 @@
<gson.version>2.8.5</gson.version>
<!--<sharding.jdbc.version>3.0.0</sharding.jdbc.version>-->
<sharding.jdbc.version>2.0.3</sharding.jdbc.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- SpringCloud 版本依赖 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>

View File

@ -32,6 +32,11 @@
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>redis.clients</groupId>-->
<!-- <artifactId>jedis</artifactId>-->

View File

@ -11,6 +11,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableCaching
@EnableTransactionManagement
@ServletComponentScan
@EnableFeignClients
//@MapperScan("net.shapelight.modules.sys.dao")
public class AdminApplication {
@ -27,8 +29,8 @@ public class AdminApplication {
SpringApplication.run(AdminApplication.class, args);
//初始化掌静脉sdk
int initCode = PalmSDK.init();
log.debug("掌静脉sdk初始化。。。。。。。。。。:"+initCode);
//int initCode = PalmSDK.init();
//log.debug("掌静脉sdk初始化。。。。。。。。。。:"+initCode);
// //mqtt服务启动
// MqttClientUtil.createClient();
//

View File

@ -98,5 +98,8 @@ public class GlobalValue {
@Value("${global.app.secret}")
private String appSecret;
@Value("${global.qingju.accountNumber}")
public String accountNumber;
}

View File

@ -30,13 +30,15 @@ public class Constant {
public static final int ROLE_TEN_CELL = 3000; //小区主管 添加楼栋
//public static final int ROLE_TEN_BUILD = 4000; //楼栋管理 只能管理某些楼栋
public static final int PERSON_TYPE_OWNER = 5000; //业主
public static final int PERSON_TYPE_MEMBER = 5001; //家属住户
public static final int PERSON_TYPE_TENANT = 5002; //租户
public static final int PERSON_TYPE_OWNER = 5000; //学生
public static final int PERSON_TYPE_MEMBER = 5001; //
public static final int PERSON_TYPE_TENANT = 5002; //
public static final int PERSON_TYPE_GUEST = 5005; //访客
public static final int PERSON_TYPE_PROPERTY = 5006; //物业人员
public static final int PERSON_TYPE_PROPERTY = 5006; //教职工
public static final int PERSON_TYPE_PARENT = 5007; //家长
public static final int PERSON_TYPE_WHITE = 5007; //白名单
public static final int PERSON_TYPE_BLACK = 5008; //黑名单
public static final int PERSON_TYPE_STUDENT = 5008; //黑名单
public static final int USER_STATUS_NOMOR = 1; //用户状态正常
public static final int USER_STATUS_DESABLE = 0; //用户状态禁用

View File

@ -3,6 +3,8 @@ package net.shapelight.modules.app.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;
import io.minio.PutObjectOptions;
@ -18,6 +20,7 @@ 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.job.entity.KeysEntity;
import net.shapelight.modules.nettyapi.service.ServerApiService;
import net.shapelight.modules.sys.entity.*;
import net.shapelight.modules.sys.service.*;
@ -25,16 +28,21 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient;
import net.shapelight.modules.vo.TenCelldeptSelectVo;
import net.shapelight.modules.vo.TenCelldeptWeVo;
import net.shapelight.modules.vo.TenDeviceVo;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
/**
* APP测试接口
@ -84,6 +92,13 @@ public class AppApiController {
private TenLabelService tenLabelService;
@Autowired
private RedisUtils redisUtils;
@Autowired
private TenParentService tenParentService;
@Autowired
private TenRelationService relationService;
@Qualifier("net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient")
@Autowired
private OpFeignClient opFeignClient;
@Login
@ -106,9 +121,11 @@ public class AppApiController {
public R checkCellAdmin(@RequestBody Map params) {
String adminMobile = (String) params.get("adminMobile");
String cellId = appUserService.checkCellAdmin(adminMobile);
String tenantId = String.valueOf(tenCellService.getById(cellId).getTenantId());
if (cellId != null && !cellId.isEmpty()) {
Map<String, Object> cellMap = new HashMap<>();
cellMap.put("cellId", cellId);
cellMap.put("tenantId",tenantId);
return R.ok().put("data", cellMap);
} else {
return R.error("验证失败,请检查输入是否正确或者联系小区管理员");
@ -118,6 +135,7 @@ public class AppApiController {
@PostMapping("/registerUser")
@ApiOperation("注册用户")
@Transactional
public R registerUser(@RequestBody TenPersonEntity tenPerson) {
//验证app人员是否注册
// if (tenPerson.getAppFlag() == Constant.APP_LOGIN_YES) {
@ -131,8 +149,34 @@ public class AppApiController {
if (appUser != null) {
return R.error("手机号已经注册");
}
AppUserEntity appUser1 = new AppUserEntity();
appUser1.setUsername(tenPerson.getUsername());
appUser1.setMobile(tenPerson.getMobile());
//sha256加密
// String salt = RandomStringUtils.randomAlphanumeric(20);
// appUser.setPassword(new Sha256Hash(entity.getPassword(), salt).toHex());
// appUser.setSalt(salt);
appUser1.setPassword(DigestUtils.sha256Hex(tenPerson.getPassword()));
appUser1.setCreateTime(new Date());
appUser1.setTenantId(tenPerson.getTenantId());
appUserService.save(appUser1);
AppUserScopeEntity appScope = new AppUserScopeEntity();
appScope.setPersonId(tenPerson.getPersonId());
appScope.setCellId(tenPerson.getCellId());
appScope.setUserId(appUser1.getUserId());
appScope.setRoleId(Constant.PERSON_TYPE_PARENT);
appUserScopeService.save(appScope);
TenCellEntity cell = tenCellService.getById(tenPerson.getCellId());
appUser1.setCurrentScopeId(appScope.getUserScopeId());
appUserService.updateById(appUser1);
TenParent tenParent = new TenParent();
tenParent.setName(tenPerson.getName());
tenParent.setGender(tenPerson.getGender());
tenParent.setIdCard(tenPerson.getIdCard());
tenParent.setRegisterType(Constant.RESGISTER_TYPE_APP);
tenParent.setUserId(appUser1.getUserId());
tenParentService.save(tenParent);
/*TenCellEntity cell = tenCellService.getById(tenPerson.getCellId());
long id = new SnowflakeIdWorker().nextId();
tenPerson.setPersonId(id);
tenPerson.setUuid(UUIDUtil.uuid());
@ -143,13 +187,6 @@ public class AppApiController {
tenPerson.setAppFlag(Constant.APP_LOGIN_YES);
tenPerson.setStatus(Constant.PESON_SUATUS_WAITREVIEW);
if(tenPerson.getIdCard()!=null){
if(tenPerson.getIdCard().length() == 15){
String id18 = Convert.toEighteen(tenPerson.getIdCard());
tenPerson.setIdCard(id18);
}
}
TenPersonEntity tenPersonEntity = tenPersonService.findByName(tenPerson.getName(),
tenPerson.getRoomId(),tenPerson.getCellId());
@ -157,32 +194,12 @@ public class AppApiController {
return R.error("姓名在此房间已存在");
}
if(tenPerson.getIdCard()!=null){
// TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(),
// tenPerson.getRoomId(),tenPerson.getCellId());
// if(tenPersonIdcard!=null){
// return R.error("身份证在此房间已存在");
// }
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId());
if(list.size()>0){
return R.error("身份证在此组织已存在");
}
}
tenPerson.setPersonType(5000);
if(tenPerson.getPersonType() == 5000 || tenPerson.getPersonType() == 5001 || tenPerson.getPersonType() == 5002){
TenLabelEntity labelEntity = tenLabelService.getOne(new QueryWrapper<TenLabelEntity>()
.eq("type",tenPerson.getPersonType())
.eq("tenant_id",tenPerson.getTenantId()));
if(labelEntity!=null){
tenPerson.setLabelId(labelEntity.getLabelId().intValue());
}
}
int res = tenPersonService.save(tenPerson);
if (res==2) {
return R.error("照片未检测到人脸");
}
}*/
return R.ok();
}
@ -288,47 +305,53 @@ public class AppApiController {
Long cellId = Long.parseLong((String) params.get("cellId"));
Long buildId = Long.parseLong((String) params.get("buildId"));
Integer layer = Integer.parseInt((String) params.get("layer"));
List<TenRoomEntity> buildList = tenRoomService.getLayerRooms(layer, buildId, cellId);
List<TenRoomEntity> buildList = tenRoomService.getLayerRooms(buildId, cellId);
return R.ok().put("data", buildList);
}
@Login
@PostMapping("addVisitor")
@ApiOperation("添加访客")
public R addVisitor(@RequestBody TenPersonEntity tenPerson) {
public R addVisitor(@LoginUser AppUserEntity user,@RequestBody TenPersonEntity tenPerson) throws Exception {
// public static final int PERSON_TYPE_OWNER = 5000; //业主
// public static final int PERSON_TYPE_MEMBER = 5001; //家属住户
// public static final int PERSON_TYPE_TENANT = 5002; //租户
// public static final int PERSON_TYPE_GUEST = 5005; //访客
tenPerson.setPersonType(Constant.PERSON_TYPE_GUEST);
tenPerson.setLabelId(Constant.PERSON_TYPE_GUEST);
tenPerson.setAppFlag(Constant.APP_LOGIN_NO);
tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR);
// TenPersonEntity tenPersonEntity = tenPersonService.findByName(tenPerson.getName(),
// tenPerson.getRoomId(),tenPerson.getCellId());
// if(tenPersonEntity!=null){
// return R.error("姓名在此房间已存在");
// }
if(tenPerson.getIdCard()!=null){
if(tenPerson.getIdCard().length() == 15){
String id18 = Convert.toEighteen(tenPerson.getIdCard());
tenPerson.setIdCard(id18);
}
}
TenCellEntity cell= tenCellService.getById(tenPerson.getCellId());
AppUserScopeEntity appUserScopeEntity = appUserScopeService.getById(user.getCurrentScopeId());
long id = new SnowflakeIdWorker().nextId();
tenPerson.setPersonId(id);
tenPerson.setUuid(UUIDUtil.uuid());
tenPerson.setTenantId(cell.getTenantId());
tenPerson.setCellId(appUserScopeEntity.getCellId());
//tenPerson.setTenantId(appUserScopeEntity.get());
// tenPerson.setCreateBy(user.getUsername());
tenPerson.setCreateTime(new Date());
tenPerson.setRegisterType(Constant.RESGISTER_TYPE_APP);
Date now = new Date();
tenPerson.setLiveStart(now);
tenPerson.setLiveEnd(new Date(now.getTime()+3600000L));
int res = tenPersonService.save(tenPerson);
/*Date now = new Date();
tenPerson.setLiveStart(new Date());
tenPerson.setLiveEnd(new Date(now.getTime()+3600000L));*/
tenPerson.setCreateBy(user.getUserId().toString());
tenPerson.setStatus(2);
tenPerson.setPersonType(Constant.PERSON_TYPE_GUEST);
tenPerson.setTenantId(user.getTenantId());
int res;
try {
res = tenPersonService.save(tenPerson);
} catch (Exception e) {
return R.error(e.getMessage());
}
if (res==2) {
return R.error("照片未检测到人脸");
}else if(res == 10){
@ -353,7 +376,7 @@ public class AppApiController {
PutObjectOptions putObjectOptions = new PutObjectOptions(inputStream.available(), -1);
putObjectOptions.setContentType(file.getContentType());
minioClient.putObject(
minioConfig.getBucketName(), fileName, inputStream, putObjectOptions);
minioConfig.getBucketName(), fileName, inputStream, putObjectOptions) ;
inputStream.close();
return R.ok().put("data", fileName);
} catch (Exception e) {
@ -366,69 +389,10 @@ public class AppApiController {
@PostMapping("getCurrentScope")
@ApiOperation("获取当前管理房间")
public R getCurrentScope(@LoginUser AppUserEntity user) {
if(user == null){
return R.error("用户不存在");
}
AppUserScopeEntity scope = new AppUserScopeEntity();
//有当前登录
if (user.getCurrentScopeId() != null) {
scope = appUserScopeService.getById(user.getCurrentScopeId());
//记录的当前登录已经不存在了
if(scope==null){
//没有当前登录重新找
List<AppUserScopeEntity> scopes = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>()
.eq("user_id", user.getUserId()));
if (scopes.size() != 0) {
scope = scopes.get(0);
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(), scope.getCellId());
scope.setPerson(personEntity);
scope.setCellName(tenCellService.getCellName(scope.getCellId().toString()));
user.setCurrentScopeId(scope.getUserScopeId());
appUserService.updateById(user);
}
}else{
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(), scope.getCellId());
scope.setPerson(personEntity);
scope.setCellName(tenCellService.getCellName(scope.getCellId().toString()));
if(personEntity!=null){
if(personEntity.getDeptId()!=null){
TenCellDeptEntity dept = tenCellDeptService.getById(personEntity.getDeptId());
if(dept!=null){
personEntity.setDeptName(dept.getName());
String deptAllName = tenCellDeptService.getAllParentName(dept.getParentId());
personEntity.setDeptAllName(deptAllName);
}
}
}
}
} else {
//没有当前登录
List<AppUserScopeEntity> scopes = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>()
.eq("user_id", user.getUserId()));
if (scopes.size() != 0) {
scope = scopes.get(0);
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(), scope.getCellId());
scope.setPerson(personEntity);
scope.setCellName(tenCellService.getCellName(scope.getCellId().toString()));
user.setCurrentScopeId(scope.getUserScopeId());
appUserService.updateById(user);
}
}
if(scope.getPerson()==null){
if (scope.getRoleId().intValue() == Constant.ROLE_TEN_CELL) {
SysUserEntity sysUserEntity = sysUserService.getById(user.getSysUserId());
if(sysUserEntity==null){
return R.error("用户无效");
}
scope.setSysUserRealName(sysUserEntity.getRealName());
}else{
return R.error("用户无效");
}
}
return R.ok().put("data", scope);
}
@ -535,7 +499,7 @@ public class AppApiController {
@Login
@PostMapping("addPerson")
@ApiOperation("管理员添加人员")
public R addPerson(@LoginUser AppUserEntity user, @RequestBody TenPersonEntity tenPerson) {
public R addPerson(@LoginUser AppUserEntity user, @RequestBody TenPersonEntity tenPerson) throws Exception {
if(user == null){
return R.error("用户不存在");
}
@ -602,7 +566,12 @@ public class AppApiController {
tenPerson.setCreateTime(new Date());
tenPerson.setRegisterType(Constant.RESGISTER_TYPE_APP);
tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR);
int res = tenPersonService.save(tenPerson);
int res = 10;
try {
res = tenPersonService.save(tenPerson);
} catch (Exception e) {
return R.error(e.getMessage());
}
if (res==2) {
return R.error("照片未检测到人脸");
}
@ -614,7 +583,7 @@ public class AppApiController {
@Login
@PostMapping("addMember")
@ApiOperation("业主添加成员")
public R addMember(@LoginUser AppUserEntity user, @RequestBody TenPersonEntity tenPerson) {
public R addMember(@LoginUser AppUserEntity user, @RequestBody TenPersonEntity tenPerson) throws Exception {
if(user == null){
return R.error("用户不存在");
}
@ -693,7 +662,12 @@ public class AppApiController {
int res = tenPersonService.save(tenPerson);
int res;
try {
res = tenPersonService.save(tenPerson);
} catch (Exception e) {
return R.error(e.getMessage());
}
if (res==2) {
return R.error("照片未检测到人脸");
}
@ -711,12 +685,12 @@ public class AppApiController {
})
public R getPersons(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
if(user == null){
return R.error("用户不存在");
}
String key = (String)params.get("key");
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
/*if(scope.getCellId() == 766326638739718144l ){
return R.error(AppComm.NOTICE_MOVE);
}
///小区管理员获取所有人员
// List<TenPersonEntity> pList = new ArrayList<>();
@ -724,16 +698,7 @@ public class AppApiController {
// pList = tenPersonService.getByCellId(scope.getCellId(),key);
params.put("cellId",scope.getCellId().toString());
PageUtils page = tenPersonService.getByCellIdQueryPage(params);
for(TenPersonEntity person: (List<TenPersonEntity>)page.getList()){
if(person.getDeptId()!=null){
TenCellDeptEntity dept = tenCellDeptService.getById(person.getDeptId());
if(dept!=null){
person.setDeptName(dept.getName());
String deptAllName = tenCellDeptService.getAllParentName(dept.getParentId());
person.setDeptAllName(deptAllName);
}
}
}
return R.ok().put("data", page);
}
//业主获取家庭成员业主租户家庭成员
@ -743,22 +708,28 @@ public class AppApiController {
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(),scope.getCellId());
// pList = tenPersonService.getByRoomId(personEntity.getRoomId(),scope.getCellId(),key);
params.put("cellId",scope.getCellId().toString());
// params.put("roomId",personEntity.getRoomId().toString());
params.put("deptId",personEntity.getDeptId().toString());
// PageUtils page = tenPersonService.selectByRoomIdQueryPage(params);
PageUtils page = tenPersonService.selectByDeptIdQueryPage(params);
for(TenPersonEntity person: (List<TenPersonEntity>)page.getList()){
if(person.getDeptId()!=null){
TenCellDeptEntity dept = tenCellDeptService.getById(person.getDeptId());
if(dept!=null){
person.setDeptName(dept.getName());
String deptAllName = tenCellDeptService.getAllParentName(dept.getParentId());
person.setDeptAllName(deptAllName);
}
}
}
params.put("roomId",personEntity.getRoomId().toString());
PageUtils page = tenPersonService.selectByRoomIdQueryPage(params);
return R.ok().put("data", page);
}*/
List<TenRelation> relationList = null;
if(params.get("status")!=null) {
relationList = relationService.list(new LambdaQueryWrapper<TenRelation>()
.eq(TenRelation::getParentId,user.getUserId())
.eq(TenRelation::getStatus,params.get("status")));
} else {
relationList = relationService.list(new LambdaQueryWrapper<TenRelation>()
.eq(TenRelation::getParentId,user.getUserId()));
}
if(!relationList.isEmpty()) {
List<Long> list = relationList.stream().map(TenRelation::getStudentId).collect(Collectors.toList());
params.put("cellId",scope.getCellId());
params.put("personIds",list.stream().distinct().collect(Collectors.toList()));
PageUtils page = tenPersonService.selectBypersonIds(params);
return R.ok().put("data",page);
}
return R.ok().put("data",new PageUtils(new ArrayList<>(),0,0,0));
@ -776,39 +747,13 @@ public class AppApiController {
})
public R getGuest(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
if(user == null){
return R.error("用户不存在");
}
String key = (String)params.get("key");
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
//获取访客
if(scope.getRoleId() == Constant.PERSON_TYPE_OWNER
|| scope.getRoleId() == Constant.PERSON_TYPE_MEMBER
|| scope.getRoleId() == Constant.PERSON_TYPE_TENANT){
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(),scope.getCellId());
// pList = tenPersonService.getByRoomId(personEntity.getRoomId(),scope.getCellId(),key);
params.put("cellId",scope.getCellId().toString());
// params.put("roomId",personEntity.getRoomId().toString());
params.put("deptId",personEntity.getDeptId().toString());
// PageUtils page = tenPersonService.selectByRoomIdForGuestQueryPage(params);
PageUtils page = tenPersonService.selectByDeptIdForGuestQueryPage(params);
for(TenPersonEntity person: (List<TenPersonEntity>)page.getList()){
if(person.getDeptId()!=null){
TenCellDeptEntity dept = tenCellDeptService.getById(person.getDeptId());
if(dept!=null){
person.setDeptName(dept.getName());
String deptAllName = tenCellDeptService.getAllParentName(dept.getParentId());
person.setDeptAllName(deptAllName);
}
}
}
params.put("cellId", scope.getCellId().toString());
params.put("createBy", user.getUserId().toString());
PageUtils page = tenPersonService.selectByCreateByQueryPage(params);
return R.ok().put("data", page);
}
return R.ok().put("data",new PageUtils(new ArrayList<>(),0,0,0));
}
@ -820,25 +765,9 @@ public class AppApiController {
@ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
})
public R deletePerson(@LoginUser AppUserEntity user, @RequestBody List<Map<String, String>> params) {
if(user == null){
return R.error("用户不存在");
}
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
//不能删除自己
if (scope.getRoleId().intValue() != Constant.ROLE_TEN_CELL) {
//住户家属
for (Map<String, String> param : params) {
Long personId = Long.parseLong(param.get("personId"));
Long cellId = Long.parseLong(param.get("cellId"));
if(scope.getPersonId().longValue() == personId.longValue()){
return R.error("不能删除自己");
}
TenPersonEntity personEntity = tenPersonService.getById(personId,cellId);
if(scope.getRoleId().intValue()>personEntity.getPersonType().intValue()){
return R.error("您无权删除"+personEntity.getName());
}
}
}
//业主不能删除自己
tenPersonService.removeByIdList(params);
return R.ok();
}
@ -1019,4 +948,145 @@ public class AppApiController {
//// }
// return R.ok().put("data", areaSelectList);
// }
@Login
@PostMapping("/binding")
@ApiOperation("绑定学员")
@ApiImplicitParams({
@ApiImplicitParam(name = "cellId", value = "学校ID", paramType = "query", dataType = "String", required = true),
@ApiImplicitParam(name = "studentId", value = "学号", paramType = "query", dataType = "String", required = true)
})
public R binding(@LoginUser AppUserEntity user, @RequestBody Map<String,Object> params) {
AppUserScopeEntity userScopeEntity = appUserScopeService.getById(user.getCurrentScopeId());
Long cellId = userScopeEntity.getCellId();
if(params.get("ryId")==null) {
return R.error("请输入学号");
}
if(params.get("idCard")==null) {
return R.error("请输入身份证号");
}
String ryId = params.get("ryId").toString();
String idCard = params.get("idCard").toString();
TenPersonEntity entity = tenPersonService.getByRyId(ryId,cellId,idCard);
if(entity == null) {
return R.error("学生未录入");
}
TenRelation tenRelation =relationService.getOne(new LambdaQueryWrapper<TenRelation>()
.eq(TenRelation::getParentId,user.getUserId())
.eq(TenRelation::getStudentId,entity.getPersonId()));
if(tenRelation!=null) {
return R.error("该学生已和您绑定");
}
TenRelation relation = new TenRelation();
relation.setParentId(user.getUserId());
relation.setStudentId(entity.getPersonId());
relation.setCreateTime(new Date());
relation.setStatus(2);
relation.setRelation(params.get("salutation").toString());
Map<String,Object> opParams = new HashMap<>();
opParams.put("operation","editUserContactData");
opParams.put("accountNumber",globalValue.accountNumber);
opParams.put("passKey", KeysEntity.passKey);
opParams.put("empowerText",KeysEntity.empowerText);
List<Map<String,Object>> dataInfo = new ArrayList<>();
Map<String,Object> info = new HashMap<>();
info.put("objectUuid",user.getUserId().toString());
info.put("userUuid",user.getUserId().toString());
info.put("salutation",params.get("salutation"));
info.put("phoneNumber",user.getMobile());
info.put("orderNumber",1);
dataInfo.add(info);
opParams.put("dataInfo",dataInfo);
/* JSONObject jsonObject = opFeignClient.submitData(opParams);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error("同步联系人失败");
}
if(!jsonObject.getJSONArray("errInfo").isEmpty()) {
return R.error("同步联系人失败");
}*/
/* 请求参数:
{
"operation": "editUserContactData",
"accountNumber": "",
"empowerText": "",
"passKey": "",
"dataInfo": [{
"objectUuid": "CU0F996E19C57D11EDBE15A4BB6D5C0823",
"userUuid": "CUCFF2A6776A0811EC82B900163E029240",
"salutation": "爸爸",
"phoneNumber": "136****0097",
"orderNumber": 1
},
*//* 此次省略8个联系人名单json数据*//*
,
{
"objectUuid": "CU0F996E19C57D11EDBE15A4BB6D5C0824",
"userUuid": "CUCFF2A6776A0811EC82B900163E029240",
"salutation": "妈妈",
"phoneNumber": "136****0098",
"orderNumber": 1
}
]
}*/
relationService.save(relation);
return R.ok();
}
@Login
@PostMapping("/remove")
public R removeBing(@LoginUser AppUserEntity user, @RequestBody List<Map<String,Object>> params) {
//AppUserScopeEntity userScopeEntity = appUserScopeService.getById(user.getCurrentScopeId());
Map<String,Object> opParams = new HashMap<>();
opParams.put("operation","delUserContactData");
opParams.put("accountNumber",globalValue.accountNumber);
opParams.put("passKey", KeysEntity.passKey);
opParams.put("empowerText",KeysEntity.empowerText);
List<Map<String,Object>> dataInfo = new ArrayList<>();
Map<String,Object> info = new HashMap<>();
info.put("objectUuid",user.getUserId());
dataInfo.add(info);
opParams.put("dataInfo",dataInfo);
JSONObject jsonObject = opFeignClient.submitData(opParams);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error("同步联系人失败");
}
if(!jsonObject.getJSONArray("errInfo").isEmpty()) {
return R.error("同步联系人失败");
}
List<String> list = new ArrayList<>();
params.forEach(item -> {
list.add(item.get("personId").toString());
});
relationService.remove(new LambdaQueryWrapper<TenRelation>()
.eq(TenRelation::getParentId,user.getUserId())
.in(TenRelation::getStudentId,list));
return R.ok();
}
@Login
@GetMapping("/selectByCellId/{cellId}")
@ApiOperation(value = "下拉选择楼栋,通过选择小区联动查询",response = TenBuildEntity.class)
public R selectByCellId(@LoginUser AppUserEntity user,@PathVariable("cellId") Long cellId){
String tenantId = user.getTenantId()+"";
Map<String,Object> params = new HashMap<>();
params.put("tenantId",tenantId+"");
List<TenBuildEntity> buildList = tenBuildService.selectByCellId(cellId);
// for(TenBuildEntity buildEntity: buildList){
// buildEntity.setName(buildEntity.getName()+buildEntity.getUnit()+"单元");
// }
return R.ok().put("data", buildList);
}
/**
* 下拉框选择
*/
@Login
@GetMapping("/select/{cellId}/{buildId}")
@ApiOperation(value = "下拉选择房间名称,通过单元楼层",response = TenBuildEntity.class)
public R select(@PathVariable("cellId") Long cellId,
@PathVariable("buildId") Long buildId){
List<TenRoomEntity> buildList = tenRoomService.getLayerRooms(buildId,cellId);
return R.ok().put("data", buildList);
}
}

View File

@ -1,6 +1,7 @@
package net.shapelight.modules.app.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.minio.MinioClient;
import io.minio.PutObjectOptions;
@ -27,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
/**
* APP测试接口
@ -66,6 +68,8 @@ public class AppInfoApiController {
private TenRecordService tenRecordService;
@Autowired
private TenCellDeptService tenCellDeptService;
@Autowired
private TenRelationService relationService;
@Login
@ -308,19 +312,18 @@ public class AppInfoApiController {
return R.ok().put("data", page);
}
//业主
else if(scope.getRoleId() == Constant.PERSON_TYPE_OWNER
|| scope.getRoleId() == Constant.PERSON_TYPE_MEMBER
|| scope.getRoleId() == Constant.PERSON_TYPE_TENANT){
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(),scope.getCellId());
// pList = tenPersonService.getByRoomId(personEntity.getRoomId(),scope.getCellId(),key);
params.put("cellId",scope.getCellId().toString());
// params.put("roomId",personEntity.getRoomId().toString());
params.put("deptId",personEntity.getDeptId().toString());
// PageUtils page = tenRecordService.queryPageRoomRecord(params);
PageUtils page = tenRecordService.queryPageDeptRecord(params);
else if(scope.getRoleId() == Constant.PERSON_TYPE_PARENT){
List<TenRelation> relationList = relationService.list(new LambdaQueryWrapper<TenRelation>()
.eq(TenRelation::getParentId,user.getUserId()));
if(!relationList.isEmpty()) {
List<Long> list = relationList.stream().map(TenRelation::getStudentId).collect(Collectors.toList());
params.put("cellId",scope.getCellId());
params.put("personIds",list);
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

@ -14,5 +14,5 @@ public interface ITask {
*
* @param params 参数多参数使用JSON数据
*/
void run(String params);
void run(String params) throws Exception;
}

View File

@ -9,6 +9,7 @@ import io.minio.MinioClient;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.SyncFailedException;
import java.util.*;
import lombok.extern.slf4j.Slf4j;
@ -686,7 +687,12 @@ public class XaImageTask implements ITask {
if(errLine.equals("empty")){
for (TenPersonEntity recordEntity : updatePersons) {
recordEntity.setXaSyncImage(1);
try {
tenPersonService.updateById(recordEntity);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}else{
String[] lines = errLine.split(",");
@ -697,7 +703,11 @@ public class XaImageTask implements ITask {
}else {
TenPersonEntity recordEntity = updatePersons.get(i);
recordEntity.setXaSyncImage(1);
try {
tenPersonService.updateById(recordEntity);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
}
@ -708,7 +718,11 @@ public class XaImageTask implements ITask {
|| ((String)resData.get("Result")).indexOf("实有人口不存在")>0){
TenPersonEntity recordEntity = updatePersons.get(i);
recordEntity.setXaSyncImage(1);
try {
tenPersonService.updateById(recordEntity);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
}

View File

@ -41,7 +41,7 @@ public class XaRealDataTask implements ITask {
@Autowired
private TenTranService tenTranService;
public void run(String params) {
public void run(String params){
log.debug("一标三实定时任务正在执行", params);
List<SysUserEntity> allSysTenUser = this.sysUserService.findAllSysTenUser();
for (SysUserEntity sysTenUser : allSysTenUser) {
@ -303,7 +303,11 @@ public class XaRealDataTask implements ITask {
if(errLine.equals("empty")){
for (TenPersonEntity recordEntity : updatePersons) {
recordEntity.setXaSync(1);
try {
tenPersonService.updateById(recordEntity);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}else{
// List<XaSYRK> syncPersonsDelete = new ArrayList();
@ -314,11 +318,19 @@ public class XaRealDataTask implements ITask {
if(res.equals("接收成功")){
TenPersonEntity recordEntity = updatePersons.get(i);
recordEntity.setXaSync(1);
try {
tenPersonService.updateById(recordEntity);
} catch (Exception e) {
log.error(e.getMessage());
}
}else if(res.indexOf("违反唯一约束条件")>0){
TenPersonEntity recordEntity = updatePersons.get(i);
recordEntity.setXaSync(1);
try {
tenPersonService.updateById(recordEntity);
} catch (Exception e) {
log.error(e.getMessage());
}
//页面删除过但是没有上报这次上报
// XaSYRK realPerson = syncPersons.get(i);
// realPerson.setLV_ZXSJ(DateUtils.format(new Date(),DateUtils.DATE_YEAR_MONTH));
@ -412,7 +424,11 @@ public class XaRealDataTask implements ITask {
if(errLine.equals("empty")){
for (TenPersonEntity recordEntity : updatePersons) {
recordEntity.setXaSyncCard(1);
try {
tenPersonService.updateById(recordEntity);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}else{
String[] lines = errLine.split(",");
@ -423,7 +439,11 @@ public class XaRealDataTask implements ITask {
}else {
TenPersonEntity recordEntity = updatePersons.get(i);
recordEntity.setXaSyncCard(1);
try {
tenPersonService.updateById(recordEntity);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
}
@ -433,7 +453,11 @@ public class XaRealDataTask implements ITask {
if(((String)resData.get("Result")).indexOf("重复申报")>0){
TenPersonEntity recordEntity = updatePersons.get(i);
recordEntity.setXaSyncCard(1);
try {
tenPersonService.updateById(recordEntity);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
}

View File

@ -87,4 +87,9 @@ public class SysDictController {
return R.ok();
}
@GetMapping("/all/{type}")
public R listAll(@PathVariable("type") String type) {
return R.ok().put("data",sysDictService.queryByType(type));
}
}

View File

@ -135,10 +135,10 @@ public class SysLoginController extends AbstractController{
// return R.error("验证码不正确");
// }
//this.loginForm.password = base.encode('f4fab52d797e197c'+this.loginForm.password)
/*//this.loginForm.password = base.encode('f4fab52d797e197c'+this.loginForm.password)
String p = Base64.decodeStr(form.getPassword());
p = p.substring(16);
form.setPassword(p);
//p = p.substring(16);
form.setPassword(p);*/
//用户信息
SysUserEntity user = sysUserService.queryByUserName(form.getUsername());

View File

@ -7,6 +7,7 @@ import net.shapelight.common.utils.PageUtils;
import net.shapelight.modules.sys.entity.SysDictEntity;
import net.shapelight.common.utils.PageUtils;
import java.util.List;
import java.util.Map;
/**
@ -17,5 +18,7 @@ import java.util.Map;
public interface SysDictService extends IService<SysDictEntity> {
PageUtils queryPage(Map<String, Object> params);
List<SysDictEntity> queryByType(String type);
}

View File

@ -2,6 +2,7 @@
package net.shapelight.modules.sys.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -15,6 +16,7 @@ import net.shapelight.modules.sys.dao.SysDictDao;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@ -34,4 +36,9 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictDao, SysDictEntity> i
return new PageUtils(page);
}
@Override
public List<SysDictEntity> queryByType(String type) {
return this.list(new LambdaQueryWrapper<SysDictEntity>().eq(SysDictEntity::getType,type));
}
}

View File

@ -2,6 +2,8 @@ package net.shapelight.modules.ten.controller;
import java.util.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -9,6 +11,7 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.shapelight.common.utils.Constant;
import net.shapelight.common.utils.SnowflakeIdWorker;
import net.shapelight.modules.job.entity.KeysEntity;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserRoleService;
@ -17,8 +20,12 @@ import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenPersonService;
import net.shapelight.modules.ten.service.TenUserScopeService;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import net.shapelight.modules.ten.entity.TenBuildEntity;
@ -46,6 +53,11 @@ public class TenBuildController extends AbstractController {
private TenUserScopeService tenUserScopeService;
@Autowired
private TenPersonService tenPersonService;
@Value("${global.qingju.accountNumber}")
private String accountNumber;
@Qualifier("net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient")
@Autowired
private OpFeignClient opFeignClient;
/**
* 列表
@ -133,10 +145,37 @@ public class TenBuildController extends AbstractController {
//@RequiresPermissions("ten:build:save")
@RequiresPermissions("ten:build")
@ApiOperation(value = "保存")
@Transactional
public R save(@RequestBody TenBuildEntity tenBuild){
TenBuildEntity check = tenBuildService.queryByNumberAndUnit(tenBuild.getNumber(),tenBuild.getUnit(),tenBuild.getCellId());
if(check!=null){
return R.error("此楼栋单元已经存在");
return R.error("当前年级已经存在");
}
//"shrgMsg": "授权过期!"
/* operation String 接口名 默认:editGradeData
accountNumber String 账号
passKey String 授权Key
empowerText String 授权密文
dataInfo JsonArray[1-16] 具体内容 年级json集合最多16个
gradeCode String[0-50] 年级编码 年级编码传递请看附录A
必传*/
Map<String,Object> params = new HashMap<>();
params.put("operation","editGradeData");
params.put("accountNumber",accountNumber);
params.put("passKey", KeysEntity.passKey);
params.put("empowerText",KeysEntity.empowerText);
Map<String, Object> grade = new HashMap<>();
grade.put("gradeCode",tenBuild.getNumber());
JSONArray jsonArray = new JSONArray();
jsonArray.add(grade);
params.put("dataInfo",jsonArray);
JSONObject jsonObject = opFeignClient.submitData(params);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error("同步联系人失败");
}
if(jsonObject.getJSONArray("errInfo")!=null &&!jsonObject.getJSONArray("errInfo").isEmpty()) {
return R.error(tenBuild.getName() + "同步失败");
}
long id = new SnowflakeIdWorker().nextId();
tenBuild.setBuildId(id);
@ -144,7 +183,6 @@ public class TenBuildController extends AbstractController {
tenBuild.setCreateBy(getUser().getUsername());
tenBuild.setCreateTime(new Date());
tenBuildService.save(tenBuild);
return R.ok();
}
@ -155,10 +193,28 @@ public class TenBuildController extends AbstractController {
//@RequiresPermissions("ten:build:update")
@RequiresPermissions("ten:build")
@ApiOperation(value = "修改")
@Transactional
public R update(@RequestBody TenBuildEntity tenBuild){
tenBuild.setTenantId(getUser().getTenantId());
tenBuild.setLastUpdateBy(getUser().getUsername());
tenBuild.setLastUpdateTime(new Date());
Map<String,Object> params = new HashMap<>();
params.put("operation","editGradeData");
params.put("accountNumber",accountNumber);
params.put("passKey", KeysEntity.passKey);
params.put("empowerText",KeysEntity.empowerText);
Map<String, Object> grade = new HashMap<>();
grade.put("gradeCode",tenBuild.getNumber());
JSONArray jsonArray = new JSONArray();
jsonArray.add(grade);
params.put("dataInfo",jsonArray);
JSONObject jsonObject = opFeignClient.submitData(params);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error("同步联系人失败");
}
if(jsonObject.getJSONArray("errInfo")!=null &&!jsonObject.getJSONArray("errInfo").isEmpty()) {
return R.error("修改年级失败");
}
tenBuildService.updateById(tenBuild);
return R.ok();
@ -175,14 +231,35 @@ public class TenBuildController extends AbstractController {
@ApiImplicitParam(name="buildId",value = "楼栋ID",paramType = "query",dataType = "String",required = true),
@ApiImplicitParam(name="cellId",value = "小区ID",paramType = "query",dataType = "String",required = true)
})
@Transactional
public R delete(@RequestBody List<Map<String, String>> params){
JSONArray jsonArray = new JSONArray();
for(Map<String,String> param: params){
Long buildId = Long.parseLong(param.get("buildId"));
Long cellId = Long.parseLong(param.get("cellId"));
int pCount = tenPersonService.findBuildCount(cellId,buildId);
if (pCount>0) {
return R.error("当前楼栋有"+pCount+"个住户,请先删除完住户");
return R.error("当前年级有"+pCount+"个学生,请先删除学生");
}
TenBuildEntity tenBuild = tenBuildService.getById(buildId,cellId);
Map<String, Object> grade = new HashMap<>();
grade.put("gradeCode",tenBuild.getNumber());
jsonArray.add(grade);
}
Map<String,Object> gradeParams = new HashMap<>();
gradeParams.put("operation","delGradeData");
gradeParams.put("accountNumber",accountNumber);
gradeParams.put("passKey", KeysEntity.passKey);
gradeParams.put("empowerText",KeysEntity.empowerText);
gradeParams.put("dataInfo",jsonArray);
JSONObject jsonObject = opFeignClient.submitData(gradeParams);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error("同步联系人失败");
}
if(jsonObject.getJSONArray("errInfo")!=null && !jsonObject.getJSONArray("errInfo").isEmpty()) {
return R.error(jsonObject.getJSONArray("errInfo") + "删除失败");
}
tenBuildService.removeByIdList(params);
return R.ok();

View File

@ -0,0 +1,110 @@
package net.shapelight.modules.ten.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.utils.PageUtils;
import net.shapelight.common.utils.R;
import net.shapelight.modules.app.entity.AppUserEntity;
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.ten.entity.TenParent;
import net.shapelight.modules.ten.entity.TenRelation;
import net.shapelight.modules.ten.service.TenParentService;
import net.shapelight.modules.ten.service.TenRelationService;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient;
import net.shapelight.modules.vo.ParentVo;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("ten/parent")
@Api(value="家长信息",tags="家长信息")
public class TenParentController {
@Autowired
TenParentService tenParentService;
@Autowired
private AppUserServiceImpl appUserService;
@Autowired
private AppUserScopeServiceImpl appUserScopeService;
@Autowired
private TenRelationService relationService;
@Autowired
private GlobalValue globalValue;
@Qualifier("net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient")
@Autowired
private OpFeignClient opFeignClient;
@GetMapping("/list")
@ApiOperation(value = "查询访客列表", response = ParentVo.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "limit", value = "每页条数", paramType = "query", dataType = "String", required = true),
@ApiImplicitParam(name = "page", value = "页码", paramType = "query", dataType = "String", required = true),
@ApiImplicitParam(name = "name", value = "姓名", paramType = "query", dataType = "String", required = true),
@ApiImplicitParam(name = "mobile", value = "手机号", paramType = "query", dataType = "String", required = true)
})
public R getParentList(@RequestParam Map<String,Object> params) {
PageUtils page = tenParentService.getParentList(params);
return R.ok().put("data",page);
}
@PostMapping("/delete")
@Transactional
public R deleteParent(@RequestBody List<Map<String, String>> params) throws Exception {
Map<String,Object> opParams = new HashMap<>();
opParams.put("operation","delUserContactData");
opParams.put("accountNumber",globalValue.accountNumber);
opParams.put("passKey", KeysEntity.passKey);
opParams.put("empowerText",KeysEntity.empowerText);
List<Map<String,Object>> dataInfo = new ArrayList<>();
Map<String,Object> info = new HashMap<>();
params.forEach(item -> {
TenParent tenParent = tenParentService.getById(item.get("id"));
info.put("objectUuid",tenParent.getUserId().toString());
dataInfo.add(info);
tenParentService.removeById(item.get("id"));
appUserService.removeById(tenParent.getUserId());
appUserScopeService.remove(new LambdaQueryWrapper<AppUserScopeEntity>()
.eq(AppUserScopeEntity::getUserId,tenParent.getUserId()));
relationService.remove(new LambdaQueryWrapper<TenRelation>().eq(TenRelation::getParentId,item.get("id")));
});
opParams.put("dataInfo",dataInfo);
JSONObject jsonObject = opFeignClient.submitData(opParams);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error("同步联系人失败");
}
if(!jsonObject.getJSONArray("errInfo").isEmpty()) {
return R.error("同步联系人失败");
}
return R.ok();
}
@PostMapping("/reset")
public R resetPassWord(@RequestBody Map<String,Object> params) {
String id = params.get("id").toString();
String passWord = params.get("password").toString();
TenParent tenParent = tenParentService.getById(id);
AppUserEntity userEntity = appUserService.getById(tenParent.getUserId());
userEntity.setPassword(DigestUtils.sha256Hex(passWord));
appUserService.save(userEntity);
return R.ok();
}
}

View File

@ -3,8 +3,13 @@ package net.shapelight.modules.ten.controller;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.ZipOutputStream;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.minio.MinioClient;
import io.minio.PutObjectOptions;
@ -22,21 +27,30 @@ import net.shapelight.commons.engine.sdk.SdkImageUtils;
import net.shapelight.commons.engine.sdk.palm.FaceFeatureBase;
import net.shapelight.commons.engine.sdk.palm.OutArg;
import net.shapelight.modules.app.entity.AppUserEntity;
import net.shapelight.modules.app.entity.AppUserScopeEntity;
import net.shapelight.modules.app.service.AppUserService;
import net.shapelight.modules.app.service.impl.AppUserScopeServiceImpl;
import net.shapelight.modules.excel.model.PersonModel;
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.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserRoleService;
import net.shapelight.modules.sys.service.SysUserService;
import net.shapelight.modules.sys.service.impl.SysDictServiceImpl;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient;
import net.shapelight.modules.vo.TenDeviceVo;
import net.shapelight.modules.vo.TenPersonOperationVo;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -86,6 +100,19 @@ public class TenPersonController extends AbstractController {
private TenCellDeptService tenCellDeptService;
@Autowired
private TenLabelService tenLabelService;
@Autowired
private SysDictServiceImpl sysDictService;
@Value("${global.minio.endpoint}")
private String imagBaseUrl;
@Value("${global.minio.bucketName}")
private String bucketName;
@Qualifier("net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient")
@Autowired
private OpFeignClient opFeignClient;
@Autowired
private AppUserScopeServiceImpl appUserScopeService;
@Autowired
private TenRelationService relationService;
/**
@ -109,6 +136,7 @@ public class TenPersonController extends AbstractController {
@ApiImplicitParam(name = "idCard", value = "证件号", paramType = "query", dataType = "String", required = true),
@ApiImplicitParam(name = "personType", value = "类型", paramType = "query", dataType = "String", required = true),
@ApiImplicitParam(name = "faceFailure", value = "人脸提取标志", paramType = "query", dataType = "String", required = true),
@ApiImplicitParam(name = "labelId", value = "类型", paramType = "query", dataType = "String", required = true)
})
public R list(@RequestParam Map<String, Object> params) {
String tenantId = getUser().getTenantId() + "";
@ -124,8 +152,8 @@ public class TenPersonController extends AbstractController {
List<TenLabelEntity> tenLabel = tenLabelService.list(new QueryWrapper<TenLabelEntity>()
.eq("tenant_id",getUser().getTenantId()));
personTypeList.add(Constant.PERSON_TYPE_OWNER);
personTypeList.add(Constant.PERSON_TYPE_MEMBER);
personTypeList.add(Constant.PERSON_TYPE_TENANT);
/*personTypeList.add(Constant.PERSON_TYPE_MEMBER);
personTypeList.add(Constant.PERSON_TYPE_TENANT);*/
params.put("personTypeList",personTypeList);
PageUtils page = tenPersonService.queryPage(params);
@ -290,16 +318,14 @@ public class TenPersonController extends AbstractController {
.eq("user_id",tenantId));
person.setTenantName(sysUserEntity.getCompanyName());
if(person.getRoomId()!=null){
if(person.getPersonType().intValue() == Constant.PERSON_TYPE_MEMBER
/*if(person.getPersonType().intValue() == Constant.PERSON_TYPE_MEMBER
|| person.getPersonType().intValue() == Constant.PERSON_TYPE_OWNER
|| person.getPersonType().intValue() == Constant.PERSON_TYPE_TENANT
|| person.getPersonType().intValue() == Constant.PERSON_TYPE_GUEST){
String n = String.format("%02d%s",Integer.parseInt(person.getBuildUnit()),person.getRoomName());
n = n.replace("","");
person.setDoorNumber(n);
}
}
}*/
if(person.getDeptId()!=null){
TenCellDeptEntity dept = tenCellDeptService.getById(person.getDeptId());
@ -330,7 +356,8 @@ public class TenPersonController extends AbstractController {
@PostMapping("/save")
@RequiresPermissions("ten:person")
@ApiOperation(value = "保存人员信息")
public R save(@RequestBody TenPersonEntity tenPerson) {
@Transactional
public R save(@RequestBody TenPersonEntity tenPerson) throws Exception {
// TenPersonEntity room = tenPersonService.queryByNumberAndLayer(tenRoom.getRoomNumber(),
// tenRoom.getLayer(),
// tenRoom.getBuildId(),
@ -344,7 +371,7 @@ public class TenPersonController extends AbstractController {
tenPerson.setIdCard(id18);
}
}
//验证app人员是否注册
/*//验证app人员是否注册
if (tenPerson.getAppFlag() == Constant.APP_LOGIN_YES) {
//1.验证用户名
AppUserEntity appUser = appUserService.findByUsername(tenPerson.getUsername());
@ -356,9 +383,9 @@ public class TenPersonController extends AbstractController {
if (appUser != null) {
return R.error("手机号已经注册");
}
}
}*/
//验证卡号
if(tenPerson.getDoorCardEntity()!=null && tenPerson.getDoorCardEntity().getDoorCard().isEmpty()){
if(tenPerson.getDoorCardEntity()!=null && !tenPerson.getDoorCardEntity().getDoorCard().isEmpty()){
//1. 检查当前钥匙是否已经使用
TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
.eq("door_card",tenPerson.getDoorCardEntity().getDoorCard())
@ -373,7 +400,7 @@ public class TenPersonController extends AbstractController {
TenPersonEntity tenPersonEntity = tenPersonService.findByName(tenPerson.getName(),
tenPerson.getRoomId(),tenPerson.getCellId());
if(tenPersonEntity!=null){
return R.error("姓名在此房间已存在");
return R.error("当前学生已存在");
}
@ -398,11 +425,15 @@ public class TenPersonController extends AbstractController {
tenPerson.setCreateBy(getUser().getUsername());
tenPerson.setCreateTime(new Date());
tenPerson.setRegisterType(Constant.RESGISTER_TYPE_WEB);
tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR);
int res = tenPersonService.save(tenPerson);
int res;
tenPerson.setStatus(0);
res = tenPersonService.save(tenPerson);
if (res==2) {
return R.error("照片未检测到人脸");
}
return R.ok();
}
@ -412,7 +443,8 @@ public class TenPersonController extends AbstractController {
@PostMapping("/update")
@RequiresPermissions("ten:person")
@ApiOperation(value = "修改人员信息")
public R update(@RequestBody TenPersonEntity tenPerson) {
@Transactional
public R update(@RequestBody TenPersonEntity tenPerson) throws Exception {
tenPerson.setTenantId(getUser().getTenantId());
tenPerson.setLastUpdateBy(getUser().getUsername());
tenPerson.setLastUpdateTime(new Date());
@ -510,15 +542,16 @@ public class TenPersonController extends AbstractController {
// }
//// tenDoorCardService.save(tenPerson);
// }
String resStr = tenPersonService.updateById(tenPerson);
if(resStr.equals("OK")){
return R.ok();
}else{
return R.error(resStr);
String res = null;
try {
res = tenPersonService.updateById(tenPerson);
} catch (Exception e) {
log.error(e.getMessage());
}
if(res!=null){
return R.ok();
}
return R.error("修改失败");
}
@ -844,7 +877,7 @@ public class TenPersonController extends AbstractController {
@RequestPart(value = "right_ir0",required = false) MultipartFile right_ir0,
@RequestPart(value = "right_ir0",required = false) MultipartFile right_ir1,
@RequestPart(value = "right_ir0",required = false) MultipartFile right_ir2
) {
) throws Exception {
tenPerson.setTenantId(getUser().getTenantId());
tenPerson.setLastUpdateBy(getUser().getUsername());
tenPerson.setLastUpdateTime(new Date());
@ -1053,7 +1086,12 @@ public class TenPersonController extends AbstractController {
//----------------------------------掌静脉特征压缩包封装--------------------------------------
String resStr = tenPersonService.updateById(tenPerson);
String resStr = null;
try {
tenPersonService.updateById(tenPerson);
} catch (Exception e) {
log.error(e.getMessage());
}
if(resStr.equals("OK")){
return R.ok();
}else{
@ -1075,7 +1113,7 @@ public class TenPersonController extends AbstractController {
@RequestPart(value = "right_ir0",required = false) MultipartFile right_ir0,
@RequestPart(value = "right_ir0",required = false) MultipartFile right_ir1,
@RequestPart(value = "right_ir0",required = false) MultipartFile right_ir2
) {
) throws Exception {
// TenPersonEntity room = tenPersonService.queryByNumberAndLayer(tenRoom.getRoomNumber(),
// tenRoom.getLayer(),
// tenRoom.getBuildId(),
@ -1265,7 +1303,9 @@ public class TenPersonController extends AbstractController {
//----------------------------------掌静脉特征压缩包封装--------------------------------------
int res = tenPersonService.save(tenPerson);
int res;
res = tenPersonService.save(tenPerson);
if (res==2) {
return R.error("照片未检测到人脸");
}
@ -1315,4 +1355,20 @@ public class TenPersonController extends AbstractController {
}
return R.error();
}
@GetMapping("/children")
public R listByParent(@RequestParam Map<String,Object> params) {
AppUserScopeEntity userScopeEntity = appUserScopeService.getOne(new LambdaQueryWrapper<AppUserScopeEntity>()
.eq(AppUserScopeEntity::getUserId, params.get("userId")));
List<TenRelation> relationList = relationService.list(new LambdaQueryWrapper<TenRelation>()
.eq(TenRelation::getParentId,userScopeEntity.getUserId()));
if(!relationList.isEmpty()) {
List<Long> list = relationList.stream().map(TenRelation::getStudentId).collect(Collectors.toList());
params.put("cellId",userScopeEntity.getCellId());
params.put("personIds",list);
PageUtils page = tenPersonService.selectBypersonIds(params);
return R.ok().put("data",page);
}
return R.ok();
}
}

View File

@ -0,0 +1,86 @@
package net.shapelight.modules.ten.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import net.shapelight.common.config.GlobalValue;
import net.shapelight.common.utils.Constant;
import net.shapelight.common.utils.R;
import net.shapelight.modules.app.entity.AppUserEntity;
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.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserRoleService;
import net.shapelight.modules.ten.entity.TenRelation;
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.TenParentService;
import net.shapelight.modules.ten.service.TenRelationService;
import net.shapelight.modules.ten.service.TenUserScopeService;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@RestController
@RequestMapping("ten/relation")
public class TenRelationController extends AbstractController {
@Autowired
TenRelationService relationService;
@Autowired
SysUserRoleService sysUserRoleService;
@Autowired
TenUserScopeService tenUserScopeService;
@Autowired
private GlobalValue globalValue;
@Autowired
private TenParentService parentService;
@Autowired
private AppUserServiceImpl appUserService;
@Qualifier("net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient")
@Autowired
private OpFeignClient opFeignClient;
@GetMapping("/list")
public R list(@RequestParam Map<String,Object> params) {
SysUserEntity user = getUser();
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
//小区管理员
if (roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL) {
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id", user.getUserId()));
params.put("cellId", scope.getCellId().toString());
}
return R.ok().put("data",relationService.getAll(params));
}
@PostMapping("/status")
public R upStatus(@RequestBody List<Map<String,Object>> params) {
params.forEach(item -> {
TenRelation tenRelation = relationService.getById(item.get("id").toString());
tenRelation.setStatus(Integer.parseInt(item.get("status").toString()));
tenRelation.setApprovalTime(new Date());
tenRelation.setApproval(getUser().getRealName());
AppUserEntity appUser = appUserService.getById(tenRelation.getParentId());
Map<String,Object> opParams = new HashMap<>();
opParams.put("operation","editUserContactData");
opParams.put("accountNumber",globalValue.accountNumber);
opParams.put("passKey", KeysEntity.passKey);
opParams.put("empowerText",KeysEntity.empowerText);
List<Map<String,Object>> dataInfo = new ArrayList<>();
Map<String,Object> info = new HashMap<>();
info.put("objectUuid",tenRelation.getParentId().toString());
info.put("userUuid",tenRelation.getStudentId().toString());
info.put("salutation",tenRelation.getRelation());
info.put("phoneNumber",appUser.getMobile());
info.put("orderNumber",1);
dataInfo.add(info);
opParams.put("dataInfo",dataInfo);
JSONObject jsonObject = opFeignClient.submitData(opParams);
relationService.updateById(tenRelation);
});
return R.ok();
}
}

View File

@ -2,21 +2,28 @@ package net.shapelight.modules.ten.controller;
import java.util.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.common.config.GlobalValue;
import net.shapelight.common.utils.*;
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.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserRoleService;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient;
import net.shapelight.modules.vo.TenPersonOperationVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@ -46,6 +53,11 @@ public class TenRoomController extends AbstractController {
private TenPersonSyncService tenPersonSyncService;
@Autowired
private ServerApiService serverApiService;
@Qualifier("net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient")
@Autowired
private OpFeignClient opFeignClient;
@Autowired
private GlobalValue globalValue;
/**
* 列表
@ -98,34 +110,54 @@ public class TenRoomController extends AbstractController {
/**
* 下拉框选择
*/
@GetMapping("/select/{cellId}/{buildId}/{layer}")
@GetMapping("/select/{cellId}/{buildId}")
@ApiOperation(value = "下拉选择房间名称,通过单元楼层",response = TenBuildEntity.class)
public R select(@PathVariable("cellId") Long cellId,
@PathVariable("buildId") Long buildId,
@PathVariable("layer") Integer layer){
List<TenRoomEntity> buildList = tenRoomService.getLayerRooms(layer,buildId,cellId);
@PathVariable("buildId") Long buildId){
List<TenRoomEntity> buildList = tenRoomService.getLayerRooms(buildId,cellId);
return R.ok().put("data", buildList);
}
/**
* 保存
*/
/**
* 保存
*/
@PostMapping("/save")
@RequiresPermissions("ten:room")
@ApiOperation(value = "保存小区信息")
@Transactional
public R save(@RequestBody TenRoomEntity tenRoom){
TenRoomEntity room = tenRoomService.queryByNumberAndLayer(tenRoom.getRoomNumber(),
tenRoom.getLayer(),
tenRoom.getBuildId(),
tenRoom.getCellId());
if(room!=null){
return R.error("户室已经存在");
return R.error("班级已经存在");
}
long id = new SnowflakeIdWorker().nextId();
tenRoom.setRoomId(id);
tenRoom.setTenantId(getUser().getTenantId());
tenRoom.setCreateBy(getUser().getUsername());
tenRoom.setCreateTime(new Date());
Map<String,Object> params = new HashMap<>();
params.put("operation","editClassData");
params.put("accountNumber", globalValue.accountNumber);
params.put("passKey", KeysEntity.passKey);
params.put("empowerText",KeysEntity.empowerText);
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 jsonArray = new JSONArray();
jsonArray.add(dataInfo);
params.put("dataInfo",jsonArray);
JSONObject jsonObject = opFeignClient.submitData(params);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error(jsonObject.getString("shrgMsg"));
}
tenRoomService.save(tenRoom);
return R.ok();
@ -137,10 +169,31 @@ public class TenRoomController extends AbstractController {
@PostMapping("/update")
@RequiresPermissions("ten:room")
@ApiOperation(value = "修改小区信息")
@Transactional
public R update(@RequestBody TenRoomEntity tenRoom0){
tenRoom0.setTenantId(getUser().getTenantId());
tenRoom0.setLastUpdateBy(getUser().getUsername());
tenRoom0.setLastUpdateTime(new Date());
Map<String,Object> params = new HashMap<>();
params.put("operation","editClassData");
params.put("accountNumber",globalValue.accountNumber);
params.put("passKey", KeysEntity.passKey);
params.put("empowerText",KeysEntity.empowerText);
Map<String, Object> dataInfo = new HashMap<>();
dataInfo.put("objectUuid",String.valueOf(tenRoom0.getRoomId()));
dataInfo.put("classCode",tenRoom0.getRoomNumber());
dataInfo.put("className",tenRoom0.getRoomName());
dataInfo.put("gradeCode",tenRoom0.getBuildNumber());
JSONArray jsonArray = new JSONArray();
jsonArray.add(dataInfo);
params.put("dataInfo",jsonArray);
JSONObject jsonObject = opFeignClient.submitData(params);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error("同步联系人失败");
}
if(!jsonObject.getJSONArray("errInfo").isEmpty()) {
return R.error("同步联系人失败");
}
tenRoomService.updateById(tenRoom0);
return R.ok();
@ -310,15 +363,35 @@ public class TenRoomController extends AbstractController {
@ApiImplicitParam(name="roomId",value = "户室ID",paramType = "query",dataType = "String",required = true),
@ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
})
@Transactional
public R delete(@RequestBody List<Map<String, String>> params){
//tenRoomService.removeByIds(Arrays.asList(roomIds));
JSONArray jsonArray = new JSONArray();
for(Map<String,String> param: params){
Long roomId = Long.parseLong(param.get("roomId"));
Long cellId = Long.parseLong(param.get("cellId"));
int pCount = tenPersonService.findRoomCount(cellId,roomId);
if (pCount>0) {
return R.error("当前户室有"+pCount+"个住户,请先删除完住户");
return R.error("当前班级有"+pCount+"个学生,请先删除完学生");
}
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);
}
Map<String,Object> roomParams = new HashMap<>();
roomParams.put("operation","delClassData");
roomParams.put("accountNumber",globalValue.accountNumber);
roomParams.put("passKey", KeysEntity.passKey);
roomParams.put("empowerText",KeysEntity.empowerText);
roomParams.put("dataInfo",jsonArray);
JSONObject jsonObject = opFeignClient.submitData(roomParams);
if(!jsonObject.getString("shrgStatus").equals("S")) {
return R.error("班级添加失败");
}
tenRoomService.removeByIdList(params);
return R.ok();

View File

@ -35,4 +35,5 @@ public interface TenBuildDao {
TenBuildEntity queryByNumberAndUnit(@Param("number")String number,@Param("unit")String unit,@Param("cellId")Long cellId);
TenBuildEntity queryByNameAndUnit(@Param("name")String name,@Param("unit")String unit,@Param("cellId")Long cellId);
String getBuildNumber(@Param("buildId")Long id,@Param("cellId")Long cellId);
}

View File

@ -0,0 +1,25 @@
package net.shapelight.modules.ten.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.shapelight.modules.ten.entity.TenParent;
import net.shapelight.modules.vo.ParentVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.Map;
/**
* @author zhangbo
* @description 针对表ten_parent的数据库操作Mapper
* @createDate 2024-10-23 19:53:30
* @Entity net.shapelight.modules.ten.entity.TenParent
*/
@Mapper
public interface TenParentMapper extends BaseMapper<TenParent> {
IPage<ParentVo> getParentVoList(Page page,Map<String, Object> params);
}

View File

@ -118,5 +118,12 @@ public interface TenPersonDao {
List<TenPersonEntity> findByIdCardAndDept(@Param("idCard")String idCard, @Param("deptId")Long deptId);
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);
IPage<TenPersonEntity> getByPersonIds(Page page,@Param("personIds")List<Long> personIds, @Param("cellId")Long cellId);
}

View File

@ -46,4 +46,6 @@ public interface TenRecordDao {
List<TenRecordEntity> getMonthRecords(@Param("start") String start, @Param("end") String end, @Param("tenantId") String tenantId);
IPage<TenRecordEntity> findPageDeptRecord(Page page, @Param("params") Map params);
IPage<TenRecordEntity> getByPersonIds(Page page,@Param("params")Map<String,Object> params);
}

View File

@ -0,0 +1,26 @@
package net.shapelight.modules.ten.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.shapelight.modules.ten.entity.TenRelation;
import net.shapelight.modules.vo.ParentAndStudentVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* @author zhangbo
* @description 针对表ten_relation的数据库操作Mapper
* @createDate 2024-10-23 19:09:03
* @Entity net.shapelight.modules.ten.entity.TenRelation
*/
@Mapper
public interface TenRelationMapper extends BaseMapper<TenRelation> {
String getCount(@Param("parentId") Long parentId);
IPage<ParentAndStudentVo> getAll(Page page, @Param("params") Map<String,Object> params);
}

View File

@ -33,10 +33,10 @@ public interface TenRoomDao {
@Param("buildId")Long buildId,
@Param("cellId")Long cellId);
List<TenRoomEntity> getLayerRooms(@Param("layer")Integer layer,
@Param("buildId")Long buildId,
List<TenRoomEntity> getLayerRooms(@Param("buildId")Long buildId,
@Param("cellId")Long cellId);
List<TenRoomEntity> getBuildRooms(@Param("buildId")Long buildId);

View File

@ -0,0 +1,43 @@
package net.shapelight.modules.ten.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
*
* @TableName ten_parent
*/
@Data
@TableName("ten_parent")
public class TenParent implements Serializable {
/**
*
*/
@TableId
private Long id;
/**
* 姓名
*/
private String name;
/**
* 性别
*/
private Integer gender;
/**
* 身份证号
*/
private String idCard;
/**
* 备份字段
*/
private Integer registerType;
private Long userId;
}

View File

@ -0,0 +1,50 @@
package net.shapelight.modules.ten.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName ten_relation
*/
@Data
@TableName("ten_relation")
public class TenRelation implements Serializable {
/**
*
*/
@TableId
private Long id;
/**
*
*/
private Long parentId;
/**
*
*/
private Long studentId;
/*
关系
*/
private String relation;
/*
审核状态
*/
private Integer status;
private Date createTime;
private String detail;
private Date approvalTime;
private String approval;
}

View File

@ -145,4 +145,8 @@ public class TenRoomEntity extends BaseEntity implements Serializable {
@ApiModelProperty("标准地址")
private String address;
@TableField(exist=false)
@ApiModelProperty("年级编号")
private String buildNumber;
}

View File

@ -0,0 +1,18 @@
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.TenParent;
import java.util.Map;
/**
* @author zhangbo
* @description 针对表ten_parent的数据库操作Service
* @createDate 2024-10-23 19:53:30
*/
public interface TenParentService extends IService<TenParent> {
PageUtils getParentList(Map<String,Object> params);
}

View File

@ -38,7 +38,7 @@ public interface TenPersonService {
boolean reviewByIdList(List<Map<String,String>> roomIdList);
String updateById(TenPersonEntity entity);
String updateById(TenPersonEntity entity) throws Exception;
boolean updateStatusById(TenPersonEntity entity);
void updateStatusByIds(List<TenPersonEntity> entitys);
boolean updateLabelById(TenPersonEntity entity);
@ -148,5 +148,11 @@ public interface TenPersonService {
List<TenPersonEntity> findByIdCardAndDept(String idCard,
Long deptId);
PageUtils selectBypersonIds(Map<String, Object> params);
PageUtils selectByCreateByQueryPage(Map<String, Object> params);
TenPersonEntity getByRyId(String ryId,Long cellId,String idCard);
}

View File

@ -44,5 +44,8 @@ public interface TenRecordService {
PageUtils queryPageDeptRecord(Map<String, Object> params);
PageUtils getByPersonIds(Map<String,Object> params);
}

View File

@ -0,0 +1,18 @@
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.TenRelation;
import java.util.Map;
/**
* @author zhangbo
* @description 针对表ten_relation的数据库操作Service
* @createDate 2024-10-23 19:09:03
*/
public interface TenRelationService extends IService<TenRelation> {
public PageUtils getAll(Map<String,Object> params);
}

View File

@ -33,10 +33,6 @@ public interface TenRoomService {
Long buildId,
Long cellId);
List<TenRoomEntity> getLayerRooms(Integer layer,
Long buildId,
Long cellId);
List<TenRoomEntity> getBuildRooms(Long buildId);
@ -52,5 +48,8 @@ public interface TenRoomService {
List<TenRoomEntity> getNotSync(Long paramLong);
int syncAddress(Long cellId,Integer layerFlag);
List<TenRoomEntity> getLayerRooms(Long buildId,
Long cellId);
}

View File

@ -3,6 +3,7 @@ package net.shapelight.modules.ten.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.shapelight.common.utils.Constant;
import net.shapelight.common.utils.SnowflakeIdWorker;
import net.shapelight.modules.sys.service.impl.SysDictServiceImpl;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.entity.TenRoomEntity;
import net.shapelight.modules.ten.service.TenCellService;
@ -39,6 +40,8 @@ public class TenBuildServiceImpl implements TenBuildService {
private TenCellService tenCellService;
@Autowired
private TenPersonService tenPersonService;
@Autowired
private SysDictServiceImpl sysDictService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
@ -106,7 +109,7 @@ public class TenBuildServiceImpl implements TenBuildService {
public int save(TenBuildEntity build) {
//List<TenRoomEntity> roomList =new ArrayList<>();
//生成房间
for(int layer = 1;layer<build.getLayerCount()+1;layer++){
/*for(int layer = 1;layer<build.getLayerCount()+1;layer++){
for(int rno = 1;rno < build.getRoomEach()+1;rno++){
TenRoomEntity room = new TenRoomEntity();
long id = new SnowflakeIdWorker().nextId();
@ -123,7 +126,7 @@ public class TenBuildServiceImpl implements TenBuildService {
//roomList.add(room);
tenRoomService.save(room);
}
}
}*/
int flag = tenBuildDao.insert(build);
if(flag==1){
return 0; //成功

View File

@ -0,0 +1,50 @@
package net.shapelight.modules.ten.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.modules.ten.dao.TenParentMapper;
import net.shapelight.modules.ten.entity.TenParent;
import net.shapelight.modules.ten.entity.TenRelation;
import net.shapelight.modules.ten.service.TenParentService;
import net.shapelight.modules.ten.service.TenRelationService;
import net.shapelight.modules.vo.ParentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @author zhangbo
* @description 针对表ten_parent的数据库操作Service实现
* @createDate 2024-10-23 19:53:30
*/
@Service
public class TenParentServiceImpl extends ServiceImpl<TenParentMapper, TenParent>
implements TenParentService{
@Autowired
TenParentMapper parentMapper;
@Autowired
TenRelationService relationService;
@Override
public PageUtils getParentList(Map<String, Object> params) {
Page pageParam = new Page();
pageParam.setCurrent(Long.parseLong((String) params.get("page")));
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()));
item.setCount(count);
});
return new PageUtils(page);
}
}

View File

@ -2,6 +2,8 @@ package net.shapelight.modules.ten.service.impl;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.metadata.Sheet;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.minio.MinioClient;
import io.minio.PutObjectOptions;
@ -16,11 +18,16 @@ 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.job.entity.KeysEntity;
import net.shapelight.modules.nettyapi.service.ServerApiService;
import net.shapelight.modules.sys.entity.SysDictEntity;
import net.shapelight.modules.sys.service.impl.SysDictServiceImpl;
import net.shapelight.modules.ten.entity.*;
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;
@ -29,6 +36,8 @@ 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;
@ -86,6 +95,17 @@ public class TenPersonServiceImpl implements TenPersonService {
private TenPersonExtractService tenPersonExtractService;
@Autowired
private TenCellDeptService tenCellDeptService;
@Autowired
private TenRelationService relationService;
@Qualifier("net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient")
@Autowired
private OpFeignClient opFeignClient;
@Autowired
private SysDictServiceImpl sysDictService;
@Value("${global.minio.endpoint}")
private String imagBaseUrl;
@Value("${global.minio.bucketName}")
private String bucketName;
@Override
@ -272,7 +292,7 @@ public class TenPersonServiceImpl implements TenPersonService {
String tempFaceFilePath = tempPath + tempFaceFileName;
String osName = System.getProperty("os.name");//获取指定键即os.name的系统属性,Windows 7
if (!Pattern.matches("Windows.*", osName)) {
if (Pattern.matches("Windows.*", osName)) {
// if (Pattern.matches("Windows.*", osName)) {
int res = PicSDK.getFace(tempOrgFilePath, tempFaceFilePath);
if (res != 0) {
@ -479,6 +499,37 @@ public class TenPersonServiceImpl implements TenPersonService {
serverApiService.personOperation(dev.getSn(), list);
}
}
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<>();
personParams.put("operation","editUserData");
personParams.put("accountNumber",globalValue.accountNumber);
personParams.put("passKey", KeysEntity.passKey);
personParams.put("empowerText",KeysEntity.empowerText);
JSONArray jsonArray = new JSONArray();
Map<String,Object> student = new HashMap<>();
student.put("objectUuid",String.valueOf(entity.getPersonId()));
student.put("userCode",entity.getRyid());
student.put("userName",entity.getName());
student.put("userType",optypeMap.get(entity.getLabelName()));
student.put("studentType","0"+entity.getLabelId());
student.put("gender",entity.getGender()==0?"WOMAN":"MAN");
student.put("cardNumber","");
student.put("idCard",entity.getIdCard());
student.put("fileUrl",imagBaseUrl+"/"+bucketName+"/"+entity.getOrgImage());
student.put("fileName",entity.getOrgImage().substring(entity.getOrgImage().lastIndexOf("/")));
jsonArray.add(student);
personParams.put("dataInfo",jsonArray);
JSONObject jsonObject = opFeignClient.submitData(personParams);
if(!jsonObject.getString("shrgStatus").equals("S")) {
log.error(jsonObject.toJSONString());
}
if(!jsonObject.getJSONArray("errInfo").isEmpty()) {
log.error(jsonObject.toJSONString());
}
return 0;
}
return 1;
@ -923,7 +974,7 @@ public class TenPersonServiceImpl implements TenPersonService {
@Override
@CacheEvict(value = "TenPerson", key = "#entity.personId+'-'+#entity.cellId")
public String updateById(TenPersonEntity entity) {
public String updateById(TenPersonEntity entity) throws SyncFailedException {
if (entity.getUsername() != null && entity.getUsername().isEmpty()) {
entity.setUsername(null);
}
@ -1378,6 +1429,37 @@ public class TenPersonServiceImpl implements TenPersonService {
// for (TenDeviceVo dev : devList) {
// CmdProcess.publishPersonChange(dev.getSn());
// }
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<>();
personParams.put("operation","editUserData");
personParams.put("accountNumber",globalValue.accountNumber);
personParams.put("passKey", KeysEntity.passKey);
personParams.put("empowerText",KeysEntity.empowerText);
JSONArray jsonArray = new JSONArray();
Map<String,Object> student = new HashMap<>();
student.put("objectUuid",String.valueOf(entity.getPersonId()));
student.put("userCode",entity.getRyid());
student.put("userName",entity.getName());
student.put("userType",optypeMap.get(entity.getLabelName()));
student.put("studentType","0"+entity.getPersonType());
student.put("gender",entity.getGender()==0?"WOMAN":"MAN");
student.put("cardNumber","");
student.put("idCard",entity.getIdCard());
student.put("fileUrl",imagBaseUrl+"/"+bucketName+"/"+entity.getOrgImage());
student.put("fileName",entity.getOrgImage().substring(entity.getOrgImage().lastIndexOf("//")));
jsonArray.add(student);
personParams.put("dataInfo",jsonArray);
JSONObject jsonObject = opFeignClient.submitData(personParams);
if(!jsonObject.getString("shrgStatus").equals("S")) {
new SyncFailedException(entity.getPersonId()+","+entity.getName()+"青桔同步失败");
}
if(jsonObject.getJSONArray("errInfo")!=null && !jsonObject.getJSONArray("errInfo").isEmpty()) {
new SyncFailedException(entity.getPersonId()+","+entity.getName()+"青桔同步失败");
}
return "OK";
@ -2416,4 +2498,33 @@ public class TenPersonServiceImpl implements TenPersonService {
public List<TenPersonEntity> findByIdCardAndDept(String idCard, Long deptId) {
return tenPersonDao.findByIdCardAndDept(idCard,deptId);
}
public PageUtils selectByCreateByQueryPage(Map<String, Object> params) {
String createBy = (String) params.get("createBy");
Long cellId = Long.parseLong((String) params.get("cellId"));
String key = (String) params.get("key");
Page pageParam = new Page();
pageParam.setCurrent(Long.parseLong((String) params.get("page")));
pageParam.setSize(Long.parseLong((String) params.get("limit")));
IPage<TenPersonEntity> page = tenPersonDao.selectByCreateBy(pageParam, createBy, cellId, key,params.get("status").toString());
return new PageUtils(page);
}
@Override
public TenPersonEntity getByRyId(String ryId,Long cellId,String idCard) {
TenPersonEntity entity = tenPersonDao.findByRyId(ryId,cellId,idCard);
return entity;
}
public PageUtils selectBypersonIds(Map<String, Object> params) {
Page pageParam = new Page();
pageParam.setCurrent(Long.parseLong((String) params.get("page")));
pageParam.setSize(Long.parseLong((String) params.get("limit")));
List<Long> list = (List<Long>) params.get("personIds");
Long cellId = Long.parseLong(params.get("cellId").toString());
IPage<TenPersonEntity> page = tenPersonDao.getByPersonIds(pageParam, list,cellId);
return new PageUtils(page);
}
}

View File

@ -475,4 +475,15 @@ public class TenRecordServiceImpl implements TenRecordService {
}
return new PageUtils(page);
}
@Override
public PageUtils getByPersonIds(Map<String, Object> params) {
Page pageParam = new Page();
pageParam.setCurrent(Long.parseLong((String) params.get("page")));
pageParam.setSize(Long.parseLong((String) params.get("limit")));
List<Long> list = (List<Long>) params.get("personIds");
Long cellId = Long.parseLong(params.get("cellId").toString());
IPage page = tenRecordDao.getByPersonIds(pageParam,params);
return new PageUtils(page);
}
}

View File

@ -0,0 +1,36 @@
package net.shapelight.modules.ten.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.modules.ten.dao.TenRelationMapper;
import net.shapelight.modules.ten.entity.TenRelation;
import net.shapelight.modules.ten.service.TenRelationService;
import net.shapelight.modules.vo.ParentAndStudentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @author zhangbo
* @description 针对表ten_relation的数据库操作Service实现
* @createDate 2024-10-23 19:09:03
*/
@Service
public class TenRelationServiceImpl extends ServiceImpl<TenRelationMapper, TenRelation>
implements TenRelationService{
@Autowired
TenRelationMapper mapper;
@Override
public PageUtils getAll(Map<String,Object> params) {
Page pageParam = new Page();
pageParam.setCurrent(Long.parseLong((String) params.get("page")));
pageParam.setSize(Long.parseLong((String) params.get("limit")));
IPage<ParentAndStudentVo> page = mapper.getAll(pageParam,params);
return new PageUtils(page);
}
}

View File

@ -5,12 +5,15 @@ import net.shapelight.modules.ten.entity.TenAddressEntity;
import net.shapelight.modules.ten.entity.TenBuildEntity;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -36,6 +39,8 @@ public class TenRoomServiceImpl implements TenRoomService {
private TenAddressService tenAddressService;
@Autowired
private TenBuildService tenBuildService;
@Autowired
OpFeignClient opFeignClient;
@Override
public PageUtils queryPage(Map<String, Object> params) {
@ -163,8 +168,8 @@ public class TenRoomServiceImpl implements TenRoomService {
}
@Override
public List<TenRoomEntity> getLayerRooms(Integer layer, Long buildId, Long cellId) {
return tenRoomDao.getLayerRooms(layer, buildId, cellId);
public List<TenRoomEntity> getLayerRooms(Long buildId, Long cellId) {
return tenRoomDao.getLayerRooms(buildId, cellId);
}
@Override

View File

@ -0,0 +1,38 @@
package net.shapelight.modules.tripartitePlatform.operatorPlatform;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.modules.job.entity.KeysEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
/**
* 青桔数据同步
*/
@Component
@Slf4j
public class DataSync {
@Autowired
OpFeignClient opFeignClient;
@Value("${global.qingju.accountNumber}")
public String accountNumber;
@Value("${global.qingju.empowerKey}")
String empowerKey;
@PostConstruct
public void init(){
Map<String,Object> params = new HashMap<>();
params.put("accountNumber", accountNumber);
params.put("empowerKey", empowerKey);
JSONObject json = opFeignClient.empower(params);
if(json.getString("shrgStatus").equals("S")) {
KeysEntity.passKey = json.getString("passKey");
KeysEntity.empowerText = json.getString("empowerText");
}
}
}

View File

@ -0,0 +1,34 @@
package net.shapelight.modules.tripartitePlatform.operatorPlatform;
import com.alibaba.fastjson.JSONObject;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.config.OpFeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.PostConstruct;
import java.util.Map;
/*
* name 指定调用rest接口对应服务名
* path 指定调用接口所在Controller的@RequestMapping对应路径没有则不填
* 青桔话务平台
*/
@FeignClient(name = "operator-service", url = "${global.qingju.url}",configuration = OpFeignConfig.class)
@Component
public interface OpFeignClient {
/**
* 获取密钥 1800s
* @return
*/
@PostConstruct
@PostMapping("/empower")
JSONObject empower(@RequestBody Map<String,Object> params);
@PostMapping("/submitData")
JSONObject submitData(@RequestBody Map<String,Object> params);
}

View File

@ -0,0 +1,17 @@
package net.shapelight.modules.tripartitePlatform.operatorPlatform;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.modules.job.entity.KeysEntity;
@Slf4j
public class OpFeignInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate requestTemplate) {
requestTemplate.header("passKey", KeysEntity.passKey);
requestTemplate.header("empowerText", KeysEntity.empowerText);
log.info("feign拦截器");
}
}

View File

@ -0,0 +1,30 @@
package net.shapelight.modules.tripartitePlatform.operatorPlatform;
import com.alibaba.fastjson.JSONObject;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class OpHystrix implements FallbackFactory<OpFeignClient> {
@Override
public OpFeignClient create(Throwable throwable) {
return new OpFeignClient() {
@Override
public JSONObject empower(Map<String, Object> params) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("errormsg","获取密钥失败");
return jsonObject;
}
@Override
public JSONObject submitData(Map<String, Object> params) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("errormsg",params.get("operation")+"失败");
return jsonObject;
}
};
}
}

View File

@ -0,0 +1,27 @@
package net.shapelight.modules.tripartitePlatform.operatorPlatform.config;
import feign.Logger;
import feign.Request;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class OpFeignConfig {
@Bean
public Logger.Level feignLogerLevel(){
return Logger.Level.FULL;
}
@Bean
public Request.Options options(){
return new Request.Options(5000,10000);
}
// 注入自定义feign拦截器
@Bean
public OpFeignInterceptor opFeignInterceptor(){
return new OpFeignInterceptor();
}
}

View File

@ -0,0 +1,41 @@
package net.shapelight.modules.vo;
import lombok.Data;
import java.util.Date;
@Data
public class ParentAndStudentVo {
private String id;
private String parentName;
private Integer parentGender;
private String relation;
private String parentMobile;
private String personId;
private String studentName;
private String studentNumber;
private Integer studentGender;
private String roomName;
private Integer status;
private Date bindTime;
private String faceImage;
private Date approvalTime;
private String approval;
}

View File

@ -0,0 +1,23 @@
package net.shapelight.modules.vo;
import lombok.Data;
@Data
public class ParentVo {
private Long id;
private String name;
private String gender;
private Integer count;
private String mobile;
private String idCard;
private String registerType;
private String userId;
}

View File

@ -3,7 +3,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.10.20:3306/cell_db_v10_pv_jd?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&rewriteBatchedStatements=true
url: jdbc:mysql://192.168.10.20:3306/cell_db_v11?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&rewriteBatchedStatements=true
username: user
password: user@server001
# url: jdbc:mysql://39.96.9.232:3306/cell_db_v8_http?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&rewriteBatchedStatements=true

View File

@ -83,19 +83,20 @@ global:
db_password: root
db_host: localhost
db_port: 3306
minio:
endpoint: http://192.168.10.20:9000
port: 9000
accessKey: admin
secretKey: admin@C501
bucketName: cell
path: /root/minio/data/cell
# minio:
# endpoint: https://c.xitu3d.com:19000
# port: 19000
# accessKey: 7885444af42e4b30c518c5be17c8850b
# secretKey: 0fad3477fb9f60c7be75561db967e8d7
# endpoint: http://192.168.10.20:9000
# port: 9000
# accessKey: admin
# secretKey: admin@C501
# bucketName: cell
# path: /root/minio/data/cell
minio:
endpoint: https://c.xitu3d.com:19000
port: 19000
accessKey: 7885444af42e4b30c518c5be17c8850b
secretKey: 0fad3477fb9f60c7be75561db967e8d7
bucketName: school
path: /root/minio/data/cell
device:
appId: 8e9b941923abd
appSecret: Mjk0ODIxOTcwMTQ0NjkwNzA1NDE0MzcyNjgxMTQ0MDc0MjE
@ -112,6 +113,10 @@ global:
app:
key: 9894480ac52e4
secret: Mjk0ODUzNzA2Mzk3NzEzMjU2OTIwOTk1NzUzMDI5MTQwNDI
qingju:
url: http://api.xstongchuang.com/dataApiV1
accountNumber: S0001
empowerKey: oRAZd58WkmAx4oQUU4gqU_aYG_e0
shapelight:
cluster: false #集群配置 true集群环境 false单机环境还需打开pom.xml里的spring-session-data-redis注释

View File

@ -330,6 +330,11 @@
</if>
</select>
<select id="getBuildNumber" resultType="string">
select number from ten_build
where build_id = #{buildId}
</select>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="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"/>
<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="mobile" column="mobile" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
id,name,
gender,id_card,register_type
</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
<if test="params.name != null and params.name!=''">
and t.name = #{params.name}
</if>
<if test="params.mobile != null and params.mobile!=''">
and t.mobile = #{params.mobile}
</if>
</select>
</mapper>

View File

@ -1301,10 +1301,37 @@
<select id="findByIdCardAndDept" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where dept_id = #{deptId} and delete_flag = 0
select * from ten_person where delete_flag = 0
and id_card = #{idCard}
</select>
<select id="selectByCreateBy" resultMap="BaseResultMap">
select p.* from ten_person p where p.delete_flag = 0 and create_by = #{createBy}
<if test="key != null and key!=''">
and (p.name like CONCAT('%', '${key}', '%')
or p.mobile like CONCAT('%', '${key}', '%'))
</if>
<if test="status != null and status!='' and status == 0">
and p.status = #{status}
</if>
<if test="status != null and status!='' and status != 0">
and p.status != 0
</if>
</select>
<select id="findByRyId" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where ryid = #{ryId} and id_card = #{idCard}
</select>
<select id="getByPersonIds" resultMap="BaseResultMap">
select * from ten_person
where delete_flag = 0 and person_id in
<foreach item="personId" collection="personIds" open="(" separator="," close=")">
#{personId}
</foreach>
</select>
</mapper>

View File

@ -638,6 +638,19 @@
</select>
<select id="getByPersonIds" resultMap="tenRecordMap">
select * from
(select * from ten_record_${cellId}
where delete_flag = 0 and person_id in
<foreach item="params.personId" collection="params.personIds" open="(" separator="," close=")">
#{personId}
</foreach>) a where 1=1
<if test="params.name != null and params.name != ''">
and a.name like CONCAT('%', '${params.name}', '%')
</if>
</select>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.shapelight.modules.ten.dao.TenRelationMapper">
<resultMap id="BaseResultMap" type="net.shapelight.modules.ten.entity.TenRelation">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="parentId" column="parent_id" jdbcType="BIGINT"/>
<result property="studentId" column="student_id" jdbcType="BIGINT"/>
<result property="relation" column="relation" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="TINYINT"/>
<result property="createTime" column="create_time" jdbcType="DATE"/>
<result property="detail" column="detail" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="BaseVoMap" type="net.shapelight.modules.vo.ParentAndStudentVo">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="parentName" column="name" jdbcType="VARCHAR"/>
<result property="parentGender" column="gender" jdbcType="INTEGER"/>
<result property="relation" column="relation" jdbcType="VARCHAR"/>
<result property="parentMobile" column="mobile" jdbcType="VARCHAR"/>
<result property="personId" column="student_id" jdbcType="BIGINT"/>
<result property="studentName" column="studentName" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="TINYINT"/>
</resultMap>
<sql id="Base_Column_List">
id
,parent_id,student_id,relation,status,create_time,detail
</sql>
<select id="getCount" resultType="java.lang.String">
select count(1)
from ten_relation
where parent_id = #{parentId}
</select>
<select id="getAll" resultType="net.shapelight.modules.vo.ParentAndStudentVo">
SELECT
t.id,
f.NAME AS parentName,
f.gender AS parentGender,
t.relation,
a.mobile AS parentMobile,
t.student_id AS personId,
p.NAME AS studentName,
p.ryid AS studentNumber,
p.gender AS studentGender,
r.room_name,
t.status,
t.create_time as bindTime,
p.face_image,
t.approval_time,
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_person p ON t.student_id = p.person_id
left join ten_room r on p.room_id = r.room_id
where 1=1
<if test="params.name!=null and params.name!=''">
and f.name = #{params.name}
</if>
<if test="params.idCard!=null and params.idCard!=''">
and f.id_card = #{params.idCard}
</if>
<if test="params.mobile!=null and params.mobile!=''">
and a.mobile = #{params.mobile}
</if>
<if test="params.status!=null and params.status!='' and params.status == 2">
and t.status = 2
</if>
<if test="params.status!=null and params.status!='' and params.status != 2">
and t.status != 2
</if>
</select>
</mapper>

View File

@ -42,6 +42,10 @@
select="net.shapelight.modules.ten.dao.TenCellDao.getCellName"
column="cellId=cell_id">
</association>
<association property="buildNumber" javaType="String"
select="net.shapelight.modules.ten.dao.TenBuildDao.getBuildNumber"
column="buildId=build_id,cellId=cell_id">
</association>
</resultMap>
<insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenRoomEntity">
@ -405,7 +409,7 @@
<select id="getLayerRooms" resultType="net.shapelight.modules.ten.entity.TenRoomEntity">
select * from ten_room where delete_flag = 0
and build_id = #{buildId} and layer = #{layer}
and build_id = #{buildId}
</select>
<select id="getBuildRooms" resultType="net.shapelight.modules.ten.entity.TenRoomEntity">