diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java index e7a3ee22c49c260a9df83e6876e3ddba5c7d88e8..6a4f4641d425bb12d3049b726a51113591cabb29 100644 --- a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java @@ -187,7 +187,7 @@ public class SysUserController extends BaseController { @PostMapping("/addApi") public R addApi(@Validated @RequestBody SysUser user) { user.setCreateBy(SecurityUtils.getUsername()); - user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + //user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); userService.insertUser(user); // 插入成功后,获取返回的userId,返回给调用方 Integer userId = Math.toIntExact(user.getUserId()); 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 09ddd28236e1d228bc45a36293a392ebb0167c95..52b57aa3e9da8f01ae2cbd4257a9f1d2bb97e136 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 @@ -21,6 +21,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import com.ruoyi.common.core.web.controller.BaseController; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; @@ -40,7 +41,7 @@ public class JsqCustomerController extends BaseController @Autowired private JsqCustomerService jsqCustomerService; - @Autowired + @Resource private RemoteUserRoleService remoteUserRoleService; /** diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqPropertyController.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqPropertyController.java index ad6f1cc96af81f563732c19dfab9be50fa135e4f..672a1c312a5c0676110d2ba7f4f85f922263a3ba 100644 --- a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqPropertyController.java +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqPropertyController.java @@ -7,6 +7,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.yonghu.domain.JsqProperty; import com.ruoyi.yonghu.service.IJsqPropertyService; import org.springframework.beans.factory.annotation.Autowired; @@ -59,9 +60,9 @@ public class JsqPropertyController extends BaseController { @RequiresPermissions("yonghu:property:add") @Log(title = "物业人员", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody Map data) { + public AjaxResult add(@Validated @RequestBody JsqProperty jsqProperty) { - return toAjax(jsqPropertyService.insertJsqProperty(data)); + return toAjax(jsqPropertyService.insertJsqProperty(jsqProperty)); } /** @@ -70,8 +71,8 @@ public class JsqPropertyController extends BaseController { @RequiresPermissions("yonghu:property:edit") @Log(title = "物业人员", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody Map data) { - return toAjax(jsqPropertyService.updateJsqProperty(data)); + public AjaxResult edit(@Validated @RequestBody JsqProperty jsqProperty) { + return toAjax(jsqPropertyService.updateJsqProperty(jsqProperty)); } /** diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/IJsqPropertyService.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/IJsqPropertyService.java index 1054c85d063794321e2264ea1987b6ee4f06416c..583fc27370c43b4354f308f5ed821f8eea6f5295 100644 --- a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/IJsqPropertyService.java +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/IJsqPropertyService.java @@ -15,7 +15,7 @@ import java.util.Map; */ public interface IJsqPropertyService extends IService { - public int insertJsqProperty(Map data); + public int insertJsqProperty(JsqProperty jsqProperty); /** @@ -43,7 +43,7 @@ public interface IJsqPropertyService extends IService { * 修改物业人员 * @return 结果 */ - public int updateJsqProperty(@Validated @RequestBody Map data); + public int updateJsqProperty(@Validated @RequestBody JsqProperty jsqProperty); /** * 批量删除物业人员 diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/impl/JsqPropertyServiceImpl.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/impl/JsqPropertyServiceImpl.java index cbae109ce0cd8d9b8c71cfa90bd046702c0ce9a1..9239b04e87ba9635f0cd3dd2e6a2ff1e15c28f7a 100644 --- a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/impl/JsqPropertyServiceImpl.java +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/impl/JsqPropertyServiceImpl.java @@ -2,6 +2,7 @@ package com.ruoyi.yonghu.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.yonghu.domain.JsqProperty; import com.ruoyi.yonghu.mapper.JsqPropertyMapper; @@ -39,31 +40,33 @@ public class JsqPropertyServiceImpl extends ServiceImpl data){ + public int insertJsqProperty(JsqProperty jsqProperty){ + //在用户表也插入一条信息 SysUser sysUser = new SysUser(); - JsqProperty jsqProperty = new JsqProperty(); - Long[] roleIds = new Long[1]; roleIds[0] = 4L; sysUser.setRoleIds(roleIds); - sysUser.setPhonenumber((String) data.get("phonenumber")); - sysUser.setPassword((String) data.get("password")); + sysUser.setUserName(jsqProperty.getPropertyName()); + sysUser.setNickName(jsqProperty.getPropertyName()); + //sysUser.setPassword(SecurityUtils.encryptPassword(sysUser.getPassword())); + sysUser.setPhonenumber(jsqProperty.getPhonenumber()); sysUser.setStatus("0"); sysUser.setCreateBy(SecurityUtils.getUsername()); sysUser.setCreateTime(jsqProperty.getCreateTime()); - R integerR = remoteUserRoleService.addApi(sysUser, "inner" ); - - jsqProperty.setCommunityId(Long.valueOf((String)data.get("communityId"))); - jsqProperty.setPropertyName((String)data.get("propertyName")); - jsqProperty.setPropertyAddress((String) data.get("propertyAddress")); - jsqProperty.setPropertyAge(Long.valueOf((String)data.get("propertyAge"))); - jsqProperty.setPropertySex((String) data.get("propertySex")); - jsqProperty.setUserId(Long.parseLong(integerR.getData().toString())); + R integerR = remoteUserRoleService.addApi(sysUser, "inner"); + //当用户表插入成功之后再插入物业表 + if (integerR.getCode() == 200) { - return jsqPropertyMapper.insertJsqProperty(jsqProperty); + jsqProperty.setUserId(integerR.getData().longValue()); + //新增维修工 + jsqProperty.setCreateTime(DateUtils.getNowDate()); + return jsqPropertyMapper.insertJsqProperty(jsqProperty); + } else { + return -1; + } } @@ -94,36 +97,32 @@ public class JsqPropertyServiceImpl extends ServiceImpl data) + public int updateJsqProperty(JsqProperty jsqProperty) { + //在用户表也插入一条信息 SysUser sysUser = new SysUser(); - Long[] roleIds = new Long[1]; roleIds[0] = 4L; sysUser.setRoleIds(roleIds); - sysUser.setPhonenumber((String) data.get("phonenumber")); - sysUser.setPassword((String) data.get("password")); - sysUser.setSex(data.get("sex").toString()); + sysUser.setUserName(jsqProperty.getPropertyName()); + sysUser.setNickName(jsqProperty.getPropertyName()); + //sysUser.setPassword(SecurityUtils.encryptPassword(sysUser.getPassword())); + sysUser.setPhonenumber(jsqProperty.getPhonenumber()); sysUser.setStatus("0"); sysUser.setCreateBy(SecurityUtils.getUsername()); - - JsqProperty jsqProperty = new JsqProperty(); sysUser.setCreateTime(jsqProperty.getCreateTime()); - R integerR = remoteUserRoleService.editApi(sysUser, "inner" ); - - jsqProperty.setUserId(integerR.getData().longValue()); + R integerR = remoteUserRoleService.addApi(sysUser, "inner"); - jsqProperty.setCommunityId(Long.valueOf(data.get("communityId").toString())); - jsqProperty.setPropertyAddress((String) data.get("propertyAddress")); - jsqProperty.setPropertyName((String)data.get("propertyName")); - jsqProperty.setPropertyAge(Long.valueOf((String)data.get("propertyAge"))); - jsqProperty.setPropertySex((String) data.get("propertySex")); - jsqProperty.setUserId(Long.valueOf(data.get("userId").toString())); + //当用户表修改成功之后再修改物业表 + if (integerR.getCode() == 200) { - System.out.println("============="+jsqProperty); - int i = jsqPropertyMapper.updateJsqProperty(jsqProperty); - return i; + //修改物业 + jsqProperty.setCreateTime(DateUtils.getNowDate()); + return jsqPropertyMapper.updateJsqProperty(jsqProperty); + } else { + return -1; + } } /** diff --git a/RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/property/index.vue b/RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/property/index.vue deleted file mode 100644 index 959944aa8ae273fd9e34c1dd35de48f1f530f50a..0000000000000000000000000000000000000000 --- a/RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/property/index.vue +++ /dev/null @@ -1,459 +0,0 @@ - - - -