From db9e568e346c07b574c5fbe59041889309f0642c Mon Sep 17 00:00:00 2001
From: whywhyo <1511349576@qq.com>
Date: 星期一, 29 五月 2023 22:09:30 +0800
Subject: [PATCH] 123
---
zhang-content/src/main/java/com/ruoyi/mapper/ZTravelPriceDetailMapper.java | 17
zhang-content/src/main/java/com/ruoyi/domain/ZfRelation.java | 10
zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelBaseServiceImpl.java | 112 +++++
zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceDetailServiceImpl.java | 20
zhang-content/src/main/java/com/ruoyi/domain/ZTravelPriceDetail.java | 77 +++
zhang-content/src/main/java/com/ruoyi/service/ZTravelBaseService.java | 11
zhang-content/src/main/java/com/ruoyi/domain/ZTravelPrice.java | 147 ++---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java | 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelBaseController.java | 115 +++++
zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java | 14
zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java | 3
zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceDetailService.java | 16
zhang-content/src/main/java/com/ruoyi/domain/dto/RelationDto.java | 23 +
zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java | 60 --
zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceService.java | 21
ruoyi-admin/src/main/resources/application-druid.yml | 4
zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorServiceImpl.java | 2
zhang-content/src/main/java/com/ruoyi/domain/dto/PriceDto.java | 34 +
zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceServiceImpl.java | 343 +++++++++++++++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java | 6
zhang-content/src/main/java/com/ruoyi/domain/ZTravelBase.java | 127 +---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelPriceController.java | 115 +++++
22 files changed, 1,046 insertions(+), 235 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java
index c64c92b..6159e82 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java
@@ -74,8 +74,8 @@
*/
// @PreAuthorize("@ss.hasPermi('system:property:export')")
@Log(title = "璇佷欢銆佽崳瑾夈�佽祫璐ㄨ褰�", businessType = BusinessType.EXPORT)
- @PostMapping("/export/{ids}")
- public void export(HttpServletResponse response,@PathVariable Long[] ids)
+ @PostMapping(value = {"/export/{ids}","/export"})
+ public void export(HttpServletResponse response,@PathVariable(required = false) Long[] ids)
{
List<ZHonor> list = zHonorService.selectByIds(ids);
log.info("瀵煎嚭璁板綍涓�:{}",list);
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 2f8e4c9..33fc28d 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
@@ -15,6 +15,7 @@
import com.ruoyi.domain.dto.EmpowerDto;
import com.ruoyi.domain.dto.Genealogy;
import com.ruoyi.domain.dto.GenealogyExportDto;
+import com.ruoyi.domain.dto.RelationDto;
import com.ruoyi.service.ZInfoUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -153,15 +154,12 @@
*/
@GetMapping("/relation")
public AjaxResult listMyRelation() {
- SysUser user = SecurityUtils.getLoginUser().getUser();
- Long userId = user.getUserId();
- return zInfoUserService.searchMyRelation(userId);
+ return zInfoUserService.searchMyRelation();
}
@PostMapping("/relation")
public AjaxResult addRelation(@RequestBody ZfRelation zfRelation){
return zInfoUserService.addRelation(zfRelation);
-
}
@PutMapping("/relation")
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelBaseController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelBaseController.java
index ca30117..81bbe58 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelBaseController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelBaseController.java
@@ -1,9 +1,27 @@
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.ZTravelBase;
+import com.ruoyi.service.ZTravelBaseService;
+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.Collections;
+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 +33,98 @@
*/
@RestController
@RequestMapping("/zTravelBase")
-public class ZTravelBaseController {
+@Slf4j
+public class ZTravelBaseController extends BaseController {
+
+ @Autowired
+ private ZTravelBaseService zTravelBaseService;
+
+ /**
+ * 鏌ヨ鎵�鏈夎褰�
+ */
+ @GetMapping("/all")
+ public AjaxResult listAll(String fid,ZTravelBase zTravelBase){
+ Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
+ Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
+ return zTravelBaseService.selectDataList(fid, zTravelBase,pageNum,pageSize);
+ }
+
+ /**
+ * 鏍规嵁id鏌ヨ
+ */
+ @GetMapping("/{id}")
+ public AjaxResult listById(@PathVariable Long id){
+ return AjaxResult.success(zTravelBaseService.getById(id));
+ }
+
+ /**
+ * 妯℃澘
+ */
+ @GetMapping("/model")
+ public void getModel(HttpServletResponse response){
+ ZTravelBase zTravelBase = new ZTravelBase();
+ List<ZTravelBase> emptyList = Collections.singletonList(zTravelBase);
+ ExcelUtil<ZTravelBase> util = new ExcelUtil<>(ZTravelBase.class);
+ util.exportExcel(response, emptyList, "鏃呮父鍩烘湰淇℃伅璁板綍鏁版嵁");
+ }
+
+ /**
+ * 瀵煎嚭鏃呮父鍩烘湰淇℃伅璁板綍鍒楄〃
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:export')")
+ @Log(title = "鏃呮父鍩烘湰淇℃伅璁板綍", businessType = BusinessType.EXPORT)
+ @PostMapping("/export/{ids}")
+ public void export(HttpServletResponse response,@PathVariable Long[] ids)
+ {
+ List<ZTravelBase> list = zTravelBaseService.selectByIds(ids);
+ log.info("瀵煎嚭璁板綍涓�:{}",list);
+ ExcelUtil<ZTravelBase> util = new ExcelUtil<>(ZTravelBase.class);
+ util.exportExcel(response, list, "鏃呮父鍩烘湰淇℃伅璁板綍鏁版嵁");
+ }
+
+ /**
+ * 瀵煎叆鏃呮父鍩烘湰淇℃伅璁板綍鍒楄〃
+ */
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT)
+ @PostMapping("/importData")
+ public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception
+ {
+ return zTravelBaseService.importExcel(file);
+ }
+
+ /**
+ * 鏂板鏃呮父鍩烘湰淇℃伅璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:add')")
+ @Log(title = "鏃呮父鍩烘湰淇℃伅璁板綍", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ZTravelBase zTravelBase)
+ {
+ return zTravelBaseService.mySave(zTravelBase);
+ }
+
+ /**
+ * 淇敼鏃呮父鍩烘湰淇℃伅璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:edit')")
+ @Log(title = "鏃呮父鍩烘湰淇℃伅璁板綍", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ZTravelBase zTravelBase)
+ {
+ return toAjax(zTravelBaseService.updateById(zTravelBase));
+ }
+//
+ /**
+ * 鎵归噺鍒犻櫎鏃呮父鍩烘湰淇℃伅璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:remove')")
+ @Log(title = "鏃呮父鍩烘湰淇℃伅璁板綍", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(zTravelBaseService.removeByIds(Arrays.asList(ids)));
+ }
+
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelPriceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelPriceController.java
index 8630415..85d814f 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelPriceController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelPriceController.java
@@ -1,9 +1,28 @@
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.ZTravelPrice;
+import com.ruoyi.domain.dto.PriceDto;
+import com.ruoyi.service.ZTravelPriceService;
+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.Collections;
+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 +34,97 @@
*/
@RestController
@RequestMapping("/zTravelPrice")
-public class ZTravelPriceController {
+@Slf4j
+public class ZTravelPriceController extends BaseController {
+
+ @Autowired
+ private ZTravelPriceService zTravelPriceService;
+
+ /**
+ * 鏌ヨ鎵�鏈夎褰�
+ */
+ @GetMapping("/all")
+ public AjaxResult listAll(ZTravelPrice zTravelPrice){
+ Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
+ Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
+ return zTravelPriceService.selectDataList(zTravelPrice,pageNum,pageSize);
+ }
+
+ /**
+ * 鏍规嵁id鏌ヨ
+ */
+ @GetMapping()
+ public AjaxResult listById(Long id){
+ return AjaxResult.success(zTravelPriceService.getById(id));
+ }
+
+ /**
+ * 妯℃澘
+ */
+ @GetMapping("/model")
+ public void getModel(HttpServletResponse response){
+ ZTravelPrice zTravelPrice = new ZTravelPrice();
+ List<ZTravelPrice> emptyList = Collections.singletonList(zTravelPrice);
+ ExcelUtil<ZTravelPrice> util = new ExcelUtil<>(ZTravelPrice.class);
+ util.exportExcel(response, emptyList, "鏃呮父璐圭敤璁板綍鏁版嵁");
+ }
+
+ /**
+ * 瀵煎嚭鏃呮父璐圭敤璁板綍鍒楄〃
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:export')")
+ @Log(title = "鏃呮父璐圭敤璁板綍", businessType = BusinessType.EXPORT)
+ @PostMapping("/export/{ids}")
+ public void export(HttpServletResponse response,@PathVariable Long[] ids)
+ {
+ List<ZTravelPrice> list = zTravelPriceService.selectByIds(ids);
+ log.info("瀵煎嚭璁板綍涓�:{}",list);
+ ExcelUtil<ZTravelPrice> util = new ExcelUtil<>(ZTravelPrice.class);
+ util.exportExcel(response, list, "鏃呮父璐圭敤璁板綍鏁版嵁");
+ }
+
+// /**
+// * 瀵煎叆鏃呮父璐圭敤璁板綍鍒楄〃
+// */
+// @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT)
+// @PostMapping("/importData")
+// public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception
+// {
+// return zTravelPriceService.importExcel(file);
+// }
+
+ /**
+ * 鏂板鏃呮父璐圭敤璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:add')")
+ @Log(title = "鏃呮父璐圭敤璁板綍", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody PriceDto priceDto)
+ {
+ return zTravelPriceService.mySave(priceDto);
+ }
+
+ /**
+ * 淇敼鏃呮父璐圭敤璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:edit')")
+ @Log(title = "鏃呮父璐圭敤璁板綍", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody PriceDto priceDto)
+ {
+ return zTravelPriceService.myUpdate(priceDto);
+ }
+//
+ /**
+ * 鎵归噺鍒犻櫎鏃呮父璐圭敤璁板綍
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:remove')")
+ @Log(title = "鏃呮父璐圭敤璁板綍", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return zTravelPriceService.myRemove(ids);
+ }
}
diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml
index b2e66b2..045d564 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-druid.yml
@@ -6,8 +6,8 @@
druid:
# 涓诲簱鏁版嵁婧�
master:
- url: jdbc:mysql://47.93.189.255:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-# url: jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+# url: jdbc:mysql://47.93.189.255:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ url: jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: ZhangApp123!
# password: 123456
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 c8f998f..f32b01b 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java
@@ -139,6 +139,18 @@
@Excel(name = "鍏ㄧ敓鍛藉懆鏈�", dateFormat = "yyyy-MM-dd")
private Date deadDay;
+ @Excel(name = "鏄熷骇")
+ private String constellation;
+
+ @Excel(name = "寰俊鍙�")
+ private String wxNo;
+
+ @Excel(name = "qq鍙�")
+ private String qqNo;
+
+ @Excel(name = "鐢熻倴")
+ private String shengXiao;
+
/**
* 鍥剧墖鍦板潃
*/
@@ -194,4 +206,6 @@
List<ZInfoUser> childList;
+
+
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZTravelBase.java b/zhang-content/src/main/java/com/ruoyi/domain/ZTravelBase.java
index 2ee9618..e229f1f 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZTravelBase.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZTravelBase.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,138 +20,91 @@
* @since 2023-03-14
*/
@TableName("z_travel_base")
+@Data
public class ZTravelBase implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
- private Integer id;
+ private Long id;
+
+ /**
+ * 瀵瑰簲璐圭敤琛╥d
+ */
+ private String feeId;
/**
* 鍦扮偣
*/
+ @Excel(name = "鍦扮偣")
private String address;
/**
* 鎵�鏈夊弬鍔犳湰娆℃梾琛岀殑浜虹墿锛岀敤閫楀彿闅斿紑
*/
+ @Excel(name = "浜虹墿")
private String people;
/**
* 鏃呰璁板綍鐨勬爣棰�
*/
+ @Excel(name = "鏍囬")
private String title;
/**
* 鏃呮湡
*/
+ @Excel(name = "鏃呮湡")
private String travelPeriod;
/**
* 鎵�鎸佺殑璇佷欢锛屽涓敤閫楀彿闅斿紑
*/
+ @Excel(name = "鎵�鎸佽瘉浠�")
private String certificate;
/**
* 鏈鏃呰鎬昏垂鐢�
*/
+ @Excel(name = "鎬昏垂鐢�")
private Double totalPrice;
/**
* 0锛氬叕璐癸紝1锛氳嚜璐�
*/
- private Integer isSelf;
+ @Excel(name = "鍏垂鎴栬嚜璐�", readConverterExp = "0=鍏垂,1=鑷垂")
+ private Integer self;
/**
* 澶囨敞淇℃伅
*/
+ @Excel(name = "澶囨敞")
private String remark;
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private Date createTime;
- public Integer getId() {
- return id;
- }
+ /**
+ * 鍙戠敓鏃堕棿
+ */
+ @Excel(name = "鏃堕棿", dateFormat = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private Date happenTime;
- public void setId(Integer id) {
- this.id = id;
- }
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @TableField(exist = false)
+ private Date happenStartTime;
- public String getAddress() {
- return address;
- }
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @TableField(exist = false)
+ private Date happenEndTime;
- public void setAddress(String address) {
- this.address = address;
- }
+ /**
+ * 鐢靛瓙鏂囦欢璺緞
+ */
+ private String url;
- public String getPeople() {
- return people;
- }
-
- public void setPeople(String people) {
- this.people = people;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getTravelPeriod() {
- return travelPeriod;
- }
-
- public void setTravelPeriod(String travelPeriod) {
- this.travelPeriod = travelPeriod;
- }
-
- public String getCertificate() {
- return certificate;
- }
-
- public void setCertificate(String certificate) {
- this.certificate = certificate;
- }
-
- public Double getTotalPrice() {
- return totalPrice;
- }
-
- public void setTotalPrice(Double totalPrice) {
- this.totalPrice = totalPrice;
- }
-
- public Integer getIsSelf() {
- return isSelf;
- }
-
- public void setIsSelf(Integer isSelf) {
- this.isSelf = isSelf;
- }
-
- public String getRemark() {
- return remark;
- }
-
- public void setRemark(String remark) {
- this.remark = remark;
- }
-
- @Override
- public String toString() {
- return "ZTravelBase{" +
- "id=" + id +
- ", address=" + address +
- ", people=" + people +
- ", title=" + title +
- ", travelPeriod=" + travelPeriod +
- ", certificate=" + certificate +
- ", totalPrice=" + totalPrice +
- ", isSelf=" + isSelf +
- ", remark=" + remark +
- "}";
- }
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZTravelPrice.java b/zhang-content/src/main/java/com/ruoyi/domain/ZTravelPrice.java
index 3702660..1c9fa31 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZTravelPrice.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZTravelPrice.java
@@ -1,10 +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 lombok.Data;
+
import java.io.Serializable;
import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.List;
/**
* <p>
@@ -15,17 +21,14 @@
* @since 2023-03-14
*/
@TableName("z_travel_price")
+@Data
public class ZTravelPrice implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
- private Integer id;
+ private String id;
- /**
- * 鏈鏃呰鐨刬d
- */
- private Integer travelId;
/**
* 椁愯垂
@@ -53,86 +56,62 @@
private Double shopping;
/**
- * 娑堣垂鏃ユ湡
+ * 璧峰鏃ユ湡
*/
- private LocalDateTime consumeDate;
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date startTime;
+
+ /**
+ * 缁撴潫鏃ユ湡
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date endTime;
+
+ /**
+ * 鍒涘缓鏃ユ湡
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date createTime;
+
+ /**
+ * 鎬诲ぉ鏁�
+ */
+ private Integer totalDay;
+
+ /**
+ * 鏍囬
+ */
+ private String title;
+
+ /**
+ * 鎬婚噾棰�
+ */
+ private Double totalCost;
+
+ /**
+ * 鎵�灞炵敤鎴穒d
+ */
+ private Long myId;
+
+ /**
+ * 璧峰鏃堕棿鎼滅储浼犲叆
+ */
+ @TableField(exist = false)
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date start;
+
+ /**
+ * 缁撴潫鏃堕棿鎼滅储浼犲叆
+ */
+ @TableField(exist = false)
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date end;
+
+ /**
+ * 璐圭敤璇︾粏璁板綍琛�
+ */
+ @TableField(exist = false)
+ private List<ZTravelPriceDetail> detailList;
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Integer getTravelId() {
- return travelId;
- }
-
- public void setTravelId(Integer travelId) {
- this.travelId = travelId;
- }
-
- public Double getEat() {
- return eat;
- }
-
- public void setEat(Double eat) {
- this.eat = eat;
- }
-
- public Double getStay() {
- return stay;
- }
-
- public void setStay(Double stay) {
- this.stay = stay;
- }
-
- public Double getTraffic() {
- return traffic;
- }
-
- public void setTraffic(Double traffic) {
- this.traffic = traffic;
- }
-
- public Double getEntrance() {
- return entrance;
- }
-
- public void setEntrance(Double entrance) {
- this.entrance = entrance;
- }
-
- public Double getShopping() {
- return shopping;
- }
-
- public void setShopping(Double shopping) {
- this.shopping = shopping;
- }
-
- public LocalDateTime getConsumeDate() {
- return consumeDate;
- }
-
- public void setConsumeDate(LocalDateTime consumeDate) {
- this.consumeDate = consumeDate;
- }
-
- @Override
- public String toString() {
- return "ZTravelPrice{" +
- "id=" + id +
- ", travelId=" + travelId +
- ", eat=" + eat +
- ", stay=" + stay +
- ", traffic=" + traffic +
- ", entrance=" + entrance +
- ", shopping=" + shopping +
- ", consumeDate=" + consumeDate +
- "}";
- }
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZTravelPriceDetail.java b/zhang-content/src/main/java/com/ruoyi/domain/ZTravelPriceDetail.java
new file mode 100644
index 0000000..931c1ad
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZTravelPriceDetail.java
@@ -0,0 +1,77 @@
+package com.ruoyi.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-05-27 17:33
+ * @Version 1.0.0
+ **/
+
+@Data
+public class ZTravelPriceDetail {
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 瀵瑰簲鏃呮父璐圭敤璁板綍id
+ */
+ private String feeId;
+
+
+ /**
+ * 椁愯垂
+ */
+ private Double eat;
+
+ /**
+ * 浣忓璐�
+ */
+ private Double stay;
+
+ /**
+ * 浜ら�氬嚭琛岀殑璐圭敤
+ */
+ private Double traffic;
+
+ /**
+ * 闂ㄧエ璐圭敤
+ */
+ private Double entrance;
+
+ /**
+ * 璐墿璐圭敤
+ */
+ private Double shopping ;
+
+ /**
+ * 姣忔棩閲戦
+ */
+ private Double dayCost;
+
+ /**
+ * 鎬婚噾棰�
+ */
+ private Double totalCost;
+
+
+ /**
+ * 娑堣垂鏃ユ湡
+ */
+ private String happenTime;
+
+ /**
+ * 鍐呭
+ */
+ private String content;
+
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfRelation.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfRelation.java
index a453668..5e4f54f 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfRelation.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfRelation.java
@@ -22,7 +22,13 @@
private Long myId;
- private Long otherId;
-
private String relation;
+
+ private String otherName;
+
+ private String otherUnit;
+
+ private String otherPosition;
+
+ private String otherPolitical;
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/PriceDto.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/PriceDto.java
new file mode 100644
index 0000000..d247810
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/PriceDto.java
@@ -0,0 +1,34 @@
+package com.ruoyi.domain.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.domain.ZTravelPriceDetail;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-05-27 19:03
+ * @Version 1.0.0
+ **/
+
+@Data
+public class PriceDto implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String id;
+
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date startTime;
+
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date endTime;
+
+ private String title;
+
+ private List<ZTravelPriceDetail> detailList;
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/RelationDto.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/RelationDto.java
new file mode 100644
index 0000000..4b1a321
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/RelationDto.java
@@ -0,0 +1,23 @@
+package com.ruoyi.domain.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-05-29 20:47
+ * @Version 1.0.0
+ **/
+@Data
+public class RelationDto implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private Long otherId;
+ private String otherName;
+ private String otherUnit;
+ private String otherPosition;
+ private String otherPolitical;
+ private String relation;
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZTravelPriceDetailMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZTravelPriceDetailMapper.java
new file mode 100644
index 0000000..6e38641
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/mapper/ZTravelPriceDetailMapper.java
@@ -0,0 +1,17 @@
+package com.ruoyi.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.domain.ZTravelPriceDetail;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-05-27 18:52
+ * @Version 1.0.0
+ **/
+
+@Mapper
+public interface ZTravelPriceDetailMapper extends BaseMapper<ZTravelPriceDetail> {
+
+}
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 9803c8e..05b1ac6 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
@@ -6,6 +6,7 @@
import com.ruoyi.domain.dto.EmpowerDto;
import com.ruoyi.domain.dto.Genealogy;
import com.ruoyi.domain.dto.GenealogyExportDto;
+import com.ruoyi.domain.dto.RelationDto;
import java.util.List;
@@ -23,7 +24,7 @@
List<ZInfoUser> selectByCondition(ZInfoUser zInfoUser);
- AjaxResult searchMyRelation(Long userId);
+ AjaxResult searchMyRelation();
AjaxResult addRelation(ZfRelation zfRelation);
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZTravelBaseService.java b/zhang-content/src/main/java/com/ruoyi/service/ZTravelBaseService.java
index 317d882..e1731e7 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZTravelBaseService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZTravelBaseService.java
@@ -2,7 +2,11 @@
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZTravelBase;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
/**
* <p>
@@ -14,4 +18,11 @@
*/
public interface ZTravelBaseService extends IService<ZTravelBase> {
+ AjaxResult selectDataList(String fid, ZTravelBase zTravelBase, Integer pageNum, Integer pageSize);
+
+ List<ZTravelBase> selectByIds(Long[] ids);
+
+ AjaxResult mySave(ZTravelBase zTravelBase);
+
+ AjaxResult importExcel(MultipartFile file);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceDetailService.java b/zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceDetailService.java
new file mode 100644
index 0000000..394b430
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceDetailService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.domain.ZTravelPrice;
+import com.ruoyi.domain.ZTravelPriceDetail;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-05-27 18:52
+ * @Version 1.0.0
+ **/
+
+public interface ZTravelPriceDetailService extends IService<ZTravelPriceDetail> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceService.java b/zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceService.java
index 44a06b3..bbca279 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceService.java
@@ -2,7 +2,13 @@
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZTravelPrice;
+import com.ruoyi.domain.ZTravelPrice;
+import com.ruoyi.domain.dto.PriceDto;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
/**
* <p>
@@ -14,4 +20,19 @@
*/
public interface ZTravelPriceService extends IService<ZTravelPrice> {
+ AjaxResult selectDataList(ZTravelPrice zTravelPrice, Integer pageNum, Integer pageSize);
+
+ AjaxResult mySave(PriceDto priceDto);
+
+// AjaxResult importExcel(MultipartFile file);
+
+ List<ZTravelPrice> selectCondition(ZTravelPrice zTravelPrice);
+
+ List<ZTravelPrice> selectByIds(Long[] ids);
+
+ AjaxResult myUpdate(PriceDto priceDto);
+
+ AjaxResult myRemove(String[] ids);
+
+// AjaxResult importExcel(MultipartFile file);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorServiceImpl.java
index 9c6d40f..11f3312 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorServiceImpl.java
@@ -98,7 +98,7 @@
@Override
public List<ZHonor> selectByIds(Long[] ids) {
List<ZHonor> list = new ArrayList<>();
- if(ids.length!=0)
+ if(!(ids==null||ids.length==0))
list = listByIds(Arrays.asList(ids));
else
list = list();
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 5db6910..6e8139c 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
@@ -15,10 +15,7 @@
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfEvent;
import com.ruoyi.domain.ZfRelation;
-import com.ruoyi.domain.dto.EmpowerDto;
-import com.ruoyi.domain.dto.Genealogy;
-import com.ruoyi.domain.dto.GenealogyExportDto;
-import com.ruoyi.domain.dto.UserRelationDto;
+import com.ruoyi.domain.dto.*;
import com.ruoyi.mapper.ZInfoUserMapper;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfRelationService;
@@ -45,6 +42,9 @@
@Autowired
private ZfRelationService zfRelationService;
+
+ @Autowired
+ private ZInfoUserService zInfoUserService;
@Override
public AjaxResult selectInfoList(ZInfoUser zInfoUser, Integer pageNum, Integer pageSize) {
@@ -93,55 +93,24 @@
}
@Override
- public AjaxResult searchMyRelation(Long userId) {
+ public AjaxResult searchMyRelation() {
+
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
LambdaQueryWrapper<ZfRelation> lqw = new LambdaQueryWrapper<>();
lqw.eq(ZfRelation::getMyId,userId);
- List<ZfRelation> relationList = zfRelationService.list(lqw);
- ArrayList<UserRelationDto> otherUserList = new ArrayList<>();
-
- relationList.stream().map(
- (relation)->{
- Long otherId = relation.getOtherId();
- ZInfoUser otherUser = getById(otherId);
- UserRelationDto userRelationDto = new UserRelationDto();
- BeanUtils.copyProperties(otherUser,userRelationDto);
- userRelationDto.setRelation(relation.getRelation());
- userRelationDto.setId(relation.getId());
- otherUserList.add(userRelationDto);
- return relation;
- }
- ).collect(Collectors.toList());
-
- return AjaxResult.success(otherUserList);
- }
-
- /**
- * 妫�鏌ヤ紶鍏ュ鏂圭殑id鏄惁瀛樺湪
- * @param zfRelation
- */
- private void checkRelation(ZfRelation zfRelation){
-
- LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>();
- lqw.eq(ZInfoUser::getUserId, zfRelation.getOtherId());
-
- ZInfoUser zInfoUser2 = getOne(lqw);
- if (zInfoUser2==null){
- throw new RuntimeException("瀵规柟鐨刬d涓嶅瓨鍦�");
- }
+ List<ZfRelation> list = zfRelationService.list(lqw);
+ return AjaxResult.success(list);
}
@Override
@Transactional
public AjaxResult addRelation(ZfRelation zfRelation) {
- checkRelation(zfRelation);
-
- //鑾峰彇鑷繁鐨刬d骞朵紶鍏�
SysUser user = SecurityUtils.getLoginUser().getUser();
Long userId = user.getUserId();
zfRelation.setMyId(userId);
-
zfRelationService.save(zfRelation);
return AjaxResult.success();
}
@@ -149,19 +118,14 @@
@Override
@Transactional
public AjaxResult updateRelation(ZfRelation zfRelation) {
- checkRelation(zfRelation);
zfRelationService.updateById(zfRelation);
return AjaxResult.success();
}
@Override
public AjaxResult deleteRelation(Long[] ids) {
- boolean flag = zfRelationService.removeByIds(Arrays.asList(ids));
- if (flag){
- return AjaxResult.success();
- }else {
- return AjaxResult.error();
- }
+ zfRelationService.removeByIds(Arrays.asList(ids));
+ return AjaxResult.success();
}
/**
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelBaseServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelBaseServiceImpl.java
index 051994a..c1af08f 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelBaseServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelBaseServiceImpl.java
@@ -1,10 +1,28 @@
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.*;
+import com.ruoyi.domain.ZTravelBase;
+import com.ruoyi.domain.ZTravelBase;
import com.ruoyi.domain.ZTravelBase;
import com.ruoyi.mapper.ZTravelBaseMapper;
import com.ruoyi.service.ZTravelBaseService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
/**
* <p>
@@ -17,4 +35,98 @@
@Service
public class ZTravelBaseServiceImpl extends ServiceImpl<ZTravelBaseMapper, ZTravelBase> implements ZTravelBaseService {
+ @Autowired
+ ZTravelBaseService zTravelBaseService;
+
+ @Override
+ public AjaxResult selectDataList(String fid, ZTravelBase zTravelBase, Integer pageNum, Integer pageSize) {
+
+ LambdaQueryWrapper<ZTravelBase> lqw = buildCondition(zTravelBase, fid);
+
+ Page<ZTravelBase> pageBean = new Page<>(pageNum, pageSize);
+ Page<ZTravelBase> pageResult = page(pageBean, lqw);
+
+ List<ZTravelBase> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+
+ HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords);
+ return AjaxResult.success(data);
+
+ }
+
+ @Override
+ public List<ZTravelBase> selectByIds(Long[] ids) {
+ List<ZTravelBase> list = new ArrayList<>();
+ if(ids.length!=0)
+ list = listByIds(Arrays.asList(ids));
+ else
+ list = list();
+ return list;
+ }
+
+ @Override
+ public AjaxResult mySave(ZTravelBase zTravelBase) {
+
+ //妫�鏌ユ槸鍚︽湁閲嶅鏁版嵁鎻掑叆
+ LambdaQueryWrapper<ZTravelBase> lqw = uniqueCondition(zTravelBase);
+ List<ZTravelBase> list = list(lqw);
+ if(list.size()>0){
+ throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+ }
+
+ if (save(zTravelBase)) {
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+ }
+
+ @Override
+ public AjaxResult importExcel(MultipartFile file) {
+
+ ExcelUtil<ZTravelBase> util = new ExcelUtil<>(ZTravelBase.class);
+ List<ZTravelBase> dataList = null;
+ try {
+ dataList = util.importExcel(file.getInputStream());
+ } catch (Exception e) {
+ throw new RuntimeException("娌℃湁鎸夌収瑙勫垯瀵煎叆鏁版嵁");
+ }
+
+ assert dataList != null;
+
+ for (ZTravelBase zTravelBase : dataList) {
+ zTravelBaseService.mySave(zTravelBase);
+ }
+
+ return AjaxResult.success();
+
+
+
+ }
+
+ private LambdaQueryWrapper<ZTravelBase> uniqueCondition(ZTravelBase zTravelBase) {
+ LambdaQueryWrapper<ZTravelBase> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(zTravelBase.getFeeId()!=null,ZTravelBase::getFeeId,zTravelBase.getFeeId())
+ .eq(StringUtils.isNotEmpty(zTravelBase.getAddress()),ZTravelBase::getAddress,zTravelBase.getAddress())
+ .eq(StringUtils.isNotEmpty(zTravelBase.getPeople()),ZTravelBase::getPeople,zTravelBase.getPeople())
+ .eq(StringUtils.isNotEmpty(zTravelBase.getTitle()),ZTravelBase::getTitle,zTravelBase.getTitle())
+ .eq(StringUtils.isNotEmpty(zTravelBase.getTravelPeriod()),ZTravelBase::getTravelPeriod,zTravelBase.getTravelPeriod())
+ .eq(StringUtils.isNotEmpty(zTravelBase.getCertificate()),ZTravelBase::getCertificate,zTravelBase.getCertificate())
+ .eq(StringUtils.isNotEmpty(zTravelBase.getRemark()),ZTravelBase::getRemark,zTravelBase.getRemark())
+ .eq(zTravelBase.getTotalPrice()!=null,ZTravelBase::getTotalPrice,zTravelBase.getTotalPrice())
+ .eq(zTravelBase.getSelf()!=null,ZTravelBase::getSelf,zTravelBase.getSelf());
+ return lqw;
+
+
+ }
+
+ private LambdaQueryWrapper<ZTravelBase> buildCondition(ZTravelBase zTravelBase, String fid) {
+ LambdaQueryWrapper<ZTravelBase> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZTravelBase::getFeeId,fid)
+ .between(zTravelBase.getHappenStartTime()!=null && zTravelBase.getHappenEndTime()!=null,ZTravelBase::getHappenTime,zTravelBase.getHappenStartTime(),zTravelBase.getHappenEndTime())
+ .like(StringUtils.isNotEmpty(zTravelBase.getAddress()),ZTravelBase::getAddress,zTravelBase.getAddress())
+ .like(StringUtils.isNotEmpty(zTravelBase.getPeople()),ZTravelBase::getPeople,zTravelBase.getPeople())
+ .like(StringUtils.isNotEmpty(zTravelBase.getTitle()),ZTravelBase::getTitle,zTravelBase.getTitle());
+ lqw.orderByDesc(ZTravelBase::getCreateTime);
+ return lqw;
+ }
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceDetailServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceDetailServiceImpl.java
new file mode 100644
index 0000000..cc36f63
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceDetailServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.domain.ZTravelPrice;
+import com.ruoyi.domain.ZTravelPriceDetail;
+import com.ruoyi.mapper.ZTravelPriceDetailMapper;
+import com.ruoyi.service.ZTravelPriceDetailService;
+import com.ruoyi.service.ZTravelPriceService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author Jinquan_Ou
+ * @Description
+ * @Date 2023-05-27 18:53
+ * @Version 1.0.0
+ **/
+@Service
+public class ZTravelPriceDetailServiceImpl extends ServiceImpl<ZTravelPriceDetailMapper, ZTravelPriceDetail> implements ZTravelPriceDetailService {
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceServiceImpl.java
index 58c7334..64f1393 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceServiceImpl.java
@@ -1,15 +1,37 @@
package com.ruoyi.service.impl;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+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.common.utils.uuid.IdUtils;
+import com.ruoyi.domain.ZTravelBase;
import com.ruoyi.domain.ZTravelPrice;
+import com.ruoyi.domain.ZTravelPrice;
+import com.ruoyi.domain.ZTravelPriceDetail;
+import com.ruoyi.domain.dto.PriceDto;
import com.ruoyi.mapper.ZTravelPriceMapper;
+import com.ruoyi.service.ZTravelBaseService;
+import com.ruoyi.service.ZTravelPriceDetailService;
import com.ruoyi.service.ZTravelPriceService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.*;
+import java.util.stream.Collectors;
/**
* <p>
- * 鏈嶅姟瀹炵幇绫�
+ * 鏈嶅姟瀹炵幇绫�
* </p>
*
* @author ojq
@@ -18,4 +40,323 @@
@Service
public class ZTravelPriceServiceImpl extends ServiceImpl<ZTravelPriceMapper, ZTravelPrice> implements ZTravelPriceService {
+ @Autowired
+ ZTravelPriceServiceImpl zTravelPriceService;
+
+ @Autowired
+ ZTravelPriceDetailService zTravelPriceDetailService;
+
+ @Autowired
+ ZTravelBaseService zTravelBaseService;
+
+// private LambdaQueryWrapper<ZTravelPrice> uniqueCondition(ZTravelPrice zTravelPrice){
+// LambdaQueryWrapper<ZTravelPrice> lqw = new LambdaQueryWrapper<>();
+// lqw.eq(zTravelPrice.getMyId()!=null,ZTravelPrice::getMyId,zTravelPrice.getMyId())
+// .eq(zTravelPrice.getStartTime()!=null,ZTravelPrice::getStartTime,zTravelPrice.getStartTime())
+// .eq(zTravelPrice.getEndTime()!=null,ZTravelPrice::getEndTime,zTravelPrice.getEndTime())
+// .eq(zTravelPrice.getTotalDay()!=null,ZTravelPrice::getTotalDay,zTravelPrice.getTotalDay())
+// .eq(StringUtils.isNotEmpty(zTravelPrice.getTitle()),ZTravelPrice::getTitle,zTravelPrice.getTitle());
+//// .eq(zTravelPrice.getEat()!=null,ZTravelPrice::getEat,zTravelPrice.getEat())
+//// .eq(zTravelPrice.getStay()!=null,ZTravelPrice::getStay,zTravelPrice.getStay())
+//// .eq(zTravelPrice.getTraffic()!=null,ZTravelPrice::getTraffic,zTravelPrice.getTraffic())
+//// .eq(zTravelPrice.getShopping()!=null,ZTravelPrice::getShopping,zTravelPrice.getShopping());
+// return lqw;
+// }
+
+ private LambdaQueryWrapper<ZTravelPrice> buildCondition(ZTravelPrice zTravelPrice, Long userId) {
+ LambdaQueryWrapper<ZTravelPrice> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZTravelPrice::getMyId, userId)
+ .eq(zTravelPrice.getTotalDay() != null, ZTravelPrice::getTotalDay, zTravelPrice.getTotalDay())
+ .le(zTravelPrice.getEnd() != null, ZTravelPrice::getEndTime, zTravelPrice.getEnd())
+ .ge(zTravelPrice.getStart() != null, ZTravelPrice::getStartTime, zTravelPrice.getStart());
+
+ lqw.orderBy(true, true, ZTravelPrice::getStartTime);
+ return lqw;
+ }
+
+ /**
+ * 鍒嗛〉鏌ユ壘
+ */
+ @Override
+ public AjaxResult selectDataList(ZTravelPrice zTravelPrice, Integer pageNum, Integer pageSize) {
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+ LambdaQueryWrapper<ZTravelPrice> lqw = buildCondition(zTravelPrice, userId);
+
+ Page<ZTravelPrice> pageBean = new Page<>(pageNum, pageSize);
+ Page<ZTravelPrice> pageResult = page(pageBean, lqw);
+
+ List<ZTravelPrice> priceList = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+
+ //鏌ヨ璐圭敤璇︽儏
+ for (ZTravelPrice price : priceList) {
+ LambdaQueryWrapper<ZTravelPriceDetail> detailLqw = new LambdaQueryWrapper<>();
+ detailLqw.eq(ZTravelPriceDetail::getFeeId,price.getId());
+ List<ZTravelPriceDetail> detailList = zTravelPriceDetailService.list(detailLqw);
+ price.setDetailList(detailList);
+ }
+
+ HashMap<String, Object> data = MapUtils.getResult(pageResult, priceList);
+ return AjaxResult.success(data);
+
+ }
+
+ @Override
+ public List<ZTravelPrice> selectCondition(ZTravelPrice zTravelPrice) {
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+ LambdaQueryWrapper<ZTravelPrice> lqw = buildCondition(zTravelPrice, userId);
+ return list(lqw);
+ }
+
+ @Override
+ public List<ZTravelPrice> selectByIds(Long[] ids) {
+ List<ZTravelPrice> list = new ArrayList<>();
+ if (ids.length != 0)
+ list = listByIds(Arrays.asList(ids));
+ else
+ list = list();
+ return list;
+ }
+
+
+ @Override
+ @Transactional
+ public AjaxResult mySave(PriceDto priceDto) {
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+
+ List<ZTravelPriceDetail> detailList = priceDto.getDetailList();
+
+ //鐢熸垚璐圭敤琛╥d
+ String priceId = IdUtils.fastSimpleUUID();
+
+ //寰楀埌鎬诲ぉ鏁�
+ long count = detailList.stream().map(ZTravelPriceDetail::getHappenTime).distinct().count();
+ Integer totalDay = Math.toIntExact(count);
+
+
+ //鍏堟彃鍏ユ槑缁嗚〃
+
+ //collectList杩樻病鏈夋坊鍔犳瘡鏃ラ噾棰濆瓧娈�
+ List<ZTravelPriceDetail> collectList = detailList.stream().peek((priceDetail) ->
+ {
+ priceDetail.setFeeId(priceId);
+ if (priceDetail.getEat() == null || priceDetail.getStay() == null || priceDetail.getTraffic() == null || priceDetail.getEntrance() == null || priceDetail.getShopping() == null) {
+ throw new RuntimeException("濡傛灉娌℃湁瀵瑰簲鐨勮垂鐢紝鍓嶇瑕佷紶涓�0杩囨潵");
+ }
+ Double totalCost = priceDetail.getEat() + priceDetail.getStay() + priceDetail.getTraffic() + priceDetail.getEntrance() + priceDetail.getShopping();
+ priceDetail.setTotalCost(totalCost);
+ }).collect(Collectors.toList());
+
+
+ //鎸夋棩鏈熷垎缁�
+ Map<String, List<ZTravelPriceDetail>> groupByTimeMap = collectList.stream().collect(Collectors.groupingBy(ZTravelPriceDetail::getHappenTime));
+
+ //灏嗘瘡鏃ラ噾棰濆瓧娈电殑鍊间篃娣诲姞涓�
+ for (String key : groupByTimeMap.keySet()) {
+ List<ZTravelPriceDetail> groupByTimeList = groupByTimeMap.get(key);
+ Double dayTotalCost = 0d;
+ for (ZTravelPriceDetail detail : groupByTimeList) {
+ dayTotalCost += detail.getTotalCost();
+ }
+
+ for (ZTravelPriceDetail detail : groupByTimeList){
+ detail.setDayCost(dayTotalCost);
+ }
+ }
+
+ //寮�濮嬫彃鍏ヨ垂鐢ㄨ鎯呮暟鎹�
+ for (String key : groupByTimeMap.keySet()) {
+ List<ZTravelPriceDetail> dataList = groupByTimeMap.get(key);
+ for (ZTravelPriceDetail detail : dataList) {
+ zTravelPriceDetailService.save(detail);
+ }
+ }
+
+
+ //鍐嶆彃鍏ヨ垂鐢ㄨ褰曠粺璁¤〃
+
+ //鍏堝緱鍒板悇涓鎯呰垂鐢ㄧ殑鎬诲拰
+ Double eatTotal = 0d;
+ Double stayTotal = 0d;
+ Double trafficTotal = 0d;
+ Double entranceTotal = 0d;
+ Double shoppingTotal = 0d;
+ Double totalFee = 0d;
+
+ for (String key : groupByTimeMap.keySet()) {
+ List<ZTravelPriceDetail> dataList = groupByTimeMap.get(key);
+ for (ZTravelPriceDetail priceDetail : dataList) {
+ if (priceDetail.getEat() == null || priceDetail.getStay() == null || priceDetail.getTraffic() == null || priceDetail.getEntrance() == null || priceDetail.getShopping() == null) {
+ throw new RuntimeException("濡傛灉娌℃湁瀵瑰簲鐨勮垂鐢紝鍓嶇瑕佷紶涓�0杩囨潵");
+ }
+ eatTotal+=priceDetail.getEat();
+ stayTotal+=priceDetail.getStay();
+ trafficTotal+=priceDetail.getTraffic();
+ entranceTotal+=priceDetail.getEntrance();
+ shoppingTotal+=priceDetail.getShopping();
+ totalFee+=priceDetail.getTotalCost();
+ }
+ }
+
+ ZTravelPrice zTravelPrice = new ZTravelPrice();
+ zTravelPrice.setId(priceId);
+ zTravelPrice.setStartTime(priceDto.getStartTime());
+ zTravelPrice.setEndTime(priceDto.getEndTime());
+ zTravelPrice.setTotalDay(totalDay);
+ zTravelPrice.setTitle(priceDto.getTitle());
+ zTravelPrice.setEat(eatTotal);
+ zTravelPrice.setStay(stayTotal);
+ zTravelPrice.setTraffic(trafficTotal);
+ zTravelPrice.setEntrance(entranceTotal);
+ zTravelPrice.setShopping(shoppingTotal);
+ zTravelPrice.setTotalCost(totalFee);
+ zTravelPrice.setMyId(userId);
+
+ //鎻掑叆璐圭敤璁板綍缁熻
+ zTravelPriceService.save(zTravelPrice);
+
+ return AjaxResult.success();
+
+ }
+
+ @Override
+ public AjaxResult myUpdate(PriceDto priceDto) {
+
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+
+ List<ZTravelPriceDetail> detailList = priceDto.getDetailList();
+
+ //寰楀埌鎬诲ぉ鏁�
+ long count = detailList.stream().map(ZTravelPriceDetail::getHappenTime).distinct().count();
+ Integer totalDay = Math.toIntExact(count);
+
+ List<ZTravelPriceDetail> collectList = detailList.stream().peek((priceDetail) ->
+ {
+ if (priceDetail.getEat() == null || priceDetail.getStay() == null || priceDetail.getTraffic() == null || priceDetail.getEntrance() == null || priceDetail.getShopping() == null) {
+ throw new RuntimeException("濡傛灉娌℃湁瀵瑰簲鐨勮垂鐢紝鍓嶇瑕佷紶涓�0杩囨潵");
+ }
+ Double totalCost = priceDetail.getEat() + priceDetail.getStay() + priceDetail.getTraffic() + priceDetail.getEntrance() + priceDetail.getShopping();
+ priceDetail.setTotalCost(totalCost);
+ }).collect(Collectors.toList());
+
+ //鎸夋棩鏈熷垎缁�
+ Map<String, List<ZTravelPriceDetail>> groupByTimeMap = collectList.stream().collect(Collectors.groupingBy(ZTravelPriceDetail::getHappenTime));
+
+ //灏嗘瘡鏃ラ噾棰濆瓧娈电殑鍊间篃娣诲姞涓�
+ for (String key : groupByTimeMap.keySet()) {
+ List<ZTravelPriceDetail> groupByTimeList = groupByTimeMap.get(key);
+ Double dayTotalCost = 0d;
+ for (ZTravelPriceDetail detail : groupByTimeList) {
+ dayTotalCost += detail.getTotalCost();
+ }
+
+ for (ZTravelPriceDetail detail : groupByTimeList){
+ detail.setDayCost(dayTotalCost);
+ }
+ }
+
+ //寮�濮嬩慨鏀硅垂鐢ㄨ鎯呮暟鎹�
+ for (String key : groupByTimeMap.keySet()) {
+ List<ZTravelPriceDetail> dataList = groupByTimeMap.get(key);
+ for (ZTravelPriceDetail detail : dataList) {
+ zTravelPriceDetailService.updateById(detail);
+ }
+ }
+
+ //鍐嶄慨鏀硅垂鐢ㄨ褰曠粺璁¤〃
+
+ //鍏堝緱鍒板悇涓鎯呰垂鐢ㄧ殑鎬诲拰
+ Double eatTotal = 0d;
+ Double stayTotal = 0d;
+ Double trafficTotal = 0d;
+ Double entranceTotal = 0d;
+ Double shoppingTotal = 0d;
+ Double totalFee = 0d;
+
+ for (String key : groupByTimeMap.keySet()) {
+ List<ZTravelPriceDetail> dataList = groupByTimeMap.get(key);
+ for (ZTravelPriceDetail priceDetail : dataList) {
+ if (priceDetail.getEat() == null || priceDetail.getStay() == null || priceDetail.getTraffic() == null || priceDetail.getEntrance() == null || priceDetail.getShopping() == null) {
+ throw new RuntimeException("濡傛灉娌℃湁瀵瑰簲鐨勮垂鐢紝鍓嶇瑕佷紶涓�0杩囨潵");
+ }
+ eatTotal+=priceDetail.getEat();
+ stayTotal+=priceDetail.getStay();
+ trafficTotal+=priceDetail.getTraffic();
+ entranceTotal+=priceDetail.getEntrance();
+ shoppingTotal+=priceDetail.getShopping();
+ totalFee+=priceDetail.getTotalCost();
+ }
+ }
+
+ ZTravelPrice zTravelPrice = new ZTravelPrice();
+ zTravelPrice.setId(priceDto.getId());
+ zTravelPrice.setStartTime(priceDto.getStartTime());
+ zTravelPrice.setEndTime(priceDto.getEndTime());
+ zTravelPrice.setTotalDay(totalDay);
+ zTravelPrice.setTitle(priceDto.getTitle());
+ zTravelPrice.setEat(eatTotal);
+ zTravelPrice.setStay(stayTotal);
+ zTravelPrice.setTraffic(trafficTotal);
+ zTravelPrice.setEntrance(entranceTotal);
+ zTravelPrice.setShopping(shoppingTotal);
+ zTravelPrice.setTotalCost(totalFee);
+ zTravelPrice.setMyId(userId);
+
+ //淇敼缁熻琛�
+ zTravelPriceService.updateById(zTravelPrice);
+
+ return AjaxResult.success();
+
+
+ }
+
+ @Override
+ @Transactional
+ public AjaxResult myRemove(String[] ids) {
+
+ for (String feeId : ids) {
+ //鍒犻櫎鏃呮父缁忓巻
+ zTravelBaseService.remove(new LambdaQueryWrapper<ZTravelBase>().eq(ZTravelBase::getFeeId,feeId));
+
+ //鍒犻櫎璐圭敤璇︽儏
+ zTravelPriceDetailService.remove(new LambdaQueryWrapper<ZTravelPriceDetail>().eq(ZTravelPriceDetail::getFeeId,feeId));
+
+ //鍒犻櫎璐圭敤璁板綍
+ zTravelPriceService.remove(new LambdaQueryWrapper<ZTravelPrice>().eq(ZTravelPrice::getId,feeId));
+ }
+
+ return AjaxResult.success();
+
+ }
+
+// @Override
+// public AjaxResult importExcel(MultipartFile file) {
+//
+// }
+
+
+// @Override
+// @Transactional
+// public AjaxResult importExcel(MultipartFile file) {
+//
+// ExcelUtil<ZTravelPrice> util = new ExcelUtil<>(ZTravelPrice.class);
+// List<ZTravelPrice> dataList = null;
+// try {
+// dataList = util.importExcel(file.getInputStream());
+// } catch (Exception e) {
+// throw new RuntimeException("娌℃湁鎸夌収瑙勫垯瀵煎叆鏁版嵁");
+// }
+//
+// assert dataList != null;
+//
+// for (ZTravelPrice zTravelPrice : dataList) {
+// zTravelPriceService.mySave(zTravelPrice);
+// }
+//
+// return AjaxResult.success();
+//
+// }
}
--
Gitblit v1.9.1