Browse Source

Merge remote-tracking branch 'origin/dev' into dev

loovi 1 year ago
parent
commit
2e5e5d9a4c

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

@@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 public interface AdminInterface {
 
 	/** 启/停边民的app账号登陆限制 */
-	@RequestMapping("rpc/isLock")
+	@RequestMapping("/AppUser/rpc/isLock")
 	int isLock(@RequestParam("id") String id,
 			   @RequestParam("type") Integer type,
 			   @RequestParam("status") Integer status);

+ 23 - 0
sp-core/sp-base/src/main/java/com/pj/enummj/People.java

@@ -0,0 +1,23 @@
+package com.pj.enummj;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 07 25 09 54
+ **/
+@Getter
+@AllArgsConstructor
+public enum People {
+
+    PEOPLE_TYPE_ONE(1,"边民类型"),
+    PEOPLE_TYPE_TWO(2,"商户类型");
+
+
+
+    private Integer code;
+
+    private String msg;
+
+}

+ 4 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleController.java

@@ -2,6 +2,8 @@ package com.pj.tb_people;
 
 import java.io.IOException;
 import java.util.List;
+
+import com.pj.tb_people.dto.StartStopDto;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -100,8 +102,8 @@ public class TbPeopleController {
 
 	/** 启/停 */
 	@PostMapping("isLock")
-	public AjaxJson isLock(TbPeople tbPeople){
-		boolean lock = tbPeopleService.isLock(tbPeople);
+	public AjaxJson isLock(StartStopDto startStopDto){
+		boolean lock = tbPeopleService.isLock(startStopDto);
 		return AjaxJson.getSuccess(lock + "");
 	}
 

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

@@ -10,7 +10,9 @@ 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.enummj.People;
 import com.pj.tb_goods_transit.TbGoodsTransit;
+import com.pj.tb_people.dto.StartStopDto;
 import com.pj.utils.so.SoMap;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFRow;
@@ -102,9 +104,9 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 	/**
 	 * 启/停
 	 */
-	boolean isLock(TbPeople tbPeople){
+	boolean isLock(StartStopDto startStopDto){
 		//获取被修改用户id
-		Long id = tbPeople.getId();
+		Long id = startStopDto.getId();
 		//查询
 		TbPeople tbPeople1 = tbPeopleMapper.selectById(id);
 		if(tbPeople1 == null)throw new RuntimeException("审核用户不存在,请检查!");
@@ -112,13 +114,15 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 		Integer deleteStatus = tbPeople1.getDeleteStatus();
 		if(deleteStatus == 0)throw new RuntimeException("该用户已被删除,无法进行启/停操作!");
 		//获取启停状态
-		Integer isLock = tbPeople.getIsLock();
+		Integer isLock = startStopDto.getIsLock();
 		//设置启/停
 		tbPeople1.setIsLock(isLock);
 		//保存结果
 		int i = tbPeopleMapper.updateById(tbPeople1);
-		//远程调用停用app user表中的便民账号
-		int lock = adminInterface.isLock(id.toString(), 1, isLock);
+		//远程调用停用app user表中的边民账号
+		int lock = adminInterface.isLock(id.toString(), People.PEOPLE_TYPE_ONE.getCode(), isLock);
+		if((lock + i) != 2)throw new RuntimeException("停用失败!");
+
 		return i == 1 && lock == 1;
 	}
 

+ 22 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_people/dto/StartStopDto.java

@@ -0,0 +1,22 @@
+package com.pj.tb_people.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * 启停状态设置
+ * @Author Mechrevo
+ * @Date 2023 07 25 09 44
+ **/
+@Data
+public class StartStopDto {
+
+    /** 边民表主键 */
+    @NotNull
+    private Long id;
+
+    /** 锁定状态 1=启用,0=停用 */
+    @NotNull
+    private Integer isLock;
+}

+ 10 - 15
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaController.java

@@ -94,21 +94,16 @@ public class TbTradeAreaController {
 	@RequestMapping("tradeAreaImport")
 	@ResponseBody
 	public AjaxJson dataImport( @RequestParam("file") MultipartFile file){
-		List<TbTradeArea> areaList = tbTradeAreaService.list();
-		ExcelUtil<TbTradeArea> excelUtil = new ExcelUtil<>(TbTradeArea.class);
 
+		String importData = null;
 		try {
-			List<TbTradeArea> tbTradeAreas = excelUtil.importExcel(file.getInputStream());
-			System.out.println(tbTradeAreas);
-
-//			String importData = tbTradeAreaService.importData(file);
-//			AjaxJson.getSuccess(importData);
+			importData = tbTradeAreaService.importData(file);
+			return AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
-			throw new RuntimeException(e);
-		} catch (Exception e) {
-			throw new RuntimeException(e);
+			e.printStackTrace();
+			return AjaxJson.getError();
+
 		}
-		return AjaxJson.getError();
 	}
 
 	/**
@@ -119,10 +114,10 @@ public class TbTradeAreaController {
 	@RequestMapping("tradeAreaOutport")
 	@ResponseBody
 	public AjaxJson dataOutport(HttpServletResponse response,@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
-
-		List<TbTradeArea> areaList = tbTradeAreaService.list();
-		ExcelUtil<TbTradeArea> excelUtil = new ExcelUtil<>(TbTradeArea.class);
-		excelUtil.exportExcel(response,areaList,"区域表");
+//
+//		List<TbTradeArea> areaList = tbTradeAreaService.list();
+//		ExcelUtil<TbTradeArea> excelUtil = new ExcelUtil<>(TbTradeArea.class);
+//		excelUtil.exportExcel(response,areaList,"区域表");
 		try {
 			String importData = tbTradeAreaService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);

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

@@ -84,8 +84,8 @@ public class AppUserController {
 	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();
+		int lock = appUserService.isLock(id,type,status);
+		if(lock == 1) return AjaxJson.getSuccess();
 		return AjaxJson.getError();
 	}
 

+ 2 - 7
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -3,7 +3,6 @@ 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;
 import org.springframework.stereotype.Service;
@@ -24,9 +23,6 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 	@Autowired
 	AppUserMapper appUserMapper;
 
-	/** 注入远程调用对象 admin */
-	@Autowired
-	private AdminInterface adminInterface;
 
 	/** 增 */
 	void add(AppUser t){
@@ -55,7 +51,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 	}
 
 	/** 启/停边民的app账号登陆限制 */
-	boolean isLock(String id, Integer type, Integer status){
+	int isLock(String id, Integer type, Integer status){
 		//查询
 		LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>();
 		queryWrapper.eq(AppUser::getFkId,id);
@@ -66,8 +62,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 		appUser1.setStatus(status.toString());
 		//保存
 		int i = appUserMapper.updateById(appUser1);
-		return i == 1;
+		return i;
 	}
 
-
 }