diff --git a/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/InsertUserRoleService.java b/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteUserRoleService.java similarity index 73% rename from RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/InsertUserRoleService.java rename to RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteUserRoleService.java index a2d70a3bc776371ea8ea381f0ef79c23000e65b5..09b8fdceb57b721b4e0ac26e0d2f5f656897fd63 100644 --- a/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/InsertUserRoleService.java +++ b/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteUserRoleService.java @@ -4,8 +4,7 @@ import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.system.api.domain.SysUser; -import com.ruoyi.system.api.factory.InsertUserRoleFallbackFactory; -import com.ruoyi.system.api.factory.RemoteLogFallbackFactory; +import com.ruoyi.system.api.factory.RemoteUserRoleFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -16,8 +15,8 @@ import org.springframework.web.bind.annotation.*; * date 2024/12/24-11:42 */ -@FeignClient(contextId = "InsertUserRoleService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = InsertUserRoleFallbackFactory.class) -public interface InsertUserRoleService { +@FeignClient(contextId = "RemoteUserRoleService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserRoleFallbackFactory.class) +public interface RemoteUserRoleService { /** * 新增用户 diff --git a/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/InsertUserRoleFallbackFactory.java b/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserRoleFallbackFactory.java similarity index 61% rename from RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/InsertUserRoleFallbackFactory.java rename to RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserRoleFallbackFactory.java index e7cef7bb465cd24dbb381cc6514828fe42e034a4..85b888562ca21fd3164c6a2f4619360358754de4 100644 --- a/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/InsertUserRoleFallbackFactory.java +++ b/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserRoleFallbackFactory.java @@ -1,7 +1,7 @@ package com.ruoyi.system.api.factory; import com.ruoyi.common.core.domain.R; -import com.ruoyi.system.api.InsertUserRoleService; +import com.ruoyi.system.api.RemoteUserRoleService; import com.ruoyi.system.api.domain.SysUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -16,19 +16,19 @@ import org.springframework.stereotype.Component; */ @Component -public class InsertUserRoleFallbackFactory implements FallbackFactory { +public class RemoteUserRoleFallbackFactory implements FallbackFactory { - private static final Logger log = LoggerFactory.getLogger(InsertUserRoleFallbackFactory.class); + private static final Logger log = LoggerFactory.getLogger(RemoteUserRoleFallbackFactory.class); @Override - public InsertUserRoleService create(Throwable throwable) + public RemoteUserRoleService create(Throwable throwable) { log.error("用户服务调用失败:{}", throwable.getMessage()); - return new InsertUserRoleService() + return new RemoteUserRoleService() { @Override - public R addApi(SysUser user,String msg) + public R addApi(SysUser user,String source) { return R.fail("新增用户失败:" + throwable.getMessage()); } diff --git a/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index ead921c12df4fed9139a6b773a9cd569f9a5396d..82e8df5f73bac62a226dc4620f4fc20f1747a87a 100644 --- a/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/RuoYi-Cloud-master/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,4 +1,4 @@ com.ruoyi.system.api.factory.RemoteUserFallbackFactory com.ruoyi.system.api.factory.RemoteLogFallbackFactory com.ruoyi.system.api.factory.RemoteFileFallbackFactory -com.ruoyi.system.api.factory.InsertUserRoleFallbackFactory +com.ruoyi.system.api.factory.RemoteUserRoleFallbackFactory diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqCustomerController.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqCustomerController.java index a8151dde136b4cda8c520dd87d1672f98a039228..447ec4af9e9bb4effc1aab6a50ea511052e86165 100644 --- a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqCustomerController.java +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqCustomerController.java @@ -1,9 +1,11 @@ package com.ruoyi.yonghu.controller; + import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.core.web.controller.BaseController; + /** * 客户管理Controller * @@ -15,4 +17,5 @@ import com.ruoyi.common.core.web.controller.BaseController; public class JsqCustomerController extends BaseController { + } diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqRepairController.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqRepairController.java index 9dc5ee7d0c1e7023519afc109885b19a1bdb9882..e1a2c7fe6dcb9157a5ab66b1fbd2fe89ba96f5c0 100644 --- a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqRepairController.java +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqRepairController.java @@ -17,7 +17,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import com.ruoyi.system.api.domain.SysUser; -import com.ruoyi.system.api.InsertUserRoleService; +import com.ruoyi.system.api.RemoteUserRoleService; import javax.annotation.Resource; import java.util.List; @@ -35,9 +35,7 @@ public class JsqRepairController extends BaseController { @Autowired private JsqRepairService jsqRepairService; @Resource - private InsertUserRoleService insertUserRoleService; -// @Resource -// private ISysUserService iSysUserService; + private RemoteUserRoleService remoteUserRoleService; /** * 查询维修人员管理列表 @@ -60,44 +58,35 @@ public class JsqRepairController extends BaseController { @Transactional public AjaxResult add(@Validated @RequestBody JsqRepair jsqRepair) { - - //验证是否存在用户名和手机号 -// if (!jsqRepairService.checkRepairNameUnique(jsqRepair)) { -// return error("新增用户'" + jsqRepair.getRepairName() + "'失败,登录账号已存在"); -// } else if (StringUtils.isNotEmpty(jsqRepair.getRepairPhone())) { -// return error("新增用户'" + jsqRepair.getRepairName() + "'失败,手机号码已存在"); -// } //新增维修工的基本信息 jsqRepair.setCreateBy(SecurityUtils.getUsername()); jsqRepair.setRepairPwd(SecurityUtils.encryptPassword(jsqRepair.getRepairPwd())); - jsqRepair.setRepairStatus(1L); - //新增维修工 - int i = jsqRepairService.insertJsqRepair(jsqRepair); - System.out.println("新增维修工成功;i=="+i); - if (i > 0) { - //新增维修工成功则在用户表也插入一条信息 - SysUser sysUser = new SysUser(); - Long[] roleIds = new Long[1]; - roleIds[0] = 5L; - sysUser.setRoleIds(roleIds); - sysUser.setUserId(jsqRepair.getUserId()); - sysUser.setUserName(jsqRepair.getRepairName()); - sysUser.setNickName(jsqRepair.getRepairName()); - sysUser.setPassword(SecurityUtils.encryptPassword(jsqRepair.getRepairPwd())); - sysUser.setPhonenumber(jsqRepair.getRepairPhone()); - sysUser.setStatus("0"); - sysUser.setCreateBy(SecurityUtils.getUsername()); - sysUser.setCreateTime(jsqRepair.getCreateTime()); - System.out.println("新增维修工成功;sysUser=="+sysUser.toString()); - R integerR = insertUserRoleService.addApi(sysUser, "inner" ); - System.out.println(integerR.getCode() + ";" + integerR.getData() + ";" + integerR.getMsg()); + //新增维修工成功则在用户表也插入一条信息 + SysUser sysUser = new SysUser(); + Long[] roleIds = new Long[1]; + roleIds[0] = 5L; + sysUser.setRoleIds(roleIds); + sysUser.setUserName(jsqRepair.getRepairName()); + sysUser.setNickName(jsqRepair.getRepairName()); + sysUser.setPassword(SecurityUtils.encryptPassword(jsqRepair.getRepairPwd())); + sysUser.setPhonenumber(jsqRepair.getRepairPhone()); + sysUser.setStatus("0"); + sysUser.setCreateBy(SecurityUtils.getUsername()); + sysUser.setCreateTime(jsqRepair.getCreateTime()); + + R integerR = remoteUserRoleService.addApi(sysUser, "inner" ); + int i= 0; + if (integerR.getCode() == 200) { + + jsqRepair.setUserId(Long.parseLong(integerR.getData().toString())); + //新增维修工 + i = jsqRepairService.insertJsqRepair(jsqRepair); return toAjax(i); } - return toAjax(i); } diff --git a/RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/repair/index.vue b/RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/repair/index.vue index 855b5e7e54401c7d65a63b6b3cb85a4c32217070..627d12a1dbeb452ea2de95ad0800b39976164b67 100644 --- a/RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/repair/index.vue +++ b/RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/repair/index.vue @@ -184,9 +184,7 @@ - - - +