Переглянути джерело

7.24 一级市场子系统 - pc端 - 基本业务

Mechrevo 1 рік тому
батько
коміт
667d9743e4

+ 3 - 1
sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterface.java

@@ -20,6 +20,8 @@ public interface AdminInterface {
 
 	/** 启/停边民的app账号登陆限制 */
 	@RequestMapping("rpc/isLock")
-	int isLock(@RequestParam("id") String id,@RequestParam("status") Integer status);
+	int isLock(@RequestParam("id") String id,
+			   @RequestParam("type") Integer tupe,
+			   @RequestParam("status") Integer status);
 
 }

+ 7 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java

@@ -9,6 +9,7 @@ import java.util.List;
 
 import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.pj.api.client.admin.AdminInterface;
 import com.pj.tb_goods_transit.TbGoodsTransit;
 import com.pj.utils.so.SoMap;
 import org.apache.commons.lang3.StringUtils;
@@ -40,6 +41,9 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 	@Autowired
 	private MethodPeopleService methodPeopleService;
 
+	@Autowired
+	private AdminInterface adminInterface;
+
 	/** 增 */
 	void add(TbPeople t){
 		save(t);
@@ -113,7 +117,9 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 		tbPeople1.setIsLock(isLock);
 		//保存结果
 		int i = tbPeopleMapper.updateById(tbPeople1);
-		return i == 1;
+		//远程调用停用app user表中的便民账号
+		int lock = adminInterface.isLock(id.toString(), 1, isLock);
+		return i == 1 && lock == 1;
 	}
 
 	/**

+ 4 - 8
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java

@@ -81,17 +81,13 @@ public class AppUserController {
 
 	/** 启/停边民的app账号登陆限制 */
 	@RequestMapping("rpc/isLock")
-	public AjaxJson isLock(@RequestParam("id") String id,@RequestParam("status") Integer status) {
-		boolean lock = appUserService.isLock(id,status);
+	public AjaxJson isLock(@RequestParam("id") String id,
+						   @RequestParam("type") Integer type,
+						   @RequestParam("status") Integer status) {
+		boolean lock = appUserService.isLock(id,type,status);
 		if(lock) return AjaxJson.getSuccess();
 		return AjaxJson.getError();
 	}
 
 
-
-
-
-
-
-
 }

+ 13 - 18
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -2,6 +2,7 @@ package com.pj.project.app_user;
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.pj.api.client.admin.AdminInterface;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -9,11 +10,11 @@ import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
-import com.pj.utils.sg.*;
+
 
 /**
  * Service: app_user -- 移动端账号
- * @author qzy 
+ * @author qzy
  */
 @Service
 @Transactional(rollbackFor = Exception.class)
@@ -48,31 +49,25 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 		return super.getById(id);
 	}
 
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	List<AppUser> getList(SoMap so) { 
-		return appUserMapper.getList(so);	
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
+	List<AppUser> getList(SoMap so) {
+		return appUserMapper.getList(so);
 	}
 
 	/** 启/停边民的app账号登陆限制 */
-	boolean isLock(String id,Integer status){
+	boolean isLock(String id, Integer type, Integer status){
 		//查询
-		AppUser appUser1 = appUserMapper.selectById(id);
+		LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>();
+		queryWrapper.eq(AppUser::getFkId,id);
+		queryWrapper.eq(AppUser::getUserType,type);
+		AppUser appUser1 = appUserMapper.selectList(queryWrapper).get(0);
 		if(appUser1 == null)throw new RuntimeException("您进行修改的用户不存在!");
 		//设置状态
 		appUser1.setStatus(status.toString());
-		//定义计数器
-		int count = 0;
 		//保存
 		int i = appUserMapper.updateById(appUser1);
-		count += i;
-		if(i == 1){
-			//远程调用
-			int lock = adminInterface.isLock(id, status);
-			count += lock;
-		}
-		if(count != 2)throw new RuntimeException("启/停状态修改失败!");
-		return count == 2;
+		return i == 1;
 	}
-	
+
 
 }

+ 2 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_agreement/TbAgreementService.java

@@ -31,7 +31,9 @@ public class TbAgreementService extends ServiceImpl<TbAgreementMapper, TbAgreeme
 			throw new RuntimeException("请输入正确的类型!");
 		//获取同类型最新的那一条数据
 		LambdaQueryWrapper<TbAgreement> queryWrapper = new LambdaQueryWrapper<>();
+		//匹配当前类型
 		queryWrapper.eq(TbAgreement::getTextType,t.getTextType());
+		//降序排列
 		queryWrapper.orderByDesc(TbAgreement::getVersion);
 		TbAgreement tbAgreement = tbAgreementMapper.selectList(queryWrapper).get(0);
 		if(tbAgreement == null)throw new RuntimeException("服务器繁忙,请稍后重试~");