From 2039385fa4b4ac688907134ee7c7025fb2aea1fb Mon Sep 17 00:00:00 2001
From: whywhyo <1511349576@qq.com>
Date: 星期日, 16 七月 2023 12:59:17 +0800
Subject: [PATCH] 666
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCleanController.java | 34
zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java | 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfRoleController.java | 28
zhang-content/src/main/java/com/ruoyi/mapper/ZfFamilyMapper.java | 15
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZRotationController.java | 51
zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java | 13
zhang-content/src/main/java/com/ruoyi/domain/ZfEquipment.java | 2
zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java | 261 ++-
zhang-content/src/main/java/com/ruoyi/service/ZfFamilyService.java | 15
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java | 458 +++-
zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java | 50
zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java | 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java | 52
zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java | 6
zhang-content/src/main/java/com/ruoyi/domain/ZfClean.java | 2
zhang-content/src/main/java/com/ruoyi/service/ZfEconomyService.java | 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPropertyController.java | 39
zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java | 5
zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java | 2
zhang-content/src/main/java/com/ruoyi/service/IZfPropertyService.java | 12
zhang-content/src/main/java/com/ruoyi/domain/ZfFamily.java | 31
zhang-content/src/main/java/com/ruoyi/service/ZfContactService.java | 6
zhang-content/src/main/java/com/ruoyi/service/ZfCleanService.java | 9
zhang-content/src/main/java/com/ruoyi/domain/ZRotation.java | 28
zhang-content/src/main/java/com/ruoyi/service/ZfRoleService.java | 15
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java | 518 +++--
zhang-content/src/main/java/com/ruoyi/service/impl/ZfRoleServiceImpl.java | 20
zhang-content/src/main/java/com/ruoyi/service/ZfEquipmentService.java | 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfFamilyController.java | 30
zhang-content/src/main/java/com/ruoyi/mapper/ZAuthorityMapper.java | 15
zhang-content/src/main/java/com/ruoyi/mapper/ZRotationMapper.java | 15
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfContactController.java | 49
zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java | 4
zhang-content/src/main/java/com/ruoyi/mapper/ZfRoleMapper.java | 16
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java | 506 +++--
zhang-content/src/main/java/com/ruoyi/domain/ZfRole.java | 26
zhang-content/src/main/java/com/ruoyi/service/impl/ZRotationServiceImpl.java | 26
zhang-content/src/main/java/com/ruoyi/service/ZAuthorityService.java | 16
zhang-content/src/main/java/com/ruoyi/domain/ZfContact.java | 2
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java | 207 ++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCollectionController.java | 34
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java | 522 +++--
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEquipmentController.java | 38
zhang-content/src/main/java/com/ruoyi/domain/ZAuthority.java | 37
zhang-content/src/main/java/com/ruoyi/service/ZRotationService.java | 16
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEconomyController.java | 34
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorService.java | 11
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java | 523 +++--
zhang-content/src/main/java/com/ruoyi/service/ZfCollectionService.java | 8
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java | 542 ++++--
zhang-content/src/main/java/com/ruoyi/service/impl/ZfFamilyServiceImpl.java | 20
zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java | 35
zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java | 516 +++--
zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java | 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java | 12
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java | 42
56 files changed, 3,398 insertions(+), 1,596 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
index 1579775..9ee14ef 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
@@ -17,6 +17,8 @@
import com.ruoyi.domain.dto.GenealogyExportDto;
import com.ruoyi.domain.dto.RelationDto;
import com.ruoyi.service.ZInfoUserService;
+import com.ruoyi.service.ZfFamilyService;
+import com.ruoyi.service.ZfRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -46,6 +48,12 @@
@Resource
private ZInfoUserService zInfoUserService;
+
+ @Resource
+ private ZfFamilyService zfFamilyService;
+
+ @Resource
+ private ZfRoleService zfRoleService;
// @GetMapping("/all")
// public AjaxResult listAll(ZInfoUser zInfoUser){
@@ -104,7 +112,7 @@
public AjaxResult getInfo() {
SysUser user = SecurityUtils.getLoginUser().getUser();
Long userId = user.getUserId();
- return AjaxResult.success(zInfoUserService.getById(userId));
+ return AjaxResult.success(zInfoUserService.getInfoById(userId));
}
//
@@ -237,5 +245,7 @@
util.exportExcel(response,list,"瀹惰氨璁板綍鏁版嵁");
}
+
+
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZRotationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZRotationController.java
new file mode 100644
index 0000000..374441f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZRotationController.java
@@ -0,0 +1,51 @@
+package com.ruoyi.web.controller.zhang;
+
+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.ZRotation;
+import com.ruoyi.service.ZRotationService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-15 0:20
+ * @Version 1.0.0
+ **/
+@RestController
+@RequestMapping("/rotation")
+public class ZRotationController {
+
+ @Resource
+ private ZRotationService zRotationService;
+
+ @GetMapping("/all")
+ public AjaxResult getRotation(){
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+ List<ZRotation> rotationList = zRotationService.getByUserId(userId);
+ return AjaxResult.success(rotationList);
+ }
+
+ @PostMapping("/add")
+ public AjaxResult addRotation(ZRotation zRotation){
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+ zRotation.setUid(userId);
+ zRotationService.save(zRotation);
+ return AjaxResult.success();
+ }
+
+ @DeleteMapping("/delete/{ids}")
+ public AjaxResult deleteRotation(@PathVariable Long[] ids){
+ zRotationService.removeByIds(Arrays.asList(ids));
+ return AjaxResult.success();
+ }
+
+
+}
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 13e7d7a..5c2fb7a 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")
- 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}")
+ @PostMapping("/export/{ids}")
public void export(HttpServletResponse response, @PathVariable Long[] ids)
{
List<ZfClean> list = zfCleanService.selectByIds(ids);
@@ -114,7 +114,7 @@
@PostMapping
public AjaxResult add(@RequestBody ZfClean zfClean)
{
- return zfCleanService.addData2(zfClean);
+ return zfCleanService.addData(zfClean);
}
/**
@@ -125,7 +125,7 @@
@PutMapping
public AjaxResult edit(@RequestBody ZfClean zfClean)
{
- return toAjax(zfCleanService.updateById(zfClean));
+ return zfCleanService.updateData(zfClean);
}
//
/**
@@ -136,7 +136,7 @@
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
- return toAjax(zfCleanService.removeByIds(Arrays.asList(ids)));
+ return zfCleanService.deleteData(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 9884102..112aec8 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")
- 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}")
+ @PostMapping("/export/{ids}")
public void export(HttpServletResponse response, @PathVariable Long[] ids)
{
List<ZfCollection> list = zfCollectionService.selectByIds(ids);
@@ -123,7 +123,7 @@
@PostMapping
public AjaxResult add(@RequestBody ZfCollection zfCollection)
{
- return zfCollectionService.addData2(zfCollection);
+ return zfCollectionService.addData(zfCollection);
}
/**
@@ -134,7 +134,7 @@
@PutMapping
public AjaxResult edit(@RequestBody ZfCollection zfCollection)
{
- return toAjax(zfCollectionService.updateById(zfCollection));
+ return zfCollectionService.updateData(zfCollection);
}
//
/**
@@ -145,7 +145,7 @@
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
- return toAjax(zfCollectionService.removeByIds(Arrays.asList(ids)));
+ return zfCollectionService.deleteData(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 58d7002..d461ea6 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("/export1/{ids}")
+ @PostMapping("/export/{ids}")
public void export(HttpServletResponse response, @PathVariable Long[] ids)
{
List<ZfContact> list = zfContactService.selectByIds(ids);
@@ -91,13 +91,14 @@
@PostMapping("/importData")
public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception
{
- ExcelUtil<ZfContact> util = new ExcelUtil<>(ZfContact.class);
- List<ZfContact> eventList = util.importExcel(file.getInputStream());
- log.info("閫氳褰曞垪琛ㄤ负锛歿}",eventList);
- if (zfContactService.saveBatch(eventList)) {
- return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
- }
- return AjaxResult.error("瀵煎叆鏁版嵁澶辫触");
+// ExcelUtil<ZfContact> util = new ExcelUtil<>(ZfContact.class);
+// List<ZfContact> eventList = util.importExcel(file.getInputStream());
+// log.info("閫氳褰曞垪琛ㄤ负锛歿}",eventList);
+// if (zfContactService.saveBatch(eventList)) {
+// return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
+// }
+// return AjaxResult.error("瀵煎叆鏁版嵁澶辫触");
+ return zfContactService.importExcel(file);
}
/**
@@ -118,7 +119,7 @@
@PostMapping
public AjaxResult add(@RequestBody ZfContact zfContact)
{
- return (zfContactService.addData2(zfContact));
+ return (zfContactService.addData(zfContact));
}
/**
@@ -129,7 +130,7 @@
@PutMapping
public AjaxResult edit(@RequestBody ZfContact zfContact)
{
- return toAjax(zfContactService.updateById(zfContact));
+ return zfContactService.updateData(zfContact);
}
//
/**
@@ -140,7 +141,7 @@
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
- return toAjax(zfContactService.removeByIds(Arrays.asList(ids)));
+ return zfContactService.deleteData(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 9a197dd..1c14108 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,26 +57,26 @@
}
+// /**
+// * 瀵煎嚭瀹跺涵灏忓尰鐢熻褰曞垪琛�
+// */
+//// @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")
- 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 export1(HttpServletResponse response, @PathVariable Long[] ids)
+ @PostMapping("/export/{ids}")
+ public void export(HttpServletResponse response, @PathVariable Long[] ids)
{
List<ZfDoctor> list = zfDoctorService.selectByIds(ids);
log.info("瀵煎嚭璁板綍涓�:{}",list);
@@ -90,14 +90,16 @@
@PostMapping("/importData")
public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception
{
- ExcelUtil<ZfDoctor> util = new ExcelUtil<>(ZfDoctor.class);
- List<ZfDoctor> eventList = util.importExcel(file.getInputStream());
- log.info("瀹跺涵灏忓尰鐢熷垪琛ㄤ负锛歿}",eventList);
+// ExcelUtil<ZfDoctor> util = new ExcelUtil<>(ZfDoctor.class);
+// List<ZfDoctor> eventList = util.importExcel(file.getInputStream());
+// log.info("瀹跺涵灏忓尰鐢熷垪琛ㄤ负锛歿}",eventList);
+//
+// if (zfDoctorService.saveBatch(eventList)) {
+// return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
+// }
+// return AjaxResult.error("瀵煎叆鏁版嵁澶辫触");
- if (zfDoctorService.saveBatch(eventList)) {
- return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
- }
- return AjaxResult.error("瀵煎叆鏁版嵁澶辫触");
+ return zfDoctorService.importExcel(file);
}
/**
@@ -118,7 +120,7 @@
@PostMapping
public AjaxResult add(@RequestBody ZfDoctor zfDoctor)
{
- return zfDoctorService.mySave(zfDoctor);
+ return zfDoctorService.addData(zfDoctor);
}
/**
@@ -129,7 +131,7 @@
@PutMapping
public AjaxResult edit(@RequestBody ZfDoctor zfDoctor)
{
- return toAjax(zfDoctorService.updateById(zfDoctor));
+ return zfDoctorService.updateData(zfDoctor);
}
//
/**
@@ -140,7 +142,7 @@
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
- return toAjax(zfDoctorService.removeByIds(Arrays.asList(ids)));
+ return zfDoctorService.deleteData(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 2521423..62ca5de 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")
- 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}")
+ @PostMapping("/export/{ids}")
public void export(HttpServletResponse response, @PathVariable Long[] ids)
{
List<ZfEconomy> list = zfEconomyService.selectByIds(ids);
@@ -113,7 +113,7 @@
@PostMapping
public AjaxResult add(@RequestBody ZfEconomy zfEconomy)
{
- return zfEconomyService.addData2(zfEconomy);
+ return zfEconomyService.addData(zfEconomy);
}
/**
@@ -124,7 +124,7 @@
@PutMapping
public AjaxResult edit(@RequestBody ZfEconomy zfEconomy)
{
- return toAjax(zfEconomyService.updateById(zfEconomy));
+ return zfEconomyService.updateData(zfEconomy);
}
//
/**
@@ -135,7 +135,7 @@
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
- return toAjax(zfEconomyService.removeByIds(Arrays.asList(ids)));
+ return zfEconomyService.deleteData(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 b871ac0..9664f3f 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,29 +60,29 @@
}
+// /**
+// * 瀵煎嚭瀹跺涵璁惧璁板綍鍒楄〃
+// */
+//// @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("/export1/{ids}")
- public void export1(HttpServletResponse response, @PathVariable Long[] ids) {
+ @PostMapping("/export/{ids}")
+ public void export(HttpServletResponse response, @PathVariable Long[] ids) {
List<ZfEquipment> list = zfEquipmentService.selectByIds(ids);
log.info("瀵煎嚭璁板綍涓�:{}", list);
ExcelUtil<ZfEquipment> util = new ExcelUtil<ZfEquipment>(ZfEquipment.class);
- util.exportExcel(response, list, "瀹跺涵澶т簨浠惰褰曟暟鎹�");
+ util.exportExcel(response, list, "瀹跺涵璁惧鏁版嵁");
}
@@ -116,7 +116,7 @@
@PostMapping
public AjaxResult add(@RequestBody ZfEquipment zfEquipment)
{
- return zfEquipmentService.addData2(zfEquipment);
+ return zfEquipmentService.addData(zfEquipment);
}
/**
@@ -127,7 +127,7 @@
@PutMapping
public AjaxResult edit(@RequestBody ZfEquipment zfEquipment)
{
- return toAjax(zfEquipmentService.updateById(zfEquipment));
+ return zfEquipmentService.updateData(zfEquipment);
}
//
/**
@@ -138,7 +138,7 @@
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
- return toAjax(zfEquipmentService.removeByIds(Arrays.asList(ids)));
+ return zfEquipmentService.deleteData(ids);
}
}
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 c74d0a5..722848a 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,28 +60,28 @@
}
+// /**
+// * 瀵煎嚭瀹跺涵澶т簨浠惰褰曞垪琛�
+// */
+//// @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")
- 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 export1(HttpServletResponse response, @PathVariable Long[] ids) {
+ @PostMapping("/export/{ids}")
+ public void export(HttpServletResponse response, @PathVariable Long[] ids) {
List<ZfEvent> list = zfEventService.selectByIds(ids);
log.info("瀵煎嚭璁板綍涓�:{}", list);
ExcelUtil<ZfEvent> util = new ExcelUtil<>(ZfEvent.class);
@@ -96,9 +96,7 @@
@Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception {
-
return zfEventService.importExcel(file);
-
}
/**
@@ -118,7 +116,7 @@
@Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ZfEvent zfEvent) {
- return zfEventService.addData2(zfEvent);
+ return zfEventService.addData(zfEvent);
}
/**
@@ -128,7 +126,7 @@
@Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ZfEvent zfEvent) {
- return toAjax(zfEventService.updateById(zfEvent));
+ return zfEventService.updateData(zfEvent);
}
//
@@ -139,7 +137,7 @@
@Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
- return toAjax(zfEventService.removeByIds(Arrays.asList(ids)));
+ return zfEventService.deleteData(ids);
}
}
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
new file mode 100644
index 0000000..09398a8
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfFamilyController.java
@@ -0,0 +1,30 @@
+package com.ruoyi.web.controller.zhang;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+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 javax.annotation.Resource;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-14 14:43
+ * @Version 1.0.0
+ **/
+
+@RestController
+@RequestMapping("/family")
+public class ZfFamilyController {
+ @Resource
+ ZfFamilyService zfFamilyService;
+
+ @GetMapping("/all")
+ public AjaxResult getAllFamily(){
+ return AjaxResult.success(zfFamilyService.list());
+ }
+
+
+}
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 46810a1..4dceeef 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
@@ -42,7 +42,7 @@
public AjaxResult listAll(ZfProperty zfProperty){
Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
- return zfPropertyService.selectPropertyList(zfProperty, pageNum, pageSize);
+ return zfPropertyService.selectDataList(zfProperty, pageNum, pageSize);
}
/**
@@ -55,30 +55,29 @@
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("/export1/{ids}")
+ @PostMapping("/export/{ids}")
public void export1(HttpServletResponse response, @PathVariable Long[] ids) {
List<ZfProperty> list = zfPropertyService.selectByIds(ids);
log.info("瀵煎嚭璁板綍涓�:{}", list);
ExcelUtil<ZfProperty> util = new ExcelUtil<ZfProperty>(ZfProperty.class);
- util.exportExcel(response, list, "瀹跺涵澶т簨浠惰褰曟暟鎹�");
-
+ util.exportExcel(response, list, "瀹跺涵璧勪骇璁板綍鏁版嵁");
}
//
@@ -110,7 +109,7 @@
@PostMapping
public AjaxResult add(@RequestBody ZfProperty zfProperty)
{
- return zfPropertyService.addData2(zfProperty);
+ return zfPropertyService.addData(zfProperty);
}
/**
@@ -121,7 +120,7 @@
@PutMapping
public AjaxResult edit(@RequestBody ZfProperty zfProperty)
{
- return toAjax(zfPropertyService.updateById(zfProperty));
+ return zfPropertyService.updateData(zfProperty);
}
//
/**
@@ -132,6 +131,6 @@
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
- return toAjax(zfPropertyService.removeByIds(Arrays.asList(ids)));
+ return zfPropertyService.deleteData(ids);
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfRoleController.java
new file mode 100644
index 0000000..1f74c94
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfRoleController.java
@@ -0,0 +1,28 @@
+package com.ruoyi.web.controller.zhang;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.service.ZfRoleService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-14 14:44
+ * @Version 1.0.0
+ **/
+@RestController
+@RequestMapping("/role")
+public class ZfRoleController {
+
+ @Resource
+ private ZfRoleService zfRoleService;
+
+ @GetMapping("/all")
+ public AjaxResult getAllRole(){
+ return AjaxResult.success(zfRoleService.list());
+ }
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java b/zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java
index 9e90016..cba08d4 100644
--- a/zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java
+++ b/zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java
@@ -1,5 +1,7 @@
package com.ruoyi.constant;
+import org.omg.CORBA.PUBLIC_MEMBER;
+
/**
* @Author Jinquan_Ou
* @Description
@@ -8,12 +10,46 @@
**/
public class MenuAuthority {
- public static final String PROPERTY_LIST="2007";
- public static final String COLLECTION_LIST="2018";
- public static final String ECONOMY_LIST="2023";
- public static final String EVENT_LIST="2013";
- public static final String EQUIPMENT_LIST="2017";
- public static final String CONTACT_LIST="2021";
- public static final String CLEAN_LIST="2020";
+ public static final String PROPERTY_LIST="2000";
+ public static final String PROPERTY_LIST_ADD="2001";
+ public static final String PROPERTY_LIST_UPDATE="2002";
+ public static final String PROPERTY_LIST_REMOVE="2003";
+ public static final String COLLECTION_LIST="2004";
+ public static final String COLLECTION_LIST_ADD="2005";
+ public static final String COLLECTION_LIST_UPDATE="2006";
+ public static final String COLLECTION_LIST_REMOVE="2007";
+ public static final String ECONOMY_LIST="2008";
+ public static final String ECONOMY_LIST_ADD="2009";
+ public static final String ECONOMY_LIST_UPDATE="2010";
+ public static final String ECONOMY_LIST_REMOVE="2011";
+ public static final String EVENT_LIST="2012";
+ public static final String EVENT_LIST_ADD="2013";
+ public static final String EVENT_LIST_UPDATE="2014";
+ public static final String EVENT_LIST_REMOVE="2015";
+ public static final String EQUIPMENT_LIST="2016";
+ public static final String EQUIPMENT_LIST_ADD="2017";
+ public static final String EQUIPMENT_LIST_UPDATE="2018";
+ public static final String EQUIPMENT_LIST_REMOVE="2019";
+ public static final String CONTACT_LIST="2020";
+ public static final String CONTACT_LIST_ADD="2021";
+ public static final String CONTACT_LIST_UPDATE="2022";
+ public static final String CONTACT_LIST_REMOVE="2023";
+ public static final String CLEAN_LIST="2024";
+ public static final String CLEAN_LIST_ADD="2025";
+ public static final String CLEAN_LIST_UPDATE="2026";
+ public static final String CLEAN_LIST_REMOVE="2027";
+
+ public static final String FAMILY_ROOT="2028";
+
+ public static final String DOCTOR_LIST="2029";
+ public static final String DOCTOR_LIST_ADD="2030";
+ public static final String DOCTOR_LIST_UPDATE="2031";
+ public static final String DOCTOR_LIST_REMOVE="2032";
+
+ public static final String FAMILY_PET="2033";
+ public static final String FAMILY_PET_ADD="2034";
+ public static final String FAMILY_PET_UPDATE="2035";
+ public static final String FAMILY_PET_REMOVE="2036";
+
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZAuthority.java b/zhang-content/src/main/java/com/ruoyi/domain/ZAuthority.java
new file mode 100644
index 0000000..7d04bfb
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZAuthority.java
@@ -0,0 +1,37 @@
+package com.ruoyi.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-15 11:05
+ * @Version 1.0.0
+ **/
+@Data
+public class ZAuthority implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 鐢ㄦ埛id
+ */
+ private Long uid;
+
+ /**
+ * 瀹跺涵id
+ */
+ private Long fid;
+
+ /**
+ * 鏉冮檺鐮�
+ */
+ private Long authority;
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java b/zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java
index 1317e2b..33cef64 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java
@@ -154,6 +154,12 @@
@Excel(name = "鏄惁鏄湰瀹跺涵鎴愬憳",readConverterExp = "0=鍚�,1=鏄�")
private Integer isMyFamily;
+ @TableField(exist = false)
+ private String familyName;
+
+ @TableField(exist = false)
+ private String roleName;
+
/**
* 鍥剧墖鍦板潃
*/
@@ -189,7 +195,12 @@
/**
* 瀹跺涵id
*/
- private String familyId;
+ private Long familyId;
+
+ /**
+ * 瑙掕壊id
+ */
+ private Long roleId;
/**
* 鍏朵粬瀹跺涵鎺堟潈id
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZRotation.java b/zhang-content/src/main/java/com/ruoyi/domain/ZRotation.java
new file mode 100644
index 0000000..3879410
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZRotation.java
@@ -0,0 +1,28 @@
+package com.ruoyi.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-15 0:17
+ * @Version 1.0.0
+ **/
+@Data
+public class ZRotation implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ private Long uid;
+
+ private String url;
+
+ private Integer flag;
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfClean.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfClean.java
index dcd3483..ed520e9 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfClean.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfClean.java
@@ -76,7 +76,7 @@
private String url;
@Excel(name="鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
- private String familyId;
+ private Long familyId;
/**
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java
index 3d84bda..b4f7498 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java
@@ -82,7 +82,7 @@
* 鎵�灞炲搴璱d
*/
@Excel(name = "鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
- private String familyId;
+ private Long familyId;
/**
* 鏄惁鏄湰瀹跺涵鐨勬暟鎹�(0:涓嶆槸,1:鏄�)
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfContact.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfContact.java
index c44af1c..17d4bfb 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfContact.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfContact.java
@@ -94,7 +94,7 @@
private String url;
@Excel(name="鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
- private String familyId;
+ private Long familyId;
/**
* 鍒涘缓鏃堕棿
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java
index 4854c9f..5abaf28 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java
@@ -89,4 +89,9 @@
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
+ private Long familyId;
+
+ @TableField(exist = false)
+ private Integer ownData;
+
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java
index d77272d..68a5159 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java
@@ -82,7 +82,7 @@
private String url;
@Excel(name = "鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
- private String familyId;
+ private Long familyId;
/**
* 鏄惁鏄湰瀹跺涵鐨勬暟鎹�(0:涓嶆槸,1:鏄�)
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfEquipment.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfEquipment.java
index c83430f..bca3e8f 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfEquipment.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfEquipment.java
@@ -69,7 +69,7 @@
* 瀹跺涵id
*/
@Excel(name = "鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
- private String familyId;
+ private Long familyId;
private String url;
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
index bb23a03..f5ca816 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
@@ -64,7 +64,7 @@
private String url;
@Excel(name="鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
- private String familyId;
+ private Long familyId;
/**
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfFamily.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfFamily.java
new file mode 100644
index 0000000..7c4175d
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfFamily.java
@@ -0,0 +1,31 @@
+package com.ruoyi.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-14 11:27
+ * @Version 1.0.0
+ **/
+@Data
+@ToString
+@TableName("zf_family")
+public class ZfFamily implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 瀹跺涵鍚嶇О
+ */
+ private String name;
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java
index 06ed9ac..536b087 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java
@@ -72,7 +72,7 @@
* 瀹跺涵id
*/
@Excel(name = "鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
- private String familyId;
+ private Long familyId;
/**
* 鏄惁鏄湰瀹跺涵鐨勬暟鎹�(0:涓嶆槸,1:鏄�)
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfRole.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfRole.java
new file mode 100644
index 0000000..39ef3ca
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfRole.java
@@ -0,0 +1,26 @@
+package com.ruoyi.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-14 14:29
+ * @Version 1.0.0
+ **/
+@Data
+@ToString
+public class ZfRole implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ private String name;
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZAuthorityMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZAuthorityMapper.java
new file mode 100644
index 0000000..ab36e2e
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/mapper/ZAuthorityMapper.java
@@ -0,0 +1,15 @@
+package com.ruoyi.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.domain.ZAuthority;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-15 13:22
+ * @Version 1.0.0
+ **/
+@Mapper
+public interface ZAuthorityMapper extends BaseMapper<ZAuthority> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZRotationMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZRotationMapper.java
new file mode 100644
index 0000000..d2c2437
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/mapper/ZRotationMapper.java
@@ -0,0 +1,15 @@
+package com.ruoyi.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.domain.ZRotation;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-15 0:18
+ * @Version 1.0.0
+ **/
+@Mapper
+public interface ZRotationMapper extends BaseMapper<ZRotation> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZfFamilyMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZfFamilyMapper.java
new file mode 100644
index 0000000..ec5a974
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/mapper/ZfFamilyMapper.java
@@ -0,0 +1,15 @@
+package com.ruoyi.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.domain.ZfFamily;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-14 14:28
+ * @Version 1.0.0
+ **/
+@Mapper
+public interface ZfFamilyMapper extends BaseMapper<ZfFamily> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZfRoleMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZfRoleMapper.java
new file mode 100644
index 0000000..88ec010
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/mapper/ZfRoleMapper.java
@@ -0,0 +1,16 @@
+package com.ruoyi.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fasterxml.jackson.databind.ser.Serializers;
+import com.ruoyi.domain.ZfRole;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-14 14:29
+ * @Version 1.0.0
+ **/
+@Mapper
+public interface ZfRoleMapper extends BaseMapper<ZfRole> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyService.java b/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyService.java
index a61ca00..9224c47 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyService.java
@@ -19,11 +19,17 @@
List<ZfProperty> selectByCondition(ZfProperty zfProperty);
- AjaxResult selectPropertyList(ZfProperty zfProperty,Integer pageNum,Integer pageSize);
- List<ZfProperty> selectByIds( Long[] ids);
+ AjaxResult selectDataList(ZfProperty zfProperty,Integer pageNum,Integer pageSize);
+ List<ZfProperty> selectByIds(Long[] ids);
+
+ List<ZfProperty> selectByFamilyIds(Long[] familyIds);
AjaxResult addData(ZfProperty zfProperty);
- AjaxResult addData2(ZfProperty zfProperty);
+ AjaxResult updateData(ZfProperty zfProperty);
+
+ AjaxResult deleteData(Long[] ids);
+
+// AjaxResult addData2(ZfProperty zfProperty);
AjaxResult importExcel(MultipartFile file);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZAuthorityService.java b/zhang-content/src/main/java/com/ruoyi/service/ZAuthorityService.java
new file mode 100644
index 0000000..6a228db
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZAuthorityService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.domain.ZAuthority;
+
+import java.util.List;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-15 13:21
+ * @Version 1.0.0
+ **/
+public interface ZAuthorityService extends IService<ZAuthority> {
+ List<ZAuthority> getAuthority();
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java b/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
index 05b1ac6..14df7a7 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
@@ -47,4 +47,8 @@
List<Genealogy> selectByIds(Long[] ids);
List<Genealogy> selectDatas(List<GenealogyExportDto> params);
+
+ ZInfoUser getInfoById(Long userId);
+
+ ZInfoUser getMyself();
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZRotationService.java b/zhang-content/src/main/java/com/ruoyi/service/ZRotationService.java
new file mode 100644
index 0000000..9c70075
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZRotationService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.domain.ZRotation;
+
+import java.util.List;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-15 0:18
+ * @Version 1.0.0
+ **/
+public interface ZRotationService extends IService<ZRotation> {
+ List<ZRotation> getByUserId(Long userId);
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfCleanService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfCleanService.java
index 89e4f16..18961e1 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfCleanService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfCleanService.java
@@ -24,10 +24,15 @@
List<ZfClean> selectByCondition(ZfClean zfClean);
List<ZfClean> selectByIds(Long[] ids);
- AjaxResult addData(ZfClean zfClean);
+// AjaxResult addData(ZfClean zfClean);
- AjaxResult addData2(ZfClean zfClean);
+// AjaxResult addData2(ZfClean zfClean);
AjaxResult importExcel(MultipartFile file);
+ AjaxResult updateData(ZfClean zfClean);
+
+ AjaxResult deleteData(Long[] ids);
+
+ AjaxResult addData(ZfClean zfClean);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionService.java
index 118b331..302c174 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionService.java
@@ -25,5 +25,11 @@
List<ZfCollection> selectByIds(Long[] ids);
AjaxResult importExcel(MultipartFile file);
- AjaxResult addData2(ZfCollection zfCollection);
+// AjaxResult addData2(ZfCollection zfCollection);
+
+ AjaxResult addData(ZfCollection zfCollection);
+
+ AjaxResult updateData(ZfCollection zfCollection);
+
+ AjaxResult deleteData(Long[] ids);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfContactService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfContactService.java
index 4130db4..1eba273 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfContactService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfContactService.java
@@ -25,7 +25,11 @@
List<ZfContact> selectByIds(Long [] ids);
AjaxResult addData(ZfContact zfContact);
- AjaxResult addData2(ZfContact zfContact);
+// AjaxResult addData2(ZfContact zfContact);
AjaxResult importExcel(MultipartFile file);
+
+ AjaxResult updateData(ZfContact zfContact);
+
+ AjaxResult deleteData(Long[] ids);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorService.java
index c748b58..9a8bb68 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDoctor;
+import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@@ -22,6 +23,14 @@
List<ZfDoctor> selectByCondition(ZfDoctor zfDoctor);
List<ZfDoctor> selectByIds(Long[] ids);
- AjaxResult mySave(ZfDoctor zfDoctor);
+// AjaxResult mySave(ZfDoctor zfDoctor);
+
+ AjaxResult importExcel(MultipartFile file);
+
+ AjaxResult addData(ZfDoctor zfDoctor);
+
+ AjaxResult updateData(ZfDoctor zfDoctor);
+
+ AjaxResult deleteData(Long[] ids);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyService.java
index 83c97cf..290715d 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyService.java
@@ -24,5 +24,11 @@
List<ZfEconomy> selectByIds(Long [] ids);
AjaxResult importExcel(MultipartFile file);
- AjaxResult addData2(ZfEconomy zfEconomy);
+// AjaxResult addData2(ZfEconomy zfEconomy);
+
+ AjaxResult addData(ZfEconomy zfEconomy);
+
+ AjaxResult updateData(ZfEconomy zfEconomy);
+
+ AjaxResult deleteData(Long[] ids);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEquipmentService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEquipmentService.java
index 428f483..e8455ae 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfEquipmentService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEquipmentService.java
@@ -24,8 +24,12 @@
List<ZfEquipment> selectByCondition(ZfEquipment zfEquipment);
List<ZfEquipment> selectByIds(Long[] ids);
AjaxResult addData(ZfEquipment zfEquipment);
- AjaxResult addData2(ZfEquipment zfEquipment);
+// AjaxResult addData2(ZfEquipment zfEquipment);
AjaxResult importExcel(MultipartFile file);
+
+ AjaxResult updateData(ZfEquipment zfEquipment);
+
+ AjaxResult deleteData(Long[] ids);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java
index 1a38063..713a043 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java
@@ -25,7 +25,11 @@
AjaxResult addData(ZfEvent zfEvent);
- AjaxResult addData2(ZfEvent zfEvent);
+// AjaxResult addData2(ZfEvent zfEvent);
AjaxResult importExcel(MultipartFile file);
+
+ AjaxResult updateData(ZfEvent zfEvent);
+
+ AjaxResult deleteData(Long[] ids);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfFamilyService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfFamilyService.java
new file mode 100644
index 0000000..27a2d65
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfFamilyService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.domain.ZfFamily;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-14 14:31
+ * @Version 1.0.0
+ **/
+@Service
+public interface ZfFamilyService extends IService<ZfFamily> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfRoleService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfRoleService.java
new file mode 100644
index 0000000..00e5c92
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfRoleService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.domain.ZfRole;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-14 14:31
+ * @Version 1.0.0
+ **/
+@Service
+public interface ZfRoleService extends IService<ZfRole> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
index a684a63..4015611 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
@@ -10,12 +10,11 @@
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.domain.ZInfoUser;
-import com.ruoyi.domain.ZfEquipment;
-import com.ruoyi.domain.ZfEvent;
-import com.ruoyi.domain.ZfProperty;
+import com.ruoyi.constant.MenuAuthority;
+import com.ruoyi.domain.*;
import com.ruoyi.mapper.ZfPropertyMapper;
import com.ruoyi.service.IZfPropertyService;
+import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.util.ArraysUtil;
import lombok.extern.slf4j.Slf4j;
@@ -29,7 +28,7 @@
import java.util.*;
import java.util.stream.Collectors;
-import static com.ruoyi.constant.MenuAuthority.PROPERTY_LIST;
+import static com.ruoyi.constant.MenuAuthority.*;
/**
@@ -47,8 +46,25 @@
@Resource
ZInfoUserService zInfoUserService;
+ @Resource
+ ZAuthorityService zAuthorityService;
- private LambdaQueryWrapper<ZfProperty> buildCondition(ZfProperty zfProperty) {
+
+// private LambdaQueryWrapper<ZfProperty> buildCondition(ZfProperty zfProperty) {
+// LambdaQueryWrapper<ZfProperty> lqw = new LambdaQueryWrapper<>();
+//
+// lqw.like(!StringUtils.isEmpty(zfProperty.getType()), ZfProperty::getType, zfProperty.getType())
+// .like(!StringUtils.isEmpty(zfProperty.getTitle()), ZfProperty::getTitle, zfProperty.getTitle())
+// .like(!StringUtils.isEmpty(zfProperty.getLocation()), ZfProperty::getLocation, zfProperty.getLocation())
+// .like(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder())
+// .like(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress())
+// .like(!StringUtils.isEmpty(zfProperty.getRemark()), ZfProperty::getRemark, zfProperty.getRemark())
+// .eq(zfProperty.getHappenTime()!=null,ZfProperty::getHappenTime,zfProperty.getHappenTime())
+// .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime());
+// return lqw;
+// }
+
+ private LambdaQueryWrapper<ZfProperty> buildCondition(ZfProperty zfProperty,List<Long> familyIdList){
LambdaQueryWrapper<ZfProperty> lqw = new LambdaQueryWrapper<>();
lqw.like(!StringUtils.isEmpty(zfProperty.getType()), ZfProperty::getType, zfProperty.getType())
@@ -57,175 +73,209 @@
.like(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder())
.like(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress())
.like(!StringUtils.isEmpty(zfProperty.getRemark()), ZfProperty::getRemark, zfProperty.getRemark())
+ .eq(zfProperty.getFamilyId()!=null,ZfProperty::getFamilyId,zfProperty.getFamilyId())
+ .in(ZfProperty::getFamilyId,familyIdList)
.eq(zfProperty.getHappenTime()!=null,ZfProperty::getHappenTime,zfProperty.getHappenTime())
.between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime());
- return lqw;
- }
-
- private LambdaQueryWrapper<ZfProperty> buildCondition(ZfProperty zfProperty, String familyIds, String secondFamilyAuthority) {
- //妯$硦鏌ヨ鐨勬潯浠�
- LambdaQueryWrapper<ZfProperty> lqw = buildCondition(zfProperty);
-
- //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
- boolean flag = false;
-
- StringBuilder secondFamilyIdsBuffer = new StringBuilder();
-
- //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
-
- if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
-
- if (secondFamilyAuthority.contains(",")) {
- //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
- String[] authorityList = secondFamilyAuthority.split(",");
- for (String authorityAndId : authorityList) {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
- }
-
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
-
- } else {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
- }
- }
- //灏哠tringBuffer杞垚String
- String secondFamilyIds = secondFamilyIdsBuffer.toString();
-
- //绗竴瀹跺涵鍙风殑鏉′欢
- if (familyIds.contains(",")) {
- flag = true;
- }
-
- //绗簩瀹跺涵鍙风殑鏉′欢
- if (StringUtils.isNotEmpty(secondFamilyIds)) {
- if (secondFamilyIds.contains(",")) {
- String[] secondFamilyIdList = secondFamilyIds.split(",");
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
- lqw.in(ZfProperty::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
- lqw.in(ZfProperty::getFamilyId, totalFamilyIdList);
- }
-
- } else {
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
- lqw.in(ZfProperty::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
- lqw.in(ZfProperty::getFamilyId, totalFamilyIdList);
- }
- }
- } else {
- //濡傛灉娌℃湁绗簩瀹跺涵鍙�
- if (flag) {
- String[] familyList = familyIds.split(",");
- lqw.in(ZfProperty::getFamilyId, familyList);
- } else {
- lqw.eq(ZfProperty::getFamilyId, familyIds);
- }
-
- }
lqw.orderByDesc(ZfProperty::getCreateTime);
return lqw;
+
}
- private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
- //寰楀埌鏉冮檺涓�
- String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
+// private LambdaQueryWrapper<ZfProperty> buildCondition(ZfProperty zfProperty, String familyIds, String secondFamilyAuthority) {
+// //妯$硦鏌ヨ鐨勬潯浠�
+// LambdaQueryWrapper<ZfProperty> lqw = buildCondition(zfProperty);
+//
+// //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
+// boolean flag = false;
+//
+// StringBuilder secondFamilyIdsBuffer = new StringBuilder();
+//
+// //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
+//
+// if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
+//
+// if (secondFamilyAuthority.contains(",")) {
+// //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
+// String[] authorityList = secondFamilyAuthority.split(",");
+// for (String authorityAndId : authorityList) {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
+// }
+//
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+//
+// } else {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+// }
+// }
+// //灏哠tringBuffer杞垚String
+// String secondFamilyIds = secondFamilyIdsBuffer.toString();
+//
+// //绗竴瀹跺涵鍙风殑鏉′欢
+// if (familyIds.contains(",")) {
+// flag = true;
+// }
+//
+// //绗簩瀹跺涵鍙风殑鏉′欢
+// if (StringUtils.isNotEmpty(secondFamilyIds)) {
+// if (secondFamilyIds.contains(",")) {
+// String[] secondFamilyIdList = secondFamilyIds.split(",");
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
+// lqw.in(ZfProperty::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
+// lqw.in(ZfProperty::getFamilyId, totalFamilyIdList);
+// }
+//
+// } else {
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
+// lqw.in(ZfProperty::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
+// lqw.in(ZfProperty::getFamilyId, totalFamilyIdList);
+// }
+// }
+// } else {
+// //濡傛灉娌℃湁绗簩瀹跺涵鍙�
+// if (flag) {
+// String[] familyList = familyIds.split(",");
+// lqw.in(ZfProperty::getFamilyId, familyList);
+// } else {
+// lqw.eq(ZfProperty::getFamilyId, familyIds);
+// }
+//
+// }
+//
+// lqw.orderByDesc(ZfProperty::getCreateTime);
+// return lqw;
+// }
- if (authorities.contains(" ")) {
- //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
- String[] authorityIdList = authorities.split(" ");
- for (String s : authorityIdList) {
- if (s.equals(PROPERTY_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- break;
- }
- }
- } else {
- if (authorities.equals(PROPERTY_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- }
- }
- }
+// private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
+// //寰楀埌鏉冮檺涓�
+// String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
+//
+// if (authorities.contains(" ")) {
+// //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
+// String[] authorityIdList = authorities.split(" ");
+// for (String s : authorityIdList) {
+// if (s.equals(PROPERTY_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// break;
+// }
+// }
+// } else {
+// if (authorities.equals(PROPERTY_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// }
+// }
+// }
- private ZInfoUser getMySelf() {
- SysUser user = SecurityUtils.getLoginUser().getUser();
- Long userId = user.getUserId();
- LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
- zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
- return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
- }
+// private ZInfoUser getMySelf() {
+// SysUser user = SecurityUtils.getLoginUser().getUser();
+// Long userId = user.getUserId();
+// LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+// zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
+// return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
+// }
- private String listFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getFamilyId();
- }
-
- private String listSecondFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getSecondFamilyId();
- }
+// private Long listFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getFamilyId();
+// }
+//
+// private String listSecondFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getSecondFamilyId();
+// }
@Override
public List<ZfProperty> selectByCondition(ZfProperty zfProperty) {
- String familyIds = listFamilyIds();
- String secondFamilyIds = listSecondFamilyIds();
- LambdaQueryWrapper<ZfProperty> lambdaQueryWrapper = buildCondition(zfProperty, familyIds, secondFamilyIds);
- List<ZfProperty> beanRecords = list(lambdaQueryWrapper);
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(PROPERTY_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfProperty> lqw = buildCondition(zfProperty, idList);
+ List<ZfProperty> beanRecords = list(lqw);
log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
- return markOwnData(familyIds, beanRecords);
+ return markOwnData(familyId, beanRecords);
}
- private static List<ZfProperty> markOwnData(String familyIds, List<ZfProperty> beanRecords) {
- return beanRecords.stream().peek(record -> {
- String recordFamilyId = record.getFamilyId();
- if (familyIds.contains(",")) {
- String[] familyIdList = familyIds.split(",");
- for (String familyId : familyIdList) {
- if (familyId.equals(recordFamilyId)) {
- record.setOwnData(1);
- }
- }
- } else {
- if (familyIds.equals(recordFamilyId)) {
- record.setOwnData(1);
- }
- }
- }).collect(Collectors.toList());
- }
+// private static List<ZfProperty> markOwnData(String familyIds, List<ZfProperty> beanRecords) {
+// return beanRecords.stream().peek(record -> {
+// String recordFamilyId = record.getFamilyId();
+// if (familyIds.contains(",")) {
+// String[] familyIdList = familyIds.split(",");
+// for (String familyId : familyIdList) {
+// if (familyId.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// } else {
+// if (familyIds.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// }).collect(Collectors.toList());
+// }
@Override
- public AjaxResult selectPropertyList(ZfProperty zfProperty, Integer pageNum, Integer pageSize) {
- String familyIds = listFamilyIds();
- String secondFamilyAuthority = listSecondFamilyIds();
- LambdaQueryWrapper<ZfProperty> lqw = buildCondition(zfProperty, familyIds, secondFamilyAuthority);
+ public AjaxResult selectDataList(ZfProperty zfProperty, Integer pageNum, Integer pageSize) {
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(PROPERTY_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfProperty> lqw = buildCondition(zfProperty, idList);
Page<ZfProperty> zfPropertyPage = new Page<>(pageNum, pageSize);
Page<ZfProperty> pageResult = page(zfPropertyPage, lqw);
List<ZfProperty> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
- List<ZfProperty> dtoResult = markOwnData(familyIds, beanRecords);
+ List<ZfProperty> dtoResult = markOwnData(familyId, beanRecords);
HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
return AjaxResult.success(data);
+ }
+
+ public List<ZfProperty> markOwnData(Long familyId,List<ZfProperty> beanRecords){
+ return beanRecords.stream().peek(
+ bean -> {
+ if (bean.getFamilyId() == familyId) {
+ bean.setOwnData(1);
+ } else {
+ bean.setOwnData(0);
+ }
+ }
+ ).collect(Collectors.toList());
}
@Override
@@ -239,58 +289,86 @@
}
@Override
- public AjaxResult addData(ZfProperty zfProperty) {
-
- String familyIds = listFamilyIds();
- boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
- if (familyIds.contains(",")) {
- String[] familyList = familyIds.split(",");
- for (String familyId : familyList) {
- if (familyId.equals(zfProperty.getFamilyId())) {
- flag = true;
- }
- }
- } else {
- if (zfProperty.getFamilyId().equals(familyIds)) {
- flag = true;
- }
- }
- if (flag) {
- if (save(zfProperty)) {
- return AjaxResult.success();
- } else {
- return AjaxResult.error();
- }
-
- } else {
- throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfProperty.getFamilyId() + "鏁版嵁鐨勬潈闄�");
- }
+ public List<ZfProperty> selectByFamilyIds(Long[] familyIds) {
+ LambdaQueryWrapper<ZfProperty> lqw = new LambdaQueryWrapper<>();
+ lqw.in(ZfProperty::getFamilyId,familyIds);
+ return list(lqw);
}
+// @Override
+// public AjaxResult addData(ZfProperty zfProperty) {
+//
+// String familyIds = listFamilyIds();
+// boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
+// if (familyIds.contains(",")) {
+// String[] familyList = familyIds.split(",");
+// for (String familyId : familyList) {
+// if (familyId.equals(zfProperty.getFamilyId())) {
+// flag = true;
+// }
+// }
+// } else {
+// if (zfProperty.getFamilyId().equals(familyIds)) {
+// flag = true;
+// }
+// }
+// if (flag) {
+// if (save(zfProperty)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+//
+// } else {
+// throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfProperty.getFamilyId() + "鏁版嵁鐨勬潈闄�");
+// }
+// }
+
+// public Boolean checkAuthority(ZfProperty zfProperty, String code){
+// ZInfoUser myself = zInfoUserService.getMyself();
+// Long familyId = myself.getFamilyId();
+//
+// List<ZAuthority> authority = zAuthorityService.getAuthority();
+// List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(code)).map(ZAuthority::getFid).collect(Collectors.toList());
+// familyIdList.add(familyId);
+//
+// if(zfProperty.getFamilyId() == null){
+// return false;
+// }
+//
+// if (!familyIdList.contains(zfProperty.getFamilyId())) {
+// throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滃搴�"+zfProperty.getFamilyId()+"鐨勬暟鎹�");
+// }
+// return true;
+// }
+
@Override
- public AjaxResult addData2(ZfProperty zfProperty) {
- ZInfoUser mySelf = getMySelf();
- String myFamilyId = mySelf.getFamilyId();
+ public AjaxResult addData(ZfProperty zfProperty){
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
- if (StringUtils.isNotEmpty(zfProperty.getFamilyId())) {
- throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
- }
-
- if (StringUtils.isEmpty(myFamilyId)) {
+ if(familyId == null){
throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
}
- if (myFamilyId.contains(",")) {
- String[] myFamilyIds = myFamilyId.split(",");
- //榛樿娣诲姞绗竴涓搴殑鏁版嵁
- zfProperty.setFamilyId(myFamilyIds[0]);
- } else {
- zfProperty.setFamilyId(myFamilyId);
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(PROPERTY_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (zfProperty.getFamilyId()!=null && !familyIdList.contains(zfProperty.getFamilyId())) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+
+ if(zfProperty.getFamilyId() == null){
+ //榛樿娣诲姞鑷繁瀹跺涵鐨勬暟鎹�
+ zfProperty.setFamilyId(familyId);
}
//鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
LambdaQueryWrapper<ZfProperty> lqw = uniqueCondition(zfProperty);
List<ZfProperty> list = list(lqw);
+
if(list.size()>0){
throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
}
@@ -302,9 +380,95 @@
}
}
+ @Override
+ public AjaxResult updateData(ZfProperty zfProperty) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ //鍏堟牴鎹甶d鏌ヨ鍑烘暟鎹殑familyId锛岀湅鐪嬫湁娌℃湁鏉冮檺鎿嶄綔
+ Long dataFamilyId = getById(zfProperty.getId()).getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(PROPERTY_LIST_UPDATE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (dataFamilyId!=null && !familyIdList.contains(dataFamilyId)) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+ if(updateById(zfProperty)){
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+
+ }
+
+ @Override
+ @Transactional
+ public AjaxResult deleteData(Long[] ids) {
+ List<ZfProperty> dataList = zfPropertyService.listByIds(Arrays.asList(ids));
+
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(PROPERTY_LIST_REMOVE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ for (ZfProperty data : dataList) {
+ if (!familyIdList.contains(data.getFamilyId())){
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+ }
+
+ if (zfPropertyService.removeByIds(Arrays.asList(ids))) {
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+
+ }
+
+// @Override
+// public AjaxResult addData2(ZfProperty zfProperty) {
+// ZInfoUser mySelf = getMySelf();
+// String myFamilyId = mySelf.getFamilyId();
+//
+// if (StringUtils.isNotEmpty(zfProperty.getFamilyId())) {
+// throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
+// }
+//
+// if (StringUtils.isEmpty(myFamilyId)) {
+// throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+// }
+//
+// if (myFamilyId.contains(",")) {
+// String[] myFamilyIds = myFamilyId.split(",");
+// //榛樿娣诲姞绗竴涓搴殑鏁版嵁
+// zfProperty.setFamilyId(myFamilyIds[0]);
+// } else {
+// zfProperty.setFamilyId(myFamilyId);
+// }
+//
+// //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+// LambdaQueryWrapper<ZfProperty> lqw = uniqueCondition(zfProperty);
+// List<ZfProperty> list = list(lqw);
+// if(list.size()>0){
+// throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+// }
+//
+// if (save(zfProperty)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+// }
+
private LambdaQueryWrapper<ZfProperty> uniqueCondition(ZfProperty zfProperty) {
LambdaQueryWrapper<ZfProperty> lqw = new LambdaQueryWrapper<>();
lqw.eq(!StringUtils.isEmpty(zfProperty.getType()), ZfProperty::getType, zfProperty.getType())
+ .eq(zfProperty.getFamilyId()!=null,ZfProperty::getFamilyId,zfProperty.getFamilyId())
.eq(!StringUtils.isEmpty(zfProperty.getTitle()), ZfProperty::getTitle, zfProperty.getTitle())
.eq(!StringUtils.isEmpty(zfProperty.getLocation()), ZfProperty::getLocation, zfProperty.getLocation())
.eq(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder())
@@ -328,7 +492,7 @@
log.info("璧勪骇鍒楄〃涓猴細{}", propertyList);
for (ZfProperty zfProperty : propertyList) {
- zfPropertyService.addData2(zfProperty);
+ zfPropertyService.addData(zfProperty);
}
return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
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
new file mode 100644
index 0000000..4fe8289
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java
@@ -0,0 +1,35 @@
+package com.ruoyi.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.domain.ZAuthority;
+import com.ruoyi.mapper.ZAuthorityMapper;
+import com.ruoyi.service.ZAuthorityService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-15 13:23
+ * @Version 1.0.0
+ **/
+@Service
+public class ZAuthorityServiceImpl extends ServiceImpl<ZAuthorityMapper, ZAuthority> implements ZAuthorityService {
+ /**
+ * 鏌ヨ褰撳墠鐢ㄦ埛鐨勬潈闄�
+ */
+ @Override
+ public List<ZAuthority> getAuthority() {
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+
+ LambdaQueryWrapper<ZAuthority> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZAuthority::getUid,userId);
+
+ return list(lqw);
+ }
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
index 7332469..514ecb0 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
@@ -18,13 +18,16 @@
import com.ruoyi.domain.dto.*;
import com.ruoyi.mapper.ZInfoUserMapper;
import com.ruoyi.service.ZInfoUserService;
+import com.ruoyi.service.ZfFamilyService;
import com.ruoyi.service.ZfRelationService;
+import com.ruoyi.service.ZfRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@@ -45,6 +48,12 @@
@Autowired
private ZInfoUserService zInfoUserService;
+
+ @Resource
+ private ZfFamilyService zfFamilyService;
+
+ @Resource
+ private ZfRoleService zfRoleService;
@Override
public AjaxResult selectInfoList(ZInfoUser zInfoUser, Integer pageNum, Integer pageSize) {
@@ -128,90 +137,95 @@
return AjaxResult.success();
}
- /**
- * 缁欑敤鎴锋巿鏉冪殑鏂规硶
- * @param empowerDto
- * @return
- */
@Override
- @Transactional
public AjaxResult empower(EmpowerDto empowerDto) {
-
- //寰楀埌dto涓殑淇℃伅
- String otherUserId = empowerDto.getUserId();
- String destinationFamilyId = empowerDto.getFamilyId();
- List<String> authorityList = empowerDto.getAuthorityList();
-
- String familyId = getMyFamilyId();
- checkAuthorization(familyId, destinationFamilyId,true);
-
- //鎺堟潈 //3{2007 1988 1004}
- String finalStr = getFinalStr(destinationFamilyId, authorityList);
-
- //鏇存柊琚巿鏉冪敤鎴风殑鏉冮檺
- LambdaQueryWrapper<ZInfoUser> lqw2 = new LambdaQueryWrapper<>();
- lqw2.eq(ZInfoUser::getUserId,otherUserId);
- ZInfoUser otherUser = getOne(lqw2);
- String secondFamilyId = otherUser.getSecondFamilyId();
-
- String replaceFamilyId=null;
-
- boolean save=true;
-
- if (StringUtils.isNotEmpty(secondFamilyId)){
- //濡傛灉鍘熸潵灏卞凡缁忔湁琚祴浜堟潈闄愪簡锛岄偅涔堥渶瑕佸垽鏂槸涓嶆槸璺熻繖涓搴彿鏈夊叧鐨勬潈闄�
-
- //杩欎釜secondFamilyId鏄綋鍓嶇敤鎴风殑瀹屾暣鏉冮檺瀛楁
- if(secondFamilyId.contains(",")){
- String[] split = secondFamilyId.split(",");
- for (int i = 0; i < split.length; i++) {
- String fid = split[i].substring(0, split[i].indexOf("{"));//浠庢潈闄愬潡涓嬁鍒拌鎺堟潈鐨勫搴彿
- if(fid.equals(finalStr.substring(0,finalStr.indexOf("{")))){
- //濡傛灉鍖归厤鍒颁簡瀵瑰簲鐨勫搴彿锛岄偅涔堝氨鏇挎崲鎺夊搴旂殑鏉冮檺鍧楀氨鍙互浜嗭紝涓嶉渶瑕佽拷鍔�
- save=false;
- split[i]=finalStr;
- break;
- }
- }
- List<String> finalList = Arrays.asList(split);
- StringBuilder stringBuilder = new StringBuilder();
- for (String s : finalList) {
- stringBuilder.append(s).append(",");
- }
- stringBuilder.deleteCharAt(stringBuilder.length()-1);
-
- replaceFamilyId = stringBuilder.toString();
-
- }else {
- String fid = secondFamilyId.substring(0, secondFamilyId.indexOf("{"));//浠庢潈闄愬潡涓嬁鍒拌鎺堟潈鐨勫搴彿
- if(fid.equals(finalStr.substring(0,finalStr.indexOf("{")))){
- //濡傛灉鍖归厤鍒颁簡瀵瑰簲鐨勫搴彿锛岄偅涔堝氨鏇挎崲鎺夊搴旂殑鏉冮檺鍧楀氨鍙互浜嗭紝涓嶉渶瑕佽拷鍔�
- save=false;
- replaceFamilyId=finalStr;
- }
- }
-
- if(save){
- //闇�瑕佽拷鍔�,娌℃湁鍖归厤鍒板搴旂殑瀹跺涵鍙�
- replaceFamilyId=secondFamilyId+","+finalStr;
- }else {
- //涓嶉渶瑕佽拷鍔�
- }
-
- }else {
- //鍘熸潵灏辨病鏈夋潈闄愪簡
- replaceFamilyId=finalStr;
- }
-
- LambdaUpdateWrapper<ZInfoUser> uw = new LambdaUpdateWrapper<>();
- uw.eq(ZInfoUser::getUserId,otherUserId).set(ZInfoUser::getSecondFamilyId,replaceFamilyId);
- if (update(null,uw)) {
- return AjaxResult.success();
- }else {
- return AjaxResult.error();
- }
-
+ return null;
}
+
+// /**
+// * 缁欑敤鎴锋巿鏉冪殑鏂规硶
+// * @param empowerDto
+// * @return
+// */
+// @Override
+// @Transactional
+// public AjaxResult empower(EmpowerDto empowerDto) {
+//
+// //寰楀埌dto涓殑淇℃伅
+// String otherUserId = empowerDto.getUserId();
+// String destinationFamilyId = empowerDto.getFamilyId();
+// List<String> authorityList = empowerDto.getAuthorityList();
+//
+// String familyId = getMyFamilyId();
+// checkAuthorization(familyId, destinationFamilyId,true);
+//
+// //鎺堟潈 //3{2007 1988 1004}
+// String finalStr = getFinalStr(destinationFamilyId, authorityList);
+//
+// //鏇存柊琚巿鏉冪敤鎴风殑鏉冮檺
+// LambdaQueryWrapper<ZInfoUser> lqw2 = new LambdaQueryWrapper<>();
+// lqw2.eq(ZInfoUser::getUserId,otherUserId);
+// ZInfoUser otherUser = getOne(lqw2);
+// String secondFamilyId = otherUser.getSecondFamilyId();
+//
+// String replaceFamilyId=null;
+//
+// boolean save=true;
+//
+// if (StringUtils.isNotEmpty(secondFamilyId)){
+// //濡傛灉鍘熸潵灏卞凡缁忔湁琚祴浜堟潈闄愪簡锛岄偅涔堥渶瑕佸垽鏂槸涓嶆槸璺熻繖涓搴彿鏈夊叧鐨勬潈闄�
+//
+// //杩欎釜secondFamilyId鏄綋鍓嶇敤鎴风殑瀹屾暣鏉冮檺瀛楁
+// if(secondFamilyId.contains(",")){
+// String[] split = secondFamilyId.split(",");
+// for (int i = 0; i < split.length; i++) {
+// String fid = split[i].substring(0, split[i].indexOf("{"));//浠庢潈闄愬潡涓嬁鍒拌鎺堟潈鐨勫搴彿
+// if(fid.equals(finalStr.substring(0,finalStr.indexOf("{")))){
+// //濡傛灉鍖归厤鍒颁簡瀵瑰簲鐨勫搴彿锛岄偅涔堝氨鏇挎崲鎺夊搴旂殑鏉冮檺鍧楀氨鍙互浜嗭紝涓嶉渶瑕佽拷鍔�
+// save=false;
+// split[i]=finalStr;
+// break;
+// }
+// }
+// List<String> finalList = Arrays.asList(split);
+// StringBuilder stringBuilder = new StringBuilder();
+// for (String s : finalList) {
+// stringBuilder.append(s).append(",");
+// }
+// stringBuilder.deleteCharAt(stringBuilder.length()-1);
+//
+// replaceFamilyId = stringBuilder.toString();
+//
+// }else {
+// String fid = secondFamilyId.substring(0, secondFamilyId.indexOf("{"));//浠庢潈闄愬潡涓嬁鍒拌鎺堟潈鐨勫搴彿
+// if(fid.equals(finalStr.substring(0,finalStr.indexOf("{")))){
+// //濡傛灉鍖归厤鍒颁簡瀵瑰簲鐨勫搴彿锛岄偅涔堝氨鏇挎崲鎺夊搴旂殑鏉冮檺鍧楀氨鍙互浜嗭紝涓嶉渶瑕佽拷鍔�
+// save=false;
+// replaceFamilyId=finalStr;
+// }
+// }
+//
+// if(save){
+// //闇�瑕佽拷鍔�,娌℃湁鍖归厤鍒板搴旂殑瀹跺涵鍙�
+// replaceFamilyId=secondFamilyId+","+finalStr;
+// }else {
+// //涓嶉渶瑕佽拷鍔�
+// }
+//
+// }else {
+// //鍘熸潵灏辨病鏈夋潈闄愪簡
+// replaceFamilyId=finalStr;
+// }
+//
+// LambdaUpdateWrapper<ZInfoUser> uw = new LambdaUpdateWrapper<>();
+// uw.eq(ZInfoUser::getUserId,otherUserId).set(ZInfoUser::getSecondFamilyId,replaceFamilyId);
+// if (update(null,uw)) {
+// return AjaxResult.success();
+// }else {
+// return AjaxResult.error();
+// }
+//
+// }
private void checkAuthorization(String familyId, String destinationFamilyId,boolean flag) {
@@ -236,14 +250,14 @@
}
}
- private String getMyFamilyId() {
+ private Long getMyFamilyId() {
//寰楀埌鑷繁鐨勫搴璱d淇℃伅
SysUser user = SecurityUtils.getLoginUser().getUser();
Long myUserId = user.getUserId();
LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>();
lqw.eq(ZInfoUser::getUserId,myUserId);
ZInfoUser zInfoUser = getOne(lqw);
- String familyId = zInfoUser.getFamilyId();
+ Long familyId = zInfoUser.getFamilyId();
return familyId;
}
@@ -263,22 +277,36 @@
List<ZInfoUser> allPeopleList = list();
List<ZInfoUser> result = null;
- try {
- result = allPeopleList.stream().filter(people -> people.getUserId()!=1&&(people.getFatherId() == 0||people.getMomId()==0))
+// try {
+// result = allPeopleList.stream().filter(people -> people.getUserId()!=1&&(people.getFatherId() == 0||people.getMomId()==0))
+// .map(people -> {
+// if(depth>1){
+// people.setIdentity(1);
+// //鏍规嵁閰嶅伓id鏌ヨ閰嶅伓鐨勬暟鎹紝灏佽濂戒竴璧疯繑鍥�
+// Long spouseId = people.getSpouseId();
+// ZInfoUser spouse = zInfoUserService.getById(spouseId);
+// spouse.setIdentity(1);
+// people.setSpouse(spouse);
+// people.setChildList(fillChildren(people, allPeopleList, depth-1));
+// }
+// return people;
+// }).collect(Collectors.toList());
+// } catch (NullPointerException e) {
+// throw new RuntimeException("鎮ㄥ湪鍔犲叆鎴愬憳鐨勬椂鍊欐病鏈夋寚瀹氳鎴愬憳鐨勭埗浜叉垨鑰呮瘝浜�");
+// }
+ result = allPeopleList.stream().filter(people -> people.getUserId()!=1&&(people.getFatherId() == 0||people.getMomId()==0)&&people.getIsMyFamily()==1)
.map(people -> {
if(depth>1){
people.setIdentity(1);
//鏍规嵁閰嶅伓id鏌ヨ閰嶅伓鐨勬暟鎹紝灏佽濂戒竴璧疯繑鍥�
Long spouseId = people.getSpouseId();
ZInfoUser spouse = zInfoUserService.getById(spouseId);
+ spouse.setIdentity(1);
people.setSpouse(spouse);
people.setChildList(fillChildren(people, allPeopleList, depth-1));
}
return people;
}).collect(Collectors.toList());
- } catch (NullPointerException e) {
- throw new RuntimeException("鎮ㄥ湪鍔犲叆鎴愬憳鐨勬椂鍊欐病鏈夋寚瀹氳鎴愬憳鐨勭埗浜叉垨鑰呮瘝浜�");
- }
return AjaxResult.success(result);
@@ -406,6 +434,55 @@
}
+ @Override
+ public ZInfoUser getInfoById(Long userId) {
+ ZInfoUser user = getById(userId);
+ Long familyId = user.getFamilyId();
+ String familyName = zfFamilyService.getById(familyId).getName();
+ String roleName = zfRoleService.getById(user.getRoleId()).getName();
+ user.setFamilyName(familyName);
+ user.setRoleName(roleName);
+ return user;
+ }
+
+// @Override
+// public ZInfoUser getInfoById(Long userId) {
+//
+// ZInfoUser user = getById(userId);
+//
+// //鐢ㄩ�楀彿闅斿紑鐨勫搴璱d
+// String familyId = user.getFamilyId();
+//
+// //鍦ㄨ嚜宸卞搴腑瑙掕壊鐨刬d
+// Long roleId = user.getRoleId();
+//
+// ArrayList<String> familyList = new ArrayList<>();
+//
+// //濉厖鎵�灞炲搴�
+// if(familyId.contains(",")){
+// String[] familyIds = familyId.split(",");
+// for (String id : familyIds) {
+// familyList.add(zfFamilyService.getById(id).getName());
+// }
+// }else {
+// familyList.add(zfFamilyService.getById(familyId).getName());
+// }
+//
+// user.setFamilyList(familyList);
+//
+// //濉厖鎵�鍦ㄥ搴殑瑙掕壊
+// user.setRole(zfRoleService.getById(roleId).getName());
+//
+// return user;
+// }
+
+ @Override
+ public ZInfoUser getMyself() {
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+ return getById(userId);
+ }
+
private void recursionFindUser(List<ZInfoUser> treeList){
if (treeList==null||treeList.isEmpty()){
@@ -488,11 +565,13 @@
return one;
else {
one.setIdentity(people.getIdentity()+1);
-
//鏍规嵁閰嶅伓id鏌ヨ閰嶅伓鐨勬暟鎹紝灏佽濂戒竴璧疯繑鍥�
Long spouseId = one.getSpouseId();
- ZInfoUser spouse = zInfoUserService.getById(spouseId);
- one.setSpouse(spouse);
+ if(spouseId!=null){
+ ZInfoUser spouse = zInfoUserService.getById(spouseId);
+ spouse.setIdentity(people.getIdentity()+1);
+ one.setSpouse(spouse);
+ }
List<ZInfoUser> zinfo = fillChildren(one, allPeopleList, depth - 1);
one.setChildList(zinfo);
System.out.println(one);
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZRotationServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZRotationServiceImpl.java
new file mode 100644
index 0000000..75e0c01
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZRotationServiceImpl.java
@@ -0,0 +1,26 @@
+package com.ruoyi.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.domain.ZRotation;
+import com.ruoyi.mapper.ZRotationMapper;
+import com.ruoyi.service.ZRotationService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-15 0:19
+ * @Version 1.0.0
+ **/
+@Service
+public class ZRotationServiceImpl extends ServiceImpl<ZRotationMapper, ZRotation> implements ZRotationService {
+ @Override
+ public List<ZRotation> getByUserId(Long userId) {
+ LambdaQueryWrapper<ZRotation> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZRotation::getUid,userId);
+ return list(lqw);
+ }
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java
index 928222c..1ed99a3 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java
@@ -14,6 +14,7 @@
import com.ruoyi.domain.ZfClean;
import com.ruoyi.mapper.ZfCleanMapper;
+import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfCleanService;
@@ -30,7 +31,7 @@
import java.util.List;
import java.util.stream.Collectors;
-import static com.ruoyi.constant.MenuAuthority.CLEAN_LIST;
+import static com.ruoyi.constant.MenuAuthority.*;
/**
* <p>
@@ -50,8 +51,12 @@
@Resource
ZfCleanService zfCleanService;
- private LambdaQueryWrapper<ZfClean> buildCondition(ZfClean zfClean) {
+ @Resource
+ ZAuthorityService zAuthorityService;
+
+ private LambdaQueryWrapper<ZfClean> buildCondition(ZfClean zfClean,List<Long> familyIdList) {
LambdaQueryWrapper<ZfClean> lqw = new LambdaQueryWrapper<>();
+ lqw.orderByDesc(ZfClean::getCreateTime);
lqw.eq(zfClean.getKind() != null, ZfClean::getKind, zfClean.getKind())
.like(StringUtils.isNotEmpty(zfClean.getSuitable()), ZfClean::getSuitable, zfClean.getSuitable())
.like(StringUtils.isNotEmpty(zfClean.getType()), ZfClean::getType, zfClean.getType())
@@ -60,6 +65,7 @@
.like(StringUtils.isNotEmpty(zfClean.getLocation()), ZfClean::getLocation, zfClean.getLocation())
.like(StringUtils.isNotEmpty(zfClean.getRemark()), ZfClean::getRemark, zfClean.getRemark())
.eq(zfClean.getHappenTime() != null, ZfClean::getHappenTime, zfClean.getHappenTime())
+ .in(ZfClean::getFamilyId,familyIdList)
.between(zfClean.getHappenStartTime() != null && zfClean.getHappenEndTime() != null, ZfClean::getHappenTime, zfClean.getHappenStartTime(), zfClean.getHappenEndTime());
return lqw;
}
@@ -73,139 +79,154 @@
.eq(StringUtils.isNotEmpty(zfClean.getPlace()), ZfClean::getPlace, zfClean.getPlace())
.eq(StringUtils.isNotEmpty(zfClean.getLocation()), ZfClean::getLocation, zfClean.getLocation())
.eq(StringUtils.isNotEmpty(zfClean.getRemark()), ZfClean::getRemark, zfClean.getRemark())
+ .eq(zfClean.getFamilyId()!=null,ZfClean::getFamilyId,zfClean.getFamilyId())
.eq(zfClean.getHappenTime() != null, ZfClean::getHappenTime, zfClean.getHappenTime());
return lqw;
}
- private LambdaQueryWrapper<ZfClean> buildCondition(ZfClean zfClean, String familyIds, String secondFamilyAuthority) {
- //妯$硦鏌ヨ鐨勬潯浠�
- LambdaQueryWrapper<ZfClean> lqw = buildCondition(zfClean);
-
- //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
- boolean flag = false;
-
- StringBuilder secondFamilyIdsBuffer = new StringBuilder();
-
- //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
-
- if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
-
- if (secondFamilyAuthority.contains(",")) {
- //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
- String[] authorityList = secondFamilyAuthority.split(",");
- for (String authorityAndId : authorityList) {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
- }
-
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
-
- } else {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
- }
- }
- //灏哠tringBuffer杞垚String
- String secondFamilyIds = secondFamilyIdsBuffer.toString();
-
- //绗竴瀹跺涵鍙风殑鏉′欢
- if (familyIds.contains(",")) {
- flag = true;
- }
-
- //绗簩瀹跺涵鍙风殑鏉′欢
- if (StringUtils.isNotEmpty(secondFamilyIds)) {
- if (secondFamilyIds.contains(",")) {
- String[] secondFamilyIdList = secondFamilyIds.split(",");
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
- lqw.in(ZfClean::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
- lqw.in(ZfClean::getFamilyId, totalFamilyIdList);
- }
-
- } else {
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
- lqw.in(ZfClean::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
- lqw.in(ZfClean::getFamilyId, totalFamilyIdList);
- }
- }
- } else {
- //濡傛灉娌℃湁绗簩瀹跺涵鍙�
- if (flag) {
- String[] familyList = familyIds.split(",");
- lqw.in(ZfClean::getFamilyId, familyList);
- } else {
- lqw.eq(ZfClean::getFamilyId, familyIds);
- }
-
- }
-
- lqw.orderByDesc(ZfClean::getCreateTime);
- return lqw;
- }
-
- private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
- //寰楀埌鏉冮檺涓�
- String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
-
- if (authorities.contains(" ")) {
- //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
- String[] authorityIdList = authorities.split(" ");
- for (String s : authorityIdList) {
- if (s.equals(CLEAN_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- break;
- }
- }
- } else {
- if (authorities.equals(CLEAN_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- }
- }
- }
-
- private ZInfoUser getMySelf() {
- SysUser user = SecurityUtils.getLoginUser().getUser();
- Long userId = user.getUserId();
- LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
- zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
- return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
- }
-
- private String listFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getFamilyId();
- }
-
- private String listSecondFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getSecondFamilyId();
- }
+// private LambdaQueryWrapper<ZfClean> buildCondition(ZfClean zfClean, String familyIds, String secondFamilyAuthority) {
+// //妯$硦鏌ヨ鐨勬潯浠�
+// LambdaQueryWrapper<ZfClean> lqw = buildCondition(zfClean);
+//
+// //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
+// boolean flag = false;
+//
+// StringBuilder secondFamilyIdsBuffer = new StringBuilder();
+//
+// //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
+//
+// if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
+//
+// if (secondFamilyAuthority.contains(",")) {
+// //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
+// String[] authorityList = secondFamilyAuthority.split(",");
+// for (String authorityAndId : authorityList) {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
+// }
+//
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+//
+// } else {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+// }
+// }
+// //灏哠tringBuffer杞垚String
+// String secondFamilyIds = secondFamilyIdsBuffer.toString();
+//
+// //绗竴瀹跺涵鍙风殑鏉′欢
+// if (familyIds.contains(",")) {
+// flag = true;
+// }
+//
+// //绗簩瀹跺涵鍙风殑鏉′欢
+// if (StringUtils.isNotEmpty(secondFamilyIds)) {
+// if (secondFamilyIds.contains(",")) {
+// String[] secondFamilyIdList = secondFamilyIds.split(",");
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
+// lqw.in(ZfClean::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
+// lqw.in(ZfClean::getFamilyId, totalFamilyIdList);
+// }
+//
+// } else {
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
+// lqw.in(ZfClean::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
+// lqw.in(ZfClean::getFamilyId, totalFamilyIdList);
+// }
+// }
+// } else {
+// //濡傛灉娌℃湁绗簩瀹跺涵鍙�
+// if (flag) {
+// String[] familyList = familyIds.split(",");
+// lqw.in(ZfClean::getFamilyId, familyList);
+// } else {
+// lqw.eq(ZfClean::getFamilyId, familyIds);
+// }
+//
+// }
+//
+// lqw.orderByDesc(ZfClean::getCreateTime);
+// return lqw;
+// }
+//
+// private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
+// //寰楀埌鏉冮檺涓�
+// String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
+//
+// if (authorities.contains(" ")) {
+// //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
+// String[] authorityIdList = authorities.split(" ");
+// for (String s : authorityIdList) {
+// if (s.equals(CLEAN_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// break;
+// }
+// }
+// } else {
+// if (authorities.equals(CLEAN_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// }
+// }
+// }
+//
+// private ZInfoUser getMySelf() {
+// SysUser user = SecurityUtils.getLoginUser().getUser();
+// Long userId = user.getUserId();
+// LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+// zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
+// return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
+// }
+//
+// private String listFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getFamilyId();
+// }
+//
+// private String listSecondFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getSecondFamilyId();
+// }
@Override
public List<ZfClean> selectByCondition(ZfClean zfClean) {
- String familyIds = listFamilyIds();
- String secondFamilyIds = listSecondFamilyIds();
- LambdaQueryWrapper<ZfClean> lambdaQueryWrapper = buildCondition(zfClean, familyIds, secondFamilyIds);
+// String familyIds = listFamilyIds();
+// String secondFamilyIds = listSecondFamilyIds();
+// LambdaQueryWrapper<ZfClean> lambdaQueryWrapper = buildCondition(zfClean, familyIds, secondFamilyIds);
+// List<ZfClean> beanRecords = list(lambdaQueryWrapper);
+// log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
+// return markOwnData(familyIds, beanRecords);
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(CLEAN_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+
+ LambdaQueryWrapper<ZfClean> lambdaQueryWrapper = buildCondition(zfClean, idList);
List<ZfClean> beanRecords = list(lambdaQueryWrapper);
log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
- return markOwnData(familyIds, beanRecords);
+ return markOwnData(familyId, beanRecords);
}
@Override
@@ -218,36 +239,71 @@
return list;
}
- private static List<ZfClean> markOwnData(String familyIds, List<ZfClean> beanRecords) {
- return beanRecords.stream().peek(record -> {
- String recordFamilyId = record.getFamilyId();
- if (familyIds.contains(",")) {
- String[] familyIdList = familyIds.split(",");
- for (String familyId : familyIdList) {
- if (familyId.equals(recordFamilyId)) {
- record.setOwnData(1);
+// private static List<ZfClean> markOwnData(String familyIds, List<ZfClean> beanRecords) {
+// return beanRecords.stream().peek(record -> {
+// String recordFamilyId = record.getFamilyId();
+// if (familyIds.contains(",")) {
+// String[] familyIdList = familyIds.split(",");
+// for (String familyId : familyIdList) {
+// if (familyId.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// } else {
+// if (familyIds.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// }).collect(Collectors.toList());
+// }
+
+ public List<ZfClean> markOwnData(Long familyId,List<ZfClean> beanRecords){
+ return beanRecords.stream().peek(
+ bean -> {
+ if (bean.getFamilyId() == familyId) {
+ bean.setOwnData(1);
+ } else {
+ bean.setOwnData(0);
}
}
- } else {
- if (familyIds.equals(recordFamilyId)) {
- record.setOwnData(1);
- }
- }
- }).collect(Collectors.toList());
+ ).collect(Collectors.toList());
}
@Override
public AjaxResult selectDataList(ZfClean zfClean, Integer pageNum, Integer pageSize) {
- String familyIds = listFamilyIds();
- String secondFamilyAuthority = listSecondFamilyIds();
- LambdaQueryWrapper<ZfClean> lqw = buildCondition(zfClean, familyIds, secondFamilyAuthority);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+// LambdaQueryWrapper<ZfClean> lqw = buildCondition(zfClean, familyIds, secondFamilyAuthority);
+//
+// Page<ZfClean> zfCleanPage = new Page<>(pageNum, pageSize);
+// Page<ZfClean> pageResult = page(zfCleanPage, lqw);
+//
+// List<ZfClean> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+//
+// List<ZfClean> dtoResult = markOwnData(familyIds, beanRecords);
+//
+// HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
+// return AjaxResult.success(data);
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(CLEAN_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfClean> lqw = buildCondition(zfClean, idList);
+
Page<ZfClean> zfCleanPage = new Page<>(pageNum, pageSize);
Page<ZfClean> pageResult = page(zfCleanPage, lqw);
List<ZfClean> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
- List<ZfClean> dtoResult = markOwnData(familyIds, beanRecords);
+ List<ZfClean> dtoResult = markOwnData(familyId, beanRecords);
HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
return AjaxResult.success(data);
@@ -256,56 +312,56 @@
@Override
public AjaxResult addData(ZfClean zfClean) {
- String familyIds = listFamilyIds();
- boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
- if (familyIds.contains(",")) {
- String[] familyList = familyIds.split(",");
- for (String familyId : familyList) {
- if (familyId.equals(zfClean.getFamilyId())) {
- flag = true;
- }
- }
- } else {
- if (zfClean.getFamilyId().equals(familyIds)) {
- flag = true;
- }
- }
- if (flag) {
- if (save(zfClean)) {
- return AjaxResult.success();
- } else {
- return AjaxResult.error();
- }
+// String familyIds = listFamilyIds();
+// boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
+// if (familyIds.contains(",")) {
+// String[] familyList = familyIds.split(",");
+// for (String familyId : familyList) {
+// if (familyId.equals(zfClean.getFamilyId())) {
+// flag = true;
+// }
+// }
+// } else {
+// if (zfClean.getFamilyId().equals(familyIds)) {
+// flag = true;
+// }
+// }
+// if (flag) {
+// if (save(zfClean)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+//
+// } else {
+// throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfClean.getFamilyId() + "鏁版嵁鐨勬潈闄�");
+// }
- } else {
- throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfClean.getFamilyId() + "鏁版嵁鐨勬潈闄�");
- }
- }
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
- @Override
- public AjaxResult addData2(ZfClean zfClean) {
- ZInfoUser mySelf = getMySelf();
- String myFamilyId = mySelf.getFamilyId();
-
- if (StringUtils.isNotEmpty(zfClean.getFamilyId())) {
- throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
- }
-
- if (StringUtils.isEmpty(myFamilyId)) {
+ if(familyId == null){
throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
}
- if (myFamilyId.contains(",")) {
- String[] myFamilyIds = myFamilyId.split(",");
- //榛樿娣诲姞绗竴涓搴殑鏁版嵁
- zfClean.setFamilyId(myFamilyIds[0]);
- } else {
- zfClean.setFamilyId(myFamilyId);
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(CLEAN_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (zfClean.getFamilyId()!=null && !familyIdList.contains(zfClean.getFamilyId())) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+
+ if(zfClean.getFamilyId() == null){
+ //榛樿娣诲姞鑷繁瀹跺涵鐨勬暟鎹�
+ zfClean.setFamilyId(familyId);
}
//鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
LambdaQueryWrapper<ZfClean> lqw = uniqueCondition(zfClean);
List<ZfClean> list = list(lqw);
+
if(list.size()>0){
throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
}
@@ -315,7 +371,44 @@
} else {
return AjaxResult.error();
}
+
+
}
+
+// @Override
+// public AjaxResult addData2(ZfClean zfClean) {
+// ZInfoUser mySelf = getMySelf();
+// String myFamilyId = mySelf.getFamilyId();
+//
+// if (StringUtils.isNotEmpty(zfClean.getFamilyId())) {
+// throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
+// }
+//
+// if (StringUtils.isEmpty(myFamilyId)) {
+// throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+// }
+//
+// if (myFamilyId.contains(",")) {
+// String[] myFamilyIds = myFamilyId.split(",");
+// //榛樿娣诲姞绗竴涓搴殑鏁版嵁
+// zfClean.setFamilyId(myFamilyIds[0]);
+// } else {
+// zfClean.setFamilyId(myFamilyId);
+// }
+//
+// //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+// LambdaQueryWrapper<ZfClean> lqw = uniqueCondition(zfClean);
+// List<ZfClean> list = list(lqw);
+// if(list.size()>0){
+// throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+// }
+//
+// if (save(zfClean)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+// }
@@ -324,21 +417,72 @@
@Transactional
public AjaxResult importExcel(MultipartFile file) {
ExcelUtil<ZfClean> util = new ExcelUtil<>(ZfClean.class);
- List<ZfClean> propertyList = null;
+ List<ZfClean> dataList = null;
try {
- propertyList = util.importExcel(file.getInputStream());
+ dataList = util.importExcel(file.getInputStream());
} catch (Exception e) {
throw new RuntimeException(e);
}
- log.info("璧勪骇鍒楄〃涓猴細{}", propertyList);
+ log.info("鏁版嵁鍒楄〃涓猴細{}", dataList);
- for (ZfClean zfClean : propertyList) {
- zfCleanService.addData2(zfClean);
+ for (ZfClean zfClean : dataList) {
+ zfCleanService.addData(zfClean);
}
return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
}
+ @Override
+ public AjaxResult updateData(ZfClean zfClean) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ //鍏堟牴鎹甶d鏌ヨ鍑烘暟鎹殑familyId锛岀湅鐪嬫湁娌℃湁鏉冮檺鎿嶄綔
+ Long dataFamilyId = getById(zfClean.getId()).getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(CLEAN_LIST_UPDATE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (dataFamilyId!=null && !familyIdList.contains(dataFamilyId)) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+ if(updateById(zfClean)){
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+
+
+ }
+
+ @Override
+ public AjaxResult deleteData(Long[] ids) {
+ List<ZfClean> dataList = zfCleanService.listByIds(Arrays.asList(ids));
+
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(CLEAN_LIST_REMOVE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ for (ZfClean data : dataList) {
+ if (!familyIdList.contains(data.getFamilyId())){
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+ }
+
+ if (zfCleanService.removeByIds(Arrays.asList(ids))) {
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+
+
+ }
+
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java
index 4ca7ad4..d3d0f14 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java
@@ -14,6 +14,7 @@
import com.ruoyi.domain.ZfCollection;
import com.ruoyi.domain.ZfCollection;
import com.ruoyi.mapper.ZfCollectionMapper;
+import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfCollectionService;
import com.ruoyi.util.ArraysUtil;
@@ -29,7 +30,7 @@
import java.util.List;
import java.util.stream.Collectors;
-import static com.ruoyi.constant.MenuAuthority.COLLECTION_LIST;
+import static com.ruoyi.constant.MenuAuthority.*;
/**
* <p>
@@ -49,8 +50,12 @@
@Resource
ZInfoUserService zInfoUserService;
- private LambdaQueryWrapper<ZfCollection> buildCondition(ZfCollection zfCollection) {
+ @Resource
+ ZAuthorityService zAuthorityService;
+
+ private LambdaQueryWrapper<ZfCollection> buildCondition(ZfCollection zfCollection,List<Long> familyIdList) {
LambdaQueryWrapper<ZfCollection> lqw = new LambdaQueryWrapper<>();
+ lqw.orderByDesc(ZfCollection::getCreateTime);
lqw.like(StringUtils.isNotEmpty(zfCollection.getType()),ZfCollection::getType,zfCollection.getType());
lqw.like(StringUtils.isNotEmpty(zfCollection.getName()),ZfCollection::getName,zfCollection.getName());
lqw.like(StringUtils.isNotEmpty(zfCollection.getSource()),ZfCollection::getSource,zfCollection.getSource());
@@ -58,6 +63,7 @@
lqw.like(StringUtils.isNotEmpty(zfCollection.getPrice()),ZfCollection::getPrice,zfCollection.getPrice());
lqw.like(StringUtils.isNotEmpty(zfCollection.getLocation()),ZfCollection::getLocation,zfCollection.getLocation());
lqw.like(StringUtils.isNotEmpty(zfCollection.getRemark()),ZfCollection::getRemark,zfCollection.getRemark());
+ lqw.in(ZfCollection::getFamilyId,familyIdList);
lqw.eq(zfCollection.getHappenTime() != null, ZfCollection::getHappenTime, zfCollection.getHappenTime());
lqw.between(zfCollection.getHappenStartTime() != null && zfCollection.getHappenEndTime() != null, ZfCollection::getHappenTime, zfCollection.getHappenStartTime(), zfCollection.getHappenEndTime());
return lqw;
@@ -73,138 +79,153 @@
lqw.eq(StringUtils.isNotEmpty(zfCollection.getLocation()),ZfCollection::getLocation,zfCollection.getLocation());
lqw.eq(StringUtils.isNotEmpty(zfCollection.getRemark()),ZfCollection::getRemark,zfCollection.getRemark());
lqw.eq(zfCollection.getHappenTime() != null, ZfCollection::getHappenTime, zfCollection.getHappenTime());
+ lqw.eq(zfCollection.getFamilyId()!=null,ZfCollection::getFamilyId,zfCollection.getFamilyId());
return lqw;
}
- private LambdaQueryWrapper<ZfCollection> buildCondition(ZfCollection zfCollection, String familyIds, String secondFamilyAuthority) {
- //妯$硦鏌ヨ鐨勬潯浠�
- LambdaQueryWrapper<ZfCollection> lqw = buildCondition(zfCollection);
-
- //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
- boolean flag = false;
-
- StringBuilder secondFamilyIdsBuffer = new StringBuilder();
-
- //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
-
- if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
-
- if (secondFamilyAuthority.contains(",")) {
- //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
- String[] authorityList = secondFamilyAuthority.split(",");
- for (String authorityAndId : authorityList) {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
- }
-
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
-
- }else{
- setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
- }
- }
- //灏哠tringBuffer杞垚String
- String secondFamilyIds = secondFamilyIdsBuffer.toString();
-
- //绗竴瀹跺涵鍙风殑鏉′欢
- if (familyIds.contains(",")) {
- flag = true;
- }
-
- //绗簩瀹跺涵鍙风殑鏉′欢
- if (StringUtils.isNotEmpty(secondFamilyIds)) {
- if (secondFamilyIds.contains(",")) {
- String[] secondFamilyIdList = secondFamilyIds.split(",");
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
- lqw.in(ZfCollection::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
- lqw.in(ZfCollection::getFamilyId, totalFamilyIdList);
- }
-
- } else {
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
- lqw.in(ZfCollection::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
- lqw.in(ZfCollection::getFamilyId, totalFamilyIdList);
- }
- }
- } else {
- //濡傛灉娌℃湁绗簩瀹跺涵鍙�
- if (flag) {
- String[] familyList = familyIds.split(",");
- lqw.in(ZfCollection::getFamilyId, familyList);
- } else {
- lqw.eq(ZfCollection::getFamilyId, familyIds);
- }
-
- }
-
- lqw.orderByDesc(ZfCollection::getCreateTime);
- return lqw;
- }
-
- private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
- //寰楀埌鏉冮檺涓�
- String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
-
- if (authorities.contains(" ")) {
- //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
- String[] authorityIdList = authorities.split(" ");
- for (String s : authorityIdList) {
- if (s.equals(COLLECTION_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- break;
- }
- }
- } else {
- if (authorities.equals(COLLECTION_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- }
- }
- }
-
- private ZInfoUser getMySelf() {
- SysUser user = SecurityUtils.getLoginUser().getUser();
- Long userId = user.getUserId();
- LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
- zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
- return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
- }
-
- private String listFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getFamilyId();
- }
-
- private String listSecondFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getSecondFamilyId();
- }
+// private LambdaQueryWrapper<ZfCollection> buildCondition(ZfCollection zfCollection, String familyIds, String secondFamilyAuthority) {
+// //妯$硦鏌ヨ鐨勬潯浠�
+// LambdaQueryWrapper<ZfCollection> lqw = buildCondition(zfCollection);
+//
+// //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
+// boolean flag = false;
+//
+// StringBuilder secondFamilyIdsBuffer = new StringBuilder();
+//
+// //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
+//
+// if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
+//
+// if (secondFamilyAuthority.contains(",")) {
+// //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
+// String[] authorityList = secondFamilyAuthority.split(",");
+// for (String authorityAndId : authorityList) {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
+// }
+//
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+//
+// }else{
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+// }
+// }
+// //灏哠tringBuffer杞垚String
+// String secondFamilyIds = secondFamilyIdsBuffer.toString();
+//
+// //绗竴瀹跺涵鍙风殑鏉′欢
+// if (familyIds.contains(",")) {
+// flag = true;
+// }
+//
+// //绗簩瀹跺涵鍙风殑鏉′欢
+// if (StringUtils.isNotEmpty(secondFamilyIds)) {
+// if (secondFamilyIds.contains(",")) {
+// String[] secondFamilyIdList = secondFamilyIds.split(",");
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
+// lqw.in(ZfCollection::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
+// lqw.in(ZfCollection::getFamilyId, totalFamilyIdList);
+// }
+//
+// } else {
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
+// lqw.in(ZfCollection::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
+// lqw.in(ZfCollection::getFamilyId, totalFamilyIdList);
+// }
+// }
+// } else {
+// //濡傛灉娌℃湁绗簩瀹跺涵鍙�
+// if (flag) {
+// String[] familyList = familyIds.split(",");
+// lqw.in(ZfCollection::getFamilyId, familyList);
+// } else {
+// lqw.eq(ZfCollection::getFamilyId, familyIds);
+// }
+//
+// }
+//
+// lqw.orderByDesc(ZfCollection::getCreateTime);
+// return lqw;
+// }
+//
+// private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
+// //寰楀埌鏉冮檺涓�
+// String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
+//
+// if (authorities.contains(" ")) {
+// //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
+// String[] authorityIdList = authorities.split(" ");
+// for (String s : authorityIdList) {
+// if (s.equals(COLLECTION_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// break;
+// }
+// }
+// } else {
+// if (authorities.equals(COLLECTION_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// }
+// }
+// }
+//
+// private ZInfoUser getMySelf() {
+// SysUser user = SecurityUtils.getLoginUser().getUser();
+// Long userId = user.getUserId();
+// LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+// zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
+// return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
+// }
+//
+// private String listFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getFamilyId();
+// }
+//
+// private String listSecondFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getSecondFamilyId();
+// }
@Override
public List<ZfCollection> selectByCondition(ZfCollection zfCollection) {
- String familyIds = listFamilyIds();
- String secondFamilyIds = listSecondFamilyIds();
- LambdaQueryWrapper<ZfCollection> lambdaQueryWrapper = buildCondition(zfCollection, familyIds, secondFamilyIds);
+// String familyIds = listFamilyIds();
+// String secondFamilyIds = listSecondFamilyIds();
+// LambdaQueryWrapper<ZfCollection> lambdaQueryWrapper = buildCondition(zfCollection, familyIds, secondFamilyIds);
+// List<ZfCollection> beanRecords = list(lambdaQueryWrapper);
+// log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
+// return markOwnData(familyIds, beanRecords);
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(COLLECTION_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+
+ LambdaQueryWrapper<ZfCollection> lambdaQueryWrapper = buildCondition(zfCollection, idList);
List<ZfCollection> beanRecords = list(lambdaQueryWrapper);
log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
- return markOwnData(familyIds, beanRecords);
+ return markOwnData(familyId, beanRecords);
}
@Override
@@ -217,78 +238,197 @@
return list;
}
- private List<ZfCollection> markOwnData(String familyIds, List<ZfCollection> beanRecords) {
- return beanRecords.stream().peek(record -> {
- String recordFamilyId = record.getFamilyId();
- if (familyIds.contains(",")) {
- String[] familyIdList = familyIds.split(",");
- for (String familyId : familyIdList) {
- if (familyId.equals(recordFamilyId)) {
- record.setOwnData(1);
+// private List<ZfCollection> markOwnData(String familyIds, List<ZfCollection> beanRecords) {
+// return beanRecords.stream().peek(record -> {
+// String recordFamilyId = record.getFamilyId();
+// if (familyIds.contains(",")) {
+// String[] familyIdList = familyIds.split(",");
+// for (String familyId : familyIdList) {
+// if (familyId.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// } else {
+// if (familyIds.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// }).collect(Collectors.toList());
+// }
+
+ public List<ZfCollection> markOwnData(Long familyId,List<ZfCollection> beanRecords){
+ return beanRecords.stream().peek(
+ bean -> {
+ if (bean.getFamilyId() == familyId) {
+ bean.setOwnData(1);
+ } else {
+ bean.setOwnData(0);
}
}
- } else {
- if (familyIds.equals(recordFamilyId)) {
- record.setOwnData(1);
- }
- }
- }).collect(Collectors.toList());
+ ).collect(Collectors.toList());
}
@Override
public AjaxResult selectDataList(ZfCollection zfCollection, Integer pageNum, Integer pageSize) {
- String familyIds = listFamilyIds();
- String secondFamilyAuthority = listSecondFamilyIds();
- LambdaQueryWrapper<ZfCollection> lqw = buildCondition(zfCollection, familyIds, secondFamilyAuthority);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+// LambdaQueryWrapper<ZfCollection> lqw = buildCondition(zfCollection, familyIds, secondFamilyAuthority);
+//
+// Page<ZfCollection> zfCollectionPage = new Page<>(pageNum, pageSize);
+// Page<ZfCollection> pageResult = page(zfCollectionPage, lqw);
+//
+// List<ZfCollection> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+//
+// List<ZfCollection> dtoResult = markOwnData(familyIds, beanRecords);
+//
+// HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
+// return AjaxResult.success(data);
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(COLLECTION_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfCollection> lqw = buildCondition(zfCollection, idList);
+
Page<ZfCollection> zfCollectionPage = new Page<>(pageNum, pageSize);
Page<ZfCollection> pageResult = page(zfCollectionPage, lqw);
List<ZfCollection> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
- List<ZfCollection> dtoResult = markOwnData(familyIds, beanRecords);
+ List<ZfCollection> dtoResult = markOwnData(familyId, beanRecords);
HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
return AjaxResult.success(data);
}
+// @Override
+// public AjaxResult addData2(ZfCollection zfCollection){
+// ZInfoUser mySelf = getMySelf();
+// String myFamilyId = mySelf.getFamilyId();
+//
+// if (StringUtils.isNotEmpty(zfCollection.getFamilyId())){
+// throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
+// }
+//
+// if(StringUtils.isEmpty(myFamilyId)){
+// throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+// }
+//
+// if (myFamilyId.contains(",")){
+// String[] myFamilyIds = myFamilyId.split(",");
+// //榛樿娣诲姞绗竴涓搴殑鏁版嵁
+// zfCollection.setFamilyId(myFamilyIds[0]);
+// }else {
+// zfCollection.setFamilyId(myFamilyId);
+// }
+//
+// //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+// LambdaQueryWrapper<ZfCollection> lqw = uniqueCondition(zfCollection);
+// List<ZfCollection> list = list(lqw);
+// if(list.size()>0){
+// throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+// }
+//
+// if (save(zfCollection)) {
+// return AjaxResult.success();
+// }else {
+// return AjaxResult.error();
+// }
+// }
+
@Override
- public AjaxResult addData2(ZfCollection zfCollection){
- ZInfoUser mySelf = getMySelf();
- String myFamilyId = mySelf.getFamilyId();
+ public AjaxResult addData(ZfCollection zfCollection) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
- if (StringUtils.isNotEmpty(zfCollection.getFamilyId())){
- throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
- }
-
- if(StringUtils.isEmpty(myFamilyId)){
+ if(familyId == null){
throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
}
- if (myFamilyId.contains(",")){
- String[] myFamilyIds = myFamilyId.split(",");
- //榛樿娣诲姞绗竴涓搴殑鏁版嵁
- zfCollection.setFamilyId(myFamilyIds[0]);
- }else {
- zfCollection.setFamilyId(myFamilyId);
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (zfCollection.getFamilyId()!=null && !familyIdList.contains(zfCollection.getFamilyId())) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+
+ if(zfCollection.getFamilyId() == null){
+ //榛樿娣诲姞鑷繁瀹跺涵鐨勬暟鎹�
+ zfCollection.setFamilyId(familyId);
}
//鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
LambdaQueryWrapper<ZfCollection> lqw = uniqueCondition(zfCollection);
List<ZfCollection> list = list(lqw);
+
if(list.size()>0){
throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
}
if (save(zfCollection)) {
return AjaxResult.success();
+ } else {
+ return AjaxResult.error();
+ }
+
+ }
+
+ @Override
+ public AjaxResult updateData(ZfCollection zfCollection) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ //鍏堟牴鎹甶d鏌ヨ鍑烘暟鎹殑familyId锛岀湅鐪嬫湁娌℃湁鏉冮檺鎿嶄綔
+ Long dataFamilyId = getById(zfCollection.getId()).getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(COLLECTION_LIST_UPDATE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (dataFamilyId!=null && !familyIdList.contains(dataFamilyId)) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+ if(updateById(zfCollection)){
+ return AjaxResult.success();
}else {
return AjaxResult.error();
}
}
+ @Override
+ public AjaxResult deleteData(Long[] ids) {
+ List<ZfCollection> dataList = zfCollectionService.listByIds(Arrays.asList(ids));
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(COLLECTION_LIST_REMOVE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ for (ZfCollection data : dataList) {
+ if (!familyIdList.contains(data.getFamilyId())){
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+ }
+
+ if (zfCollectionService.removeByIds(Arrays.asList(ids))) {
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+ }
@Override
@@ -304,7 +444,7 @@
log.info("鍑嗗瑕佸鍏ョ殑鏁版嵁鍒楄〃涓猴細{}", dataList);
for (ZfCollection zfCollection : dataList) {
- zfCollectionService.addData2(zfCollection);
+ zfCollectionService.addData(zfCollection);
}
return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java
index d6a662c..9c330d2 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java
@@ -14,6 +14,7 @@
import com.ruoyi.domain.ZfContact;
import com.ruoyi.domain.ZfContact;
import com.ruoyi.mapper.ZfContactMapper;
+import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfContactService;
import com.ruoyi.service.ZfContactService;
@@ -30,8 +31,7 @@
import java.util.List;
import java.util.stream.Collectors;
-import static com.ruoyi.constant.MenuAuthority.CONTACT_LIST;
-import static com.ruoyi.constant.MenuAuthority.EVENT_LIST;
+import static com.ruoyi.constant.MenuAuthority.*;
/**
* <p>
@@ -49,10 +49,15 @@
@Resource
ZfContactService zfContactService;
+
+ @Resource
+ ZAuthorityService zAuthorityService;
- private LambdaQueryWrapper<ZfContact> buildCondition(ZfContact zfContact) {
+ private LambdaQueryWrapper<ZfContact> buildCondition(ZfContact zfContact,List<Long> familyIdList) {
LambdaQueryWrapper<ZfContact> lqw = new LambdaQueryWrapper<>();
+ lqw.orderByDesc(ZfContact::getCreateTime);
+ lqw.in(ZfContact::getFamilyId,familyIdList);
lqw.like(StringUtils.isNotEmpty(zfContact.getMyName()),ZfContact::getMyName,zfContact.getMyName());
lqw.like(StringUtils.isNotEmpty(zfContact.getNickName()),ZfContact::getNickName,zfContact.getNickName());
lqw.like(StringUtils.isNotEmpty(zfContact.getName()),ZfContact::getName,zfContact.getName());
@@ -67,135 +72,148 @@
return lqw;
}
- private LambdaQueryWrapper<ZfContact> buildCondition(ZfContact zfContact, String familyIds, String secondFamilyAuthority) {
- //妯$硦鏌ヨ鐨勬潯浠�
- LambdaQueryWrapper<ZfContact> lqw = buildCondition(zfContact);
-
- //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
- boolean flag = false;
-
- StringBuilder secondFamilyIdsBuffer = new StringBuilder();
-
- //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
-
- if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
-
- if (secondFamilyAuthority.contains(",")) {
- //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
- String[] authorityList = secondFamilyAuthority.split(",");
- for (String authorityAndId : authorityList) {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
- }
-
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
-
- } else {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
- }
- }
- //灏哠tringBuffer杞垚String
- String secondFamilyIds = secondFamilyIdsBuffer.toString();
-
- //绗竴瀹跺涵鍙风殑鏉′欢
- if (familyIds.contains(",")) {
- flag = true;
- }
-
- //绗簩瀹跺涵鍙风殑鏉′欢
- if (StringUtils.isNotEmpty(secondFamilyIds)) {
- if (secondFamilyIds.contains(",")) {
- String[] secondFamilyIdList = secondFamilyIds.split(",");
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
- lqw.in(ZfContact::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
- lqw.in(ZfContact::getFamilyId, totalFamilyIdList);
- }
-
- } else {
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
- lqw.in(ZfContact::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
- lqw.in(ZfContact::getFamilyId, totalFamilyIdList);
- }
- }
- } else {
- //濡傛灉娌℃湁绗簩瀹跺涵鍙�
- if (flag) {
- String[] familyList = familyIds.split(",");
- lqw.in(ZfContact::getFamilyId, familyList);
- } else {
- lqw.eq(ZfContact::getFamilyId, familyIds);
- }
-
- }
-
- lqw.orderByDesc(ZfContact::getCreateTime);
- return lqw;
- }
-
- private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
- //寰楀埌鏉冮檺涓�
- String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
-
- if (authorities.contains(" ")) {
- //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
- String[] authorityIdList = authorities.split(" ");
- for (String s : authorityIdList) {
- if (s.equals(CONTACT_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- break;
- }
- }
- } else {
- if (authorities.equals(CONTACT_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- }
- }
- }
-
- private ZInfoUser getMySelf() {
- SysUser user = SecurityUtils.getLoginUser().getUser();
- Long userId = user.getUserId();
- LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
- zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
- return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
- }
-
- private String listFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getFamilyId();
- }
-
- private String listSecondFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getSecondFamilyId();
- }
+// private LambdaQueryWrapper<ZfContact> buildCondition(ZfContact zfContact, String familyIds, String secondFamilyAuthority) {
+// //妯$硦鏌ヨ鐨勬潯浠�
+// LambdaQueryWrapper<ZfContact> lqw = buildCondition(zfContact);
+//
+// //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
+// boolean flag = false;
+//
+// StringBuilder secondFamilyIdsBuffer = new StringBuilder();
+//
+// //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
+//
+// if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
+//
+// if (secondFamilyAuthority.contains(",")) {
+// //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
+// String[] authorityList = secondFamilyAuthority.split(",");
+// for (String authorityAndId : authorityList) {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
+// }
+//
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+//
+// } else {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+// }
+// }
+// //灏哠tringBuffer杞垚String
+// String secondFamilyIds = secondFamilyIdsBuffer.toString();
+//
+// //绗竴瀹跺涵鍙风殑鏉′欢
+// if (familyIds.contains(",")) {
+// flag = true;
+// }
+//
+// //绗簩瀹跺涵鍙风殑鏉′欢
+// if (StringUtils.isNotEmpty(secondFamilyIds)) {
+// if (secondFamilyIds.contains(",")) {
+// String[] secondFamilyIdList = secondFamilyIds.split(",");
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
+// lqw.in(ZfContact::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
+// lqw.in(ZfContact::getFamilyId, totalFamilyIdList);
+// }
+//
+// } else {
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
+// lqw.in(ZfContact::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
+// lqw.in(ZfContact::getFamilyId, totalFamilyIdList);
+// }
+// }
+// } else {
+// //濡傛灉娌℃湁绗簩瀹跺涵鍙�
+// if (flag) {
+// String[] familyList = familyIds.split(",");
+// lqw.in(ZfContact::getFamilyId, familyList);
+// } else {
+// lqw.eq(ZfContact::getFamilyId, familyIds);
+// }
+//
+// }
+//
+// lqw.orderByDesc(ZfContact::getCreateTime);
+// return lqw;
+// }
+//
+// private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
+// //寰楀埌鏉冮檺涓�
+// String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
+//
+// if (authorities.contains(" ")) {
+// //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
+// String[] authorityIdList = authorities.split(" ");
+// for (String s : authorityIdList) {
+// if (s.equals(CONTACT_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// break;
+// }
+// }
+// } else {
+// if (authorities.equals(CONTACT_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// }
+// }
+// }
+//
+// private ZInfoUser getMySelf() {
+// SysUser user = SecurityUtils.getLoginUser().getUser();
+// Long userId = user.getUserId();
+// LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+// zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
+// return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
+// }
+//
+// private String listFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getFamilyId();
+// }
+//
+// private String listSecondFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getSecondFamilyId();
+// }
@Override
public List<ZfContact> selectByCondition(ZfContact zfContact) {
- String familyIds = listFamilyIds();
- String secondFamilyIds = listSecondFamilyIds();
- LambdaQueryWrapper<ZfContact> lambdaQueryWrapper = buildCondition(zfContact, familyIds, secondFamilyIds);
+// String familyIds = listFamilyIds();
+// String secondFamilyIds = listSecondFamilyIds();
+// LambdaQueryWrapper<ZfContact> lambdaQueryWrapper = buildCondition(zfContact, familyIds, secondFamilyIds);
+// List<ZfContact> beanRecords = list(lambdaQueryWrapper);
+// log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
+// return markOwnData(familyIds, beanRecords);
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(CONTACT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+
+ LambdaQueryWrapper<ZfContact> lambdaQueryWrapper = buildCondition(zfContact, idList);
List<ZfContact> beanRecords = list(lambdaQueryWrapper);
log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
- return markOwnData(familyIds, beanRecords);
+ return markOwnData(familyId, beanRecords);
}
@Override
@@ -208,36 +226,71 @@
return list;
}
- private static List<ZfContact> markOwnData(String familyIds, List<ZfContact> beanRecords) {
- return beanRecords.stream().peek(record -> {
- String recordFamilyId = record.getFamilyId();
- if (familyIds.contains(",")) {
- String[] familyIdList = familyIds.split(",");
- for (String familyId : familyIdList) {
- if (familyId.equals(recordFamilyId)) {
- record.setOwnData(1);
+// private static List<ZfContact> markOwnData(String familyIds, List<ZfContact> beanRecords) {
+// return beanRecords.stream().peek(record -> {
+// String recordFamilyId = record.getFamilyId();
+// if (familyIds.contains(",")) {
+// String[] familyIdList = familyIds.split(",");
+// for (String familyId : familyIdList) {
+// if (familyId.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// } else {
+// if (familyIds.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// }).collect(Collectors.toList());
+// }
+
+ public List<ZfContact> markOwnData(Long familyId,List<ZfContact> beanRecords){
+ return beanRecords.stream().peek(
+ bean -> {
+ if (bean.getFamilyId() == familyId) {
+ bean.setOwnData(1);
+ } else {
+ bean.setOwnData(0);
}
}
- } else {
- if (familyIds.equals(recordFamilyId)) {
- record.setOwnData(1);
- }
- }
- }).collect(Collectors.toList());
+ ).collect(Collectors.toList());
}
@Override
public AjaxResult selectDataList(ZfContact zfContact, Integer pageNum, Integer pageSize) {
- String familyIds = listFamilyIds();
- String secondFamilyAuthority = listSecondFamilyIds();
- LambdaQueryWrapper<ZfContact> lqw = buildCondition(zfContact, familyIds, secondFamilyAuthority);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+// LambdaQueryWrapper<ZfContact> lqw = buildCondition(zfContact, familyIds, secondFamilyAuthority);
+//
+// Page<ZfContact> zfContactPage = new Page<>(pageNum, pageSize);
+// Page<ZfContact> pageResult = page(zfContactPage, lqw);
+//
+// List<ZfContact> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+//
+// List<ZfContact> dtoResult = markOwnData(familyIds, beanRecords);
+//
+// HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
+// return AjaxResult.success(data);
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(CONTACT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfContact> lqw = buildCondition(zfContact, idList);
+
Page<ZfContact> zfContactPage = new Page<>(pageNum, pageSize);
Page<ZfContact> pageResult = page(zfContactPage, lqw);
List<ZfContact> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
- List<ZfContact> dtoResult = markOwnData(familyIds, beanRecords);
+ List<ZfContact> dtoResult = markOwnData(familyId, beanRecords);
HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
return AjaxResult.success(data);
@@ -246,56 +299,56 @@
@Override
public AjaxResult addData(ZfContact zfContact) {
- String familyIds = listFamilyIds();
- boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
- if (familyIds.contains(",")) {
- String[] familyList = familyIds.split(",");
- for (String familyId : familyList) {
- if (familyId.equals(zfContact.getFamilyId())) {
- flag = true;
- }
- }
- } else {
- if (zfContact.getFamilyId().equals(familyIds)) {
- flag = true;
- }
- }
- if (flag) {
- if (save(zfContact)) {
- return AjaxResult.success();
- } else {
- return AjaxResult.error();
- }
+// String familyIds = listFamilyIds();
+// boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
+// if (familyIds.contains(",")) {
+// String[] familyList = familyIds.split(",");
+// for (String familyId : familyList) {
+// if (familyId.equals(zfContact.getFamilyId())) {
+// flag = true;
+// }
+// }
+// } else {
+// if (zfContact.getFamilyId().equals(familyIds)) {
+// flag = true;
+// }
+// }
+// if (flag) {
+// if (save(zfContact)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+//
+// } else {
+// throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfContact.getFamilyId() + "鏁版嵁鐨勬潈闄�");
+// }
- } else {
- throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfContact.getFamilyId() + "鏁版嵁鐨勬潈闄�");
- }
- }
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
- @Override
- public AjaxResult addData2(ZfContact zfContact) {
- ZInfoUser mySelf = getMySelf();
- String myFamilyId = mySelf.getFamilyId();
-
- if (StringUtils.isNotEmpty(zfContact.getFamilyId())) {
- throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
- }
-
- if (StringUtils.isEmpty(myFamilyId)) {
+ if(familyId == null){
throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
}
- if (myFamilyId.contains(",")) {
- String[] myFamilyIds = myFamilyId.split(",");
- //榛樿娣诲姞绗竴涓搴殑鏁版嵁
- zfContact.setFamilyId(myFamilyIds[0]);
- } else {
- zfContact.setFamilyId(myFamilyId);
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(CONTACT_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (zfContact.getFamilyId()!=null && !familyIdList.contains(zfContact.getFamilyId())) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+
+ if(zfContact.getFamilyId() == null){
+ //榛樿娣诲姞鑷繁瀹跺涵鐨勬暟鎹�
+ zfContact.setFamilyId(familyId);
}
//鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
LambdaQueryWrapper<ZfContact> lqw = uniqueCondition(zfContact);
List<ZfContact> list = list(lqw);
+
if(list.size()>0){
throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
}
@@ -306,6 +359,41 @@
return AjaxResult.error();
}
}
+
+// @Override
+// public AjaxResult addData2(ZfContact zfContact) {
+// ZInfoUser mySelf = getMySelf();
+// String myFamilyId = mySelf.getFamilyId();
+//
+// if (StringUtils.isNotEmpty(zfContact.getFamilyId())) {
+// throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
+// }
+//
+// if (StringUtils.isEmpty(myFamilyId)) {
+// throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+// }
+//
+// if (myFamilyId.contains(",")) {
+// String[] myFamilyIds = myFamilyId.split(",");
+// //榛樿娣诲姞绗竴涓搴殑鏁版嵁
+// zfContact.setFamilyId(myFamilyIds[0]);
+// } else {
+// zfContact.setFamilyId(myFamilyId);
+// }
+//
+// //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+// LambdaQueryWrapper<ZfContact> lqw = uniqueCondition(zfContact);
+// List<ZfContact> list = list(lqw);
+// if(list.size()>0){
+// throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+// }
+//
+// if (save(zfContact)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+// }
private LambdaQueryWrapper<ZfContact> uniqueCondition(ZfContact zfContact) {
LambdaQueryWrapper<ZfContact> lqw = new LambdaQueryWrapper<>();
@@ -319,6 +407,7 @@
lqw.eq(StringUtils.isNotEmpty(zfContact.getTwitter()),ZfContact::getTwitter,zfContact.getTwitter());
lqw.eq(StringUtils.isNotEmpty(zfContact.getRemark()),ZfContact::getRemark,zfContact.getRemark());
lqw.eq(zfContact.getHappenTime() != null, ZfContact::getHappenTime, zfContact.getHappenTime());
+ lqw.eq(zfContact.getFamilyId()!=null,ZfContact::getFamilyId,zfContact.getFamilyId());
return lqw;
}
@@ -327,20 +416,67 @@
@Transactional
public AjaxResult importExcel(MultipartFile file) {
ExcelUtil<ZfContact> util = new ExcelUtil<>(ZfContact.class);
- List<ZfContact> propertyList = null;
+ List<ZfContact> dataList = null;
try {
- propertyList = util.importExcel(file.getInputStream());
+ dataList = util.importExcel(file.getInputStream());
} catch (Exception e) {
throw new RuntimeException(e);
}
- log.info("璧勪骇鍒楄〃涓猴細{}", propertyList);
+ log.info("鏁版嵁鍒楄〃涓猴細{}", dataList);
- for (ZfContact zfContact : propertyList) {
- zfContactService.addData2(zfContact);
+ for (ZfContact zfContact : dataList) {
+ zfContactService.addData(zfContact);
}
return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
}
+ @Override
+ public AjaxResult updateData(ZfContact zfContact) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ //鍏堟牴鎹甶d鏌ヨ鍑烘暟鎹殑familyId锛岀湅鐪嬫湁娌℃湁鏉冮檺鎿嶄綔
+ Long dataFamilyId = getById(zfContact.getId()).getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(CONTACT_LIST_UPDATE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (dataFamilyId!=null && !familyIdList.contains(dataFamilyId)) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+ if(updateById(zfContact)){
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+ }
+
+ @Override
+ public AjaxResult deleteData(Long[] ids) {
+ List<ZfContact> dataList = zfContactService.listByIds(Arrays.asList(ids));
+
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(CONTACT_LIST_REMOVE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ for (ZfContact data : dataList) {
+ if (!familyIdList.contains(data.getFamilyId())){
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+ }
+
+ if (zfContactService.removeByIds(Arrays.asList(ids))) {
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+ }
+
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
index 62f029b..9379889 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
@@ -7,18 +7,25 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.domain.ZfDoctor;
-import com.ruoyi.domain.ZfEquipment;
-import com.ruoyi.domain.ZfPet;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.domain.*;
import com.ruoyi.mapper.ZfDoctorMapper;
+import com.ruoyi.service.ZAuthorityService;
+import com.ruoyi.service.ZInfoUserService;
+import com.ruoyi.service.ZfDoctorService;
import com.ruoyi.service.ZfDoctorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
+import java.util.stream.Collectors;
+
+import static com.ruoyi.constant.MenuAuthority.*;
/**
* <p>
@@ -32,25 +39,82 @@
@Slf4j
public class ZfDoctorServiceImpl extends ServiceImpl<ZfDoctorMapper, ZfDoctor> implements ZfDoctorService {
+ @Resource
+ ZInfoUserService zInfoUserService;
+
+ @Resource
+ ZfDoctorService zfDoctorService;
+
+ @Resource
+ ZAuthorityService zAuthorityService;
+
@Override
public AjaxResult selectDoctorList(ZfDoctor zfDoctor, Integer pageNum, Integer pageSize) {
- LambdaQueryWrapper<ZfDoctor> lqw = buildCondition(zfDoctor);
- lqw.orderByDesc(ZfDoctor::getCreateTime);
+// LambdaQueryWrapper<ZfDoctor> lqw = buildCondition(zfDoctor);
+// lqw.orderByDesc(ZfDoctor::getCreateTime);
+//
+// Page<ZfDoctor> ZfDoctorPage = new Page<>(pageNum, pageSize);
+// Page<ZfDoctor> pageResult = page(ZfDoctorPage, lqw);
+//
+// HashMap<String, Object> data = MapUtils.getResult(pageResult);
+// return AjaxResult.success(data);
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(DOCTOR_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfDoctor> lqw = buildCondition(zfDoctor, idList);
- Page<ZfDoctor> ZfDoctorPage = new Page<>(pageNum, pageSize);
- Page<ZfDoctor> pageResult = page(ZfDoctorPage, lqw);
- HashMap<String, Object> data = MapUtils.getResult(pageResult);
+ Page<ZfDoctor> zfDoctorPage = new Page<>(pageNum, pageSize);
+ Page<ZfDoctor> pageResult = page(zfDoctorPage, lqw);
+
+ List<ZfDoctor> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+
+ List<ZfDoctor> dtoResult = markOwnData(familyId, beanRecords);
+
+ HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
return AjaxResult.success(data);
}
@Override
public List<ZfDoctor> selectByCondition(ZfDoctor zfDoctor) {
- LambdaQueryWrapper<ZfDoctor> lambdaQueryWrapper = buildCondition(zfDoctor);
- lambdaQueryWrapper.orderByDesc(ZfDoctor::getCreateTime);
- List<ZfDoctor> list = list(lambdaQueryWrapper);
- log.info("杩斿洖鐨勬暟鎹负:{}", list);
- return list;
+// LambdaQueryWrapper<ZfDoctor> lambdaQueryWrapper = buildCondition(zfDoctor);
+// lambdaQueryWrapper.orderByDesc(ZfDoctor::getCreateTime);
+// List<ZfDoctor> list = list(lambdaQueryWrapper);
+// log.info("杩斿洖鐨勬暟鎹负:{}", list);
+// return list;
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(DOCTOR_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+
+ LambdaQueryWrapper<ZfDoctor> lambdaQueryWrapper = buildCondition(zfDoctor, idList);
+ List<ZfDoctor> beanRecords = list(lambdaQueryWrapper);
+ log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
+ return markOwnData(familyId, beanRecords);
+ }
+
+ public List<ZfDoctor> markOwnData(Long familyId,List<ZfDoctor> beanRecords){
+ return beanRecords.stream().peek(
+ bean -> {
+ if (bean.getFamilyId() == familyId) {
+ bean.setOwnData(1);
+ } else {
+ bean.setOwnData(0);
+ }
+ }
+ ).collect(Collectors.toList());
}
@Override
@@ -64,11 +128,52 @@
}
@Override
- public AjaxResult mySave(ZfDoctor zfDoctor) {
+ public AjaxResult importExcel(MultipartFile file) {
+ ExcelUtil<ZfDoctor> util = new ExcelUtil<>(ZfDoctor.class);
+ List<ZfDoctor> dataList = null;
+ try {
+ dataList = util.importExcel(file.getInputStream());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ log.info("鏁版嵁鍒楄〃涓猴細{}", dataList);
+
+ for (ZfDoctor zfDoctor : dataList) {
+ zfDoctorService.addData(zfDoctor);
+ }
+
+ return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
+
+ }
+
+ @Override
+ public AjaxResult addData(ZfDoctor zfDoctor) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ if(familyId == null){
+ throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+ }
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(DOCTOR_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (zfDoctor.getFamilyId()!=null && !familyIdList.contains(zfDoctor.getFamilyId())) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+
+ if(zfDoctor.getFamilyId() == null){
+ //榛樿娣诲姞鑷繁瀹跺涵鐨勬暟鎹�
+ zfDoctor.setFamilyId(familyId);
+ }
+
//鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
LambdaQueryWrapper<ZfDoctor> lqw = uniqueCondition(zfDoctor);
List<ZfDoctor> list = list(lqw);
- if (list.size() > 0) {
+
+ if(list.size()>0){
throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
}
@@ -77,9 +182,72 @@
} else {
return AjaxResult.error();
}
-
-
}
+
+ @Override
+ public AjaxResult updateData(ZfDoctor zfDoctor) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ //鍏堟牴鎹甶d鏌ヨ鍑烘暟鎹殑familyId锛岀湅鐪嬫湁娌℃湁鏉冮檺鎿嶄綔
+ Long dataFamilyId = getById(zfDoctor.getId()).getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(DOCTOR_LIST_UPDATE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (dataFamilyId!=null && !familyIdList.contains(dataFamilyId)) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+ if(updateById(zfDoctor)){
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+ }
+
+ @Override
+ public AjaxResult deleteData(Long[] ids) {
+ List<ZfDoctor> dataList = zfDoctorService.listByIds(Arrays.asList(ids));
+
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(DOCTOR_LIST_REMOVE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ for (ZfDoctor data : dataList) {
+ if (!familyIdList.contains(data.getFamilyId())){
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+ }
+
+ if (zfDoctorService.removeByIds(Arrays.asList(ids))) {
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+ }
+
+// @Override
+// public AjaxResult mySave(ZfDoctor zfDoctor) {
+// //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+// LambdaQueryWrapper<ZfDoctor> lqw = uniqueCondition(zfDoctor);
+// List<ZfDoctor> list = list(lqw);
+// if (list.size() > 0) {
+// throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+// }
+//
+// if (save(zfDoctor)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+//
+//
+// }
private LambdaQueryWrapper<ZfDoctor> uniqueCondition(ZfDoctor zfDoctor) {
LambdaQueryWrapper<ZfDoctor> lqw = new LambdaQueryWrapper<>();
@@ -91,12 +259,15 @@
lqw.eq(StringUtils.isNotEmpty(zfDoctor.getEffect()), ZfDoctor::getEffect, zfDoctor.getEffect());
lqw.eq(StringUtils.isNotEmpty(zfDoctor.getSuitable()), ZfDoctor::getSuitable, zfDoctor.getSuitable());
lqw.eq(StringUtils.isNotEmpty(zfDoctor.getRemark()), ZfDoctor::getRemark, zfDoctor.getRemark());
+ lqw.eq(zfDoctor.getFamilyId()!=null,ZfDoctor::getFamilyId,zfDoctor.getFamilyId());
return lqw;
}
- private LambdaQueryWrapper<ZfDoctor> buildCondition(ZfDoctor zfDoctor) {
+ private LambdaQueryWrapper<ZfDoctor> buildCondition(ZfDoctor zfDoctor,List<Long> familyIdList) {
LambdaQueryWrapper<ZfDoctor> lqw = new LambdaQueryWrapper<>();
+ lqw.in(ZfDoctor::getFamilyId,familyIdList);
+ lqw.orderByDesc(ZfDoctor::getCreateTime);
lqw.like(StringUtils.isNotEmpty(zfDoctor.getType()), ZfDoctor::getType, zfDoctor.getType())
.like(StringUtils.isNotEmpty(zfDoctor.getSymptom()), ZfDoctor::getSymptom, zfDoctor.getSymptom())
.like(StringUtils.isNotEmpty(zfDoctor.getDuration()), ZfDoctor::getDuration, zfDoctor.getDuration())
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java
index 3badb7a..66a01c0 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java
@@ -14,6 +14,7 @@
import com.ruoyi.domain.ZfEconomy;
import com.ruoyi.domain.ZfEconomy;
import com.ruoyi.mapper.ZfEconomyMapper;
+import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfEconomyService;
import com.ruoyi.util.ArraysUtil;
@@ -29,8 +30,7 @@
import java.util.List;
import java.util.stream.Collectors;
-import static com.ruoyi.constant.MenuAuthority.COLLECTION_LIST;
-import static com.ruoyi.constant.MenuAuthority.ECONOMY_LIST;
+import static com.ruoyi.constant.MenuAuthority.*;
/**
* <p>
@@ -49,8 +49,13 @@
@Resource
ZInfoUserService zInfoUserService;
- private LambdaQueryWrapper<ZfEconomy> buildCondition(ZfEconomy zfEconomy) {
+ @Resource
+ ZAuthorityService zAuthorityService;
+
+ private LambdaQueryWrapper<ZfEconomy> buildCondition(ZfEconomy zfEconomy,List<Long> familyIdList) {
LambdaQueryWrapper<ZfEconomy> lqw = new LambdaQueryWrapper<>();
+ lqw.orderByDesc(ZfEconomy::getCreateTime);
+ lqw.in(ZfEconomy::getFamilyId,familyIdList);
lqw.like(StringUtils.isNotEmpty(zfEconomy.getType()),ZfEconomy::getType,zfEconomy.getType());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getKind()),ZfEconomy::getKind,zfEconomy.getKind());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getPrice()),ZfEconomy::getPrice,zfEconomy.getPrice());
@@ -72,139 +77,154 @@
lqw.eq(StringUtils.isNotEmpty(zfEconomy.getUsePeople()),ZfEconomy::getUsePeople,zfEconomy.getUsePeople());
lqw.eq(StringUtils.isNotEmpty(zfEconomy.getBalance()),ZfEconomy::getBalance,zfEconomy.getBalance());
lqw.eq(StringUtils.isNotEmpty(zfEconomy.getRemark()),ZfEconomy::getRemark,zfEconomy.getRemark());
+ lqw.eq(zfEconomy.getFamilyId()!=null,ZfEconomy::getFamilyId,zfEconomy.getFamilyId());
lqw.eq(zfEconomy.getHappenTime() != null, ZfEconomy::getHappenTime, zfEconomy.getHappenTime());
return lqw;
}
- private LambdaQueryWrapper<ZfEconomy> buildCondition(ZfEconomy zfEconomy, String familyIds, String secondFamilyAuthority) {
- //妯$硦鏌ヨ鐨勬潯浠�
- LambdaQueryWrapper<ZfEconomy> lqw = buildCondition(zfEconomy);
-
- //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
- boolean flag = false;
-
- StringBuilder secondFamilyIdsBuffer = new StringBuilder();
-
- //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
-
- if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
-
- if (secondFamilyAuthority.contains(",")) {
- //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
- String[] authorityList = secondFamilyAuthority.split(",");
- for (String authorityAndId : authorityList) {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
- }
-
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
-
- }else{
- setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
- }
- }
- //灏哠tringBuffer杞垚String
- String secondFamilyIds = secondFamilyIdsBuffer.toString();
-
- //绗竴瀹跺涵鍙风殑鏉′欢
- if (familyIds.contains(",")) {
- flag = true;
- }
-
- //绗簩瀹跺涵鍙风殑鏉′欢
- if (StringUtils.isNotEmpty(secondFamilyIds)) {
- if (secondFamilyIds.contains(",")) {
- String[] secondFamilyIdList = secondFamilyIds.split(",");
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
- lqw.in(ZfEconomy::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
- lqw.in(ZfEconomy::getFamilyId, totalFamilyIdList);
- }
-
- } else {
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
- lqw.in(ZfEconomy::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
- lqw.in(ZfEconomy::getFamilyId, totalFamilyIdList);
- }
- }
- } else {
- //濡傛灉娌℃湁绗簩瀹跺涵鍙�
- if (flag) {
- String[] familyList = familyIds.split(",");
- lqw.in(ZfEconomy::getFamilyId, familyList);
- } else {
- lqw.eq(ZfEconomy::getFamilyId, familyIds);
- }
-
- }
-
- lqw.orderByDesc(ZfEconomy::getCreateTime);
- return lqw;
- }
-
- private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
- //寰楀埌鏉冮檺涓�
- String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
-
- if (authorities.contains(" ")) {
- //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
- String[] authorityIdList = authorities.split(" ");
- for (String s : authorityIdList) {
- if (s.equals(ECONOMY_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- break;
- }
- }
- } else {
- if (authorities.equals(ECONOMY_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- }
- }
- }
-
- private ZInfoUser getMySelf() {
- SysUser user = SecurityUtils.getLoginUser().getUser();
- Long userId = user.getUserId();
- LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
- zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
- return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
- }
-
- private String listFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getFamilyId();
- }
-
- private String listSecondFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getSecondFamilyId();
- }
+// private LambdaQueryWrapper<ZfEconomy> buildCondition(ZfEconomy zfEconomy, String familyIds, String secondFamilyAuthority) {
+// //妯$硦鏌ヨ鐨勬潯浠�
+// LambdaQueryWrapper<ZfEconomy> lqw = buildCondition(zfEconomy);
+//
+// //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
+// boolean flag = false;
+//
+// StringBuilder secondFamilyIdsBuffer = new StringBuilder();
+//
+// //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
+//
+// if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
+//
+// if (secondFamilyAuthority.contains(",")) {
+// //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
+// String[] authorityList = secondFamilyAuthority.split(",");
+// for (String authorityAndId : authorityList) {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
+// }
+//
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+//
+// }else{
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+// }
+// }
+// //灏哠tringBuffer杞垚String
+// String secondFamilyIds = secondFamilyIdsBuffer.toString();
+//
+// //绗竴瀹跺涵鍙风殑鏉′欢
+// if (familyIds.contains(",")) {
+// flag = true;
+// }
+//
+// //绗簩瀹跺涵鍙风殑鏉′欢
+// if (StringUtils.isNotEmpty(secondFamilyIds)) {
+// if (secondFamilyIds.contains(",")) {
+// String[] secondFamilyIdList = secondFamilyIds.split(",");
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
+// lqw.in(ZfEconomy::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
+// lqw.in(ZfEconomy::getFamilyId, totalFamilyIdList);
+// }
+//
+// } else {
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
+// lqw.in(ZfEconomy::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
+// lqw.in(ZfEconomy::getFamilyId, totalFamilyIdList);
+// }
+// }
+// } else {
+// //濡傛灉娌℃湁绗簩瀹跺涵鍙�
+// if (flag) {
+// String[] familyList = familyIds.split(",");
+// lqw.in(ZfEconomy::getFamilyId, familyList);
+// } else {
+// lqw.eq(ZfEconomy::getFamilyId, familyIds);
+// }
+//
+// }
+//
+// lqw.orderByDesc(ZfEconomy::getCreateTime);
+// return lqw;
+// }
+//
+// private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
+// //寰楀埌鏉冮檺涓�
+// String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
+//
+// if (authorities.contains(" ")) {
+// //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
+// String[] authorityIdList = authorities.split(" ");
+// for (String s : authorityIdList) {
+// if (s.equals(ECONOMY_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// break;
+// }
+// }
+// } else {
+// if (authorities.equals(ECONOMY_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// }
+// }
+// }
+//
+// private ZInfoUser getMySelf() {
+// SysUser user = SecurityUtils.getLoginUser().getUser();
+// Long userId = user.getUserId();
+// LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+// zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
+// return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
+// }
+//
+// private String listFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getFamilyId();
+// }
+//
+// private String listSecondFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getSecondFamilyId();
+// }
@Override
public List<ZfEconomy> selectByCondition(ZfEconomy zfEconomy) {
- String familyIds = listFamilyIds();
- String secondFamilyIds = listSecondFamilyIds();
- LambdaQueryWrapper<ZfEconomy> lambdaQueryWrapper = buildCondition(zfEconomy, familyIds, secondFamilyIds);
+// String familyIds = listFamilyIds();
+// String secondFamilyIds = listSecondFamilyIds();
+// LambdaQueryWrapper<ZfEconomy> lambdaQueryWrapper = buildCondition(zfEconomy, familyIds, secondFamilyIds);
+// List<ZfEconomy> beanRecords = list(lambdaQueryWrapper);
+// log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
+// return markOwnData(familyIds, beanRecords);
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(ECONOMY_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+
+ LambdaQueryWrapper<ZfEconomy> lambdaQueryWrapper = buildCondition(zfEconomy, idList);
List<ZfEconomy> beanRecords = list(lambdaQueryWrapper);
log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
- return markOwnData(familyIds, beanRecords);
+ return markOwnData(familyId, beanRecords);
}
@Override
@@ -217,76 +237,111 @@
return list;
}
- private List<ZfEconomy> markOwnData(String familyIds, List<ZfEconomy> beanRecords) {
- return beanRecords.stream().peek(record -> {
- String recordFamilyId = record.getFamilyId();
- if (familyIds.contains(",")) {
- String[] familyIdList = familyIds.split(",");
- for (String familyId : familyIdList) {
- if (familyId.equals(recordFamilyId)) {
- record.setOwnData(1);
- }
- }
- } else {
- if (familyIds.equals(recordFamilyId)) {
- record.setOwnData(1);
- }
- }
- }).collect(Collectors.toList());
- }
+// private List<ZfEconomy> markOwnData(String familyIds, List<ZfEconomy> beanRecords) {
+// return beanRecords.stream().peek(record -> {
+// String recordFamilyId = record.getFamilyId();
+// if (familyIds.contains(",")) {
+// String[] familyIdList = familyIds.split(",");
+// for (String familyId : familyIdList) {
+// if (familyId.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// } else {
+// if (familyIds.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// }).collect(Collectors.toList());
+// }
@Override
public AjaxResult selectDataList(ZfEconomy zfEconomy, Integer pageNum, Integer pageSize) {
- String familyIds = listFamilyIds();
- String secondFamilyAuthority = listSecondFamilyIds();
- LambdaQueryWrapper<ZfEconomy> lqw = buildCondition(zfEconomy, familyIds, secondFamilyAuthority);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+// LambdaQueryWrapper<ZfEconomy> lqw = buildCondition(zfEconomy, familyIds, secondFamilyAuthority);
+//
+// Page<ZfEconomy> zfEconomyPage = new Page<>(pageNum, pageSize);
+// Page<ZfEconomy> pageResult = page(zfEconomyPage, lqw);
+//
+// List<ZfEconomy> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+//
+// List<ZfEconomy> dtoResult = markOwnData(familyIds, beanRecords);
+//
+// HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
+// return AjaxResult.success(data);
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(ECONOMY_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfEconomy> lqw = buildCondition(zfEconomy, idList);
+
Page<ZfEconomy> zfEconomyPage = new Page<>(pageNum, pageSize);
Page<ZfEconomy> pageResult = page(zfEconomyPage, lqw);
List<ZfEconomy> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
- List<ZfEconomy> dtoResult = markOwnData(familyIds, beanRecords);
+ List<ZfEconomy> dtoResult = markOwnData(familyId, beanRecords);
HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
return AjaxResult.success(data);
}
-
- @Override
- public AjaxResult addData2(ZfEconomy zfEconomy){
- ZInfoUser mySelf = getMySelf();
- String myFamilyId = mySelf.getFamilyId();
-
- if (StringUtils.isNotEmpty(zfEconomy.getFamilyId())){
- throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
- }
-
- if(StringUtils.isEmpty(myFamilyId)){
- throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
- }
-
- if (myFamilyId.contains(",")){
- String[] myFamilyIds = myFamilyId.split(",");
- //榛樿娣诲姞绗竴涓搴殑鏁版嵁
- zfEconomy.setFamilyId(myFamilyIds[0]);
- }else {
- zfEconomy.setFamilyId(myFamilyId);
- }
-
- //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
- LambdaQueryWrapper<ZfEconomy> lqw = uniqueCondition(zfEconomy);
- List<ZfEconomy> list = list(lqw);
- if(list.size()>0){
- throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
- }
-
- if (save(zfEconomy)) {
- return AjaxResult.success();
- }else {
- return AjaxResult.error();
- }
+ public List<ZfEconomy> markOwnData(Long familyId,List<ZfEconomy> beanRecords){
+ return beanRecords.stream().peek(
+ bean -> {
+ if (bean.getFamilyId() == familyId) {
+ bean.setOwnData(1);
+ } else {
+ bean.setOwnData(0);
+ }
+ }
+ ).collect(Collectors.toList());
}
+
+
+// @Override
+// public AjaxResult addData2(ZfEconomy zfEconomy){
+// ZInfoUser mySelf = getMySelf();
+// String myFamilyId = mySelf.getFamilyId();
+//
+// if (StringUtils.isNotEmpty(zfEconomy.getFamilyId())){
+// throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
+// }
+//
+// if(StringUtils.isEmpty(myFamilyId)){
+// throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+// }
+//
+// if (myFamilyId.contains(",")){
+// String[] myFamilyIds = myFamilyId.split(",");
+// //榛樿娣诲姞绗竴涓搴殑鏁版嵁
+// zfEconomy.setFamilyId(myFamilyIds[0]);
+// }else {
+// zfEconomy.setFamilyId(myFamilyId);
+// }
+//
+// //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+// LambdaQueryWrapper<ZfEconomy> lqw = uniqueCondition(zfEconomy);
+// List<ZfEconomy> list = list(lqw);
+// if(list.size()>0){
+// throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+// }
+//
+// if (save(zfEconomy)) {
+// return AjaxResult.success();
+// }else {
+// return AjaxResult.error();
+// }
+// }
@Override
@@ -302,12 +357,97 @@
log.info("鍑嗗瑕佸鍏ョ殑鏁版嵁鍒楄〃涓猴細{}", dataList);
for (ZfEconomy zfEconomy : dataList) {
- zfEconomyService.addData2(zfEconomy);
+ zfEconomyService.addData(zfEconomy);
}
return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
}
+ @Override
+ public AjaxResult addData(ZfEconomy zfEconomy) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ if(familyId == null){
+ throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+ }
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(ECONOMY_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (zfEconomy.getFamilyId()!=null && !familyIdList.contains(zfEconomy.getFamilyId())) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+
+ if(zfEconomy.getFamilyId() == null){
+ //榛樿娣诲姞鑷繁瀹跺涵鐨勬暟鎹�
+ zfEconomy.setFamilyId(familyId);
+ }
+
+ //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+ LambdaQueryWrapper<ZfEconomy> lqw = uniqueCondition(zfEconomy);
+ List<ZfEconomy> list = list(lqw);
+
+ if(list.size()>0){
+ throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+ }
+
+ if (save(zfEconomy)) {
+ return AjaxResult.success();
+ } else {
+ return AjaxResult.error();
+ }
+ }
+
+ @Override
+ public AjaxResult updateData(ZfEconomy zfEconomy) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ //鍏堟牴鎹甶d鏌ヨ鍑烘暟鎹殑familyId锛岀湅鐪嬫湁娌℃湁鏉冮檺鎿嶄綔
+ Long dataFamilyId = getById(zfEconomy.getId()).getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(ECONOMY_LIST_UPDATE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (dataFamilyId!=null && !familyIdList.contains(dataFamilyId)) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+ if(updateById(zfEconomy)){
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+ }
+
+ @Override
+ public AjaxResult deleteData(Long[] ids) {
+ List<ZfEconomy> dataList = zfEconomyService.listByIds(Arrays.asList(ids));
+
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(ECONOMY_LIST_REMOVE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ for (ZfEconomy data : dataList) {
+ if (!familyIdList.contains(data.getFamilyId())){
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+ }
+
+ if (zfEconomyService.removeByIds(Arrays.asList(ids))) {
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+ }
+
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java
index 8b1a5bf..2d99122 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java
@@ -13,6 +13,7 @@
import com.ruoyi.domain.*;
import com.ruoyi.domain.ZfEquipment;
import com.ruoyi.mapper.ZfEquipmentMapper;
+import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfEquipmentService;
import com.ruoyi.util.ArraysUtil;
@@ -28,8 +29,7 @@
import java.util.List;
import java.util.stream.Collectors;
-import static com.ruoyi.constant.MenuAuthority.EQUIPMENT_LIST;
-import static com.ruoyi.constant.MenuAuthority.EVENT_LIST;
+import static com.ruoyi.constant.MenuAuthority.*;
/**
* <p>
@@ -48,14 +48,19 @@
@Resource
ZfEquipmentService zfEquipmentService;
- private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment) {
+ @Resource
+ ZAuthorityService zAuthorityService;
+
+ private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment,List<Long> familyIdList) {
LambdaQueryWrapper<ZfEquipment> lqw = new LambdaQueryWrapper<>();
+ lqw.orderByDesc(ZfEquipment::getCreateTime);
lqw.like(StringUtils.isNotEmpty(zfEquipment.getName()), ZfEquipment::getName, zfEquipment.getName());
lqw.like(StringUtils.isNotEmpty(zfEquipment.getBuyer()), ZfEquipment::getBuyer, zfEquipment.getBuyer());
lqw.like(StringUtils.isNotEmpty(zfEquipment.getContent()), ZfEquipment::getContent, zfEquipment.getContent());
lqw.like(StringUtils.isNotEmpty(zfEquipment.getLocation()), ZfEquipment::getLocation, zfEquipment.getLocation());
lqw.like(StringUtils.isNotEmpty(zfEquipment.getRemark()), ZfEquipment::getRemark, zfEquipment.getRemark());
lqw.eq(zfEquipment.getHappenTime() != null, ZfEquipment::getHappenTime, zfEquipment.getHappenTime());
+ lqw.in(ZfEquipment::getFamilyId,familyIdList);
lqw.between(zfEquipment.getHappenStartTime() != null && zfEquipment.getHappenEndTime() != null, ZfEquipment::getHappenTime, zfEquipment.getHappenStartTime(), zfEquipment.getHappenEndTime());
return lqw;
}
@@ -73,136 +78,150 @@
- //------------------------------------------------------------------------------------------
- private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment, String familyIds, String secondFamilyAuthority) {
- //妯$硦鏌ヨ鐨勬潯浠�
- LambdaQueryWrapper<ZfEquipment> lqw = buildCondition(zfEquipment);
-
- //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
- boolean flag = false;
-
- StringBuilder secondFamilyIdsBuffer = new StringBuilder();
-
- //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
-
- if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
-
- if (secondFamilyAuthority.contains(",")) {
- //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
- String[] authorityList = secondFamilyAuthority.split(",");
- for (String authorityAndId : authorityList) {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
- }
-
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
-
- } else {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
- }
- }
- //灏哠tringBuffer杞垚String
- String secondFamilyIds = secondFamilyIdsBuffer.toString();
-
- //绗竴瀹跺涵鍙风殑鏉′欢
- if (familyIds.contains(",")) {
- flag = true;
- }
-
- //绗簩瀹跺涵鍙风殑鏉′欢
- if (StringUtils.isNotEmpty(secondFamilyIds)) {
- if (secondFamilyIds.contains(",")) {
- String[] secondFamilyIdList = secondFamilyIds.split(",");
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
- lqw.in(ZfEquipment::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
- lqw.in(ZfEquipment::getFamilyId, totalFamilyIdList);
- }
-
- } else {
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
- lqw.in(ZfEquipment::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
- lqw.in(ZfEquipment::getFamilyId, totalFamilyIdList);
- }
- }
- } else {
- //濡傛灉娌℃湁绗簩瀹跺涵鍙�
- if (flag) {
- String[] familyList = familyIds.split(",");
- lqw.in(ZfEquipment::getFamilyId, familyList);
- } else {
- lqw.eq(ZfEquipment::getFamilyId, familyIds);
- }
-
- }
-
- lqw.orderByDesc(ZfEquipment::getCreateTime);
- return lqw;
- }
-
- private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
- //寰楀埌鏉冮檺涓�
- String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
-
- if (authorities.contains(" ")) {
- //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
- String[] authorityIdList = authorities.split(" ");
- for (String s : authorityIdList) {
- if (s.equals(EQUIPMENT_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- break;
- }
- }
- } else {
- if (authorities.equals(EQUIPMENT_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- }
- }
- }
-
- private ZInfoUser getMySelf() {
- SysUser user = SecurityUtils.getLoginUser().getUser();
- Long userId = user.getUserId();
- LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
- zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
- return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
- }
-
- private String listFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getFamilyId();
- }
-
- private String listSecondFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getSecondFamilyId();
- }
+// //------------------------------------------------------------------------------------------
+// private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment, String familyIds, String secondFamilyAuthority) {
+// //妯$硦鏌ヨ鐨勬潯浠�
+// LambdaQueryWrapper<ZfEquipment> lqw = buildCondition(zfEquipment);
+//
+// //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
+// boolean flag = false;
+//
+// StringBuilder secondFamilyIdsBuffer = new StringBuilder();
+//
+// //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
+//
+// if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
+//
+// if (secondFamilyAuthority.contains(",")) {
+// //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
+// String[] authorityList = secondFamilyAuthority.split(",");
+// for (String authorityAndId : authorityList) {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
+// }
+//
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+//
+// } else {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+// }
+// }
+// //灏哠tringBuffer杞垚String
+// String secondFamilyIds = secondFamilyIdsBuffer.toString();
+//
+// //绗竴瀹跺涵鍙风殑鏉′欢
+// if (familyIds.contains(",")) {
+// flag = true;
+// }
+//
+// //绗簩瀹跺涵鍙风殑鏉′欢
+// if (StringUtils.isNotEmpty(secondFamilyIds)) {
+// if (secondFamilyIds.contains(",")) {
+// String[] secondFamilyIdList = secondFamilyIds.split(",");
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
+// lqw.in(ZfEquipment::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
+// lqw.in(ZfEquipment::getFamilyId, totalFamilyIdList);
+// }
+//
+// } else {
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
+// lqw.in(ZfEquipment::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
+// lqw.in(ZfEquipment::getFamilyId, totalFamilyIdList);
+// }
+// }
+// } else {
+// //濡傛灉娌℃湁绗簩瀹跺涵鍙�
+// if (flag) {
+// String[] familyList = familyIds.split(",");
+// lqw.in(ZfEquipment::getFamilyId, familyList);
+// } else {
+// lqw.eq(ZfEquipment::getFamilyId, familyIds);
+// }
+//
+// }
+//
+// lqw.orderByDesc(ZfEquipment::getCreateTime);
+// return lqw;
+// }
+//
+// private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
+// //寰楀埌鏉冮檺涓�
+// String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
+//
+// if (authorities.contains(" ")) {
+// //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
+// String[] authorityIdList = authorities.split(" ");
+// for (String s : authorityIdList) {
+// if (s.equals(EQUIPMENT_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// break;
+// }
+// }
+// } else {
+// if (authorities.equals(EQUIPMENT_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// }
+// }
+// }
+//
+// private ZInfoUser getMySelf() {
+// SysUser user = SecurityUtils.getLoginUser().getUser();
+// Long userId = user.getUserId();
+// LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+// zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
+// return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
+// }
+//
+// private String listFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getFamilyId();
+// }
+//
+// private String listSecondFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getSecondFamilyId();
+// }
@Override
public List<ZfEquipment> selectByCondition(ZfEquipment zfEquipment) {
- String familyIds = listFamilyIds();
- String secondFamilyIds = listSecondFamilyIds();
- LambdaQueryWrapper<ZfEquipment> lambdaQueryWrapper = buildCondition(zfEquipment, familyIds, secondFamilyIds);
+// String familyIds = listFamilyIds();
+// String secondFamilyIds = listSecondFamilyIds();
+// LambdaQueryWrapper<ZfEquipment> lambdaQueryWrapper = buildCondition(zfEquipment, familyIds, secondFamilyIds);
+// List<ZfEquipment> beanRecords = list(lambdaQueryWrapper);
+// log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
+// return markOwnData(familyIds, beanRecords);
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EQUIPMENT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+
+ LambdaQueryWrapper<ZfEquipment> lambdaQueryWrapper = buildCondition(zfEquipment, idList);
List<ZfEquipment> beanRecords = list(lambdaQueryWrapper);
log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
- return markOwnData(familyIds, beanRecords);
+ return markOwnData(familyId, beanRecords);
}
@Override
@@ -214,94 +233,103 @@
list = list();
return list; }
- private static List<ZfEquipment> markOwnData(String familyIds, List<ZfEquipment> beanRecords) {
- return beanRecords.stream().peek(record -> {
- String recordFamilyId = record.getFamilyId();
- if (familyIds.contains(",")) {
- String[] familyIdList = familyIds.split(",");
- for (String familyId : familyIdList) {
- if (familyId.equals(recordFamilyId)) {
- record.setOwnData(1);
+// private static List<ZfEquipment> markOwnData(String familyIds, List<ZfEquipment> beanRecords) {
+// return beanRecords.stream().peek(record -> {
+// String recordFamilyId = record.getFamilyId();
+// if (familyIds.contains(",")) {
+// String[] familyIdList = familyIds.split(",");
+// for (String familyId : familyIdList) {
+// if (familyId.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// } else {
+// if (familyIds.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// }).collect(Collectors.toList());
+// }
+
+ public List<ZfEquipment> markOwnData(Long familyId,List<ZfEquipment> beanRecords){
+ return beanRecords.stream().peek(
+ bean -> {
+ if (bean.getFamilyId() == familyId) {
+ bean.setOwnData(1);
+ } else {
+ bean.setOwnData(0);
}
}
- } else {
- if (familyIds.equals(recordFamilyId)) {
- record.setOwnData(1);
- }
- }
- }).collect(Collectors.toList());
+ ).collect(Collectors.toList());
}
@Override
public AjaxResult selectDataList(ZfEquipment zfEquipment, Integer pageNum, Integer pageSize) {
- String familyIds = listFamilyIds();
- String secondFamilyAuthority = listSecondFamilyIds();
- LambdaQueryWrapper<ZfEquipment> lqw = buildCondition(zfEquipment, familyIds, secondFamilyAuthority);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+// LambdaQueryWrapper<ZfEquipment> lqw = buildCondition(zfEquipment, familyIds, secondFamilyAuthority);
+//
+// Page<ZfEquipment> zfEquipmentPage = new Page<>(pageNum, pageSize);
+// Page<ZfEquipment> pageResult = page(zfEquipmentPage, lqw);
+//
+// List<ZfEquipment> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+//
+// List<ZfEquipment> dtoResult = markOwnData(familyIds, beanRecords);
+//
+// HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
+// return AjaxResult.success(data);
+
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EQUIPMENT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfEquipment> lqw = buildCondition(zfEquipment, idList);
+
Page<ZfEquipment> zfEquipmentPage = new Page<>(pageNum, pageSize);
Page<ZfEquipment> pageResult = page(zfEquipmentPage, lqw);
List<ZfEquipment> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
- List<ZfEquipment> dtoResult = markOwnData(familyIds, beanRecords);
+ List<ZfEquipment> dtoResult = markOwnData(familyId, beanRecords);
HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
return AjaxResult.success(data);
}
@Override
- public AjaxResult addData(ZfEquipment zfEquipment) {
+ public AjaxResult addData(ZfEquipment zfEquipment){
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
- String familyIds = listFamilyIds();
- boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
- if (familyIds.contains(",")) {
- String[] familyList = familyIds.split(",");
- for (String familyId : familyList) {
- if (familyId.equals(zfEquipment.getFamilyId())) {
- flag = true;
- }
- }
- } else {
- if (zfEquipment.getFamilyId().equals(familyIds)) {
- flag = true;
- }
- }
- if (flag) {
- if (save(zfEquipment)) {
- return AjaxResult.success();
- } else {
- return AjaxResult.error();
- }
-
- } else {
- throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfEquipment.getFamilyId() + "鏁版嵁鐨勬潈闄�");
- }
- }
-
- @Override
- public AjaxResult addData2(ZfEquipment zfEquipment) {
- ZInfoUser mySelf = getMySelf();
- String myFamilyId = mySelf.getFamilyId();
-
- if (StringUtils.isNotEmpty(zfEquipment.getFamilyId())) {
- throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
- }
-
- if (StringUtils.isEmpty(myFamilyId)) {
+ if(familyId == null){
throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
}
- if (myFamilyId.contains(",")) {
- String[] myFamilyIds = myFamilyId.split(",");
- //榛樿娣诲姞绗竴涓搴殑鏁版嵁
- zfEquipment.setFamilyId(myFamilyIds[0]);
- } else {
- zfEquipment.setFamilyId(myFamilyId);
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EQUIPMENT_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (zfEquipment.getFamilyId()!=null && !familyIdList.contains(zfEquipment.getFamilyId())) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+
+ if(zfEquipment.getFamilyId() == null){
+ //榛樿娣诲姞鑷繁瀹跺涵鐨勬暟鎹�
+ zfEquipment.setFamilyId(familyId);
}
//鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
LambdaQueryWrapper<ZfEquipment> lqw = uniqueCondition(zfEquipment);
List<ZfEquipment> list = list(lqw);
+
if(list.size()>0){
throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
}
@@ -311,7 +339,72 @@
} else {
return AjaxResult.error();
}
+
}
+
+// @Override
+// public AjaxResult addData(ZfEquipment zfEquipment) {
+//
+// String familyIds = listFamilyIds();
+// boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
+// if (familyIds.contains(",")) {
+// String[] familyList = familyIds.split(",");
+// for (String familyId : familyList) {
+// if (familyId.equals(zfEquipment.getFamilyId())) {
+// flag = true;
+// }
+// }
+// } else {
+// if (zfEquipment.getFamilyId().equals(familyIds)) {
+// flag = true;
+// }
+// }
+// if (flag) {
+// if (save(zfEquipment)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+//
+// } else {
+// throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfEquipment.getFamilyId() + "鏁版嵁鐨勬潈闄�");
+// }
+// }
+
+// @Override
+// public AjaxResult addData2(ZfEquipment zfEquipment) {
+// ZInfoUser mySelf = getMySelf();
+// String myFamilyId = mySelf.getFamilyId();
+//
+// if (StringUtils.isNotEmpty(zfEquipment.getFamilyId())) {
+// throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
+// }
+//
+// if (StringUtils.isEmpty(myFamilyId)) {
+// throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+// }
+//
+// if (myFamilyId.contains(",")) {
+// String[] myFamilyIds = myFamilyId.split(",");
+// //榛樿娣诲姞绗竴涓搴殑鏁版嵁
+// zfEquipment.setFamilyId(myFamilyIds[0]);
+// } else {
+// zfEquipment.setFamilyId(myFamilyId);
+// }
+//
+// //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+// LambdaQueryWrapper<ZfEquipment> lqw = uniqueCondition(zfEquipment);
+// List<ZfEquipment> list = list(lqw);
+// if(list.size()>0){
+// throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+// }
+//
+// if (save(zfEquipment)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+// }
@@ -329,13 +422,63 @@
log.info("璧勪骇鍒楄〃涓猴細{}", propertyList);
for (ZfEquipment zfEquipment : propertyList) {
- zfEquipmentService.addData2(zfEquipment);
+ zfEquipmentService.addData(zfEquipment);
}
return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
}
+ @Override
+ public AjaxResult updateData(ZfEquipment zfEquipment) {
+
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ //鍏堟牴鎹甶d鏌ヨ鍑烘暟鎹殑familyId锛岀湅鐪嬫湁娌℃湁鏉冮檺鎿嶄綔
+ Long dataFamilyId = getById(zfEquipment.getId()).getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EQUIPMENT_LIST_UPDATE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (dataFamilyId!=null && !familyIdList.contains(dataFamilyId)) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+ if(updateById(zfEquipment)){
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+
+
+ }
+
+ @Override
+ public AjaxResult deleteData(Long[] ids) {
+ List<ZfEquipment> dataList = zfEquipmentService.listByIds(Arrays.asList(ids));
+
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EQUIPMENT_LIST_REMOVE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ for (ZfEquipment data : dataList) {
+ if (!familyIdList.contains(data.getFamilyId())){
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+ }
+
+ if (zfEquipmentService.removeByIds(Arrays.asList(ids))) {
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+
+ }
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
index 0a139c9..b67f269 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
@@ -10,11 +10,11 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.domain.ZInfoUser;
-import com.ruoyi.domain.ZfEvent;
+import com.ruoyi.domain.*;
import com.ruoyi.domain.ZfEvent;
import com.ruoyi.domain.ZfEvent;
import com.ruoyi.mapper.ZfEventMapper;
+import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfEventService;
import com.ruoyi.util.ArraysUtil;
@@ -30,8 +30,7 @@
import java.util.List;
import java.util.stream.Collectors;
-import static com.ruoyi.constant.MenuAuthority.EVENT_LIST;
-import static com.ruoyi.constant.MenuAuthority.PROPERTY_LIST;
+import static com.ruoyi.constant.MenuAuthority.*;
/**
* <p>
@@ -51,13 +50,18 @@
@Resource
ZfEventService zfEventService;
- private LambdaQueryWrapper<ZfEvent> buildCondition(ZfEvent zfEvent) {
+ @Resource
+ ZAuthorityService zAuthorityService;
+
+ private LambdaQueryWrapper<ZfEvent> buildCondition(ZfEvent zfEvent,List<Long> familyIdList) {
LambdaQueryWrapper<ZfEvent> lqw = new LambdaQueryWrapper<>();
+ lqw.orderByDesc(ZfEvent::getCreateTime);
lqw.like(!StringUtils.isEmpty(zfEvent.getAddress()), ZfEvent::getAddress, zfEvent.getAddress());
lqw.like(!StringUtils.isEmpty(zfEvent.getPeople()), ZfEvent::getPeople, zfEvent.getPeople());
lqw.like(!StringUtils.isEmpty(zfEvent.getTitle()), ZfEvent::getTitle, zfEvent.getTitle());
lqw.like(!StringUtils.isEmpty(zfEvent.getRemark()), ZfEvent::getRemark, zfEvent.getRemark());
lqw.eq(zfEvent.getHappenTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenTime());
+ lqw.in(ZfEvent::getFamilyId,familyIdList);
lqw.between(zfEvent.getHappenStartTime() != null && zfEvent.getHappenEndTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenStartTime(), zfEvent.getHappenEndTime());
return lqw;
}
@@ -68,139 +72,149 @@
lqw.eq(!StringUtils.isEmpty(zfEvent.getPeople()), ZfEvent::getPeople, zfEvent.getPeople());
lqw.eq(!StringUtils.isEmpty(zfEvent.getTitle()), ZfEvent::getTitle, zfEvent.getTitle());
lqw.eq(!StringUtils.isEmpty(zfEvent.getRemark()), ZfEvent::getRemark, zfEvent.getRemark());
+ lqw.eq(zfEvent.getFamilyId()!=null,ZfEvent::getFamilyId,zfEvent.getFamilyId());
lqw.eq(zfEvent.getHappenTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenTime());
return lqw;
}
- private LambdaQueryWrapper<ZfEvent> buildCondition(ZfEvent zfEvent, String familyIds, String secondFamilyAuthority) {
- //妯$硦鏌ヨ鐨勬潯浠�
- LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent);
-
- //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
- boolean flag = false;
-
- StringBuilder secondFamilyIdsBuffer = new StringBuilder();
-
- //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
-
- if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
-
- if (secondFamilyAuthority.contains(",")) {
- //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
- String[] authorityList = secondFamilyAuthority.split(",");
- for (String authorityAndId : authorityList) {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
- }
-
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
-
- } else {
- setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
- //鎶婂悗闈㈢殑閫楀彿鍘绘帀
- if (secondFamilyIdsBuffer.length() > 1) {
- secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
- }
- }
- }
- //灏哠tringBuffer杞垚String
- String secondFamilyIds = secondFamilyIdsBuffer.toString();
-
- //绗竴瀹跺涵鍙风殑鏉′欢
- if (familyIds.contains(",")) {
- flag = true;
- }
-
- //绗簩瀹跺涵鍙风殑鏉′欢
- if (StringUtils.isNotEmpty(secondFamilyIds)) {
- if (secondFamilyIds.contains(",")) {
- String[] secondFamilyIdList = secondFamilyIds.split(",");
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
- lqw.in(ZfEvent::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
- lqw.in(ZfEvent::getFamilyId, totalFamilyIdList);
- }
-
- } else {
- if (flag) {
- //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
- String[] familyList = familyIds.split(",");
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
- lqw.in(ZfEvent::getFamilyId, totalFamilyIdList);
- } else {
- //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
- String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
- lqw.in(ZfEvent::getFamilyId, totalFamilyIdList);
- }
- }
- } else {
- //濡傛灉娌℃湁绗簩瀹跺涵鍙�
- if (flag) {
- String[] familyList = familyIds.split(",");
- lqw.in(ZfEvent::getFamilyId, familyList);
- } else {
- lqw.eq(ZfEvent::getFamilyId, familyIds);
- }
-
- }
-
- lqw.orderByDesc(ZfEvent::getCreateTime);
- return lqw;
- }
-
- private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
- //寰楀埌鏉冮檺涓�
- String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
-
- if (authorities.contains(" ")) {
- //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
- String[] authorityIdList = authorities.split(" ");
- for (String s : authorityIdList) {
- if (s.equals(EVENT_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- break;
- }
- }
- } else {
- if (authorities.equals(EVENT_LIST)) {
- secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
- }
- }
- }
-
- private ZInfoUser getMySelf() {
- SysUser user = SecurityUtils.getLoginUser().getUser();
- Long userId = user.getUserId();
- LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
- zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
- return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
- }
-
- private String listFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getFamilyId();
- }
-
- private String listSecondFamilyIds() {
- ZInfoUser mySelf = getMySelf();
- return mySelf.getSecondFamilyId();
- }
+// private LambdaQueryWrapper<ZfEvent> buildCondition(ZfEvent zfEvent, String familyIds, String secondFamilyAuthority) {
+// //妯$硦鏌ヨ鐨勬潯浠�
+// LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent);
+//
+// //瀹氫箟涓�涓竷灏旀爣璁帮紝鏍囪绗竴瀹跺涵鍙锋槸鍚︽湁閫楀彿
+// boolean flag = false;
+//
+// StringBuilder secondFamilyIdsBuffer = new StringBuilder();
+//
+// //澶勭悊浼犲叆鐨剆econdFamilyAuthority 3{2007 2018 2015},4{2007 2019}
+//
+// if (StringUtils.isNotEmpty(secondFamilyAuthority)) {
+//
+// if (secondFamilyAuthority.contains(",")) {
+// //閫楀彿闅斿紑寰楀埌濡備笅涓诧細3{2007 2018 2015}
+// String[] authorityList = secondFamilyAuthority.split(",");
+// for (String authorityAndId : authorityList) {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, authorityAndId);
+// }
+//
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+//
+// } else {
+// setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
+// //鎶婂悗闈㈢殑閫楀彿鍘绘帀
+// if (secondFamilyIdsBuffer.length() > 1) {
+// secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
+// }
+// }
+// }
+// //灏哠tringBuffer杞垚String
+// String secondFamilyIds = secondFamilyIdsBuffer.toString();
+//
+// //绗竴瀹跺涵鍙风殑鏉′欢
+// if (familyIds.contains(",")) {
+// flag = true;
+// }
+//
+// //绗簩瀹跺涵鍙风殑鏉′欢
+// if (StringUtils.isNotEmpty(secondFamilyIds)) {
+// if (secondFamilyIds.contains(",")) {
+// String[] secondFamilyIdList = secondFamilyIds.split(",");
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘鏈夐�楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIdList);
+// lqw.in(ZfEvent::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙锋病鏈夐�楀彿浣嗘槸绗簩瀹跺涵鍙锋湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(secondFamilyIdList, familyIds);
+// lqw.in(ZfEvent::getFamilyId, totalFamilyIdList);
+// }
+//
+// } else {
+// if (flag) {
+// //濡傛灉绗竴瀹跺涵鍙锋湁閫楀彿浣嗙浜屽搴彿娌℃湁閫楀彿
+// String[] familyList = familyIds.split(",");
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyList, secondFamilyIds);
+// lqw.in(ZfEvent::getFamilyId, totalFamilyIdList);
+// } else {
+// //濡傛灉绗竴瀹跺涵鍙峰拰绗簩瀹跺涵鍙烽兘娌℃湁閫楀彿
+// String[] totalFamilyIdList = ArraysUtil.appendToArray(familyIds, secondFamilyIds);
+// lqw.in(ZfEvent::getFamilyId, totalFamilyIdList);
+// }
+// }
+// } else {
+// //濡傛灉娌℃湁绗簩瀹跺涵鍙�
+// if (flag) {
+// String[] familyList = familyIds.split(",");
+// lqw.in(ZfEvent::getFamilyId, familyList);
+// } else {
+// lqw.eq(ZfEvent::getFamilyId, familyIds);
+// }
+//
+// }
+//
+// lqw.orderByDesc(ZfEvent::getCreateTime);
+// return lqw;
+// }
+//
+// private void setSecondFamilyAuthority(StringBuilder secondFamilyIdsBuffer, String authorityAndId) {
+// //寰楀埌鏉冮檺涓�
+// String authorities = authorityAndId.substring(2, authorityAndId.length() - 1);
+//
+// if (authorities.contains(" ")) {
+// //绌烘牸闅斿紑寰楀埌鑿滃崟id锛岀湅鏄惁鏈夊搴旂殑鏉冮檺
+// String[] authorityIdList = authorities.split(" ");
+// for (String s : authorityIdList) {
+// if (s.equals(EVENT_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// break;
+// }
+// }
+// } else {
+// if (authorities.equals(EVENT_LIST)) {
+// secondFamilyIdsBuffer.append(authorityAndId.charAt(0)).append(",");
+// }
+// }
+// }
+//
+// private ZInfoUser getMySelf() {
+// SysUser user = SecurityUtils.getLoginUser().getUser();
+// Long userId = user.getUserId();
+// LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+// zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
+// return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
+// }
+//
+// private Long listFamilyId() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getFamilyId();
+// }
+//
+// private String listSecondFamilyIds() {
+// ZInfoUser mySelf = getMySelf();
+// return mySelf.getSecondFamilyId();
+// }
@Override
public List<ZfEvent> selectByCondition(ZfEvent zfEvent) {
- String familyIds = listFamilyIds();
- String secondFamilyIds = listSecondFamilyIds();
- LambdaQueryWrapper<ZfEvent> lambdaQueryWrapper = buildCondition(zfEvent, familyIds, secondFamilyIds);
+// Long familyId = listFamilyId();
+// String secondFamilyIds = listSecondFamilyIds();
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+
+ LambdaQueryWrapper<ZfEvent> lambdaQueryWrapper = buildCondition(zfEvent, idList);
List<ZfEvent> beanRecords = list(lambdaQueryWrapper);
log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
- return markOwnData(familyIds, beanRecords);
+ return markOwnData(familyId, beanRecords);
}
@Override
@@ -213,94 +227,118 @@
return list;
}
- private static List<ZfEvent> markOwnData(String familyIds, List<ZfEvent> beanRecords) {
- return beanRecords.stream().peek(record -> {
- String recordFamilyId = record.getFamilyId();
- if (familyIds.contains(",")) {
- String[] familyIdList = familyIds.split(",");
- for (String familyId : familyIdList) {
- if (familyId.equals(recordFamilyId)) {
- record.setOwnData(1);
+ public List<ZfEvent> markOwnData(Long familyId,List<ZfEvent> beanRecords){
+ return beanRecords.stream().peek(
+ bean -> {
+ if (bean.getFamilyId() == familyId) {
+ bean.setOwnData(1);
+ } else {
+ bean.setOwnData(0);
}
}
- } else {
- if (familyIds.equals(recordFamilyId)) {
- record.setOwnData(1);
- }
- }
- }).collect(Collectors.toList());
+ ).collect(Collectors.toList());
}
+
+// private static List<ZfEvent> markOwnData(String familyIds, List<ZfEvent> beanRecords) {
+// return beanRecords.stream().peek(record -> {
+// String recordFamilyId = record.getFamilyId();
+// if (familyIds.contains(",")) {
+// String[] familyIdList = familyIds.split(",");
+// for (String familyId : familyIdList) {
+// if (familyId.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// } else {
+// if (familyIds.equals(recordFamilyId)) {
+// record.setOwnData(1);
+// }
+// }
+// }).collect(Collectors.toList());
+// }
@Override
public AjaxResult selectDataList(ZfEvent zfEvent, Integer pageNum, Integer pageSize) {
- String familyIds = listFamilyIds();
- String secondFamilyAuthority = listSecondFamilyIds();
- LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent, familyIds, secondFamilyAuthority);
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+ //涔熻鏌ュ埆浜烘巿鏉冪殑
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+ //鍔犱笂鑷繁瀹跺涵鐨刬d
+ idList.add(familyId);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent, idList);
+
Page<ZfEvent> zfEventPage = new Page<>(pageNum, pageSize);
Page<ZfEvent> pageResult = page(zfEventPage, lqw);
List<ZfEvent> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
- List<ZfEvent> dtoResult = markOwnData(familyIds, beanRecords);
+ List<ZfEvent> dtoResult = markOwnData(familyId, beanRecords);
HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult);
return AjaxResult.success(data);
}
+// @Override
+// public AjaxResult addData(ZfEvent zfEvent) {
+//
+// String familyIds = listFamilyIds();
+// boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
+// if (familyIds.contains(",")) {
+// String[] familyList = familyIds.split(",");
+// for (String familyId : familyList) {
+// if (familyId.equals(zfEvent.getFamilyId())) {
+// flag = true;
+// }
+// }
+// } else {
+// if (zfEvent.getFamilyId().equals(familyIds)) {
+// flag = true;
+// }
+// }
+// if (flag) {
+// if (save(zfEvent)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+//
+// } else {
+// throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfEvent.getFamilyId() + "鏁版嵁鐨勬潈闄�");
+// }
+// }
+
@Override
public AjaxResult addData(ZfEvent zfEvent) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
- String familyIds = listFamilyIds();
- boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
- if (familyIds.contains(",")) {
- String[] familyList = familyIds.split(",");
- for (String familyId : familyList) {
- if (familyId.equals(zfEvent.getFamilyId())) {
- flag = true;
- }
- }
- } else {
- if (zfEvent.getFamilyId().equals(familyIds)) {
- flag = true;
- }
- }
- if (flag) {
- if (save(zfEvent)) {
- return AjaxResult.success();
- } else {
- return AjaxResult.error();
- }
-
- } else {
- throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfEvent.getFamilyId() + "鏁版嵁鐨勬潈闄�");
- }
- }
-
- @Override
- public AjaxResult addData2(ZfEvent zfEvent) {
- ZInfoUser mySelf = getMySelf();
- String myFamilyId = mySelf.getFamilyId();
-
- if (StringUtils.isNotEmpty(zfEvent.getFamilyId())) {
- throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
- }
-
- if (StringUtils.isEmpty(myFamilyId)) {
+ if(familyId == null){
throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
}
- if (myFamilyId.contains(",")) {
- String[] myFamilyIds = myFamilyId.split(",");
- //榛樿娣诲姞绗竴涓搴殑鏁版嵁
- zfEvent.setFamilyId(myFamilyIds[0]);
- } else {
- zfEvent.setFamilyId(myFamilyId);
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (zfEvent.getFamilyId()!=null && !familyIdList.contains(zfEvent.getFamilyId())) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+
+ if(zfEvent.getFamilyId() == null){
+ //榛樿娣诲姞鑷繁瀹跺涵鐨勬暟鎹�
+ zfEvent.setFamilyId(familyId);
}
//鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
- LambdaQueryWrapper<ZfEvent> zfEventLambdaQueryWrapper = uniqueCondition(zfEvent);
- List<ZfEvent> list = list(zfEventLambdaQueryWrapper);
+ LambdaQueryWrapper<ZfEvent> lqw = uniqueCondition(zfEvent);
+ List<ZfEvent> list = list(lqw);
+
if(list.size()>0){
throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
}
@@ -312,28 +350,110 @@
}
}
+// @Override
+// public AjaxResult addData2(ZfEvent zfEvent) {
+// ZInfoUser mySelf = getMySelf();
+// String myFamilyId = mySelf.getFamilyId();
+//
+// if (StringUtils.isNotEmpty(zfEvent.getFamilyId())) {
+// throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
+// }
+//
+// if (StringUtils.isEmpty(myFamilyId)) {
+// throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+// }
+//
+// if (myFamilyId.contains(",")) {
+// String[] myFamilyIds = myFamilyId.split(",");
+// //榛樿娣诲姞绗竴涓搴殑鏁版嵁
+// zfEvent.setFamilyId(myFamilyIds[0]);
+// } else {
+// zfEvent.setFamilyId(myFamilyId);
+// }
+//
+// //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+// LambdaQueryWrapper<ZfEvent> zfEventLambdaQueryWrapper = uniqueCondition(zfEvent);
+// List<ZfEvent> list = list(zfEventLambdaQueryWrapper);
+// if(list.size()>0){
+// throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+// }
+//
+// if (save(zfEvent)) {
+// return AjaxResult.success();
+// } else {
+// return AjaxResult.error();
+// }
+// }
+
@Override
@Transactional
public AjaxResult importExcel(MultipartFile file) {
ExcelUtil<ZfEvent> util = new ExcelUtil<>(ZfEvent.class);
- List<ZfEvent> propertyList = null;
+ List<ZfEvent> dataList = null;
try {
- propertyList = util.importExcel(file.getInputStream());
+ dataList = util.importExcel(file.getInputStream());
} catch (Exception e) {
throw new RuntimeException(e);
}
- log.info("璧勪骇鍒楄〃涓猴細{}", propertyList);
+ log.info("鏁版嵁鍒楄〃涓猴細{}", dataList);
- for (ZfEvent zfEvent : propertyList) {
- zfEventService.addData2(zfEvent);
+ for (ZfEvent zfEvent : dataList) {
+ zfEventService.addData(zfEvent);
}
return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
}
-
-
-
+
+ @Override
+ public AjaxResult updateData(ZfEvent zfEvent) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ //鍏堟牴鎹甶d鏌ヨ鍑烘暟鎹殑familyId锛岀湅鐪嬫湁娌℃湁鏉冮檺鎿嶄綔
+ Long dataFamilyId = getById(zfEvent.getId()).getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST_UPDATE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ if (dataFamilyId!=null && !familyIdList.contains(dataFamilyId)) {
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+
+ if(updateById(zfEvent)){
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+
+ }
+
+ @Override
+ public AjaxResult deleteData(Long[] ids) {
+ List<ZfEvent> dataList = zfEventService.listByIds(Arrays.asList(ids));
+
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST_REMOVE)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+ for (ZfEvent data : dataList) {
+ if (!familyIdList.contains(data.getFamilyId())){
+ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+ }
+ }
+
+ if (zfEventService.removeByIds(Arrays.asList(ids))) {
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+
+ }
+
}
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
new file mode 100644
index 0000000..2413f70
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfFamilyServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.domain.ZfEvent;
+import com.ruoyi.domain.ZfFamily;
+import com.ruoyi.mapper.ZfEventMapper;
+import com.ruoyi.mapper.ZfFamilyMapper;
+import com.ruoyi.service.ZfEventService;
+import com.ruoyi.service.ZfFamilyService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-14 14:32
+ * @Version 1.0.0
+ **/
+@Service
+public class ZfFamilyServiceImpl extends ServiceImpl<ZfFamilyMapper, ZfFamily> implements ZfFamilyService {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfRoleServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfRoleServiceImpl.java
new file mode 100644
index 0000000..e949f9b
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfRoleServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.domain.ZfFamily;
+import com.ruoyi.domain.ZfRole;
+import com.ruoyi.mapper.ZfFamilyMapper;
+import com.ruoyi.mapper.ZfRoleMapper;
+import com.ruoyi.service.ZfFamilyService;
+import com.ruoyi.service.ZfRoleService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-07-14 14:33
+ * @Version 1.0.0
+ **/
+@Service
+public class ZfRoleServiceImpl extends ServiceImpl<ZfRoleMapper, ZfRole> implements ZfRoleService {
+}
--
Gitblit v1.9.1