Browse Source

条件商户禁用App登录功能

loovi 1 year ago
parent
commit
3c76312614

+ 17 - 7
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseController.java

@@ -7,6 +7,8 @@ import java.util.Objects;
 
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.date.DateUtil;
+import com.pj.api.client.admin.AdminInterface;
+import com.pj.api.consts.FeignFactory;
 import com.pj.common.core.utils.DateUtils;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.BeanUtils;
@@ -36,6 +38,9 @@ public class TbEnterpriseController {
 	/** 底层 Service 对象 */
 	@Autowired
 	TbEnterpriseService tbEnterpriseService;
+	@Autowired
+	AdminInterface adminInterface;
+
 
 	/** 增 */  
 	@RequestMapping("add")
@@ -142,16 +147,17 @@ public class TbEnterpriseController {
 	@SaCheckPermission(TbEnterprise.PERMISSION_CODE_EDIT)
 	public AjaxJson audit(TbEnterprise t){
 
-		Long loginId = StpUtil.getLoginIdAsLong();
+		Long loginId = StpUserUtil.getLoginIdAsLong();
 		TbEnterprise tbEnterprise = tbEnterpriseService.getById(t.getId());
 		if(Objects.isNull(tbEnterprise)){
 			return AjaxJson.getSuccess("该商户不存在");
 		}
-		BeanUtils.copyProperties(t,tbEnterprise);
 		tbEnterprise.setUpdateBy(String.valueOf(loginId));
 		tbEnterpriseService.update(t);
 		return AjaxJson.getSuccess();
 	}
+
+
 	/**
 	*是否锁住商户
 	*
@@ -160,14 +166,18 @@ public class TbEnterpriseController {
 	*/
 	@RequestMapping("isLock")
 	@SaCheckPermission(TbEnterprise.PERMISSION_CODE_EDIT)
-	public AjaxJson isLock(Long id, Integer isLock) {
-		Long loginId = StpUtil.getLoginIdAsLong();
-		TbEnterprise tbEnterprise = tbEnterpriseService.getById(id);
+	public AjaxJson isLock(TbEnterprise t) {
+		Long loginId = StpUserUtil.getLoginIdAsLong();
+		TbEnterprise tbEnterprise = tbEnterpriseService.getById(t.getId());
 		if (Objects.isNull(tbEnterprise)) {
 			return AjaxJson.getSuccess("该商户不存在");
 		}
-		int line = SP.publicMapper.updateColumnById(TbEnterprise.TABLE_NAME, "is_lock", isLock, id);
+		// 如果商户被锁住则禁止app端登录
+		adminInterface.isLock(String.valueOf(t.getId()), Integer.valueOf(t.getType()),0);
 		tbEnterprise.setUpdateBy(String.valueOf(loginId));
-		return AjaxJson.getByLine(line);
+		tbEnterpriseService.update(t);
+
+
+		return AjaxJson.getSuccess();
 	}
 }

+ 12 - 12
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupController.java

@@ -146,7 +146,7 @@ public class TbGroupController {
 	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
 	public AjaxJson setLeader(Long groupId,Long leaderId){
 
-		Long loginId = StpUtil.getLoginIdAsLong();
+		Long loginId = StpUserUtil.getLoginIdAsLong();
 
 		TbGroup tbGroup = tbGroupService.getById(groupId);
 		TbPeople tbPeople = tbPeopleService.getById(leaderId);
@@ -179,9 +179,9 @@ public class TbGroupController {
 	*/
 	@RequestMapping("groupAddPeople")
 	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
-	public AjaxJson GroupAddPeople(Long groupId,Long []peopleIds){
+	public AjaxJson AddGroupPeople(Long groupId,Long [] peopleIds){
 
-		Long loginId = StpUtil.getLoginIdAsLong();
+		Long loginId = StpUserUtil.getLoginIdAsLong();
 
 		TbGroup tbGroup = tbGroupService.getById(groupId);
 		if (Objects.isNull(tbGroup)){
@@ -196,7 +196,7 @@ public class TbGroupController {
 			TbPeople tbPeople = tbPeopleService.getById(peopleId);
 			tbPeople.setGroupId(tbGroup.getId());
 			tbPeople.setGroupName(tbGroup.getName());
-			tbGroup.setUpdateBy(String.valueOf(loginId));
+			tbPeople.setUpdateBy(String.valueOf(loginId));
 			tbPeopleService.updateById(tbPeople);
 		});
 		return AjaxJson.getSuccess();
@@ -209,9 +209,9 @@ public class TbGroupController {
 	 */
 	@RequestMapping("groupDelPeople")
 	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
-	public AjaxJson GroupDelPeople(Long groupId,Long []peopleIds){
+	public AjaxJson DelGroupPeople(Long groupId,Long [] peopleIds){
 
-		Long loginId = StpUtil.getLoginIdAsLong();
+		Long loginId = StpUserUtil.getLoginIdAsLong();
 
 		TbGroup tbGroup = tbGroupService.getById(groupId);
 		if (Objects.isNull(tbGroup)){
@@ -226,7 +226,7 @@ public class TbGroupController {
 			TbPeople tbPeople = tbPeopleService.getById(peopleId);
 			tbPeople.setGroupId(0L);
 			tbPeople.setGroupName("");
-			tbGroup.setUpdateBy(String.valueOf(loginId));
+			tbPeople.setUpdateBy(String.valueOf(loginId));
 			tbPeopleService.updateById(tbPeople);
 		});
 		return AjaxJson.getSuccess();
@@ -239,15 +239,15 @@ public class TbGroupController {
 	 */
 	@RequestMapping("isLock")
 	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
-	public AjaxJson isLock(Long id, Integer isLock) {
-		Long loginId = StpUtil.getLoginIdAsLong();
-		TbGroup tbGroup = tbGroupService.getById(id);
+	public AjaxJson isLock(TbGroup t) {
+		Long loginId = StpUserUtil.getLoginIdAsLong();
+		TbGroup tbGroup = tbGroupService.getById(t.getId());
 		if (Objects.isNull(tbGroup)) {
 			return AjaxJson.getSuccess("该互助组不存在");
 		}
-		int line = SP.publicMapper.updateColumnById(TbGroup.TABLE_NAME, "is_lock", isLock, id);
 		tbGroup.setUpdateBy(String.valueOf(loginId));
-		return AjaxJson.getByLine(line);
+		tbGroupService.update(t);
+		return AjaxJson.getSuccess();
 	}
 
 

+ 2 - 8
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupMapper.xml

@@ -63,13 +63,7 @@
 		</choose>
 	</select>
 	
-	
-	
-	
-	
-	
-	
-	
-	
+
+
 
 </mapper>