智慧校园联系人管理

This commit is contained in:
张博 2024-11-18 17:03:34 +08:00
parent 82d00f1c5b
commit 4ad55b92a4
12 changed files with 75 additions and 253 deletions

View File

@ -5,7 +5,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Snowflake {
}

View File

@ -1,30 +0,0 @@
package net.shapelight.common.aspect;
import net.shapelight.common.utils.SnowflakeIdWorker;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@Aspect
public class SnowflakeAspect {
@Around("@annotation(net.shapelight.common.annotation.Snowflake)")
public Object generateSnowflakeId(ProceedingJoinPoint joinPoint) throws Throwable {
// 生成Snowflake ID
SnowflakeIdWorker snowflakeIdWorker = new SnowflakeIdWorker();
long snowflakeId = snowflakeIdWorker.nextId();
// 修改方法参数或者返回值来设置Snowflake ID
Object[] args = joinPoint.getArgs();
if (args != null && args.length > 0) {
// 假设第一个参数是传递Snowflake ID的参数
args[0] = snowflakeId;
}
// 继续执行原方法并且可以返回修改后的结果
return joinPoint.proceed(args);
}
}

View File

@ -40,7 +40,7 @@ public class MybatisPlusConfig {
DynamicTableNameInnerInterceptor dynamicTableNameInnerInterceptor = new DynamicTableNameInnerInterceptor();
dynamicTableNameInnerInterceptor.setTableNameHandler(
//可以传多个表名参数指定哪些表使用MonthTableNameHandler处理表名称
new CustomizeTableNameHandler("ten_person_extract,mobile_device,mobile_package_order,mobile_call_logs")
new CustomizeTableNameHandler("ten_person_extract,mobile_device,mobile_package_order,mobile_call_logs,mobile_contact")
);
//以拦截器的方式处理表名称

View File

@ -10,7 +10,7 @@ import java.util.List;
*/
public class CustomizeTableNameHandler implements TableNameHandler {
//用于记录哪些表可以使用该月份动态表名处理器即哪些表可以分表
private List<String> tableNames;
private final List<String> tableNames;
//构造函数构造动态表名处理器的时候传递tableNames参数
public CustomizeTableNameHandler(String ...tableNames) {
@ -39,4 +39,5 @@ public class CustomizeTableNameHandler implements TableNameHandler {
return tableName; //表名原样返回
}
}
}

View File

@ -0,0 +1,16 @@
package net.shapelight.common.handler;
import net.shapelight.common.utils.SnowflakeIdWorker;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Invocation;
public class SnowflakeHandler implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
SnowflakeIdWorker snowflakeIdWorker = new SnowflakeIdWorker();
Object target = invocation.getTarget();
// 检查字段并生成 ID 的逻辑...
target = snowflakeIdWorker.nextId();
return invocation.proceed();
}
}

View File

@ -14,8 +14,8 @@ public class OpFeignInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate requestTemplate) {
requestTemplate.header("access_token", redisUtils.get("wxToken").toString());
//requestTemplate.header("empowerText", KeysEntity.empowerText);
//requestTemplate.header("access_token", redisUtils.get("wxToken").toString());
requestTemplate.header("empowerText", KeysEntity.empowerText);
log.info("feign拦截器");
}
}

View File

@ -29,44 +29,7 @@ public class OpHystrix implements FallbackFactory<OpFeignClient> {
}
@Override
public JSONObject getToken(Map<String, Object> params) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("errorMessage","token获取失败");
return jsonObject;
}
@Override
public JSONObject createIotGroupId(Map<String, Object> params) {
return null;
}
@Override
public JSONObject removeIotGroupDevice(Map<String, Object> params) {
return null;
}
@Override
public JSONObject addIotGroupDevice(Map<String, Object> params) {
return null;
}
@Override
public JSONObject getIotGroupInfo(Map<String, Object> params) {
return null;
}
@Override
public JSONObject activeLicenseDevice(Map<String, Object> params) {
return null;
}
@Override
public JSONObject getLicenseDeviceInfo(Map<String, Object> params) {
return null;
}
@Override
public JSONObject createOrder(Map<String, Object> params) {
public JSONObject getData(Map<String, Object> params) {
return null;
}
};

View File

