Commit 334710f4 authored by 赵啸非's avatar 赵啸非

添加h5钉钉用户授权登录与注册绑定

parent ac7eb10b
......@@ -3,17 +3,24 @@ package com.mortals.xhx.busiz;
import cn.hutool.json.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.base.system.idgenerator.service.IdgeneratorService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService;
import com.mortals.xhx.module.workman.model.WorkmanEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -58,6 +65,7 @@ public class TestController {
//
@GetMapping("updatePersons")
@UnAuth
public String updatePersons() {
log.info("更新用户手机号码");
......@@ -72,8 +80,37 @@ public class TestController {
userMap.put(workmanEntity.getName(), workmanEntity);
});
return "ok";
List<StaffEntity> staffEntities = staffService.find(new StaffQuery());
ArrayList<StaffEntity> updateList = new ArrayList<>();
for (StaffEntity staffEntity : staffEntities) {
if (ObjectUtils.isEmpty(staffEntity.getPhoneNumber())) {
WorkmanEntity workmanEntity = userMap.get(staffEntity.getName());
if (!ObjectUtils.isEmpty(workmanEntity)) {
staffEntity.setPhoneNumber(workmanEntity.getMobile());
updateList.add(staffEntity);
}
}
}
if(ObjectUtils.isEmpty(updateList)){
log.info("更新数量:"+updateList.size());
for (StaffEntity staffEntity : updateList) {
staffService.update(staffEntity);
//更新绑定的系统用户手机号码
UserQuery userQuery = new UserQuery();
userQuery.setCustomerId(staffEntity.getId());
UserEntity userEntity = userService.selectOne(userQuery);
if(userEntity!=null){
Map<String, Object> condition = new HashMap<>(1);
condition.put("id", userEntity.getId());
Map<String, Object> data = new HashMap<>(1);
data.put("mobile", staffEntity.getPhoneNumber());
userService.getUserDao().update(data, condition);
}
}
}
return "更新数量:"+updateList.size();
}
......
......@@ -36,6 +36,12 @@ public class WorkmanEntity extends WorkmanVo {
* 电话号码
*/
private String phone;
/**
* 电话号码
*/
private String mobile;
/**
* 照片
*/
......@@ -129,8 +135,13 @@ public class WorkmanEntity extends WorkmanVo {
this.photoPath = photoPath;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
@Override
public int hashCode() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment