|
|
@@ -7,7 +7,13 @@ import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.ruoyi.common.constant.Constants;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
+import com.ruoyi.framework.web.service.SysLoginService;
|
|
|
+import com.ruoyi.system.domain.SysUserRole;
|
|
|
+import com.ruoyi.system.mapper.SysUserRoleMapper;
|
|
|
+import com.ruoyi.system.service.ISysUserService;
|
|
|
import com.ruoyi.web.controller.chenyanlogin.ChengYanAesUtil;
|
|
|
import com.ruoyi.web.controller.chenyanlogin.dto.*;
|
|
|
import com.ruoyi.web.controller.chenyanlogin.dto.HouseVillagerRelation;
|
|
|
@@ -211,13 +217,20 @@ public class HuiCunServiceImpl implements HuiCunService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Autowired
|
|
|
private PersonInfoMapper personInfoMapper;
|
|
|
@Autowired
|
|
|
private TagsMapper tagsMapper;
|
|
|
@Autowired
|
|
|
private TagsPersonMapper tagsPersonMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ private SysUserRoleMapper sysUserRoleMapper;
|
|
|
+ @Autowired
|
|
|
+ private SysLoginService loginService;
|
|
|
@Transactional
|
|
|
public void saveVillager(SyncVillagerDataDto villageNewsDataDto) {
|
|
|
|
|
|
@@ -231,6 +244,7 @@ public class HuiCunServiceImpl implements HuiCunService {
|
|
|
List<VillagerList> villagerList = villageNewsDataDto.getVillagerList();
|
|
|
for (VillagerList list : villagerList) {
|
|
|
PersonInfo personInfo = personInfoMapper.selectById(list.getId());
|
|
|
+ saveUser(personInfo.getPhone());
|
|
|
if (ObjectUtil.isEmpty(personInfo)){
|
|
|
personInfo = copyVillagerToPerson(personInfo,list);
|
|
|
personInfo.setId(list.getId());
|
|
|
@@ -241,10 +255,27 @@ public class HuiCunServiceImpl implements HuiCunService {
|
|
|
personInfoMapper.updateById(personInfo);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+ private void saveUser(String phone){
|
|
|
+ SysUser phonenumber = sysUserService.selectUserByPhone(phone);
|
|
|
+ if (ObjectUtil.isEmpty(phonenumber)){
|
|
|
+ phonenumber = new SysUser();
|
|
|
+ phonenumber.setUserName(phone);
|
|
|
+ phonenumber.setPhonenumber(phone);
|
|
|
+ phonenumber.setNickName("测试");
|
|
|
+ phonenumber.setSex("0");
|
|
|
+ phonenumber.setPassword("$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2");
|
|
|
+ sysUserService.registerUser(phonenumber);
|
|
|
+ SysUserRole sysUserRole = new SysUserRole();
|
|
|
+ sysUserRole.setRoleId(4L);
|
|
|
+ SysUser sysUser = sysUserService.selectUserByPhone(phone);
|
|
|
+ sysUserRole.setUserId(sysUser.getUserId());
|
|
|
+ List list = new ArrayList();
|
|
|
+ list.add(sysUserRole);
|
|
|
+ sysUserRoleMapper.batchUserRole(list);
|
|
|
+ }
|
|
|
+ }
|
|
|
private void saveVillagerTag(List<VillagerTagList> villagerTagList) {
|
|
|
if (ObjectUtil.isNotEmpty(villagerTagList)){
|
|
|
for (VillagerTagList list : villagerTagList) {
|