@ -5,19 +5,22 @@ import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.shapelight.common.annotation.Snowflake;
import org.hibernate.validator.constraints.Length;
/**
*
* @TableName mobile_contact
*/
@Data
@ApiModel("联系人信息")
@TableName("mobile_contact")
@ApiModel("联系人信息")
@Data
public class MobileContact implements Serializable {
/**
@ -25,14 +28,15 @@ public class MobileContact implements Serializable {
*/
@NotNull(message="[联系人ID]不能为空")
@ApiModelProperty("联系人ID")
@Snowflake
private Long contactId;
/**
* 联系人姓名
* 联系人称呼
*/
@Size(max= 20,message="编码长度不能超过20")
@ApiModelProperty("联系人姓名")
@ApiModelProperty("联系人称呼")
@Length(max= 20,message="编码长度不能超过20")
private String name;
private String callName;
/**
* 联系人电话
*/
@ -49,7 +53,7 @@ public class MobileContact implements Serializable {
* 排序字段
*/
@ApiModelProperty("排序字段")
private Integer order;
private Integer sort;
/**
* 家长ID
*/
@ -60,5 +64,15 @@ public class MobileContact implements Serializable {
*/
@ApiModelProperty("绑定状态")
private Integer bindStatus;
/**
* 是否主联系人
*/
@ApiModelProperty("是否主联系人")
private Integer isMain;
/**
* 绑定时间
*/
@ApiModelProperty("绑定时间")
private Date bindTime;
}

View File

@ -86,173 +86,4 @@ public class MobilePackageOrder implements Serializable {
@ApiModelProperty("到期时间")
private Date expireTime;
/**
* 订单ID
*/
private void setOrderId(Long orderId){
this.orderId = orderId;
}
/**
* 学生ID
*/
private void setPersonId(Long personId){
this.personId = personId;
}
/**
* 套餐ID
*/
private void setPackageId(Long packageId){
this.packageId = packageId;
}
/**
* 支付金额
*/
private void setPayment(BigDecimal payment){
this.payment = payment;
}
/**
* 付款时间
*/
private void setPayTime(Date payTime){
this.payTime = payTime;
}
/**
* 支付状态(1已支付0未支付)
*/
private void setPayStatus(Integer payStatus){
this.payStatus = payStatus;
}
/**
* 生效时间
*/
private void setEffectiveDate(Date effectiveDate){
this.effectiveDate = effectiveDate;
}
/**
* 剩余时长
*/
private void setRemainderTime(Integer remainderTime){
this.remainderTime = remainderTime;
}
/**
* 剩余次数
*/
private void setRemainderCount(Integer remainderCount){
this.remainderCount = remainderCount;
}
/**
* 生效状态
*/
private void setStatus(Integer status){
this.status = status;
}
/**
* 学生姓名
*/
private void setPersonName(String personName){
this.personName = personName;
}
/**
* 到期时间
*/
private void setExpireTime(Date expireTime){
this.expireTime = expireTime;
}
/**
* 订单ID
*/
private Long getOrderId(){
return this.orderId;
}
/**
* 学生ID
*/
private Long getPersonId(){
return this.personId;
}
/**
* 套餐ID
*/
private Long getPackageId(){
return this.packageId;
}
/**
* 支付金额
*/
private BigDecimal getPayment(){
return this.payment;
}
/**
* 付款时间
*/
private Date getPayTime(){
return this.payTime;
}
/**
* 支付状态(1已支付0未支付)
*/
private Integer getPayStatus(){
return this.payStatus;
}
/**
* 生效时间
*/
private Date getEffectiveDate(){
return this.effectiveDate;
}
/**
* 剩余时长
*/
private Integer getRemainderTime(){
return this.remainderTime;
}
/**
* 剩余次数
*/
private Integer getRemainderCount(){
return this.remainderCount;
}
/**
* 生效状态
*/
private Integer getStatus(){
return this.status;
}
/**
* 学生姓名
*/
private String getPersonName(){
return this.personName;
}
/**
* 到期时间
*/
private Date getExpireTime(){
return this.expireTime;
}
}

View File

@ -2,13 +2,15 @@ package net.shapelight.modules.mobile.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.mobile.entity.MobileContact;
import org.apache.ibatis.annotations.Mapper;
/**
* @author zhangbo
* @description 针对表mobile_contact的数据库操作Mapper
* @createDate 2024-11-18 13:29:24
* @Entity net.shapelight.modules.mobile.entity.MobileContact
* @createDate 2024-11-18 16:03:51
* @Entity net.shapelight.modules.mobile.MobileContact
*/
@Mapper
public interface MobileContactMapper extends BaseMapper<MobileContact> {
}

View File

@ -37,7 +37,6 @@ import net.shapelight.modules.fegin.OpFeignClient;
import net.shapelight.modules.vo.*;
import org.apache.commons.codec.digest.DigestUtils;
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.Cacheable;
@ -161,6 +160,9 @@ public class TenPersonServiceImpl implements TenPersonService {
new QueryWrapper<TenPersonExtractEntity>()
.eq("person_id", personEntity.getPersonId())
);
List<MobileContact> mobileContacts = mobileContactService.list(new LambdaQueryWrapper<MobileContact>().eq(MobileContact::getPersonId,personEntity.getPersonId()));
CustomizeTableNameHandler.removeData();
personEntity.setMobileContactList(mobileContacts);
if (extracts != null) {
personEntity.setExtractCount(extracts.size());
personEntity.setExtractList(extracts);
@ -177,7 +179,6 @@ public class TenPersonServiceImpl implements TenPersonService {
personEntity.setDeptAllName(deptAllName);
}
}
CustomizeTableNameHandler.removeData();
}
return new PageUtils(page);
}
@ -471,7 +472,7 @@ public class TenPersonServiceImpl implements TenPersonService {
appUserService.updateById(appUser);
}
if (entity.getPersonType().equals(Constant.PERSON_TYPE_OWNER)) {
mobileContactService.saveBatch(entity.getMobileContactList());
}
//发送设备通知

View File

@ -0,0 +1,24 @@
<?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.mobile.mapper.MobileContactMapper">
<resultMap id="BaseResultMap" type="net.shapelight.modules.mobile.entity.MobileContact">
<id property="contactId" column="contact_id" jdbcType="BIGINT"/>
<result property="callName" column="call_name" jdbcType="VARCHAR"/>
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
<result property="personId" column="person_id" jdbcType="BIGINT"/>
<result property="sort" column="sort" jdbcType="INTEGER"/>
<result property="parentId" column="parent_id" jdbcType="BIGINT"/>
<result property="bindStatus" column="bind_status" jdbcType="TINYINT"/>
<result property="isMain" column="is_main" jdbcType="TINYINT"/>
<result property="bindTime" column="bind_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
contact_id,call_name,mobile,
person_id,sort,parent_id,
bind_status,is_main,bind_time
</sql>
</mapper>