| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.cache.DictCache; |
| | | import org.springblade.common.enums.DictEnum; |
| | | import org.springblade.common.utils.arg; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.constant.RoleConstant; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.DigestUtil; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.excel.UserImporter; |
| | | import org.springblade.modules.system.node.TreeNode; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.DeptVO; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE; |
| | | import static org.springblade.core.cache.constant.CacheConstant.USER_CACHE; |
| | | |
| | | /** |
| | |
| | | public class UserController { |
| | | |
| | | private final IUserService userService; |
| | | private final IDeptService iDeptService; |
| | | |
| | | /** |
| | | * 查询单条 |
| | |
| | | List<Map<Object, Object>> list = userService.selectInr(deptid); |
| | | return R.data(list); |
| | | } |
| | | |
| | | @GetMapping("/zc") |
| | | public R zc(String deptname,String username,String password,String sname,String phone) { |
| | | Dept dept = new Dept(); |
| | | Long i = 1426355050199945218L; |
| | | dept.setParentId(i); |
| | | dept.setTenantId("000000"); |
| | | dept.setDeptName(deptname); |
| | | dept.setAncestors("0,1426354978959691778,1426355050199945218"); |
| | | dept.setDeptCategory(1); |
| | | User user = new User(); |
| | | user.setAccount(username); |
| | | user.setPassword(DigestUtil.encrypt(password)); |
| | | user.setRealName(sname); |
| | | user.setPhone(phone); |
| | | if (iDeptService.submit(dept)) { |
| | | CacheUtil.clear(SYS_CACHE); |
| | | // 返回懒加载树更新节点所需字段 |
| | | Kv kv = Kv.create().set("id", String.valueOf(dept.getId())).set("tenantId", dept.getTenantId()) |
| | | .set("deptCategoryName", DictCache.getValue(DictEnum.ORG_CATEGORY, dept.getDeptCategory())); |
| | | String id = kv.get("id").toString(); |
| | | user.setDeptId(id); |
| | | } |
| | | userService.saveOrUpdate(user); |
| | | return R.success("注册成功"); |
| | | } |
| | | |
| | | |
| | | } |