From dfdd4bd5d112a17ccd1483ad11fe023817d54d26 Mon Sep 17 00:00:00 2001 From: whywhyo <1511349576@qq.com> Date: 星期六, 22 七月 2023 15:20:13 +0800 Subject: [PATCH] 45648 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEquipmentController.java | 28 +- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCleanController.java | 28 +- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetController.java | 28 +- zhang-content/src/main/java/com/ruoyi/domain/dto/AuthorityDto2.java | 15 + ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfFamilyController.java | 43 ++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPropertyController.java | 28 +- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEconomyController.java | 28 +- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfContactController.java | 28 +- zhang-content/src/main/java/com/ruoyi/domain/dto/UserInfoDto.java | 17 + zhang-content/src/main/java/com/ruoyi/service/impl/ZfFamilyServiceImpl.java | 90 ++++++++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZAuthorityController.java | 9 + zhang-content/src/main/java/com/ruoyi/service/ZfFamilyService.java | 12 + zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java | 93 ++++++++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java | 28 +- zhang-content/src/main/java/com/ruoyi/service/ZAuthorityService.java | 3 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCollectionController.java | 28 +- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java | 32 +- 17 files changed, 407 insertions(+), 131 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZAuthorityController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZAuthorityController.java index e62117a..a0ad216 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZAuthorityController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZAuthorityController.java @@ -5,6 +5,7 @@ import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.domain.ZAuthority; import com.ruoyi.domain.dto.AuthorityDto; +import com.ruoyi.domain.dto.AuthorityDto2; import com.ruoyi.service.ZAuthorityService; import org.springframework.web.bind.annotation.*; @@ -47,6 +48,14 @@ return AjaxResult.success(zAuthorityService.getByCondition(authorityDto)); } + /** + * 鏉冮檺绠$悊(绠$悊鍛樼) + */ + @PostMapping() + public AjaxResult authorityManager(@RequestBody AuthorityDto2 authorityDto){ + return zAuthorityService.managerAuthority(authorityDto); + } + // /** // * 鎺堟潈(鍙湁瀹跺涵绠$悊鍛樻墠鑳借皟鐢ㄨ繖涓帴鍙�) // */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCleanController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCleanController.java index 5c2fb7a..bbf8e0a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCleanController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCleanController.java @@ -58,25 +58,25 @@ } -// /** -// * 瀵煎嚭淇濇磥鏀剁撼璁板綍鍒楄〃 -// */ -//// @PreAuthorize("@ss.hasPermi('system:property:export')") -// @Log(title = "淇濇磥鏀剁撼璁板綍", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response, ZfClean zfClean) -// { -// List<ZfClean> list = zfCleanService.selectByCondition(zfClean); -// log.info("瀵煎嚭璁板綍涓�:{}",list); -// ExcelUtil<ZfClean> util = new ExcelUtil<>(ZfClean.class); -// util.exportExcel(response, list, "淇濇磥鏀剁撼璁板綍鏁版嵁"); -// } /** * 瀵煎嚭淇濇磥鏀剁撼璁板綍鍒楄〃 */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "淇濇磥鏀剁撼璁板綍", businessType = BusinessType.EXPORT) - @PostMapping("/export/{ids}") + @PostMapping("/export") + public void export(HttpServletResponse response, ZfClean zfClean) + { + List<ZfClean> list = zfCleanService.selectByCondition(zfClean); + log.info("瀵煎嚭璁板綍涓�:{}",list); + ExcelUtil<ZfClean> util = new ExcelUtil<>(ZfClean.class); + util.exportExcel(response, list, "淇濇磥鏀剁撼璁板綍鏁版嵁"); + } + /** + * 瀵煎嚭淇濇磥鏀剁撼璁板綍鍒楄〃 + */ +// @PreAuthorize("@ss.hasPermi('system:property:export')") + @Log(title = "淇濇磥鏀剁撼璁板綍", businessType = BusinessType.EXPORT) + @PostMapping("/export1/{ids}") public void export(HttpServletResponse response, @PathVariable Long[] ids) { List<ZfClean> list = zfCleanService.selectByIds(ids); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCollectionController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCollectionController.java index 112aec8..0bcede8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCollectionController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCollectionController.java @@ -67,25 +67,25 @@ util.exportExcel(response,list,"鏀惰棌鑽h獕瀵煎叆妯℃澘"); } -// /** -// * 瀵煎嚭鏀惰棌鍜岃崳瑾夎褰曞垪琛� -// */ -//// @PreAuthorize("@ss.hasPermi('system:property:export')") -// @Log(title = "鏀惰棌鍜岃崳瑾夎褰�", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response, ZfCollection zfCollection) -// { -// List<ZfCollection> list = zfCollectionService.selectByCondition(zfCollection); -// log.info("瀵煎嚭璁板綍涓�:{}",list); -// ExcelUtil<ZfCollection> util = new ExcelUtil<>(ZfCollection.class); -// util.exportExcel(response, list, "鏀惰棌鍜岃崳瑾夎褰曟暟鎹�"); -// } /** * 瀵煎嚭鏀惰棌鍜岃崳瑾夎褰曞垪琛� */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "鏀惰棌鍜岃崳瑾夎褰�", businessType = BusinessType.EXPORT) - @PostMapping("/export/{ids}") + @PostMapping("/export") + public void export(HttpServletResponse response, ZfCollection zfCollection) + { + List<ZfCollection> list = zfCollectionService.selectByCondition(zfCollection); + log.info("瀵煎嚭璁板綍涓�:{}",list); + ExcelUtil<ZfCollection> util = new ExcelUtil<>(ZfCollection.class); + util.exportExcel(response, list, "鏀惰棌鍜岃崳瑾夎褰曟暟鎹�"); + } + /** + * 瀵煎嚭鏀惰棌鍜岃崳瑾夎褰曞垪琛� + */ +// @PreAuthorize("@ss.hasPermi('system:property:export')") + @Log(title = "鏀惰棌鍜岃崳瑾夎褰�", businessType = BusinessType.EXPORT) + @PostMapping("/export1/{ids}") public void export(HttpServletResponse response, @PathVariable Long[] ids) { List<ZfCollection> list = zfCollectionService.selectByIds(ids); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfContactController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfContactController.java index d461ea6..fda1205 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfContactController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfContactController.java @@ -57,26 +57,26 @@ util.exportExcel(response,list,"閫氳褰曞鍏ユā鏉�"); } -// /** -// * 瀵煎嚭閫氳褰曡褰曞垪琛� -// */ -//// @PreAuthorize("@ss.hasPermi('system:property:export')") -// @Log(title = "閫氳褰曡褰�", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response, ZfContact zfContact) -// { -// List<ZfContact> list = zfContactService.selectByCondition(zfContact); -// log.info("瀵煎嚭璁板綍涓�:{}",list); -// ExcelUtil<ZfContact> util = new ExcelUtil<>(ZfContact.class); -// util.exportExcel(response, list, "閫氳褰曡褰曟暟鎹�"); -// } + /** + * 瀵煎嚭閫氳褰曡褰曞垪琛� + */ +// @PreAuthorize("@ss.hasPermi('system:property:export')") + @Log(title = "閫氳褰曡褰�", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ZfContact zfContact) + { + List<ZfContact> list = zfContactService.selectByCondition(zfContact); + log.info("瀵煎嚭璁板綍涓�:{}",list); + ExcelUtil<ZfContact> util = new ExcelUtil<>(ZfContact.class); + util.exportExcel(response, list, "閫氳褰曡褰曟暟鎹�"); + } /** * 瀵煎嚭閫氳褰曡褰曞垪琛� */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "閫氳褰曡褰�", businessType = BusinessType.EXPORT) - @PostMapping("/export/{ids}") + @PostMapping("/export1/{ids}") public void export(HttpServletResponse response, @PathVariable Long[] ids) { List<ZfContact> list = zfContactService.selectByIds(ids); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java index 1c14108..bfadebf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java @@ -57,25 +57,25 @@ } -// /** -// * 瀵煎嚭瀹跺涵灏忓尰鐢熻褰曞垪琛� -// */ -//// @PreAuthorize("@ss.hasPermi('system:property:export')") -// @Log(title = "瀹跺涵灏忓尰鐢熻褰�", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response, ZfDoctor zfDoctor) -// { -// List<ZfDoctor> list = zfDoctorService.selectByCondition(zfDoctor); -// log.info("瀵煎嚭璁板綍涓�:{}",list); -// ExcelUtil<ZfDoctor> util = new ExcelUtil<>(ZfDoctor.class); -// util.exportExcel(response, list, "瀹跺涵灏忓尰鐢熻褰曟暟鎹�"); -// } /** * 瀵煎嚭瀹跺涵灏忓尰鐢熻褰曞垪琛� */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "瀹跺涵灏忓尰鐢熻褰�", businessType = BusinessType.EXPORT) - @PostMapping("/export/{ids}") + @PostMapping("/export") + public void export(HttpServletResponse response, ZfDoctor zfDoctor) + { + List<ZfDoctor> list = zfDoctorService.selectByCondition(zfDoctor); + log.info("瀵煎嚭璁板綍涓�:{}",list); + ExcelUtil<ZfDoctor> util = new ExcelUtil<>(ZfDoctor.class); + util.exportExcel(response, list, "瀹跺涵灏忓尰鐢熻褰曟暟鎹�"); + } + /** + * 瀵煎嚭瀹跺涵灏忓尰鐢熻褰曞垪琛� + */ +// @PreAuthorize("@ss.hasPermi('system:property:export')") + @Log(title = "瀹跺涵灏忓尰鐢熻褰�", businessType = BusinessType.EXPORT) + @PostMapping("/export1/{ids}") public void export(HttpServletResponse response, @PathVariable Long[] ids) { List<ZfDoctor> list = zfDoctorService.selectByIds(ids); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEconomyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEconomyController.java index 62ca5de..ec151a4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEconomyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEconomyController.java @@ -57,25 +57,25 @@ util.exportExcel(response,list,"瀹跺涵鏀舵敮鍙拌处瀵煎叆妯℃澘"); } -// /** -// * 瀵煎嚭瀹跺涵鏀舵敮鍙拌处璁板綍鍒楄〃 -// */ -//// @PreAuthorize("@ss.hasPermi('system:property:export')") -// @Log(title = "瀹跺涵鏀舵敮鍙拌处璁板綍", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response, ZfEconomy zfEconomy) -// { -// List<ZfEconomy> list = zfEconomyService.selectByCondition(zfEconomy); -// log.info("瀵煎嚭璁板綍涓�:{}",list); -// ExcelUtil<ZfEconomy> util = new ExcelUtil<>(ZfEconomy.class); -// util.exportExcel(response, list, "瀹跺涵鏀舵敮鍙拌处璁板綍鏁版嵁"); -// } /** * 瀵煎嚭瀹跺涵鏀舵敮鍙拌处璁板綍鍒楄〃 */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "瀹跺涵鏀舵敮鍙拌处璁板綍", businessType = BusinessType.EXPORT) - @PostMapping("/export/{ids}") + @PostMapping("/export") + public void export(HttpServletResponse response, ZfEconomy zfEconomy) + { + List<ZfEconomy> list = zfEconomyService.selectByCondition(zfEconomy); + log.info("瀵煎嚭璁板綍涓�:{}",list); + ExcelUtil<ZfEconomy> util = new ExcelUtil<>(ZfEconomy.class); + util.exportExcel(response, list, "瀹跺涵鏀舵敮鍙拌处璁板綍鏁版嵁"); + } + /** + * 瀵煎嚭瀹跺涵鏀舵敮鍙拌处璁板綍鍒楄〃 + */ +// @PreAuthorize("@ss.hasPermi('system:property:export')") + @Log(title = "瀹跺涵鏀舵敮鍙拌处璁板綍", businessType = BusinessType.EXPORT) + @PostMapping("/export1/{ids}") public void export(HttpServletResponse response, @PathVariable Long[] ids) { List<ZfEconomy> list = zfEconomyService.selectByIds(ids); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEquipmentController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEquipmentController.java index 9664f3f..820f05d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEquipmentController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEquipmentController.java @@ -60,24 +60,24 @@ } -// /** -// * 瀵煎嚭瀹跺涵璁惧璁板綍鍒楄〃 -// */ -//// @PreAuthorize("@ss.hasPermi('system:equipment:export')") -// @Log(title = "瀹跺涵璁惧璁板綍", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response, ZfEquipment zfEquipment) -// { -// List<ZfEquipment> list = zfEquipmentService.selectByCondition(zfEquipment); -// log.info("瀵煎嚭璁板綍涓�:{}",list); -// ExcelUtil<ZfEquipment> util = new ExcelUtil<ZfEquipment>(ZfEquipment.class); -// util.exportExcel(response, list, "瀹跺涵璁惧璁板綍鏁版嵁"); -// } + /** + * 瀵煎嚭瀹跺涵璁惧璁板綍鍒楄〃 + */ +// @PreAuthorize("@ss.hasPermi('system:equipment:export')") + @Log(title = "瀹跺涵璁惧璁板綍", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ZfEquipment zfEquipment) + { + List<ZfEquipment> list = zfEquipmentService.selectByCondition(zfEquipment); + log.info("瀵煎嚭璁板綍涓�:{}",list); + ExcelUtil<ZfEquipment> util = new ExcelUtil<ZfEquipment>(ZfEquipment.class); + util.exportExcel(response, list, "瀹跺涵璁惧璁板綍鏁版嵁"); + } /** * 瀵煎嚭瀹跺涵璁惧璁板綍鍒楄〃 */ @Log(title = "瀹跺涵璁惧璁板綍", businessType = BusinessType.EXPORT) - @PostMapping("/export/{ids}") + @PostMapping("/export1/{ids}") public void export(HttpServletResponse response, @PathVariable Long[] ids) { List<ZfEquipment> list = zfEquipmentService.selectByIds(ids); log.info("瀵煎嚭璁板綍涓�:{}", list); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java index 722848a..9a82850 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java @@ -60,27 +60,27 @@ } -// /** -// * 瀵煎嚭瀹跺涵澶т簨浠惰褰曞垪琛� -// */ -//// @PreAuthorize("@ss.hasPermi('system:property:export')") -// @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response, ZfEvent zfEvent) { -// List<ZfEvent> list = new ArrayList<>(); -// -// list = zfEventService.selectByCondition(zfEvent); -// log.info("瀵煎嚭璁板綍涓�:{}", list); -// ExcelUtil<ZfEvent> util = new ExcelUtil<>(ZfEvent.class); -// util.exportExcel(response, list, "瀹跺涵澶т簨浠惰褰曟暟鎹�"); -// -// } /** * 瀵煎嚭瀹跺涵澶т簨浠惰褰曞垪琛� */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.EXPORT) - @PostMapping("/export/{ids}") + @PostMapping("/export") + public void export(HttpServletResponse response, ZfEvent zfEvent) { + List<ZfEvent> list = new ArrayList<>(); + + list = zfEventService.selectByCondition(zfEvent); + log.info("瀵煎嚭璁板綍涓�:{}", list); + ExcelUtil<ZfEvent> util = new ExcelUtil<>(ZfEvent.class); + util.exportExcel(response, list, "瀹跺涵澶т簨浠惰褰曟暟鎹�"); + + } + /** + * 瀵煎嚭瀹跺涵澶т簨浠惰褰曞垪琛� + */ +// @PreAuthorize("@ss.hasPermi('system:property:export')") + @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.EXPORT) + @PostMapping("/export1/{ids}") public void export(HttpServletResponse response, @PathVariable Long[] ids) { List<ZfEvent> list = zfEventService.selectByIds(ids); log.info("瀵煎嚭璁板綍涓�:{}", list); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfFamilyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfFamilyController.java index 09398a8..13bc437 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfFamilyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfFamilyController.java @@ -1,10 +1,10 @@ package com.ruoyi.web.controller.zhang; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.domain.dto.UserInfoDto; import com.ruoyi.service.ZfFamilyService; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.security.core.parameters.P; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -26,5 +26,42 @@ return AjaxResult.success(zfFamilyService.list()); } + /** + * 鏍规嵁瀹跺涵id鏌ヨ瀹跺涵鎴愬憳 + */ + @GetMapping("/{fid}") + public AjaxResult getByFamilyId(@PathVariable Long fid){ + return AjaxResult.success(zfFamilyService.getByFamilyId(fid)); + } + + /** + * 鏌ョ湅褰撳墠鐢ㄦ埛褰撳墠瀹跺涵鐨勫搴垚鍛� + */ + + @GetMapping("/now") + public AjaxResult getNowMember(){ + return AjaxResult.success(zfFamilyService.getNowMember()); + } + + /** + * 鏂板瀹跺涵鎴愬憳 + */ + @PostMapping() + public AjaxResult addFamilyMember(@RequestBody UserInfoDto userInfoDto){ + return zfFamilyService.addMember(userInfoDto); + + } + + /** + * 鍒犻櫎瀹跺涵鎴愬憳 + */ + + @DeleteMapping() + public AjaxResult removeFamilyMember(@RequestBody UserInfoDto userInfoDto){ + return zfFamilyService.removeMember(userInfoDto); + } + + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetController.java index efa483d..32e270f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetController.java @@ -56,26 +56,26 @@ util.exportExcel(response,list,"榄呭疇璁板綍瀵煎叆妯℃澘"); } -// /** -// * 瀵煎嚭榄呭疇璁板綍鍒楄〃 -// */ -//// @PreAuthorize("@ss.hasPermi('system:property:export')") -// @Log(title = "榄呭疇璁板綍", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response, ZfPet zfPet) -// { -// List<ZfPet> list = zfPetService.selectByCondition(zfPet); -// log.info("瀵煎嚭璁板綍涓�:{}",list); -// ExcelUtil<ZfPet> util = new ExcelUtil<>(ZfPet.class); -// util.exportExcel(response, list, "榄呭疇璁板綍鏁版嵁"); -// } + /** + * 瀵煎嚭榄呭疇璁板綍鍒楄〃 + */ +// @PreAuthorize("@ss.hasPermi('system:property:export')") + @Log(title = "榄呭疇璁板綍", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ZfPet zfPet) + { + List<ZfPet> list = zfPetService.selectByCondition(zfPet); + log.info("瀵煎嚭璁板綍涓�:{}",list); + ExcelUtil<ZfPet> util = new ExcelUtil<>(ZfPet.class); + util.exportExcel(response, list, "榄呭疇璁板綍鏁版嵁"); + } /** * 瀵煎嚭榄呭疇璁板綍鍒楄〃 */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "榄呭疇璁板綍", businessType = BusinessType.EXPORT) - @PostMapping("/export/{ids}") + @PostMapping("/export1/{ids}") public void export(HttpServletResponse response, @PathVariable Long[] ids) { List<ZfPet> list = zfPetService.selectByIds(ids); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPropertyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPropertyController.java index 4dceeef..9582c55 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPropertyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPropertyController.java @@ -55,24 +55,24 @@ util.exportExcel(response,list,"瀹跺涵璧勪骇瀵煎叆妯℃澘"); } -// /** -// * 瀵煎嚭瀹跺涵璧勪骇璁板綍鍒楄〃 -// */ -//// @PreAuthorize("@ss.hasPermi('system:property:export')") -// @Log(title = "瀹跺涵璧勪骇璁板綍", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response,ZfProperty zfProperty) -// { -// List<ZfProperty> list = zfPropertyService.selectByCondition(zfProperty); -// log.info("瀵煎嚭璁板綍涓�:{}",list); -// ExcelUtil<ZfProperty> util = new ExcelUtil<>(ZfProperty.class); -// util.exportExcel(response, list, "瀹跺涵璧勪骇璁板綍鏁版嵁"); -// } + /** + * 瀵煎嚭瀹跺涵璧勪骇璁板綍鍒楄〃 + */ +// @PreAuthorize("@ss.hasPermi('system:property:export')") + @Log(title = "瀹跺涵璧勪骇璁板綍", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response,ZfProperty zfProperty) + { + List<ZfProperty> list = zfPropertyService.selectByCondition(zfProperty); + log.info("瀵煎嚭璁板綍涓�:{}",list); + ExcelUtil<ZfProperty> util = new ExcelUtil<>(ZfProperty.class); + util.exportExcel(response, list, "瀹跺涵璧勪骇璁板綍鏁版嵁"); + } /** * 瀵煎嚭瀹跺涵璧勪骇璁板綍鍒楄〃 */ @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.EXPORT) - @PostMapping("/export/{ids}") + @PostMapping("/export1/{ids}") public void export1(HttpServletResponse response, @PathVariable Long[] ids) { List<ZfProperty> list = zfPropertyService.selectByIds(ids); log.info("瀵煎嚭璁板綍涓�:{}", list); diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/AuthorityDto2.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/AuthorityDto2.java new file mode 100644 index 0000000..91c6172 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/AuthorityDto2.java @@ -0,0 +1,15 @@ +package com.ruoyi.domain.dto; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-21 20:07 + * @Version 1.0.0 + **/ +@Data +public class AuthorityDto2 extends AuthorityDto{ + private Long uid; + +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/UserInfoDto.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/UserInfoDto.java new file mode 100644 index 0000000..ac46946 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/UserInfoDto.java @@ -0,0 +1,17 @@ +package com.ruoyi.domain.dto; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-21 19:58 + * @Version 1.0.0 + **/ +@Data +public class UserInfoDto { + private Long id; + private Long familyId; + private String familyName; + private String name; +} diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZAuthorityService.java b/zhang-content/src/main/java/com/ruoyi/service/ZAuthorityService.java index 55223ad..224ed7e 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZAuthorityService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZAuthorityService.java @@ -1,8 +1,10 @@ package com.ruoyi.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZAuthority; import com.ruoyi.domain.dto.AuthorityDto; +import com.ruoyi.domain.dto.AuthorityDto2; import java.util.List; @@ -19,4 +21,5 @@ List<String> getAuthorityFamilyName(); + AjaxResult managerAuthority(AuthorityDto2 authorityDto); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfFamilyService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfFamilyService.java index 5d4255d..d74a482 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfFamilyService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfFamilyService.java @@ -1,8 +1,13 @@ package com.ruoyi.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.domain.ZInfoUser; import com.ruoyi.domain.ZfFamily; +import com.ruoyi.domain.dto.UserInfoDto; import org.springframework.stereotype.Service; + +import java.util.List; /** * @Author Jinquan_Ou @@ -19,4 +24,11 @@ ZfFamily getByName(String familyName); + List<UserInfoDto> getByFamilyId(Long fid); + + List<UserInfoDto> getNowMember(); + + AjaxResult addMember(UserInfoDto userInfoDto); + + AjaxResult removeMember(UserInfoDto userInfoDto); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java index 9feb3d5..50cf44e 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java @@ -2,17 +2,22 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.domain.ZAuthority; +import com.ruoyi.domain.ZInfoUser; import com.ruoyi.domain.ZfCode; import com.ruoyi.domain.ZfFamily; import com.ruoyi.domain.dto.AuthorityDto; +import com.ruoyi.domain.dto.AuthorityDto2; import com.ruoyi.mapper.ZAuthorityMapper; import com.ruoyi.service.ZAuthorityService; +import com.ruoyi.service.ZInfoUserService; import com.ruoyi.service.ZfCodeService; import com.ruoyi.service.ZfFamilyService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; @@ -32,6 +37,12 @@ @Resource private ZfCodeService zfCodeService; + + @Resource + private ZAuthorityService zAuthorityService; + + @Resource + private ZInfoUserService zInfoUserService; /** * 鏌ヨ褰撳墠鐢ㄦ埛鐨勬潈闄� @@ -103,4 +114,86 @@ return familyList.stream().map(ZfFamily::getName).distinct().collect(Collectors.toList()); } + /** + * + * @param authorityDto 浼犲叆浜嗙敤鎴穒d銆乵odelName + * @return + */ + @Override + @Transactional + public AjaxResult managerAuthority(AuthorityDto2 authorityDto) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + ZInfoUser myself = zInfoUserService.getById(userId); + + //鏌ョ湅褰撳墠鐢ㄦ埛鏄笉鏄鐞嗗憳 + if(myself.getRoleId()!=1 && myself.getRoleId()!=2){ + throw new RuntimeException("浣犱笉鏄搴鐞嗗憳锛屾病鏈夋潈闄愭搷浣�"); + } + + + Long uid = authorityDto.getUid(); + Long fid = myself.getFamilyId(); + String modelName = authorityDto.getModelName(); + + //鏍规嵁妯″潡鐨勫悕瀛楁煡鍑哄搴旂殑鏉冮檺鐮� + List<ZfCode> zfCodeList = zfCodeService.likeGetByName(modelName); + List<Long> allCodeList = zfCodeList.stream().map(ZfCode::getCode).collect(Collectors.toList());//鏉冮檺鐮佹暟缁� + + //鎵惧埌瀵瑰簲瀹跺涵瀵瑰簲妯″潡鐨勬潈闄愭暟缁� + LambdaQueryWrapper<ZAuthority> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZAuthority::getFid,fid) + .eq(ZAuthority::getUid,uid) + .in(ZAuthority::getAuthority,allCodeList); + List<ZAuthority> authorityList = list(lqw); + + //鍏堝垹鎺夌幇鍦ㄦ墍鏈夌殑鏉冮檺 + List<Long> idList = authorityList.stream().map(ZAuthority::getId).collect(Collectors.toList()); + zAuthorityService.removeBatchByIds(idList); + + //鍐嶆坊鍔犳柊璁剧疆鐨勬潈闄� + if(authorityDto.getSearch() == 1){ + //鏍规嵁妯″潡鐨勫悕瀛楁煡鍒版潈闄愮爜锛屽彧浼氭湁涓�涓粨鏋� + List<ZfCode> zfcode = zfCodeService.likeGetByName(modelName + "鏌ョ湅"); + ZAuthority zAuthority = new ZAuthority(); + zAuthority.setFid(fid); + zAuthority.setUid(uid); + zAuthority.setAuthority(zfcode.get(0).getCode()); + zAuthorityService.save(zAuthority); + } + + if(authorityDto.getInsert() == 1){ + //鏍规嵁妯″潡鐨勫悕瀛楁煡鍒版潈闄愮爜锛屽彧浼氭湁涓�涓粨鏋� + List<ZfCode> zfcode = zfCodeService.likeGetByName(modelName + "娣诲姞"); + ZAuthority zAuthority = new ZAuthority(); + zAuthority.setFid(fid); + zAuthority.setUid(uid); + zAuthority.setAuthority(zfcode.get(0).getCode()); + zAuthorityService.save(zAuthority); + } + + if(authorityDto.getUpdate() == 1){ + //鏍规嵁妯″潡鐨勫悕瀛楁煡鍒版潈闄愮爜锛屽彧浼氭湁涓�涓粨鏋� + List<ZfCode> zfcode = zfCodeService.likeGetByName(modelName + "淇敼"); + ZAuthority zAuthority = new ZAuthority(); + zAuthority.setFid(fid); + zAuthority.setUid(uid); + zAuthority.setAuthority(zfcode.get(0).getCode()); + zAuthorityService.save(zAuthority); + } + + if(authorityDto.getDelete() == 1){ + //鏍规嵁妯″潡鐨勫悕瀛楁煡鍒版潈闄愮爜锛屽彧浼氭湁涓�涓粨鏋� + List<ZfCode> zfcode = zfCodeService.likeGetByName(modelName + "鍒犻櫎"); + ZAuthority zAuthority = new ZAuthority(); + zAuthority.setFid(fid); + zAuthority.setUid(uid); + zAuthority.setAuthority(zfcode.get(0).getCode()); + zAuthorityService.save(zAuthority); + } + + return AjaxResult.success(); + + } + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfFamilyServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfFamilyServiceImpl.java index 48cb8b8..d76aa4f 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfFamilyServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfFamilyServiceImpl.java @@ -1,14 +1,26 @@ package com.ruoyi.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.domain.ZInfoUser; import com.ruoyi.domain.ZfEvent; import com.ruoyi.domain.ZfFamily; +import com.ruoyi.domain.dto.UserInfoDto; import com.ruoyi.mapper.ZfEventMapper; import com.ruoyi.mapper.ZfFamilyMapper; +import com.ruoyi.service.ZInfoUserService; import com.ruoyi.service.ZfEventService; import com.ruoyi.service.ZfFamilyService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; /** * @Author Jinquan_Ou @@ -18,10 +30,88 @@ **/ @Service public class ZfFamilyServiceImpl extends ServiceImpl<ZfFamilyMapper, ZfFamily> implements ZfFamilyService { + @Autowired + ZInfoUserService zInfoUserService; + + @Override public ZfFamily getByName(String familyName) { LambdaQueryWrapper<ZfFamily> lqw = new LambdaQueryWrapper<>(); lqw.eq(ZfFamily::getName,familyName); return getOne(lqw); } + + @Override + public List<UserInfoDto> getByFamilyId(Long fid) { + LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZInfoUser::getFamilyId,fid); + List<ZInfoUser> list = zInfoUserService.list(lqw); + return list.stream().map( + zInfoUser -> { + UserInfoDto userInfoDto = new UserInfoDto(); + userInfoDto.setId(zInfoUser.getUserId()); + userInfoDto.setFamilyId(zInfoUser.getFamilyId()); + userInfoDto.setName(zInfoUser.getNickName()); + userInfoDto.setFamilyName(getById(zInfoUser.getFamilyId()).getName()); + return userInfoDto; + } + ).collect(Collectors.toList()); + + } + + @Override + public List<UserInfoDto> getNowMember() { + + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + ZInfoUser myself = zInfoUserService.getById(userId); + return getByFamilyId(myself.getFamilyId()); + } + + @Override + public AjaxResult addMember(UserInfoDto userInfoDto) { + + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + ZInfoUser myself = zInfoUserService.getById(userId); + + //鏌ョ湅褰撳墠鐢ㄦ埛鏄笉鏄鐞嗗憳 + if(myself.getRoleId()!=1 && myself.getRoleId()!=2){ + throw new RuntimeException("浣犱笉鏄搴鐞嗗憳锛屾病鏈夋潈闄愭搷浣�"); + } + + Long uid = userInfoDto.getId(); +// Long targetFamilyId = zInfoUserService.getById(uid).getFamilyId(); + UpdateWrapper<ZInfoUser> luw = new UpdateWrapper<>(); + luw.eq("user_id",uid); + //update from z_info_user set family_id = #{targetFamilyId where user_id = #{uid} + luw.setSql("family_id = "+myself.getFamilyId()); + + zInfoUserService.update(luw); + return AjaxResult.success(); + + } + + @Override + public AjaxResult removeMember(UserInfoDto userInfoDto) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + ZInfoUser myself = zInfoUserService.getById(userId); + + //鏌ョ湅褰撳墠鐢ㄦ埛鏄笉鏄鐞嗗憳 + if(myself.getRoleId()!=1 && myself.getRoleId()!=2){ + throw new RuntimeException("浣犱笉鏄搴鐞嗗憳锛屾病鏈夋潈闄愭搷浣�"); + } + + Long uid = userInfoDto.getId(); +// Long targetFamilyId = zInfoUserService.getById(uid).getFamilyId(); + UpdateWrapper<ZInfoUser> luw = new UpdateWrapper<>(); + luw.eq("user_id",uid); + //update from z_info_user set family_id = #{targetFamilyId where user_id = #{uid} + luw.setSql("family_id = "+null); + + zInfoUserService.update(luw); + return AjaxResult.success(); + + } } -- Gitblit v1.9.1