|
@@ -24,164 +24,198 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
|
|
|
/**
|
|
|
* Controller: app_user -- 移动端账号
|
|
|
+ *
|
|
|
* @author qzy
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/AppUser/")
|
|
|
public class AppUserController {
|
|
|
|
|
|
- /** 底层 Service 对象 */
|
|
|
- @Autowired
|
|
|
- AppUserService appUserService;
|
|
|
-
|
|
|
- /** 增 */
|
|
|
- @RequestMapping("add")
|
|
|
- @SaCheckPermission(AppUser.PERMISSION_CODE_ADD)
|
|
|
- public AjaxJson add(AppUser a){
|
|
|
- appUserService.add(a);
|
|
|
- a = appUserService.getById(SP.publicMapper.getPrimarykey());
|
|
|
- return AjaxJson.getSuccessData(a);
|
|
|
- }
|
|
|
-
|
|
|
- /** 删 */
|
|
|
- @RequestMapping("delete")
|
|
|
- @SaCheckPermission(AppUser.PERMISSION_CODE_DEL)
|
|
|
- public AjaxJson delete(Long id){
|
|
|
- appUserService.delete(id);
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
-
|
|
|
- /** 删 - 根据id列表 */
|
|
|
- @RequestMapping("deleteByIds")
|
|
|
- @SaCheckPermission(AppUser.PERMISSION_CODE_DEL)
|
|
|
- public AjaxJson deleteByIds(){
|
|
|
- List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
|
|
|
- int line = SP.publicMapper.deleteByIds(AppUser.TABLE_NAME, ids);
|
|
|
- return AjaxJson.getByLine(line);
|
|
|
- }
|
|
|
-
|
|
|
- /** 改 */
|
|
|
- @RequestMapping("update")
|
|
|
- @SaCheckPermission(AppUser.PERMISSION_CODE_EDIT)
|
|
|
- public AjaxJson update(AppUser a){
|
|
|
- appUserService.update(a);
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
-
|
|
|
- /** 修改密码 */
|
|
|
- @RequestMapping("pass")
|
|
|
- @SaCheckPermission( AppUser.PERMISSION_CODE_EDIT)
|
|
|
- public AjaxJson pass(@Validated PassDto dto){
|
|
|
- StaticLog.info("dto:", JSONUtil.toJsonStr(dto.getPassword()));
|
|
|
- return AjaxJson.toAjax(appUserService.pass(dto));
|
|
|
- }
|
|
|
-
|
|
|
- /** 查 - 根据id */
|
|
|
- @RequestMapping("getById")
|
|
|
- @SaCheckPermission(AppUser.PERMISSION_CODE)
|
|
|
- public AjaxJson getById(Long id){
|
|
|
- AppUser a = appUserService.getById(id);
|
|
|
- return AjaxJson.getSuccessData(a);
|
|
|
- }
|
|
|
-
|
|
|
- /** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
|
|
|
- @RequestMapping("getList")
|
|
|
- @SaCheckPermission(AppUser.PERMISSION_CODE)
|
|
|
- public AjaxJson getList() {
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- List<AppUser> list = appUserService.getList(so.startPage());
|
|
|
- return AjaxJson.getPageData(so.getDataCount(), list);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 更换角色
|
|
|
- *
|
|
|
- * 当前用户已登录,app点击该按钮时,从缓存获取用户类型与选择要更换的角色id做对比,相同则进入此方法,故在此不做用户角色权限过滤
|
|
|
- * @param appRoleId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping("updateRole")
|
|
|
- AjaxJson updateRole(@RequestParam("appRoleId")String appRoleId) {
|
|
|
- return appUserService.updateRole(appRoleId);
|
|
|
- }
|
|
|
-
|
|
|
- /*----- 正常业务接口👆👆 不越界 rpc远程调用 👇👇 -----*/
|
|
|
-
|
|
|
-
|
|
|
- /** 启/停边民的app账号登陆限制 */
|
|
|
- @PostMapping("rpc/isLock")
|
|
|
- public int isLock(@RequestParam("id") String id,
|
|
|
- @RequestParam("type") Integer type,
|
|
|
- @RequestParam("status") Integer status) {
|
|
|
- int lock = appUserService.isLock(id,type,status);
|
|
|
- return lock;
|
|
|
- }
|
|
|
-
|
|
|
- /** 查单个app有效用户 - 根据id */
|
|
|
- @RequestMapping("rpc/getById")
|
|
|
- public AppUserDto getAppUserById(@RequestParam("id") Long id){
|
|
|
- AppUserDto appUser = appUserService.getUserById(id);
|
|
|
- return appUser;
|
|
|
- }
|
|
|
- /** 商户认证 */
|
|
|
- @PostMapping("rpc/audit")
|
|
|
- public boolean audit(@RequestBody EnterpriseAuditDto dto){
|
|
|
- LambdaUpdateWrapper<AppUser> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.set(AppUser::getAuth, dto.getAuth()).set(AppUser::getAuthTime, new Date()).eq(AppUser::getFkId, dto.getFkId());
|
|
|
- boolean update = appUserService.update(updateWrapper);
|
|
|
- return update;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 收购商认证
|
|
|
- */
|
|
|
- @PostMapping("rpc/saveAppUserInfo")
|
|
|
- public Boolean saveAppUserInfo(@RequestBody AppUserDto appUser) {
|
|
|
- boolean info = appUserService.saveAppUserInfo(appUser);
|
|
|
- return info;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 用户数量统计
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping("selectUsers")
|
|
|
- public AjaxJson selectUsers(){
|
|
|
- return AjaxJson.getSuccessData(appUserService.selectUsers());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 创建账号
|
|
|
- * @param createDTO
|
|
|
- */
|
|
|
- @PostMapping("rpc/createAppAccount")
|
|
|
- public boolean createAccount(@RequestBody AppUserCreateDTO createDTO){
|
|
|
- return appUserService.createUser(createDTO);
|
|
|
- }
|
|
|
- @PostMapping("rpc/changeBindShopStatus")
|
|
|
- public void changeBindShopStatus(@RequestBody BindShopDTO bindShopDTO){
|
|
|
- appUserService.changeBindShopStatus(bindShopDTO);
|
|
|
- }
|
|
|
-
|
|
|
- /** 根据fkId查app用户 */
|
|
|
- @PostMapping("rpc/getByFkId")
|
|
|
- public AppUserDto getAppUserByFkId(@RequestParam("fkId") Long fkId){
|
|
|
- return appUserService.getAppUserByFkId(fkId);
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping("rpc/findUserByPhone")
|
|
|
- public AppUserDto findUserByPhone(@RequestParam("phone") String phone) {
|
|
|
- return appUserService.findUserByPhone(phone);
|
|
|
- }
|
|
|
- @RequestMapping("rpc/bindFkId")
|
|
|
- public boolean bindFkId(@RequestParam("appUserId") Long appUserId,@RequestParam("fkId") Long fkId){
|
|
|
- return appUserService.bindFkId(appUserId,fkId);
|
|
|
- }
|
|
|
- @PostMapping("rpc/updateAccount")
|
|
|
- public int updateAccount(@RequestBody UpdateAccountDTO phone) {
|
|
|
- return appUserService.updateAccount(phone);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 底层 Service 对象
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ AppUserService appUserService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 增
|
|
|
+ */
|
|
|
+ @RequestMapping("add")
|
|
|
+ @SaCheckPermission(AppUser.PERMISSION_CODE_ADD)
|
|
|
+ public AjaxJson add(AppUser a) {
|
|
|
+ appUserService.add(a);
|
|
|
+ a = appUserService.getById(SP.publicMapper.getPrimarykey());
|
|
|
+ return AjaxJson.getSuccessData(a);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删
|
|
|
+ */
|
|
|
+ @RequestMapping("delete")
|
|
|
+ @SaCheckPermission(AppUser.PERMISSION_CODE_DEL)
|
|
|
+ public AjaxJson delete(Long id) {
|
|
|
+ appUserService.delete(id);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删 - 根据id列表
|
|
|
+ */
|
|
|
+ @RequestMapping("deleteByIds")
|
|
|
+ @SaCheckPermission(AppUser.PERMISSION_CODE_DEL)
|
|
|
+ public AjaxJson deleteByIds() {
|
|
|
+ List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
|
|
|
+ int line = SP.publicMapper.deleteByIds(AppUser.TABLE_NAME, ids);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 改
|
|
|
+ */
|
|
|
+ @RequestMapping("update")
|
|
|
+ @SaCheckPermission(AppUser.PERMISSION_CODE_EDIT)
|
|
|
+ public AjaxJson update(AppUser a) {
|
|
|
+ appUserService.update(a);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改密码
|
|
|
+ */
|
|
|
+ @RequestMapping("pass")
|
|
|
+ @SaCheckPermission(AppUser.PERMISSION_CODE_EDIT)
|
|
|
+ public AjaxJson pass(@Validated PassDto dto) {
|
|
|
+ StaticLog.info("dto:", JSONUtil.toJsonStr(dto.getPassword()));
|
|
|
+ return AjaxJson.toAjax(appUserService.pass(dto));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查 - 根据id
|
|
|
+ */
|
|
|
+ @RequestMapping("getById")
|
|
|
+ @SaCheckPermission(AppUser.PERMISSION_CODE)
|
|
|
+ public AjaxJson getById(Long id) {
|
|
|
+ AppUser a = appUserService.getById(id);
|
|
|
+ return AjaxJson.getSuccessData(a);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查集合 - 根据条件(参数为空时代表忽略指定条件)
|
|
|
+ */
|
|
|
+ @RequestMapping("getList")
|
|
|
+ @SaCheckPermission(AppUser.PERMISSION_CODE)
|
|
|
+ public AjaxJson getList() {
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ List<AppUser> list = appUserService.getList(so.startPage());
|
|
|
+ return AjaxJson.getPageData(so.getDataCount(), list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更换角色
|
|
|
+ * <p>
|
|
|
+ * 当前用户已登录,app点击该按钮时,从缓存获取用户类型与选择要更换的角色id做对比,相同则进入此方法,故在此不做用户角色权限过滤
|
|
|
+ *
|
|
|
+ * @param appRoleId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("updateRole")
|
|
|
+ AjaxJson updateRole(@RequestParam("appRoleId") String appRoleId) {
|
|
|
+ return appUserService.updateRole(appRoleId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*----- 正常业务接口👆👆 不越界 rpc远程调用 👇👇 -----*/
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 启/停边民的app账号登陆限制
|
|
|
+ */
|
|
|
+ @PostMapping("rpc/isLock")
|
|
|
+ public int isLock(@RequestParam("id") String id,
|
|
|
+ @RequestParam("type") Integer type,
|
|
|
+ @RequestParam("status") Integer status) {
|
|
|
+ int lock = appUserService.isLock(id, type, status);
|
|
|
+ return lock;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查单个app有效用户 - 根据id
|
|
|
+ */
|
|
|
+ @RequestMapping("rpc/getById")
|
|
|
+ public AppUserDto getAppUserById(@RequestParam("id") Long id) {
|
|
|
+ AppUserDto appUser = appUserService.getUserById(id);
|
|
|
+ return appUser;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 商户认证
|
|
|
+ */
|
|
|
+ @PostMapping("rpc/audit")
|
|
|
+ public boolean audit(@RequestBody EnterpriseAuditDto dto) {
|
|
|
+ LambdaUpdateWrapper<AppUser> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.set(AppUser::getAuth, dto.getAuth()).set(AppUser::getAuthTime, new Date()).eq(AppUser::getFkId, dto.getFkId());
|
|
|
+ boolean update = appUserService.update(updateWrapper);
|
|
|
+ return update;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 收购商认证
|
|
|
+ */
|
|
|
+ @PostMapping("rpc/saveAppUserInfo")
|
|
|
+ public Boolean saveAppUserInfo(@RequestBody AppUserDto appUser) {
|
|
|
+ boolean info = appUserService.saveAppUserInfo(appUser);
|
|
|
+ return info;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户数量统计
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("selectUsers")
|
|
|
+ public AjaxJson selectUsers() {
|
|
|
+ return AjaxJson.getSuccessData(appUserService.selectUsers());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建账号
|
|
|
+ *
|
|
|
+ * @param createDTO
|
|
|
+ */
|
|
|
+ @PostMapping("rpc/createAppAccount")
|
|
|
+ public boolean createAccount(@RequestBody AppUserCreateDTO createDTO) {
|
|
|
+ return appUserService.createUser(createDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("rpc/changeBindShopStatus")
|
|
|
+ public void changeBindShopStatus(@RequestBody BindShopDTO bindShopDTO) {
|
|
|
+ appUserService.changeBindShopStatus(bindShopDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据fkId查app用户
|
|
|
+ */
|
|
|
+ @PostMapping("rpc/getByFkId")
|
|
|
+ public AppUserDto getAppUserByFkId(@RequestParam("fkId") Long fkId) {
|
|
|
+ return appUserService.getAppUserByFkId(fkId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("rpc/findUserByPhone")
|
|
|
+ public AppUserDto findUserByPhone(@RequestParam("phone") String phone) {
|
|
|
+ return appUserService.findUserByPhone(phone);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("rpc/bindFkId")
|
|
|
+ public boolean bindFkId(@RequestParam("appUserId") Long appUserId, @RequestParam("fkId") Long fkId) {
|
|
|
+ return appUserService.bindFkId(appUserId, fkId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("rpc/updateAccount")
|
|
|
+ public int updateAccount(@RequestBody UpdateAccountDTO phone) {
|
|
|
+ return appUserService.updateAccount(phone);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|