Parcourir la source

refactor(national-motion-system-biz): 优化代码格式和结构- 调整缩进和空格,提高代码可读性
- 移除未使用的代码片段
- 修改部分方法签名,增加参数以支持新功能
- 更新注释以反映代码变化

SheepHy il y a 3 semaines
Parent
commit
e08c542db7

+ 3 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/AppUserController.java

@@ -54,8 +54,9 @@ public class AppUserController {
     @GetMapping("/updateUserInfo")
     @Operation(summary = "修改用户基础信息")
     public Result<Boolean> updateUserInfo(@RequestParam(required = false) @Schema(description = "用户昵称") String nickName,
-                                          @RequestParam(required = false) @Schema(description = "用户头像") String avatarUrl){
-        return Result.ok(userService.updateUserInfo(nickName,avatarUrl));
+                                          @RequestParam(required = false) @Schema(description = "用户头像") String avatarUrl,
+                                          @RequestParam(required = false) @Schema(description = "手机号") String phone){
+        return Result.ok(userService.updateUserInfo(nickName,avatarUrl,phone));
     }
 
     /**

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/IUserService.java

@@ -41,7 +41,7 @@ public interface IUserService {
      * @Param
      * @return
      **/
-    boolean updateUserInfo(String nickName, String avatarUrl);
+    boolean updateUserInfo(String nickName, String avatarUrl,String phone);
 
     /**
      * @Author SheepHy

+ 5 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/DetailServiceImpl.java

@@ -232,9 +232,11 @@ public class DetailServiceImpl implements IDetailService {
         List<AppOrder> appOrders = appOrderMapper.selectList(Wrappers.<AppOrder>lambdaQuery().eq(AppOrder::getUserId, userId).eq(AppOrder::getType, CommonConstant.ORDER_TYPE_2));
         if (CollUtil.isNotEmpty(appOrders)){
             for (AppOrder appOrder : appOrders) {
-                AppCourses appCours = appCoursesMapper.selectById(appOrder.getProductIds());
-                if (appCours.getCategoryId().equals(categoryId)) {
-                    return Boolean.FALSE;
+                if(null != appOrder){
+                    AppCourses appCours = appCoursesMapper.selectById(appOrder.getProductIds());
+                    if (null != appCours && appCours.getCategoryId().equals(categoryId)) {
+                        return Boolean.FALSE;
+                    }
                 }
             }
         }

+ 5 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/UserServiceImpl.java

@@ -173,7 +173,7 @@ public class UserServiceImpl implements IUserService {
 
     @Override
     @Transactional
-    public boolean updateUserInfo(String nickName, String avatarUrl) {
+    public boolean updateUserInfo(String nickName, String avatarUrl, String phone) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         if (null != nickName && !nickName.isEmpty()) {
             sysUserMapper.update(null, Wrappers.<SysUser>lambdaUpdate()
@@ -183,6 +183,10 @@ public class UserServiceImpl implements IUserService {
             sysUserMapper.update(null, Wrappers.<SysUser>lambdaUpdate()
                     .eq(SysUser::getId, user.getId())
                     .set(SysUser::getAvatar, avatarUrl));
+        } else if (null != phone && !phone.isEmpty()) {
+            sysUserMapper.update(null, Wrappers.<SysUser>lambdaUpdate()
+                    .eq(SysUser::getId, user.getId())
+                    .set(SysUser::getPhone, phone));
         }
         return true;
     }

+ 2 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/hikiot/HikiotTool.java

@@ -550,7 +550,8 @@ public class HikiotTool {
     }
 
     public static void main(String[] args) throws IOException, InterruptedException {
-        deleteExpiredVisitors("FX0889961");
+        addUser(new Date(),"FX0889961","Sheep123","10011",null);
+        addFace("FX0889961","10011","https://national-motion.oss-cn-beijing.aliyuncs.com/opt/upFiles/tmp_81fc8aa195d37dac70fd57221d82845e_1756361097600.jpg");
 //        addUser(new Date(),"FX0889961","Sheep123","10011");
 //        addFace("FX0889961","1001","https://national-motion.oss-cn-beijing.aliyuncs.com/opt/upFiles/tmp_81fc8aa195d37dac70fd57221d82845e_1756361097600.jpg");
 //        addUser();

+ 60 - 67
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppDeviceController.java

@@ -44,7 +44,7 @@ public class AppDeviceController extends JeecgController<AppDevice, IAppDeviceSe
 	private IAppDeviceService AppDeviceService;
 	@Resource
 	private AppSiteMapper appSiteMapper;
-	
+
 	/**
 	 * 分页列表查询
 	 *
@@ -55,113 +55,113 @@ public class AppDeviceController extends JeecgController<AppDevice, IAppDeviceSe
 	 * @return
 	 */
 	//@AutoLog(value = "nm_device-分页列表查询")
-	@Operation(summary="nm_device-分页列表查询")
+	@Operation(summary = "nm_device-分页列表查询")
 	@GetMapping(value = "/list")
 	public Result<IPage<AppDevice>> queryPageList(AppDevice AppDevice,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
+												  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+												  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+												  HttpServletRequest req) {
 
 
-        QueryWrapper<AppDevice> queryWrapper = QueryGenerator.initQueryWrapper(AppDevice, req.getParameterMap());
+		QueryWrapper<AppDevice> queryWrapper = QueryGenerator.initQueryWrapper(AppDevice, req.getParameterMap());
 		Page<AppDevice> page = new Page<AppDevice>(pageNo, pageSize);
 		IPage<AppDevice> pageList = AppDeviceService.page(page, queryWrapper);
-		if(CollUtil.isEmpty(pageList.getRecords())){
+		if (CollUtil.isEmpty(pageList.getRecords())) {
 			return Result.OK(pageList);
 		}
-		pageList.getRecords().forEach(item->{
-			if(null != item.getSiteId() && !item.getSiteId().isEmpty()){
+		pageList.getRecords().forEach(item -> {
+			if (null != item.getSiteId() && !item.getSiteId().isEmpty()) {
 				item.setSiteName(appSiteMapper.selectById(item.getSiteId()).getName());
 			}
 		});
 		return Result.OK(pageList);
 	}
-	
+
 	/**
-	 *   添加
+	 * 添加
 	 *
 	 * @return
 	 */
 	@AutoLog(value = "nm_device-添加")
-	@Operation(summary="nm_device-添加")
+	@Operation(summary = "nm_device-添加")
 	@PostMapping(value = "/add")
 	@Transactional
-	public Result<String> add(@RequestBody AppDevice appDevice){
-		if(AppDeviceService.getOne(Wrappers.<AppDevice>lambdaQuery()
-				.eq(AppDevice::getDeviceSerial,appDevice.getDeviceSerial())) != null) {
+	public Result<String> add(@RequestBody AppDevice appDevice) {
+		if (AppDeviceService.getOne(Wrappers.<AppDevice>lambdaQuery()
+				.eq(AppDevice::getDeviceSerial, appDevice.getDeviceSerial())) != null) {
 			return Result.error("设备已存在!");
 		}
 		AppDeviceService.save(appDevice);
 		return Result.OK("添加成功!");
 	}
-	
+
 	/**
-	 *  编辑
+	 * 编辑
 	 *
 	 * @param appDevice
 	 * @return
 	 */
 	@AutoLog(value = "nm_device-编辑")
-	@Operation(summary="nm_device-编辑")
+	@Operation(summary = "nm_device-编辑")
 	@PostMapping(value = "/edit")
 	@Transactional
 	public Result<String> edit(@RequestBody AppDevice appDevice) {
 		AppSite appSite = appSiteMapper.selectById(appDevice.getSiteId());
 		appDevice.setOrgCode(appSite.getOrgCode());
-		if(AppDeviceService.getOne(Wrappers.<AppDevice>lambdaQuery()
-				.eq(AppDevice::getDeviceSerial,appDevice.getDeviceSerial())
-				.eq(AppDevice::getDeviceNo,appDevice.getDeviceNo())
-				.eq(AppDevice::getSiteId,appDevice.getSiteId())
-				.eq(AppDevice::getDeviceType,appDevice.getDeviceType())) != null) {
+		if (AppDeviceService.getOne(Wrappers.<AppDevice>lambdaQuery()
+				.eq(AppDevice::getDeviceSerial, appDevice.getDeviceSerial())
+				.eq(AppDevice::getDeviceNo, appDevice.getDeviceNo())
+				.eq(AppDevice::getSiteId, appDevice.getSiteId())
+				.eq(AppDevice::getDeviceType, appDevice.getDeviceType())) != null) {
 			return Result.error("设备已存在!");
 		}
 		AppDeviceService.updateById(appDevice);
-		if(appDevice.getDeviceSerial() != null && appDevice.getValidateCode() != null && appDevice.getSiteId() != null){
+		if (appDevice.getDeviceSerial() != null && appDevice.getValidateCode() != null && appDevice.getSiteId() != null) {
 			String addDevice = addDevice(appDevice.getDeviceSerial(), appDevice.getValidateCode());
 			String userWeekPlan = addUserWeekPlan(appDevice.getDeviceSerial());
 			String userPlanTemplate = addUserPlanTemplate(appDevice.getDeviceSerial());
 			JsonObject deviceJson = JsonParser.parseString(addDevice).getAsJsonObject();
 			JsonObject userWeekPlanJson = JsonParser.parseString(userWeekPlan).getAsJsonObject();
 			JsonObject userPlanTemplateJson = JsonParser.parseString(userPlanTemplate).getAsJsonObject();
-			if(deviceJson.get("code").getAsInt() == 0
+			if (deviceJson.get("code").getAsInt() == 0
 					&& userWeekPlanJson.get("code").getAsInt() == 0
-					&& userPlanTemplateJson.get("code").getAsInt() == 0){
+					&& userPlanTemplateJson.get("code").getAsInt() == 0) {
 				return Result.OK("添加成功!");
-			}else {
+			} else {
 				return Result.OK("添加失败!");
 			}
 		}
 		return Result.OK("编辑成功!");
 	}
-	
+
 	/**
-	 *   通过id删除
+	 * 通过id删除
 	 *
 	 * @param id
 	 * @return
 	 */
 	@AutoLog(value = "nm_device-通过id删除")
-	@Operation(summary="nm_device-通过id删除")
+	@Operation(summary = "nm_device-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+	public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
 		AppDeviceService.removeById(id);
 		return Result.OK("删除成功!");
 	}
-	
+
 	/**
-	 *  批量删除
+	 * 批量删除
 	 *
 	 * @param ids
 	 * @return
 	 */
 	@AutoLog(value = "nm_device-批量删除")
-	@Operation(summary="nm_device-批量删除")
+	@Operation(summary = "nm_device-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+	public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
 		this.AppDeviceService.removeByIds(Arrays.asList(ids.split(",")));
 		return Result.OK("批量删除成功!");
 	}
-	
+
 	/**
 	 * 通过id查询
 	 *
@@ -169,46 +169,39 @@ public class AppDeviceController extends JeecgController<AppDevice, IAppDeviceSe
 	 * @return
 	 */
 	//@AutoLog(value = "nm_device-通过id查询")
-	@Operation(summary="nm_device-通过id查询")
+	@Operation(summary = "nm_device-通过id查询")
 	@GetMapping(value = "/queryById")
-	public Result<AppDevice> queryById(@RequestParam(name="id",required=true) String id) {
+	public Result<AppDevice> queryById(@RequestParam(name = "id", required = true) String id) {
 		AppDevice appDevice = AppDeviceService.getById(id);
-		if(appDevice==null) {
+		if (appDevice == null) {
 			return Result.error("未找到对应数据");
 		}
-		if(null != appDevice.getSiteId() && !appDevice.getSiteId().isEmpty()){
+		if (null != appDevice.getSiteId() && !appDevice.getSiteId().isEmpty()) {
 			appDevice.setSiteName(appSiteMapper.selectById(appDevice.getSiteId()).getName());
 		}
 		return Result.OK(appDevice);
 	}
 
-    /**
-    * 导出excel
-    *
-    * @param request
-    * @param appDevice
-    */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, AppDevice appDevice) {
-        return super.exportXls(request, appDevice, AppDevice.class, "nm_device");
-    }
-
-    /**
-      * 通过excel导入数据
-    *
-    * @param request
-    * @param response
-    * @return
-    */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        return super.importExcel(request, response, AppDevice.class);
-    }
-
-	@PostMapping(value = "/notice")
-	public Result<String> doorOpeningNotice(@RequestBody Object json) {
-		System.out.println("海康回调通知: " + json);
-		return Result.OK(null);
+	/**
+	 * 导出excel
+	 *
+	 * @param request
+	 * @param appDevice
+	 */
+	@RequestMapping(value = "/exportXls")
+	public ModelAndView exportXls(HttpServletRequest request, AppDevice appDevice) {
+		return super.exportXls(request, appDevice, AppDevice.class, "nm_device");
 	}
 
+	/**
+	 * 通过excel导入数据
+	 *
+	 * @param request
+	 * @param response
+	 * @return
+	 */
+	@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+	public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+		return super.importExcel(request, response, AppDevice.class);
+	}
 }