|
@@ -6,14 +6,14 @@ import com.xhkjedu.suser.config.ConfigKey;
|
6
|
6
|
import com.xhkjedu.suser.mapper.gradeclass.ClassMapper;
|
7
|
7
|
import com.xhkjedu.suser.mapper.gradeclass.ClassTeacherMapper;
|
8
|
8
|
import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
|
9
|
|
-import com.xhkjedu.suser.mapper.subjectbook.TeacherPowersbMapper;
|
10
|
9
|
import com.xhkjedu.suser.mapper.system.MsgMapper;
|
11
|
|
-import com.xhkjedu.suser.mapper.system.UserLogMapper;
|
|
10
|
+import com.xhkjedu.suser.mapper.system.UserComponentMapper;
|
12
|
11
|
import com.xhkjedu.suser.mapper.system.UserMapper;
|
13
|
12
|
import com.xhkjedu.suser.mapper.system.UserUsecretMapper;
|
14
|
13
|
import com.xhkjedu.suser.model.gradeclass.TClassTeacher;
|
15
|
14
|
import com.xhkjedu.suser.model.system.TMsg;
|
16
|
15
|
import com.xhkjedu.suser.model.system.TUser;
|
|
16
|
+import com.xhkjedu.suser.model.system.TUserComponent;
|
17
|
17
|
import com.xhkjedu.suser.model.system.TUserUsecret;
|
18
|
18
|
import com.xhkjedu.suser.utils.PoiUtils;
|
19
|
19
|
import com.xhkjedu.suser.utils.SMSSender;
|
|
@@ -62,9 +62,7 @@ public class UserService extends JedisUtil {
|
62
|
62
|
@Resource
|
63
|
63
|
private UserUsecretMapper userUsecretMapper;
|
64
|
64
|
@Resource
|
65
|
|
- private TeacherPowersbMapper teacherPowersbMapper;
|
66
|
|
- @Resource
|
67
|
|
- private UserLogMapper userLogMapper;
|
|
65
|
+ private UserComponentMapper userComponentMapper;
|
68
|
66
|
|
69
|
67
|
/**
|
70
|
68
|
* 添加用户信息
|
|
@@ -74,6 +72,7 @@ public class UserService extends JedisUtil {
|
74
|
72
|
* @Author ywx
|
75
|
73
|
* @Date 2020/6/2 9:45
|
76
|
74
|
**/
|
|
75
|
+ @Transactional(rollbackFor = Exception.class)
|
77
|
76
|
public ResultVo save(TUser user) {
|
78
|
77
|
Integer schoolid = user.getSchoolid();
|
79
|
78
|
Integer usernum = schoolMapper.getUserNumById(schoolid);
|
|
@@ -108,7 +107,25 @@ public class UserService extends JedisUtil {
|
108
|
107
|
user.setErrornum(0);
|
109
|
108
|
user.setLoginname(N_Utils.strTrim(user.getLoginname()));
|
110
|
109
|
userMapper.insertUseGeneratedKeys(user);
|
111
|
|
- return new ResultVo(0, "保存成功", user.getId());
|
|
110
|
+ Integer userid = user.getId();
|
|
111
|
+ if(user.getUsertype() == 1){
|
|
112
|
+ List<TUserComponent> initComponents = UserUtil.listInitComponents();
|
|
113
|
+ List<TUserComponent> saveComponents = new ArrayList<>();
|
|
114
|
+ Integer timestamp = N_Utils.getSecondTimestamp();
|
|
115
|
+ for (TUserComponent userComponent : initComponents) {
|
|
116
|
+ TUserComponent sc = new TUserComponent();
|
|
117
|
+ sc.setUserid(userid);
|
|
118
|
+ sc.setCcode(userComponent.getCcode());
|
|
119
|
+ sc.setCwidth(userComponent.getCwidth());
|
|
120
|
+ sc.setCheight(userComponent.getCheight());
|
|
121
|
+ sc.setCorder(userComponent.getCorder());
|
|
122
|
+ sc.setCreatetime(timestamp);
|
|
123
|
+ saveComponents.add(sc);
|
|
124
|
+ }
|
|
125
|
+ userComponentMapper.insertList(saveComponents);
|
|
126
|
+ }
|
|
127
|
+
|
|
128
|
+ return new ResultVo(0, "保存成功", userid);
|
112
|
129
|
}
|
113
|
130
|
|
114
|
131
|
/**
|
|
@@ -435,7 +452,23 @@ public class UserService extends JedisUtil {
|
435
|
452
|
user.setUserlock(0);
|
436
|
453
|
user.setErrornum(0);
|
437
|
454
|
userMapper.insertUseGeneratedKeys(user);
|
438
|
|
- //teacherList.add(user);
|
|
455
|
+ int timestamp = N_Utils.getSecondTimestamp();
|
|
456
|
+ userid = user.getId();
|
|
457
|
+
|
|
458
|
+ //初始化首页组件
|
|
459
|
+ List<TUserComponent> initComponents = UserUtil.listInitComponents();
|
|
460
|
+ List<TUserComponent> saveComponents = new ArrayList<>();
|
|
461
|
+ for(TUserComponent userComponent : initComponents){
|
|
462
|
+ TUserComponent sc = new TUserComponent();
|
|
463
|
+ sc.setUserid(userid);
|
|
464
|
+ sc.setCcode(userComponent.getCcode());
|
|
465
|
+ sc.setCwidth(userComponent.getCwidth());
|
|
466
|
+ sc.setCheight(userComponent.getCheight());
|
|
467
|
+ sc.setCorder(userComponent.getCorder());
|
|
468
|
+ sc.setCreatetime(timestamp);
|
|
469
|
+ saveComponents.add(sc);
|
|
470
|
+ }
|
|
471
|
+ userComponentMapper.insertList(saveComponents);
|
439
|
472
|
|
440
|
473
|
//处理用户班级
|
441
|
474
|
Integer grageid = user.getGrageid();
|
|
@@ -443,8 +476,7 @@ public class UserService extends JedisUtil {
|
443
|
476
|
List<Integer> classids = user.getClassids();
|
444
|
477
|
if (N_Utils.isListEmpty(classids)) return new AsyncResult<>(true);
|
445
|
478
|
|
446
|
|
- userid = user.getId();
|
447
|
|
- int timestamp = N_Utils.getSecondTimestamp();
|
|
479
|
+
|
448
|
480
|
for (Integer classid : classids) {
|
449
|
481
|
TClassTeacher ct = new TClassTeacher();
|
450
|
482
|
ct.setTeacherid(userid);
|
|
@@ -454,6 +486,7 @@ public class UserService extends JedisUtil {
|
454
|
486
|
ct.setCreatetime(timestamp);
|
455
|
487
|
ctlst.add(ct);
|
456
|
488
|
}
|
|
489
|
+
|
457
|
490
|
} else {
|
458
|
491
|
if (schoolid != u.getSchoolid()) {
|
459
|
492
|
usersExisted.add(u);
|