Commit af1c91a9 authored by 竹天卫's avatar 竹天卫

企业微信用户自动登录信息

parent 9de559e2
......@@ -168,6 +168,22 @@
<artifactId>jfreechart</artifactId>
<version>1.5.0</version>
</dependency>
<!-- lombok start -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
<scope>provided</scope>
</dependency>
<!-- lombok end -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180130</version>
</dependency>
</dependencies>
<build>
......
......@@ -105,6 +105,9 @@ public class SysGroupController {
@PostMapping("/delete/{id}")
public BaseResponse delete(@PathVariable Integer id) {
try {
if(id == 1 || id == 2){
return BaseResponse.errorMsg("工作组不允许删除!");
}
QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
sysUserQueryWrapper.eq("group_id", id);
Integer conunts = userService.count(sysUserQueryWrapper);
......
......@@ -107,6 +107,9 @@ public class SysPostController {
@PostMapping("/delete/{id}")
public BaseResponse delete(@PathVariable Integer id) {
try {
if(id == 1 || id == 2){
return BaseResponse.errorMsg("职务不允许删除!");
}
QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
sysUserQueryWrapper.eq("post_id", id);
Integer conunts = userService.count(sysUserQueryWrapper);
......
......@@ -10,6 +10,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -17,6 +18,7 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Api(tags = "微信接口")
......@@ -155,5 +157,4 @@ public class WeiXinController {
return BaseResponse.errorMsg("失败!");
}
}
......@@ -144,6 +144,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
if(id == 1){
return BaseResponse.errorMsg("系统管理员角色不允许删除!");
}
if(id == 2){
return BaseResponse.errorMsg("角色不允许删除!");
}
SysRole role = roleMapper.selectById(id);
if (role == null) {
return BaseResponse.errorMsg("角色不存在!");
......
......@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.SysUser;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser;
import cn.wise.sc.cement.business.model.query.UserQuery;
import cn.wise.sc.cement.business.service.ISysUserService;
import cn.wise.sc.cement.business.util.JwtUtil;
import cn.wise.sc.cement.business.util.RedisUtil;
......@@ -14,16 +15,21 @@ import cn.wise.sc.cement.business.util.weixin.WeixinInterfaceUtil;
import cn.wise.sc.cement.business.util.weixin.message.send.BaseMessage;
import cn.wise.sc.cement.business.util.weixin.message.send.Text;
import cn.wise.sc.cement.business.util.weixin.message.send.TextMessage;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.base.Strings;
import com.google.gson.Gson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@Service
public class WeiXinService {
......@@ -122,7 +128,28 @@ public class WeiXinService {
wrapper.eq("phone", userJson.get("mobile"));
SysUser sysUser = userService.getOne(wrapper);
if (sysUser == null) {
return BaseResponse.errorMsg("非系统用户不允许登录!");
UserQuery query = new UserQuery();
query.setUsername(userJson.getString("userid"));
query.setName(userJson.getString("name"));
Integer sexVal = userJson.getInteger("gender"); //企业微信1男2女 系统1男0女
query.setSex(sexVal==1?1:sexVal==2?0:null);
query.setGroupId(2);
query.setPostId(2);
query.setWxId(userJson.getString("userid"));
query.setQualifications(userJson.getString("position"));
query.setWorkYear(null);
query.setPhone(userJson.getString("mobile"));
query.setFax(null);
query.setMajor(null);
query.setEmail(userJson.getString("email"));
query.setTechnologyDate(null);
query.setTechnologyYear(null);
query.setEducation(null);
query.setRemark(null);
query.setRoleId(2);
BaseResponse<SysUser> baseResponse = userService.create(query);
sysUser = baseResponse.getData();
// return BaseResponse.errorMsg("非系统用户不允许登录!");
}
if (sysUser.getStatus() == 0) {
return BaseResponse.errorMsg("用户被禁用!");
......@@ -302,4 +329,30 @@ public class WeiXinService {
BigDecimal bigDecimal = NumberUtil.toBigDecimal(StrUtil.trim("111 "));
}
}
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