From 3cfa0bda6574d0c39db120c457e98a168aa193e8 Mon Sep 17 00:00:00 2001
From: Jinquan_Ou <Jinquan@gdut.com>
Date: 星期日, 23 四月 2023 17:15:20 +0800
Subject: [PATCH] 完成婚姻
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCleanController.java | 103 ++
zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java | 6
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java | 264 +++++-
zhang-content/src/main/java/com/ruoyi/service/ZfEquipmentService.java | 5
ruoyi-admin/src/test/java/com/ruoyi/insertData.java | 39 +
zhang-content/src/main/java/com/ruoyi/service/impl/MarryUserServiceImpl.java | 17
zhang-content/src/main/java/com/ruoyi/mapper/MarryUserMapper.java | 15
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfContactController.java | 4
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java | 6
zhang-content/src/main/java/com/ruoyi/service/ZMarryService.java | 8
zhang-content/src/main/java/com/ruoyi/domain/ZfEquipment.java | 33
zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java | 4
zhang-content/src/main/java/com/ruoyi/domain/ZfContact.java | 39 +
zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java | 6
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java | 290 +++++++
zhang-content/src/main/java/com/ruoyi/domain/ZfClean.java | 111 +-
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEquipmentController.java | 4
zhang-content/src/main/java/com/ruoyi/service/MarryUserService.java | 13
zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java | 22
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java | 288 ++++++-
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZMarryController.java | 67 +
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java | 15
zhang-content/src/main/java/com/ruoyi/service/ZfContactService.java | 10
zhang-content/src/main/java/com/ruoyi/domain/MarryUser.java | 37 +
zhang-content/src/main/java/com/ruoyi/domain/dto/MarryInfoDto.java | 73 +
zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java | 279 +++++++
zhang-content/src/main/java/com/ruoyi/service/ZfCleanService.java | 15
zhang-content/src/main/java/com/ruoyi/service/impl/ZMarryServiceImpl.java | 266 +++++++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java | 4
zhang-content/src/main/java/com/ruoyi/domain/ZMarry.java | 165 ---
30 files changed, 1,827 insertions(+), 381 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZMarryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZMarryController.java
index 5b245fe..95c572e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZMarryController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZMarryController.java
@@ -1,9 +1,24 @@
package com.ruoyi.web.controller.zhang;
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.domain.ZMarry;
+import com.ruoyi.domain.dto.MarryInfoDto;
+import com.ruoyi.service.ZMarryService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.bind.annotation.RestController;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+import java.util.List;
/**
* <p>
@@ -15,7 +30,53 @@
*/
@RestController
@RequestMapping("/zMarry")
-public class ZMarryController {
+@Slf4j
+public class ZMarryController extends BaseController {
+ @Autowired
+ private ZMarryService zMarryService;
+
+
+ /**
+ * 鏌ヨ褰撳墠濠氬Щ鐘跺喌
+ */
+ @GetMapping("/list")
+ public AjaxResult getMarryStatus(){
+ return zMarryService.getNow();
+ }
+
+ /**
+ * 鏂板濠氬Щ鐘跺喌璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:add')")
+ @Log(title = "濠氬Щ鐘跺喌璁板綍", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody MarryInfoDto marryInfoDto)
+ {
+ return zMarryService.addInfo(marryInfoDto);
+ }
+
+ /**
+ * 淇敼濠氬Щ鐘跺喌璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:edit')")
+ @Log(title = "濠氬Щ鐘跺喌璁板綍", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody MarryInfoDto marryInfoDto)
+ {
+ return zMarryService.updateInfo(marryInfoDto);
+ }
+//
+ /**
+ * 鎵归噺鍒犻櫎濠氬Щ鐘跺喌璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:remove')")
+ @Log(title = "濠氬Щ鐘跺喌璁板綍", businessType = BusinessType.DELETE)
+ @DeleteMapping()
+ public AjaxResult remove(String id)
+ {
+ return zMarryService.deleteOld(id);
+ }
+
}
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 04844ba..d464645 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
@@ -1,9 +1,26 @@
package com.ruoyi.web.controller.zhang;
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.domain.ZfClean;
+import com.ruoyi.service.ZfCleanService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.bind.annotation.RestController;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+import java.util.List;
+
+import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
+import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
/**
* <p>
@@ -15,7 +32,87 @@
*/
@RestController
@RequestMapping("/zfClean")
-public class ZfCleanController {
+@Slf4j
+public class ZfCleanController extends BaseController {
+
+ @Resource
+ private ZfCleanService zfCleanService;
+
+ @GetMapping("/all")
+ public AjaxResult listAll(ZfClean zfClean){
+ Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
+ Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
+ return zfCleanService.selectDataList(zfClean, pageNum, pageSize);
+ }
+
+
+ /**
+ * 瀵煎嚭淇濇磥鏀剁撼璁板綍鍒楄〃
+ */
+// @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, "淇濇磥鏀剁撼璁板綍鏁版嵁");
+ }
+
+ /**
+ * 瀵煎叆淇濇磥鏀剁撼璁板綍鍒楄〃
+ */
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT)
+ @PostMapping("/importData")
+ public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception
+ {
+ return zfCleanService.importExcel(file);
+
+ }
+
+ /**
+ * 鑾峰彇淇濇磥鏀剁撼璁板綍璇︾粏淇℃伅
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return success(zfCleanService.getById(id));
+ }
+//
+ /**
+ * 鏂板淇濇磥鏀剁撼璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:add')")
+ @Log(title = "淇濇磥鏀剁撼璁板綍", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ZfClean zfClean)
+ {
+ return zfCleanService.addData2(zfClean);
+ }
+
+ /**
+ * 淇敼淇濇磥鏀剁撼璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:edit')")
+ @Log(title = "淇濇磥鏀剁撼璁板綍", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ZfClean zfClean)
+ {
+ return toAjax(zfCleanService.updateById(zfClean));
+ }
+//
+ /**
+ * 鎵归噺鍒犻櫎淇濇磥鏀剁撼璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:remove')")
+ @Log(title = "淇濇磥鏀剁撼璁板綍", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(zfCleanService.removeByIds(Arrays.asList(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 548a05b..1434285 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
@@ -41,7 +41,7 @@
public AjaxResult listAll(ZfContact zfContact){
Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
- return zfContactService.selectContactList(zfContact, pageNum, pageSize);
+ return zfContactService.selectDataList(zfContact, pageNum, pageSize);
}
@@ -93,7 +93,7 @@
@PostMapping
public AjaxResult add(@RequestBody ZfContact zfContact)
{
- return toAjax(zfContactService.save(zfContact));
+ return (zfContactService.addData2(zfContact));
}
/**
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 c028530..978344c 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
@@ -43,7 +43,7 @@
Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
- return zfEquipmentService.selectEquipmentList(zfEquipment, pageNum, pageSize);
+ return zfEquipmentService.selectDataList(zfEquipment, pageNum, pageSize);
}
@@ -90,7 +90,7 @@
@PostMapping
public AjaxResult add(@RequestBody ZfEquipment zfEquipment)
{
- return toAjax(zfEquipmentService.addEquipment(zfEquipment));
+ return zfEquipmentService.addData2(zfEquipment);
}
/**
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 1b586df..82753e6 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
@@ -42,7 +42,7 @@
public AjaxResult listAll(ZfEvent zfEvent){
Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
- return zfEventService.selectEventList(zfEvent, pageNum, pageSize);
+ return zfEventService.selectDataList(zfEvent, pageNum, pageSize);
}
@@ -89,7 +89,7 @@
@PostMapping
public AjaxResult add(@RequestBody ZfEvent zfEvent)
{
- return toAjax(zfEventService.addEvent(zfEvent));
+ return zfEventService.addData2(zfEvent);
}
/**
diff --git a/ruoyi-admin/src/test/java/com/ruoyi/insertData.java b/ruoyi-admin/src/test/java/com/ruoyi/insertData.java
index 2c4e2a3..e67f869 100644
--- a/ruoyi-admin/src/test/java/com/ruoyi/insertData.java
+++ b/ruoyi-admin/src/test/java/com/ruoyi/insertData.java
@@ -149,7 +149,7 @@
// int familyNum = family.nextInt(4);
zfCollection = new ZfCollection();
- zfCollection.setGetTime(simpleDateFormat.parse(l1.get(typeNum)));
+ zfCollection.setHappenTime(simpleDateFormat.parse(l1.get(typeNum)));
zfCollection.setType(l2.get(typeNum));
zfCollection.setName(l3.get(typeNum));
zfCollection.setSource(l4.get(sourceNum));
@@ -206,8 +206,45 @@
zfEconomyService.save(zfEconomy);
}
+ }
+
+
+ @Autowired
+ ZfCleanService zfCleanService;
+ @Test
+ void insertClean() {
+ List<Integer> l1 = Arrays.asList(0,1);
+ List<String> l2 = Arrays.asList("鎵�鏈変汉", "寮犱笁");
+ List<String> l3 = Arrays.asList("鐜荤拑绐�", "琚瓙");
+ List<String> l4 = Arrays.asList("鐜荤拑姘存礂", "鎶樺ソ鏀捐琚�");
+ List<String> l5 = Arrays.asList("鏉傜墿鎴�", "琛f煖");
+ List<String> l6 = Arrays.asList("绐楁埛", "鏀剁撼鏌�");
+ List<String> l7 = Arrays.asList("1", "2", "3", "4");
+ List<String> l9 = Arrays.asList("鎿︾幓鐠冭灏忓績","鍙犺瀛愯缁嗗績");
+
+ ZfClean zfClean=null;
+ int count=0;
+ int familyNum = 0;
+ Random family = new Random();
+
+ for (int i = 0; i < 100; i++) {
+ count=i%2;
+ familyNum=family.nextInt(4);
+ zfClean=new ZfClean();
+ zfClean.setKind(l1.get(count));
+ zfClean.setSuitable(l2.get(count));
+ zfClean.setType(l3.get(count));
+ zfClean.setMethod(l4.get(count));
+ zfClean.setPlace(l5.get(count));
+ zfClean.setLocation(l6.get(count));
+ zfClean.setRemark(l9.get(count));
+ zfClean.setUrl("profile/upload/2023/03/19/test7_20230319222030A007.jpg");
+ zfClean.setFamilyId(l7.get(familyNum));
+ zfCleanService.save(zfClean);
+ }
}
+
}
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 bb888ac..9e90016 100644
--- a/zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java
+++ b/zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java
@@ -11,5 +11,9 @@
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";
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/MarryUser.java b/zhang-content/src/main/java/com/ruoyi/domain/MarryUser.java
new file mode 100644
index 0000000..c275941
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/MarryUser.java
@@ -0,0 +1,37 @@
+package com.ruoyi.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.PipedReader;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-04-23 13:23
+ * @Version 1.0.0
+ **/
+@Data
+@TableName("marry_user")
+public class MarryUser implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String id;
+ private Long myId;
+
+ private String name;
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date birthday;
+ private String address;
+ private String workAddress;
+ private Integer marryStatus;
+ private Integer sex;
+ private String nation;
+ private String phone;
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZMarry.java b/zhang-content/src/main/java/com/ruoyi/domain/ZMarry.java
index 3ea76cf..add16f5 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZMarry.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZMarry.java
@@ -3,192 +3,67 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.ToString;
+
import java.io.Serializable;
import java.time.LocalDateTime;
+import java.util.Date;
/**
* <p>
- *
+ *
* </p>
*
* @author ojq
* @since 2023-03-14
*/
@TableName("z_marry")
+@Data
+@ToString
public class ZMarry implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
- private Integer id;
+ private Long id;
/**
* 鏈汉id
*/
- private Integer userId;
+ private Long userId;
/**
* 閰嶅伓id
*/
- private Integer spouseId;
+ private String spouseId;
/**
* 缁撳鏃堕棿
*/
- private LocalDateTime marryDate;
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date marryTime;
/**
* 鐢熻偛鎯呭喌,0锛氭湭鐢熻偛銆�1锛氬湪瀛曘��2锛氬凡鐢熻偛
*/
private Integer bearStatus;
- /**
- * 鏄惁棰嗗彇璁″垝鐢熻偛鏈嶅姟鎵嬪唽
- */
- private Integer isJhsyfwsc;
+ private Integer handbookStatus;
- /**
- * 棰嗗彇璁″垝鐢熻偛鏈嶅姟鎵嬪唽鏃堕棿
- */
- private LocalDateTime getJhsyfwscDate;
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date handbookTime;
- /**
- * 鏄惁棰嗗彇鐙敓瀛愬コ璇�
- */
- private Integer isDsznz;
+ private Integer oneBorn;
- /**
- * 棰嗗彇鐙敓瀛愬コ璇佹椂闂�
- */
- private LocalDateTime getDsznzDate;
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date oneBornTime;
- /**
- * 闇�澹版槑鐨勬儏鍐�
- */
private String content;
- /**
- * 澶囨敞
- */
private String remark;
- /**
- * 璁板綍鏄惁琚垹闄わ紝鏈変釜鏌ョ湅杩囧線鍙茬殑鍔熻兘
- */
- private Integer isDelete;
+ private Integer deleteStatus;
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Integer getUserId() {
- return userId;
- }
-
- public void setUserId(Integer userId) {
- this.userId = userId;
- }
-
- public Integer getSpouseId() {
- return spouseId;
- }
-
- public void setSpouseId(Integer spouseId) {
- this.spouseId = spouseId;
- }
-
- public LocalDateTime getMarryDate() {
- return marryDate;
- }
-
- public void setMarryDate(LocalDateTime marryDate) {
- this.marryDate = marryDate;
- }
-
- public Integer getBearStatus() {
- return bearStatus;
- }
-
- public void setBearStatus(Integer bearStatus) {
- this.bearStatus = bearStatus;
- }
-
- public Integer getIsJhsyfwsc() {
- return isJhsyfwsc;
- }
-
- public void setIsJhsyfwsc(Integer isJhsyfwsc) {
- this.isJhsyfwsc = isJhsyfwsc;
- }
-
- public LocalDateTime getGetJhsyfwscDate() {
- return getJhsyfwscDate;
- }
-
- public void setGetJhsyfwscDate(LocalDateTime getJhsyfwscDate) {
- this.getJhsyfwscDate = getJhsyfwscDate;
- }
-
- public Integer getIsDsznz() {
- return isDsznz;
- }
-
- public void setIsDsznz(Integer isDsznz) {
- this.isDsznz = isDsznz;
- }
-
- public LocalDateTime getGetDsznzDate() {
- return getDsznzDate;
- }
-
- public void setGetDsznzDate(LocalDateTime getDsznzDate) {
- this.getDsznzDate = getDsznzDate;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public String getRemark() {
- return remark;
- }
-
- public void setRemark(String remark) {
- this.remark = remark;
- }
-
- public Integer getIsDelete() {
- return isDelete;
- }
-
- public void setIsDelete(Integer isDelete) {
- this.isDelete = isDelete;
- }
-
- @Override
- public String toString() {
- return "ZMarry{" +
- "id=" + id +
- ", userId=" + userId +
- ", spouseId=" + spouseId +
- ", marryDate=" + marryDate +
- ", bearStatus=" + bearStatus +
- ", isJhsyfwsc=" + isJhsyfwsc +
- ", getJhsyfwscDate=" + getJhsyfwscDate +
- ", isDsznz=" + isDsznz +
- ", getDsznzDate=" + getDsznzDate +
- ", content=" + content +
- ", remark=" + remark +
- ", isDelete=" + isDelete +
- "}";
- }
}
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 4555cae..0e93e46 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfClean.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfClean.java
@@ -1,9 +1,15 @@
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+
import java.io.Serializable;
+import java.util.Date;
/**
* <p>
@@ -14,12 +20,13 @@
* @since 2023-03-12
*/
@TableName("zf_clean")
+@Data
public class ZfClean implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
- private Integer id;
+ private Long id;
/**
* 0锛氫繚娲侊紝1锛氭敹绾�
@@ -56,82 +63,44 @@
*/
private String remark;
+ /**
+ * 鐢靛瓙鏂囦欢璺緞
+ */
+ private String url;
- public Integer getId() {
- return id;
- }
+ @Excel(name="鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
+ private String familyId;
- public void setId(Integer id) {
- this.id = id;
- }
- public Integer getKind() {
- return kind;
- }
+ /**
+ * 鏄惁鏄湰瀹跺涵鐨勬暟鎹�(0:涓嶆槸,1:鏄�)
+ */
+ @TableField(exist = false)
+ private Integer ownData = 0;
- public void setKind(Integer kind) {
- this.kind = kind;
- }
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date createTime;
- public String getSuitable() {
- return suitable;
- }
+ /**
+ * 寮�濮嬫椂闂�
+ */
+ @TableField(exist = false)
+ private Date happenStartTime;
- public void setSuitable(String suitable) {
- this.suitable = suitable;
- }
+ /**
+ * 缁撴潫鏃堕棿
+ */
+ @TableField(exist = false)
+ private Date happenEndTime;
- public String getType() {
- return type;
- }
+ /**
+ * 鍙戠敓鏃堕棿
+ */
+ @Excel(name = "鍙戠敓鏃堕棿", dateFormat = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date happenTime;
- public void setType(String type) {
- this.type = type;
- }
-
- public String getMethod() {
- return method;
- }
-
- public void setMethod(String method) {
- this.method = method;
- }
-
- public String getPlace() {
- return place;
- }
-
- public void setPlace(String place) {
- this.place = place;
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getRemark() {
- return remark;
- }
-
- public void setRemark(String remark) {
- this.remark = remark;
- }
-
- @Override
- public String toString() {
- return "ZfClean{" +
- "id=" + id +
- ", kind=" + kind +
- ", suitable=" + suitable +
- ", type=" + type +
- ", method=" + method +
- ", place=" + place +
- ", location=" + location +
- ", remark=" + remark +
- "}";
- }
}
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 2e15a8b..d64b3fe 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfContact.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfContact.java
@@ -1,13 +1,16 @@
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
+import java.util.Date;
/**
* <p>
@@ -87,7 +90,43 @@
@Excel(name = "澶囨敞")
private String remark;
+
private String url;
+ @Excel(name="鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
+ private String familyId;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date createTime;
+
+
+ /**
+ * 鏄惁鏄湰瀹跺涵鐨勬暟鎹�(0:涓嶆槸,1:鏄�)
+ */
+ @TableField(exist = false)
+ private Integer ownData = 0;
+
+ /**
+ * 寮�濮嬫椂闂�
+ */
+ @TableField(exist = false)
+ private Date happenStartTime;
+
+ /**
+ * 缁撴潫鏃堕棿
+ */
+ @TableField(exist = false)
+ private Date happenEndTime;
+
+ /**
+ * 鍙戠敓鏃堕棿
+ */
+ @Excel(name = "鍙戠敓鏃堕棿", dateFormat = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date happenTime;
+
}
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 9683148..889ad2d 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java
@@ -41,7 +41,6 @@
* 鏃堕棿
*/
@JsonFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鍒涘缓鏃堕棿", dateFormat = "yyyy-MM-dd")
private Date createTime;
/**
@@ -82,7 +81,7 @@
private String url;
- @Excel(name = "鎵�灞炲搴紪鍙�")
+ @Excel(name = "鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
private String familyId;
/**
@@ -91,4 +90,23 @@
@TableField(exist = false)
private Integer ownData = 0;
+ /**
+ * 寮�濮嬫椂闂�
+ */
+ @TableField(exist = false)
+ private Date happenStartTime;
+
+ /**
+ * 缁撴潫鏃堕棿
+ */
+ @TableField(exist = false)
+ private Date happenEndTime;
+
+ /**
+ * 鍙戠敓鏃堕棿
+ */
+ @Excel(name = "鍙戠敓鏃堕棿", dateFormat = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date happenTime;
+
}
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 b7448fe..6d7e308 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfEquipment.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfEquipment.java
@@ -36,11 +36,10 @@
private String name;
/**
- * 璁板綍鏃堕棿
+ * 鎻掑叆鏃堕棿
*/
@JsonFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鍒涘缓鏃堕棿", dateFormat = "yyyy-MM-dd")
- private Date createDate;
+ private Date createTime;
/**
* 璐拱浜�
@@ -69,7 +68,7 @@
/**
* 瀹跺涵id
*/
- @Excel(name = "瀹跺涵id")
+ @Excel(name = "鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
private String familyId;
private String url;
@@ -78,5 +77,31 @@
private Integer status;
+ /**
+ * 鏄惁鏄湰瀹跺涵鐨勬暟鎹�(0:涓嶆槸,1:鏄�)
+ */
+ @TableField(exist = false)
+ private Integer ownData = 0;
+
+ /**
+ * 寮�濮嬫椂闂�
+ */
+ @TableField(exist = false)
+ private Date happenStartTime;
+
+ /**
+ * 缁撴潫鏃堕棿
+ */
+ @TableField(exist = false)
+ private Date happenEndTime;
+
+ /**
+ * 璁板綍鏃堕棿
+ */
+ @Excel(name = "璁板綍鏃堕棿", dateFormat = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date happenTime;
+
+
}
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 4285af2..bb23a03 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
@@ -68,6 +68,12 @@
/**
+ * 鏄惁鏄湰瀹跺涵鐨勬暟鎹�(0:涓嶆槸,1:鏄�)
+ */
+ @TableField(exist = false)
+ private Integer ownData = 0;
+
+ /**
* 寮�濮嬫椂闂�
*/
@TableField(exist = false)
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/MarryInfoDto.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/MarryInfoDto.java
new file mode 100644
index 0000000..b0c4bab
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/MarryInfoDto.java
@@ -0,0 +1,73 @@
+package com.ruoyi.domain.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.domain.MarryUser;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-04-23 14:04
+ * @Version 1.0.0
+ **/
+@Data
+public class MarryInfoDto implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ //鎴戜釜浜虹殑鏁版嵁
+ private String id;
+ private String name;
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date birthday;
+ private String address;
+ private String workAddress;
+ private Integer marryStatus;
+ private Integer sex;
+ private String nation;
+ private String phone;
+
+ //閰嶅伓鐨勬暟鎹�
+ private String spouseId;
+ private String spouseName;
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date spouseBirthday;
+ private String spouseAddress;
+ private String spouseWorkAddress;
+ private Integer spouseMarryStatus;
+ private Integer spouseSex;
+ private String spouseNation;
+ private String spousePhone;
+
+
+
+ //鐢熻偛鎯呭喌(涓棿琛�)
+ private Long marryId;
+ /**
+ * 缁撳鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date marryTime;
+
+ /**
+ * 鐢熻偛鎯呭喌,0锛氭湭鐢熻偛銆�1锛氬湪瀛曘��2锛氬凡鐢熻偛
+ */
+ private Integer bearStatus;
+ private Integer handbookStatus;
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date handbookTime;
+ private Integer oneBorn;
+ @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+ private Date oneBornTime;
+ private String content;
+ private String remark;
+
+ /**
+ * 鍓嶄换淇℃伅鐨凩ist
+ */
+ private List<MarryUser> oldSpouseList;
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/MarryUserMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/MarryUserMapper.java
new file mode 100644
index 0000000..00d7ead
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/mapper/MarryUserMapper.java
@@ -0,0 +1,15 @@
+package com.ruoyi.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.domain.MarryUser;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-04-23 13:30
+ * @Version 1.0.0
+ **/
+@Mapper
+public interface MarryUserMapper extends BaseMapper<MarryUser> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/MarryUserService.java b/zhang-content/src/main/java/com/ruoyi/service/MarryUserService.java
new file mode 100644
index 0000000..0c5d33f
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/MarryUserService.java
@@ -0,0 +1,13 @@
+package com.ruoyi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.domain.MarryUser;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-04-23 13:31
+ * @Version 1.0.0
+ **/
+public interface MarryUserService extends IService<MarryUser> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZMarryService.java b/zhang-content/src/main/java/com/ruoyi/service/ZMarryService.java
index 04f45d0..2604d0a 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZMarryService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZMarryService.java
@@ -2,7 +2,9 @@
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZMarry;
+import com.ruoyi.domain.dto.MarryInfoDto;
/**
* <p>
@@ -14,4 +16,10 @@
*/
public interface ZMarryService extends IService<ZMarry> {
+ AjaxResult getNow();
+
+ AjaxResult addInfo(MarryInfoDto marryInfoDto);
+
+ AjaxResult updateInfo(MarryInfoDto marryInfoDto);
+ AjaxResult deleteOld(String spouseId);
}
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 5f2c8d0..1a02dac 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfCleanService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfCleanService.java
@@ -2,7 +2,12 @@
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfClean;
+import com.ruoyi.domain.ZfClean;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
/**
* <p>
@@ -14,4 +19,14 @@
*/
public interface ZfCleanService extends IService<ZfClean> {
+ AjaxResult selectDataList(ZfClean zfClean, Integer pageNum, Integer pageSize);
+
+ List<ZfClean> selectByCondition(ZfClean zfClean);
+
+ AjaxResult addData(ZfClean zfClean);
+
+ AjaxResult addData2(ZfClean zfClean);
+
+ AjaxResult importExcel(MultipartFile file);
+
}
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 4979954..fa6efe4 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfContactService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfContactService.java
@@ -5,6 +5,8 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfContact;
+import org.springframework.web.multipart.MultipartFile;
+
import java.util.List;
/**
@@ -17,7 +19,13 @@
*/
public interface ZfContactService extends IService<ZfContact> {
- AjaxResult selectContactList(ZfContact zfContact, Integer pageNum, Integer pageSize);
+ AjaxResult selectDataList(ZfContact zfContact, Integer pageNum, Integer pageSize);
List<ZfContact> selectByCondition(ZfContact zfContact);
+
+ AjaxResult addData(ZfContact zfContact);
+
+ AjaxResult addData2(ZfContact zfContact);
+
+ AjaxResult importExcel(MultipartFile file);
}
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 6f42fc2..8df6b0e 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfEquipmentService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEquipmentService.java
@@ -18,11 +18,12 @@
*/
public interface ZfEquipmentService extends IService<ZfEquipment> {
- AjaxResult selectEquipmentList(ZfEquipment zfEquipment, Integer pageNum, Integer pageSize);
+ AjaxResult selectDataList(ZfEquipment zfEquipment, Integer pageNum, Integer pageSize);
List<ZfEquipment> selectByCondition(ZfEquipment zfEquipment);
- int addEquipment(ZfEquipment zfEquipment);
+ AjaxResult addData(ZfEquipment zfEquipment);
+ AjaxResult addData2(ZfEquipment zfEquipment);
AjaxResult importExcel(MultipartFile file);
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 36f3cdf..ed4cf44 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java
@@ -18,11 +18,13 @@
*/
public interface ZfEventService extends IService<ZfEvent> {
- AjaxResult selectEventList(ZfEvent zfEvent, Integer pageNum, Integer pageSize);
+ AjaxResult selectDataList(ZfEvent zfEvent, Integer pageNum, Integer pageSize);
List<ZfEvent> selectByCondition(ZfEvent zfEvent);
- int addEvent(ZfEvent zfEvent);
+ AjaxResult addData(ZfEvent zfEvent);
+
+ AjaxResult addData2(ZfEvent zfEvent);
AjaxResult importExcel(MultipartFile file);
}
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 cc75031..dda52e9 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
@@ -48,21 +48,6 @@
ZInfoUserService zInfoUserService;
-// private Date getHappenTime(ZfProperty zfProperty) {
-// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-// String happenTimeStr = format.format(zfProperty.getHappenTime());
-//
-// Date happenTime = null;
-// try {
-// happenTime = format.parse(happenTimeStr);
-// System.out.println("鏂规硶閲岀殑:" + happenTime);
-// } catch (ParseException e) {
-// throw new RuntimeException("鏃堕棿鏍煎紡杞崲鏈夎");
-// }
-// return happenTime;
-// }
-
-
private LambdaQueryWrapper<ZfProperty> buildCondition(ZfProperty zfProperty) {
LambdaQueryWrapper<ZfProperty> lqw = new LambdaQueryWrapper<>();
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/MarryUserServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/MarryUserServiceImpl.java
new file mode 100644
index 0000000..20255ab
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/MarryUserServiceImpl.java
@@ -0,0 +1,17 @@
+package com.ruoyi.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.domain.MarryUser;
+import com.ruoyi.mapper.MarryUserMapper;
+import com.ruoyi.service.MarryUserService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-04-23 13:31
+ * @Version 1.0.0
+ **/
+@Service
+public class MarryUserServiceImpl extends ServiceImpl<MarryUserMapper, MarryUser> implements MarryUserService {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZMarryServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZMarryServiceImpl.java
index 829457f..66f70d6 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZMarryServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZMarryServiceImpl.java
@@ -1,15 +1,30 @@
package com.ruoyi.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.domain.MarryUser;
import com.ruoyi.domain.ZMarry;
+import com.ruoyi.domain.dto.MarryInfoDto;
import com.ruoyi.mapper.ZMarryMapper;
+import com.ruoyi.service.MarryUserService;
import com.ruoyi.service.ZMarryService;
+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.*;
/**
* <p>
- * 鏈嶅姟瀹炵幇绫�
+ * 鏈嶅姟瀹炵幇绫�
* </p>
*
* @author ojq
@@ -18,4 +33,253 @@
@Service
public class ZMarryServiceImpl extends ServiceImpl<ZMarryMapper, ZMarry> implements ZMarryService {
+ @Resource
+ MarryUserService marryUserService;
+
+ @Autowired
+ ZMarryServiceImpl zMarryService;
+
+ @Override
+ public AjaxResult getNow() {
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+
+ //鍏堟煡璇釜浜轰俊鎭�
+ LambdaQueryWrapper<MarryUser> marryUserLambdaQueryWrapper1 = new LambdaQueryWrapper<>();
+ marryUserLambdaQueryWrapper1.eq(MarryUser::getMyId, userId);
+ MarryUser myself = marryUserService.getOne(marryUserLambdaQueryWrapper1);
+
+ //鍐嶆煡璇腑闂磋〃淇℃伅
+ if (myself == null) {
+ throw new RuntimeException("鎮ㄦ殏鏃惰繕鏈湪濠氬Щ琛ㄤ腑娣诲姞涓汉淇℃伅");
+ }
+ LambdaQueryWrapper<ZMarry> zMarryLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ zMarryLambdaQueryWrapper.eq(ZMarry::getUserId, myself.getMyId())
+ .eq(ZMarry::getDeleteStatus, 0);
+ ZMarry myMarryInfo = getOne(zMarryLambdaQueryWrapper);//鍙兘鏈変竴涓厤鍋�
+
+ //鏍规嵁涓棿琛ㄤ俊鎭煡璇㈤厤鍋朵俊鎭�
+ if (myMarryInfo == null) {
+ throw new RuntimeException("鎮ㄦ殏鏃惰繕鏈湪濠氬Щ琛ㄤ腑娣诲姞濠氬Щ淇℃伅");
+ }
+ String spouseId = myMarryInfo.getSpouseId();
+ LambdaQueryWrapper<MarryUser> marryUserLambdaQueryWrapper2 = new LambdaQueryWrapper<>();
+ marryUserLambdaQueryWrapper2.eq(MarryUser::getId, spouseId);
+ MarryUser spouse = marryUserService.getOne(marryUserLambdaQueryWrapper2);
+ if (spouse == null) {
+ throw new RuntimeException("鎮ㄦ殏鏃惰繕鏈湪濠氬Щ琛ㄤ腑娣诲姞閰嶅伓淇℃伅");
+ }
+
+ //鏍规嵁涓棿琛ㄤ俊鎭煡璇㈠墠浠讳俊鎭�
+ LambdaQueryWrapper<ZMarry> zMarryOldLQW = new LambdaQueryWrapper<>();
+ zMarryOldLQW.eq(ZMarry::getUserId,myself.getMyId())
+ .eq(ZMarry::getDeleteStatus,1);
+ List<ZMarry> oldList = list(zMarryOldLQW);
+
+ //鍓嶄换淇℃伅琛�
+ List<MarryUser> oldSpouseList = new ArrayList<>();
+ for (ZMarry zMarry : oldList) {
+ String spouseId1 = zMarry.getSpouseId();
+ MarryUser oldSpouse = marryUserService.getById(spouseId1);
+ oldSpouseList.add(oldSpouse);
+ }
+
+ //缁熶竴灏佽杩斿洖
+ HashMap<String, Object> resultMap = new HashMap<>();
+ resultMap.put("myInfo",myself);
+ resultMap.put("spouseInfo",spouse);
+ resultMap.put("marryInfo",myMarryInfo);
+ resultMap.put("oldSpouseInfo",oldSpouseList);
+
+ return AjaxResult.success(resultMap);
+ }
+
+ @Transactional
+ public AjaxResult addInfo(MarryInfoDto marryInfoDto){
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+
+ String meId= IdUtils.simpleUUID();
+ String spouseId = IdUtils.simpleUUID();
+
+ //娣诲姞鑷繁鐨勪俊鎭�
+ MarryUser myself = new MarryUser();
+ myself.setId(meId);
+ myself.setName(marryInfoDto.getName());
+ myself.setBirthday(marryInfoDto.getBirthday());
+ myself.setAddress(marryInfoDto.getAddress());
+ myself.setWorkAddress(marryInfoDto.getWorkAddress());
+ myself.setMarryStatus(marryInfoDto.getMarryStatus());
+ myself.setSex(marryInfoDto.getSex());
+ myself.setMyId(userId);
+ myself.setNation(marryInfoDto.getNation());
+ myself.setPhone(marryInfoDto.getPhone());
+ marryUserService.save(myself);
+
+ //娣诲姞閰嶅伓鐨勪俊鎭�
+ MarryUser spouse = new MarryUser();
+ spouse.setId(spouseId);
+ spouse.setName(marryInfoDto.getSpouseName());
+ spouse.setBirthday(marryInfoDto.getSpouseBirthday());
+ spouse.setAddress(marryInfoDto.getSpouseAddress());
+ spouse.setWorkAddress(marryInfoDto.getSpouseWorkAddress());
+ spouse.setMarryStatus(marryInfoDto.getSpouseMarryStatus());
+ spouse.setSex(marryInfoDto.getSpouseSex());
+ spouse.setNation(marryInfoDto.getSpouseNation());
+ spouse.setPhone(marryInfoDto.getSpousePhone());
+ marryUserService.save(spouse);
+
+ //娣诲姞鐢熻偛鎯呭喌(涓棿琛�)淇℃伅
+ ZMarry zMarry = new ZMarry();
+ zMarry.setUserId(userId);
+ zMarry.setSpouseId(spouseId);
+ zMarry.setMarryTime(marryInfoDto.getMarryTime());
+ zMarry.setBearStatus(marryInfoDto.getBearStatus());
+ zMarry.setHandbookStatus(marryInfoDto.getHandbookStatus());
+ zMarry.setHandbookTime(marryInfoDto.getHandbookTime());
+ zMarry.setOneBorn(marryInfoDto.getOneBorn());
+ zMarry.setOneBornTime(marryInfoDto.getOneBornTime());
+ zMarry.setContent(marryInfoDto.getContent());
+ zMarry.setRemark(marryInfoDto.getRemark());
+ zMarry.setDeleteStatus(0);
+ zMarryService.save(zMarry);
+
+
+ List<MarryUser> oldSpouseList = marryInfoDto.getOldSpouseList();
+
+ //娣诲姞鍓嶄换鐨勪俊鎭�
+ if(oldSpouseList!=null&&oldSpouseList.size()!=0){
+ for (MarryUser marryUser : oldSpouseList) {
+ //鍏堟坊鍔犻厤鍋剁敤鎴蜂俊鎭�
+ String spId = IdUtils.simpleUUID();
+ marryUser.setId(spId);
+ marryUserService.save(marryUser);
+
+ //鍐嶆坊鍔犱腑闂磋〃淇℃伅
+ ZMarry oldMarry = new ZMarry();
+ oldMarry.setUserId(userId);
+ oldMarry.setSpouseId(spId);
+ oldMarry.setDeleteStatus(1);
+ zMarryService.save(oldMarry);
+ }
+ }
+
+ return AjaxResult.success();
+ }
+
+ @Transactional
+ public AjaxResult updateInfo(MarryInfoDto marryInfoDto){
+
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+ //鏇存柊鑷繁鐨勪俊鎭�
+ MarryUser myself = new MarryUser();
+ myself.setId(marryInfoDto.getId());
+ myself.setName(marryInfoDto.getName());
+ myself.setBirthday(marryInfoDto.getBirthday());
+ myself.setAddress(marryInfoDto.getAddress());
+ myself.setWorkAddress(marryInfoDto.getWorkAddress());
+ myself.setMarryStatus(marryInfoDto.getMarryStatus());
+ myself.setSex(marryInfoDto.getSex());
+ myself.setNation(marryInfoDto.getNation());
+ myself.setPhone(marryInfoDto.getPhone());
+ marryUserService.updateById(myself);
+
+ //鏇存柊閰嶅伓鐨勪俊鎭�
+
+ //鍏堟煡璇㈡槸鏇存柊閰嶅伓淇℃伅杩樻槸鎹㈤厤鍋讹紝鍥犱负閰嶅伓鍙兘鏈変竴涓�
+ //杩欓噷鏆傛椂鐢ㄥ悕瀛楁潵鍒ゆ柇鍚э紝濡傛灉鏈夐噸鍚嶇殑浜哄氨浼氭湁bug
+ //鍏堟煡璇�
+ String spouseName = marryInfoDto.getSpouseName();
+ MarryUser marry = marryUserService.getById(marryInfoDto.getSpouseId());
+ String marryName = marry.getName();
+ if(!spouseName.equals(marryName)){
+
+ //濡傛灉姝e瀛愭崲浜轰簡锛屽氨鏂板鑰屼笉鏄慨鏀癸紝鍚屾椂鍒犻櫎鏃х邯褰�
+ //灏嗙幇鍦ㄤ腑闂磋〃鐨勫瀛愭敼鎴愬墠濡�
+ LambdaQueryWrapper<ZMarry> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZMarry::getUserId,userId)
+ .eq(ZMarry::getSpouseId,marryInfoDto.getSpouseId());
+ ZMarry one = getOne(lqw);
+ one.setDeleteStatus(1);
+ zMarryService.updateById(one);
+
+ //鏂板鐢ㄦ埛淇℃伅琛�
+ String spouseId = IdUtils.simpleUUID();
+ MarryUser spouse = new MarryUser();
+ spouse.setId(spouseId);
+ spouse.setName(marryInfoDto.getSpouseName());
+ spouse.setBirthday(marryInfoDto.getSpouseBirthday());
+ spouse.setAddress(marryInfoDto.getSpouseAddress());
+ spouse.setWorkAddress(marryInfoDto.getSpouseWorkAddress());
+ spouse.setMarryStatus(marryInfoDto.getSpouseMarryStatus());
+ spouse.setSex(marryInfoDto.getSpouseSex());
+ spouse.setNation(marryInfoDto.getSpouseNation());
+ spouse.setPhone(marryInfoDto.getSpousePhone());
+ marryUserService.save(spouse);
+
+ //鏂板涓棿琛�
+ //娣诲姞鐢熻偛鎯呭喌(涓棿琛�)淇℃伅
+ ZMarry zMarry = new ZMarry();
+ zMarry.setUserId(userId);
+ zMarry.setSpouseId(spouseId);
+ zMarry.setMarryTime(marryInfoDto.getMarryTime());
+ zMarry.setBearStatus(marryInfoDto.getBearStatus());
+ zMarry.setHandbookStatus(marryInfoDto.getHandbookStatus());
+ zMarry.setHandbookTime(marryInfoDto.getHandbookTime());
+ zMarry.setOneBorn(marryInfoDto.getOneBorn());
+ zMarry.setOneBornTime(marryInfoDto.getOneBornTime());
+ zMarry.setContent(marryInfoDto.getContent());
+ zMarry.setRemark(marryInfoDto.getRemark());
+ zMarry.setDeleteStatus(0);
+ zMarryService.save(zMarry);
+
+
+
+ }else {
+
+ MarryUser spouse = new MarryUser();
+ spouse.setId(marryInfoDto.getSpouseId());
+ spouse.setName(marryInfoDto.getSpouseName());
+ spouse.setBirthday(marryInfoDto.getSpouseBirthday());
+ spouse.setAddress(marryInfoDto.getSpouseAddress());
+ spouse.setWorkAddress(marryInfoDto.getSpouseWorkAddress());
+ spouse.setMarryStatus(marryInfoDto.getSpouseMarryStatus());
+ spouse.setSex(marryInfoDto.getSpouseSex());
+ spouse.setNation(marryInfoDto.getSpouseNation());
+ spouse.setPhone(marryInfoDto.getSpousePhone());
+ marryUserService.updateById(spouse);
+
+ //鏇存柊鐢熻偛鎯呭喌淇℃伅
+ ZMarry zMarry = new ZMarry();
+ zMarry.setId(marryInfoDto.getMarryId());
+ zMarry.setMarryTime(marryInfoDto.getMarryTime());
+ zMarry.setBearStatus(marryInfoDto.getBearStatus());
+ zMarry.setHandbookStatus(marryInfoDto.getHandbookStatus());
+ zMarry.setHandbookTime(marryInfoDto.getHandbookTime());
+ zMarry.setOneBorn(marryInfoDto.getOneBorn());
+ zMarry.setOneBornTime(marryInfoDto.getOneBornTime());
+ zMarry.setContent(marryInfoDto.getContent());
+ zMarry.setRemark(marryInfoDto.getRemark());
+ zMarry.setDeleteStatus(0);
+ zMarryService.updateById(zMarry);
+ }
+
+ //鏇存柊鍓嶄换淇℃伅
+ List<MarryUser> oldSpouseList = marryInfoDto.getOldSpouseList();
+ if(oldSpouseList!=null&&oldSpouseList.size()!=0){
+ for (MarryUser marryUser : oldSpouseList) {
+ //淇敼鐢ㄦ埛鍓嶄换淇℃伅
+ marryUserService.updateById(marryUser);
+ //涓棿琛ㄤ笉闇�瑕佷慨鏀�
+ }
+ }
+ return AjaxResult.success();
+ }
+
+ public AjaxResult deleteOld(String spouseId){
+ marryUserService.removeById(spouseId);
+ return AjaxResult.success();
+ }
+
}
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 5918df5..cdb1eec 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
@@ -1,11 +1,35 @@
package com.ruoyi.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.MapUtils;
+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.ZfClean;
+
import com.ruoyi.domain.ZfClean;
import com.ruoyi.mapper.ZfCleanMapper;
+import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfCleanService;
+
+import com.ruoyi.util.ArraysUtil;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static com.ruoyi.constant.MenuAuthority.CLEAN_LIST;
/**
* <p>
@@ -16,6 +40,272 @@
* @since 2023-03-12
*/
@Service
+@Slf4j
public class ZfCleanServiceImpl extends ServiceImpl<ZfCleanMapper, ZfClean> implements ZfCleanService {
+ @Resource
+ ZInfoUserService zInfoUserService;
+
+ @Resource
+ ZfCleanService zfCleanService;
+
+ private LambdaQueryWrapper<ZfClean> buildCondition(ZfClean zfClean) {
+ LambdaQueryWrapper<ZfClean> lqw = new LambdaQueryWrapper<>();
+ 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())
+ .like(StringUtils.isNotEmpty(zfClean.getMethod()), ZfClean::getMethod, zfClean.getMethod())
+ .like(StringUtils.isNotEmpty(zfClean.getPlace()), ZfClean::getPlace, zfClean.getPlace())
+ .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())
+ .between(zfClean.getHappenStartTime() != null && zfClean.getHappenEndTime() != null, ZfClean::getHappenTime, zfClean.getHappenStartTime(), zfClean.getHappenEndTime());
+ 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();
+ }
+
+ @Override
+ public List<ZfClean> selectByCondition(ZfClean zfClean) {
+ 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);
+ }
+
+ 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());
+ }
+
+ @Override
+ public AjaxResult selectDataList(ZfClean zfClean, Integer pageNum, Integer pageSize) {
+ 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);
+ }
+
+ @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();
+ }
+
+ } else {
+ throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfClean.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)) {
+ throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+ }
+
+ if (myFamilyId.contains(",")) {
+ String[] myFamilyIds = myFamilyId.split(",");
+ //榛樿娣诲姞绗竴涓搴殑鏁版嵁
+ zfClean.setFamilyId(myFamilyIds[0]);
+ } else {
+ zfClean.setFamilyId(myFamilyId);
+ }
+
+ if (save(zfClean)) {
+ return AjaxResult.success();
+ } else {
+ return AjaxResult.error();
+ }
+ }
+
+
+ @Override
+ @Transactional
+ public AjaxResult importExcel(MultipartFile file) {
+ ExcelUtil<ZfClean> util = new ExcelUtil<>(ZfClean.class);
+ List<ZfClean> propertyList = null;
+ try {
+ propertyList = util.importExcel(file.getInputStream());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ log.info("璧勪骇鍒楄〃涓猴細{}", propertyList);
+
+ for (ZfClean zfClean : propertyList) {
+ zfCleanService.addData2(zfClean);
+ }
+
+ 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 9420b3e..086057a 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
@@ -5,17 +5,31 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.MapUtils;
+import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.domain.*;
import com.ruoyi.domain.ZfContact;
import com.ruoyi.domain.ZfContact;
import com.ruoyi.mapper.ZfContactMapper;
+import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfContactService;
+import com.ruoyi.service.ZfContactService;
+import com.ruoyi.util.ArraysUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+import javax.annotation.Resource;
import java.util.HashMap;
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;
/**
* <p>
@@ -28,23 +42,12 @@
@Service
@Slf4j
public class ZfContactServiceImpl extends ServiceImpl<ZfContactMapper, ZfContact> implements ZfContactService {
+ @Resource
+ ZInfoUserService zInfoUserService;
- @Override
- public AjaxResult selectContactList(ZfContact zfContact, Integer pageNum, Integer pageSize) {
- LambdaQueryWrapper<ZfContact> lqw = buildCondition(zfContact);
- Page<ZfContact> ZfContactPage = new Page<>(pageNum,pageSize);
- Page<ZfContact> pageResult = page(ZfContactPage, lqw);
- HashMap<String, Object> data = MapUtils.getResult(pageResult);
- return AjaxResult.success(data);
- }
+ @Resource
+ ZfContactService zfContactService;
- @Override
- public List<ZfContact> selectByCondition(ZfContact zfContact) {
- LambdaQueryWrapper<ZfContact> lambdaQueryWrapper = buildCondition(zfContact);
- List<ZfContact> list = list(lambdaQueryWrapper);
- log.info("杩斿洖鐨勬暟鎹负:{}",list);
- return list;
- }
private LambdaQueryWrapper<ZfContact> buildCondition(ZfContact zfContact) {
LambdaQueryWrapper<ZfContact> lqw = new LambdaQueryWrapper<>();
@@ -57,7 +60,253 @@
lqw.like(StringUtils.isNotEmpty(zfContact.getQq()),ZfContact::getQq,zfContact.getQq());
lqw.like(StringUtils.isNotEmpty(zfContact.getTwitter()),ZfContact::getTwitter,zfContact.getTwitter());
lqw.like(StringUtils.isNotEmpty(zfContact.getRemark()),ZfContact::getRemark,zfContact.getRemark());
+ lqw.eq(zfContact.getHappenTime() != null, ZfContact::getHappenTime, zfContact.getHappenTime());
+ lqw.between(zfContact.getHappenStartTime() != null && zfContact.getHappenEndTime() != null, ZfContact::getHappenTime, zfContact.getHappenStartTime(), zfContact.getHappenEndTime());
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();
+ }
+
+ @Override
+ public List<ZfContact> selectByCondition(ZfContact zfContact) {
+ 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);
+ }
+
+ 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());
+ }
+
+ @Override
+ public AjaxResult selectDataList(ZfContact zfContact, Integer pageNum, Integer pageSize) {
+ 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);
+ }
+
+ @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();
+ }
+
+ } else {
+ throw new RuntimeException("浣犳病鏈夋搷浣滆瀹跺涵鍙蜂负" + zfContact.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)) {
+ throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+ }
+
+ if (myFamilyId.contains(",")) {
+ String[] myFamilyIds = myFamilyId.split(",");
+ //榛樿娣诲姞绗竴涓搴殑鏁版嵁
+ zfContact.setFamilyId(myFamilyIds[0]);
+ } else {
+ zfContact.setFamilyId(myFamilyId);
+ }
+
+ if (save(zfContact)) {
+ return AjaxResult.success();
+ } else {
+ return AjaxResult.error();
+ }
+ }
+
+
+ @Override
+ @Transactional
+ public AjaxResult importExcel(MultipartFile file) {
+ ExcelUtil<ZfContact> util = new ExcelUtil<>(ZfContact.class);
+ List<ZfContact> propertyList = null;
+ try {
+ propertyList = util.importExcel(file.getInputStream());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ log.info("璧勪骇鍒楄〃涓猴細{}", propertyList);
+
+ for (ZfContact zfContact : propertyList) {
+ zfContactService.addData2(zfContact);
+ }
+
+ return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
+
+ }
+
}
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 21a607b..88df0af 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
@@ -13,6 +13,7 @@
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfEconomy;
import com.ruoyi.domain.ZfEconomy;
+import com.ruoyi.domain.ZfEconomy;
import com.ruoyi.mapper.ZfEconomyMapper;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfEconomyService;
@@ -51,12 +52,13 @@
LambdaQueryWrapper<ZfEconomy> lqw = new LambdaQueryWrapper<>();
lqw.eq(zfEconomy.getType()!=null,ZfEconomy::getType,zfEconomy.getType());
lqw.eq(zfEconomy.getKind()!=null,ZfEconomy::getKind,zfEconomy.getKind());
- lqw.like(zfEconomy.getCreateTime()!=null,ZfEconomy::getCreateTime,zfEconomy.getCreateTime());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getPrice()),ZfEconomy::getPrice,zfEconomy.getPrice());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getUseFor()),ZfEconomy::getUseFor,zfEconomy.getUseFor());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getUsePeople()),ZfEconomy::getUsePeople,zfEconomy.getUsePeople());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getBalance()),ZfEconomy::getBalance,zfEconomy.getBalance());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getRemark()),ZfEconomy::getRemark,zfEconomy.getRemark());
+ lqw.eq(zfEconomy.getHappenTime() != null, ZfEconomy::getHappenTime, zfEconomy.getHappenTime());
+ lqw.between(zfEconomy.getHappenStartTime() != null && zfEconomy.getHappenEndTime() != null, ZfEconomy::getHappenTime, zfEconomy.getHappenStartTime(), zfEconomy.getHappenEndTime());
return lqw;
}
@@ -139,7 +141,7 @@
}
- lqw.orderByDesc(ZfEconomy::getId);
+ lqw.orderByDesc(ZfEconomy::getCreateTime);
return lqw;
}
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 7b85359..052b480 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
@@ -10,13 +10,12 @@
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.*;
import com.ruoyi.domain.ZfEquipment;
-import com.ruoyi.domain.ZfEquipment;
-import com.ruoyi.domain.ZfProperty;
import com.ruoyi.mapper.ZfEquipmentMapper;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfEquipmentService;
+import com.ruoyi.util.ArraysUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -25,6 +24,10 @@
import javax.annotation.Resource;
import java.util.HashMap;
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;
/**
* <p>
@@ -42,17 +45,191 @@
@Resource
ZfEquipmentService zfEquipmentService;
- @Override
- public List<ZfEquipment> selectByCondition(ZfEquipment zfEquipment) {
- String familyIds = listFamilyIds();
- LambdaQueryWrapper<ZfEquipment> lambdaQueryWrapper = buildCondition(zfEquipment, familyIds);
- List<ZfEquipment> list = list(lambdaQueryWrapper);
- log.info("杩斿洖鐨勬暟鎹负:{}", list);
- return list;
+
+ private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment) {
+ LambdaQueryWrapper<ZfEquipment> lqw = new LambdaQueryWrapper<>();
+ 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.between(zfEquipment.getHappenStartTime() != null && zfEquipment.getHappenEndTime() != null, ZfEquipment::getHappenTime, zfEquipment.getHappenStartTime(), zfEquipment.getHappenEndTime());
+ return lqw;
+ }
+
+
+
+ //------------------------------------------------------------------------------------------
+ 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 int addEquipment(ZfEquipment zfEquipment) {
+ public List<ZfEquipment> selectByCondition(ZfEquipment zfEquipment) {
+ 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);
+ }
+
+ 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());
+ }
+
+ @Override
+ public AjaxResult selectDataList(ZfEquipment zfEquipment, Integer pageNum, Integer pageSize) {
+ 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);
+ }
+
+ @Override
+ public AjaxResult addData(ZfEquipment zfEquipment) {
+
String familyIds = listFamilyIds();
boolean flag = false;//鍒ゆ柇褰撳墠鐢ㄦ埛鐨刬d鏄惁鏈夋潈鍔犲叆褰撳墠瀹跺涵id鐨勫璞�
if (familyIds.contains(",")) {
@@ -68,75 +245,66 @@
}
}
if (flag) {
- boolean save = save(zfEquipment);
- return save ? 1 : 0;
+ 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);
+ }
+
+ if (save(zfEquipment)) {
+ return AjaxResult.success();
+ } else {
+ return AjaxResult.error();
+ }
+ }
+
+
+ @Override
@Transactional
public AjaxResult importExcel(MultipartFile file) {
-
ExcelUtil<ZfEquipment> util = new ExcelUtil<>(ZfEquipment.class);
- List<ZfEquipment> equipmentList = null;
+ List<ZfEquipment> propertyList = null;
try {
- equipmentList = util.importExcel(file.getInputStream());
+ propertyList = util.importExcel(file.getInputStream());
} catch (Exception e) {
throw new RuntimeException(e);
}
- log.info("璧勪骇鍒楄〃涓猴細{}", equipmentList);
+ log.info("璧勪骇鍒楄〃涓猴細{}", propertyList);
- for (ZfEquipment zfEquipment : equipmentList) {
- zfEquipmentService.addEquipment(zfEquipment);
+ for (ZfEquipment zfEquipment : propertyList) {
+ zfEquipmentService.addData2(zfEquipment);
}
return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
}
- private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment) {
- LambdaQueryWrapper<ZfEquipment> lqw = new LambdaQueryWrapper<>();
- 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.like(zfEquipment.getCreateDate() != null, ZfEquipment::getCreateDate, zfEquipment.getCreateDate());
- return lqw;
- }
- private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment, String familyIds) {
- LambdaQueryWrapper<ZfEquipment> lqw = buildCondition(zfEquipment);
- if (familyIds.contains(",")) {
- String[] familyList = familyIds.split(",");
- lqw.in(ZfEquipment::getFamilyId,familyList);
-
- } else {
- lqw.eq(ZfEquipment::getFamilyId, familyIds);
- }
- return lqw;
- }
-
- private String listFamilyIds() {
- SysUser user = SecurityUtils.getLoginUser().getUser();
- Long userId = user.getUserId();
- LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
- zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
- ZInfoUser zInfoUser = zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
- return zInfoUser.getFamilyId();
- }
-
- @Override
- public AjaxResult selectEquipmentList(ZfEquipment zfEquipment, Integer pageNum, Integer pageSize) {
- String familyIds = listFamilyIds();
- LambdaQueryWrapper<ZfEquipment> lqw = buildCondition(zfEquipment, familyIds);
- Page<ZfEquipment> zfEquipmentPage = new Page<>(pageNum, pageSize);
- Page<ZfEquipment> pageResult = page(zfEquipmentPage, lqw);
- HashMap<String, Object> data = MapUtils.getResult(pageResult);
- return AjaxResult.success(data);
-
- }
}
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 9fef9fc..6d4d8e6 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
@@ -13,17 +13,23 @@
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfEvent;
import com.ruoyi.domain.ZfEvent;
-import com.ruoyi.domain.ZfProperty;
+import com.ruoyi.domain.ZfEvent;
import com.ruoyi.mapper.ZfEventMapper;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfEventService;
+import com.ruoyi.util.ArraysUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.HashMap;
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;
/**
* <p>
@@ -43,40 +49,186 @@
@Resource
ZfEventService zfEventService;
- private String listFamilyIds() {
+ private LambdaQueryWrapper<ZfEvent> buildCondition(ZfEvent zfEvent) {
+ LambdaQueryWrapper<ZfEvent> lqw = new LambdaQueryWrapper<>();
+ 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.between(zfEvent.getHappenStartTime() != null && zfEvent.getHappenEndTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenStartTime(), zfEvent.getHappenEndTime());
+ 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);
- ZInfoUser zInfoUser = zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
- return zInfoUser.getFamilyId();
+ return zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
}
-
- @Override
- public AjaxResult selectEventList(ZfEvent zfEvent, Integer pageNum, Integer pageSize) {
- String familyIds = listFamilyIds();
- LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent, familyIds);
-
- Page<ZfEvent> ZfEventPage = new Page<>(pageNum, pageSize);
- Page<ZfEvent> pageResult = page(ZfEventPage, lqw);
-
- HashMap<String, Object> data = MapUtils.getResult(pageResult);
- return AjaxResult.success(data);
+ private String listFamilyIds() {
+ 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();
- LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent, familyIds);
- List<ZfEvent> list = list(lqw);
- log.info("杩斿洖鐨勬暟鎹负:{}", list);
- return list;
+ String secondFamilyIds = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfEvent> lambdaQueryWrapper = buildCondition(zfEvent, familyIds, secondFamilyIds);
+ List<ZfEvent> beanRecords = list(lambdaQueryWrapper);
+ log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
+ return markOwnData(familyIds, beanRecords);
+ }
+
+ 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 int addEvent(ZfEvent zfEvent) {
+ public AjaxResult selectDataList(ZfEvent zfEvent, Integer pageNum, Integer pageSize) {
+ String familyIds = listFamilyIds();
+ String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent, familyIds, secondFamilyAuthority);
+
+ Page<ZfEvent> zfEventPage = new Page<>(pageNum, pageSize);
+ Page<ZfEvent> pageResult = page(zfEventPage, lqw);
+
+ List<ZfEvent> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+
+ List<ZfEvent> dtoResult = markOwnData(familyIds, 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(",")) {
@@ -92,51 +244,67 @@
}
}
if (flag) {
- boolean save = save(zfEvent);
- return save ? 1 : 0;
+ 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)) {
+ throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+ }
+
+ if (myFamilyId.contains(",")) {
+ String[] myFamilyIds = myFamilyId.split(",");
+ //榛樿娣诲姞绗竴涓搴殑鏁版嵁
+ zfEvent.setFamilyId(myFamilyIds[0]);
+ } else {
+ zfEvent.setFamilyId(myFamilyId);
+ }
+
+ 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> eventList = null;
+ List<ZfEvent> propertyList = null;
try {
- eventList = util.importExcel(file.getInputStream());
+ propertyList = util.importExcel(file.getInputStream());
} catch (Exception e) {
throw new RuntimeException(e);
}
- log.info("璧勪骇鍒楄〃涓猴細{}", eventList);
+ log.info("璧勪骇鍒楄〃涓猴細{}", propertyList);
- for (ZfEvent zfEvent : eventList) {
- zfEventService.addEvent(zfEvent);
+ for (ZfEvent zfEvent : propertyList) {
+ zfEventService.addData2(zfEvent);
}
return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
- }
- private LambdaQueryWrapper<ZfEvent> buildCondition(ZfEvent zfEvent) {
- LambdaQueryWrapper<ZfEvent> lqw = new LambdaQueryWrapper<>();
- 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.between(zfEvent.getHappenStartTime() != null && zfEvent.getHappenEndTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenStartTime(), zfEvent.getHappenEndTime());
- return lqw;
}
-
- private LambdaQueryWrapper<ZfEvent> buildCondition(ZfEvent zfEvent, String familyIds) {
- LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent);
- if (familyIds.contains(",")) {
- String[] familyList = familyIds.split(",");
- lqw.in(ZfEvent::getFamilyId, familyList);
- } else {
- lqw.eq(ZfEvent::getFamilyId, familyIds);
- }
- return lqw;
- }
+
+
+
}
--
Gitblit v1.9.1