From 801956f3b52d092e88d6c85b809383a1c1f71a05 Mon Sep 17 00:00:00 2001
From: jiaosong <jiaosong6760@dingtalk.com>
Date: 星期二, 10 十月 2023 08:59:51 +0800
Subject: [PATCH] #pgsql 基础配置 字段值跟新上传
---
server/services/src/main/java/com/doumee/dao/business/model/PricingDetail.java | 8 +
server/platform/src/main/java/com/doumee/api/business/BaseParamController.java | 5
server/services/src/main/java/com/doumee/dao/business/model/PricingParam.java | 2
server/services/src/main/java/com/doumee/service/business/impl/BaseParamServiceImpl.java | 57 +++++++
server/services/src/main/java/com/doumee/dao/business/model/BaseParam.java | 7 +
server/services/src/main/java/com/doumee/service/business/PricingParamService.java | 6
server/services/src/main/java/com/doumee/service/business/impl/MemberRidesServiceImpl.java | 45 ++++++
server/services/src/main/java/com/doumee/dao/business/web/response/BikeLogDTO.java | 56 ++++++++
server/services/src/main/java/com/doumee/dao/business/join/PricingDetailJoinMapper.java | 13 +
server/services/src/main/java/com/doumee/dao/business/web/response/MemberRidesQuery.java | 3
server/services/src/main/java/com/doumee/service/business/impl/PricingDetailServiceImpl.java | 67 +++++++++
server/services/src/main/java/com/doumee/service/business/MemberRidesService.java | 10 +
server/services/src/main/java/com/doumee/dao/business/web/response/MiniProgrammeDTO.java | 57 ++++++++
server/services/src/main/java/com/doumee/service/business/impl/PricingParamServiceImpl.java | 32 ++++
14 files changed, 355 insertions(+), 13 deletions(-)
diff --git a/server/platform/src/main/java/com/doumee/api/business/BaseParamController.java b/server/platform/src/main/java/com/doumee/api/business/BaseParamController.java
index d2dd2b2..1afb6df 100644
--- a/server/platform/src/main/java/com/doumee/api/business/BaseParamController.java
+++ b/server/platform/src/main/java/com/doumee/api/business/BaseParamController.java
@@ -10,8 +10,9 @@
import com.doumee.service.business.BaseParamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@@ -34,7 +35,7 @@
@ApiOperation("鏂板缓")
@PostMapping("/create")
@RequiresPermissions("business:baseparam:create")
- public ApiResponse create(@RequestBody BaseParam baseParam) {
+ public ApiResponse create(@RequestBody @Validated BaseParam baseParam) {
return ApiResponse.success(baseParamService.create(baseParam));
}
diff --git a/server/services/src/main/java/com/doumee/dao/business/join/PricingDetailJoinMapper.java b/server/services/src/main/java/com/doumee/dao/business/join/PricingDetailJoinMapper.java
new file mode 100644
index 0000000..a4e0568
--- /dev/null
+++ b/server/services/src/main/java/com/doumee/dao/business/join/PricingDetailJoinMapper.java
@@ -0,0 +1,13 @@
+package com.doumee.dao.business.join;
+
+import com.doumee.dao.business.model.PricingDetail;
+import com.github.yulichang.base.mapper.MPJJoinMapper;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @author T14
+ */
+@Repository
+public interface PricingDetailJoinMapper extends MPJJoinMapper<PricingDetail> {
+}
diff --git a/server/services/src/main/java/com/doumee/dao/business/model/BaseParam.java b/server/services/src/main/java/com/doumee/dao/business/model/BaseParam.java
index d1d6641..dd0bda3 100644
--- a/server/services/src/main/java/com/doumee/dao/business/model/BaseParam.java
+++ b/server/services/src/main/java/com/doumee/dao/business/model/BaseParam.java
@@ -1,5 +1,6 @@
package com.doumee.dao.business.model;
+import com.baomidou.mybatisplus.annotation.TableLogic;
import com.doumee.core.annotation.excel.ExcelColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -8,6 +9,9 @@
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
import java.util.Date;
/**
@@ -44,10 +48,12 @@
@ApiModelProperty(value = "鏄惁宸插垹闄� 0鏈垹闄� 1宸插垹闄�", example = "1")
@ExcelColumn(name="鏄惁宸插垹闄� 0鏈垹闄� 1宸插垹闄�")
+ @TableLogic
private Integer isdeleted;
@ApiModelProperty(value = "鍚嶇О")
@ExcelColumn(name="鍚嶇О")
+ @NotBlank
private String name;
@ApiModelProperty(value = "鎺掑簭鐮侊紙鍗囧簭锛�", example = "1")
@@ -56,6 +62,7 @@
@ApiModelProperty(value = "绫诲瀷 0杞﹁締淇濅慨鍘熷洜 1寮哄埗杩樿溅鍘熷洜 2鏃堕暱鍑忓厤鍘熷洜 3鍗曡溅绫诲瀷", example = "1")
@ExcelColumn(name="绫诲瀷 0杞﹁締淇濅慨鍘熷洜 1寮哄埗杩樿溅鍘熷洜 2鏃堕暱鍑忓厤鍘熷洜 3鍗曡溅绫诲瀷")
+ @NotEmpty
private Integer type;
@ApiModelProperty(value = "鐘舵�� 0鍚敤 1绂佺敤", example = "1")
diff --git a/server/services/src/main/java/com/doumee/dao/business/model/PricingDetail.java b/server/services/src/main/java/com/doumee/dao/business/model/PricingDetail.java
index b86c513..5ad8dbe 100644
--- a/server/services/src/main/java/com/doumee/dao/business/model/PricingDetail.java
+++ b/server/services/src/main/java/com/doumee/dao/business/model/PricingDetail.java
@@ -1,5 +1,6 @@
package com.doumee.dao.business.model;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -54,8 +55,13 @@
@ExcelColumn(name="杞﹁締绫诲瀷缂栫爜(鍏宠仈bike_types琛級")
private String bikeTypeId;
+ @ApiModelProperty(value = "杞﹁締绫诲瀷缂栫爜(鍏宠仈bike_types琛級")
+ @ExcelColumn(name="杞﹁締绫诲瀷缂栫爜(鍏宠仈bike_types琛級")
+ @TableField(exist = false)
+ private String bikeTypeName;
+
@ApiModelProperty(value = "宸ヤ綔鏃ヨ捣姝ユ椂闂达紙鍒嗛挓锛�", example = "1")
- @ExcelColumn(name="宸ヤ綔鏃ヨ捣姝ユ椂闂达紙鍒嗛挓锛�")
+ @ExcelColumn(name="宸ヤ綔鏃ヨ捣姝ユ椂闂达紙鍒嗛挓锛� -1 琛ㄧず涓�鍙d环")
private Integer baseTime;
@ApiModelProperty(value = "宸ヤ綔鏃ヨ捣姝ヤ环鏍硷紙鍒嗭級", example = "1")
diff --git a/server/services/src/main/java/com/doumee/dao/business/model/PricingParam.java b/server/services/src/main/java/com/doumee/dao/business/model/PricingParam.java
index 1d0f72b..38750a2 100644
--- a/server/services/src/main/java/com/doumee/dao/business/model/PricingParam.java
+++ b/server/services/src/main/java/com/doumee/dao/business/model/PricingParam.java
@@ -1,5 +1,6 @@
package com.doumee.dao.business.model;
+import com.baomidou.mybatisplus.annotation.TableLogic;
import com.doumee.core.annotation.excel.ExcelColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -44,6 +45,7 @@
@ApiModelProperty(value = "鏄惁宸插垹闄� 0鏈垹闄� 1宸插垹闄�", example = "1")
@ExcelColumn(name="鏄惁宸插垹闄� 0鏈垹闄� 1宸插垹闄�")
+ @TableLogic
private Integer isdeleted;
@ApiModelProperty(value = "鍚嶇О")
diff --git a/server/services/src/main/java/com/doumee/dao/business/web/response/BikeLogDTO.java b/server/services/src/main/java/com/doumee/dao/business/web/response/BikeLogDTO.java
new file mode 100644
index 0000000..920336a
--- /dev/null
+++ b/server/services/src/main/java/com/doumee/dao/business/web/response/BikeLogDTO.java
@@ -0,0 +1,56 @@
+package com.doumee.dao.business.web.response;
+
+import com.doumee.core.annotation.excel.ExcelColumn;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author T14
+ */
+@Data
+public class BikeLogDTO {
+
+ @ApiModelProperty(value = "鐢ㄦ埛OpenID")
+ private String openid;
+
+ @ApiModelProperty(value = "杞﹁締缂栧彿")
+ private String bikeCode;
+
+ @ApiModelProperty(value = "杞﹁締绫诲瀷")
+ private String bikeType;
+
+ @ApiModelProperty(value = "绉熻溅绔欑偣缂栫爜")
+ private String rentSiteId;
+
+ @ApiModelProperty(value = "绉熻溅绔欑偣缂栫爜")
+ private String rentSiteName;
+
+ @ApiModelProperty(value = "绉熻溅閿佸ご缂栫爜")
+ private String rentLockId;
+
+ @ApiModelProperty(value = "绉熻溅閿佸ご缂栫爜")
+ private String rentLockName;
+
+ @ApiModelProperty(value = "楠戣鏃堕暱")
+ private Integer rideTime;
+
+ @ApiModelProperty(value = "绉熻溅鏃堕棿")
+ private Date rentDate;
+
+ @ApiModelProperty(value = "杩樿溅绔欑偣缂栫爜")
+ private String backSiteId;
+
+ @ApiModelProperty(value = "杩樿溅绔欑偣缂栫爜")
+ private String backSiteName;
+
+ @ApiModelProperty(value = "杩樿溅閿佸ご缂栫爜")
+ private String backLockId;
+
+ @ApiModelProperty(value = "杩樿溅閿佸ご缂栫爜")
+ private String backLockName;
+
+ @ApiModelProperty(value = "杩樿溅鏃堕棿")
+ private Date backDate;
+}
diff --git a/server/services/src/main/java/com/doumee/dao/business/web/response/MemberRidesQuery.java b/server/services/src/main/java/com/doumee/dao/business/web/response/MemberRidesQuery.java
index 4dd6e27..fd1b7f6 100644
--- a/server/services/src/main/java/com/doumee/dao/business/web/response/MemberRidesQuery.java
+++ b/server/services/src/main/java/com/doumee/dao/business/web/response/MemberRidesQuery.java
@@ -26,4 +26,7 @@
@ApiModelProperty(value = "鍊熷嚭鏃堕棿缁撴潫")
private Date rentDateEnd;
+
+ @ApiModelProperty(value = "鏄惁褰掕繕 [杞﹁締鍙栬繕璁板綍(绔欑偣) 鍏ュ弬]")
+ private Boolean hasBack;
}
diff --git a/server/services/src/main/java/com/doumee/dao/business/web/response/MiniProgrammeDTO.java b/server/services/src/main/java/com/doumee/dao/business/web/response/MiniProgrammeDTO.java
new file mode 100644
index 0000000..dd4f919
--- /dev/null
+++ b/server/services/src/main/java/com/doumee/dao/business/web/response/MiniProgrammeDTO.java
@@ -0,0 +1,57 @@
+package com.doumee.dao.business.web.response;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author T14
+ */
+@Data
+public class MiniProgrammeDTO {
+
+ @ApiModelProperty("涓婚〉涓婚")
+ private String projectName;
+
+ @ApiModelProperty("鏈嶅姟鐢佃瘽")
+ private String serverPhone;
+
+ @ApiModelProperty("鎶奸噾閲戦")
+ private String rentDeposit;
+
+ @ApiModelProperty("钀ヤ笟鏃堕棿璧峰")
+ private String businessStarttime;
+
+ @ApiModelProperty("钀ヤ笟鏃堕棿缁撴潫")
+ private String businessEndtime;
+
+ @ApiModelProperty("鍏嶈垂楠戣鏃堕暱")
+ private String freeRentTime;
+
+ @ApiModelProperty("婊¤冻棰勮鏈�灏忓��")
+ private String warnMin;
+
+ @ApiModelProperty("婊¤冻棰勮鏈�澶у��")
+ private String warnMax;
+
+ @ApiModelProperty("灏忕▼搴忛璀﹂拤閽夌兢鍦板潃")
+ private String warnDingdingUrl;
+
+ @ApiModelProperty("绉熻祦娴佺▼瑙嗛")
+ private String rentTipsVideo;
+
+ @ApiModelProperty("楠戣溅閫氱煡鍐呭")
+ private String rentNotice;
+
+ @ApiModelProperty("鏄惁鍋滄鏈嶅姟")
+ private String isStopServe;
+
+ @ApiModelProperty("鍋滄鏈嶅姟鎻愮ず")
+ private String stopServeTips;
+
+
+ @ApiModelProperty("鍋滄鏈嶅姟寮�濮�")
+ private String stopServeStarttime;
+
+ @ApiModelProperty("鍋滄鏈嶅姟缁撴潫")
+ private String stopServeEndtime;
+}
diff --git a/server/services/src/main/java/com/doumee/service/business/MemberRidesService.java b/server/services/src/main/java/com/doumee/service/business/MemberRidesService.java
index 779dae7..d886882 100644
--- a/server/services/src/main/java/com/doumee/service/business/MemberRidesService.java
+++ b/server/services/src/main/java/com/doumee/service/business/MemberRidesService.java
@@ -3,6 +3,7 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.MemberRides;
+import com.doumee.dao.business.web.response.BikeLogDTO;
import com.doumee.dao.business.web.response.MemberRidesDTO;
import com.doumee.dao.business.web.response.MemberRidesQuery;
@@ -97,4 +98,13 @@
* @return long
*/
long count(MemberRides memberRides);
+
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ *
+ * @param pageWrap 鍒嗛〉瀵硅薄
+ * @return PageData<MemberRides>
+ */
+ PageData<BikeLogDTO> findBikeLog(PageWrap<MemberRidesQuery> pageWrap);
}
diff --git a/server/services/src/main/java/com/doumee/service/business/PricingParamService.java b/server/services/src/main/java/com/doumee/service/business/PricingParamService.java
index 584cc68..a1658a6 100644
--- a/server/services/src/main/java/com/doumee/service/business/PricingParamService.java
+++ b/server/services/src/main/java/com/doumee/service/business/PricingParamService.java
@@ -14,7 +14,7 @@
/**
* 鍒涘缓
- *
+ *
* @param pricingParam 瀹炰綋瀵硅薄
* @return String
*/
@@ -46,6 +46,8 @@
*
* @param pricingParam 瀹炰綋瀵硅薄
*/
+ void update(PricingParam pricingParam);
+
void updateById(PricingParam pricingParam);
/**
@@ -78,7 +80,7 @@
* @return List<PricingParam>
*/
List<PricingParam> findList(PricingParam pricingParam);
-
+
/**
* 鍒嗛〉鏌ヨ
*
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/BaseParamServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/BaseParamServiceImpl.java
index b02a7dd..2b5b809 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/BaseParamServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/BaseParamServiceImpl.java
@@ -1,5 +1,9 @@
package com.doumee.service.business.impl;
+import com.doumee.core.constants.Constants;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Utils;
@@ -10,11 +14,14 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import java.util.Date;
import java.util.List;
+import java.util.Objects;
/**
* 绯荤粺鍩虹閰嶇疆琛⊿ervice瀹炵幇
@@ -29,8 +36,31 @@
@Override
public String create(BaseParam baseParam) {
- baseParamMapper.insert(baseParam);
- return baseParam.getId();
+
+ LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ QueryWrapper<BaseParam> wrapper = new QueryWrapper<>();
+ wrapper.lambda()
+ .eq(BaseParam::getType,baseParam.getType())
+ .eq(BaseParam::getType,baseParam.getName());
+
+ Integer count = baseParamMapper.selectCount(wrapper);
+ if (count > 0){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"杞﹁締闂宸插瓨鍦�");
+ }
+ BaseParam insert = new BaseParam();
+ insert.setCreateDate(new Date());
+ insert.setCreator(principal.getId());
+ insert.setEditDate(new Date());
+ insert.setEditor(principal.getId());
+ insert.setIsdeleted(Constants.ZERO);
+ insert.setName(baseParam.getName());
+ insert.setSortnum(baseParam.getSortnum());
+ insert.setType(baseParam.getType());
+ insert.setStatus(Constants.ZERO);
+ insert.setInfo(baseParam.getInfo());
+ insert.setRequired(baseParam.getRequired());
+ baseParamMapper.insert(insert);
+ return insert.getId();
}
@Override
@@ -46,6 +76,7 @@
@Override
public void deleteByIdInBatch(List<String> ids) {
+
if (CollectionUtils.isEmpty(ids)) {
return;
}
@@ -54,7 +85,25 @@
@Override
public void updateById(BaseParam baseParam) {
- baseParamMapper.updateById(baseParam);
+ LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ QueryWrapper<BaseParam> wrapper = new QueryWrapper<>();
+ wrapper.lambda()
+ .eq(BaseParam::getType,baseParam.getType())
+ .eq(BaseParam::getType,baseParam.getName());
+
+ BaseParam baseParam1 = baseParamMapper.selectOne(wrapper);
+ if (Objects.nonNull(baseParam1) && !baseParam1.getId().equals(baseParam.getId())){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"杞﹁締闂宸插瓨鍦�");
+ }
+ UpdateWrapper<BaseParam> updateWrapper = new UpdateWrapper<>();
+ updateWrapper
+ .lambda()
+ .eq(BaseParam::getId,baseParam.getId())
+ .set(BaseParam::getName,baseParam.getName())
+ .set(BaseParam::getSortnum,baseParam.getSortnum())
+ .set(BaseParam::getEditDate,new Date())
+ .set(BaseParam::getEditor,principal.getId());
+ baseParamMapper.update(null,updateWrapper);
}
@Override
@@ -83,7 +132,7 @@
QueryWrapper<BaseParam> wrapper = new QueryWrapper<>(baseParam);
return baseParamMapper.selectList(wrapper);
}
-
+
@Override
public PageData<BaseParam> findPage(PageWrap<BaseParam> pageWrap) {
IPage<BaseParam> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/MemberRidesServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/MemberRidesServiceImpl.java
index e4c54a6..3c98943 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/MemberRidesServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/MemberRidesServiceImpl.java
@@ -11,6 +11,7 @@
import com.doumee.dao.business.model.Goodsorder;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.model.MemberRides;
+import com.doumee.dao.business.web.response.BikeLogDTO;
import com.doumee.dao.business.web.response.MemberRidesDTO;
import com.doumee.dao.business.web.response.MemberRidesQuery;
import com.doumee.service.business.MemberRidesService;
@@ -145,5 +146,49 @@
return memberRidesMapper.selectCount(wrapper);
}
+ @Override
+ public PageData<BikeLogDTO> findBikeLog(PageWrap<MemberRidesQuery> pageWrap) {
+ IPage<MemberRides> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
+ MPJLambdaWrapper<MemberRides> queryWrapper = new MPJLambdaWrapper<>();
+ Utils.MP.blankToNull(pageWrap.getModel());
+ queryWrapper.orderByDesc(MemberRides::getCreateDate);
+ queryWrapper.leftJoin(Member.class,Member::getId,MemberRides::getMemberId)
+ .leftJoin(BaseParam.class,BaseParam::getId,MemberRides::getParamId)
+ .eq(BaseParam::getType, Constants.THREE)
+ .like(StringUtils.isNotBlank(pageWrap.getModel().getOpenid()),Member::getOpenid,pageWrap.getModel().getOpenid())
+ .like(StringUtils.isNotBlank(pageWrap.getModel().getBikeCode()),MemberRides::getBikeCode,pageWrap.getModel().getBikeCode())
+ .between((Objects.nonNull(pageWrap.getModel().getRentDateStart())&&Objects.nonNull(pageWrap.getModel().getRentDateEnd())),
+ MemberRides::getRentDate,
+ pageWrap.getModel().getRentDateStart(),pageWrap.getModel().getRentDateEnd());
+ if (Objects.nonNull(pageWrap.getModel().getHasBack())
+ && pageWrap.getModel().getHasBack()){
+ queryWrapper.isNotNull(MemberRides::getBackDate);
+ }else if (Objects.nonNull(pageWrap.getModel().getStatus())
+ && !pageWrap.getModel().getHasBack()){
+ queryWrapper.isNull(MemberRides::getBackDate);
+ }
+ queryWrapper.orderByDesc(MemberRides::getCreateDate);
+ queryWrapper.leftJoin("locks rl on rl.id = t.rent_lock_id and rl.site_id = t.rent_site_id")
+ .leftJoin("sites rs on rs.id = rl.site_id")
+ .leftJoin("locks bl on bl.id = t.rent_lock_id and bl.site_id = t.rent_site_id")
+ .leftJoin("sites bs on bs.id = rl.site_id");
+ queryWrapper.selectAs(Member::getOpenid,BikeLogDTO::getOpenid)
+ .selectAs(MemberRides::getBikeCode,BikeLogDTO::getBikeCode)
+ .selectAs(BaseParam::getName,BikeLogDTO::getBikeType)
+ .selectAs(MemberRides::getRentDate,BikeLogDTO::getRentDate)
+ .selectAs(MemberRides::getBackDate,BikeLogDTO::getBackDate)
+ .select("rs.Name as rentSiteName, rl.name as rentLockName")
+ .select("bs.Name as backSiteName, bl.name as backLockName");
+
+ IPage<BikeLogDTO> bikeLogDTOIPage = memberRidesJoinMapper.selectJoinPage(page, BikeLogDTO.class, queryWrapper);
+ if (!CollectionUtils.isEmpty(bikeLogDTOIPage.getRecords())){
+ bikeLogDTOIPage.getRecords().forEach(s->{
+ if (Objects.nonNull(s.getBackDate())){
+ s.setRideTime(DateUtil.betweenMin(s.getRentDate(),s.getBackDate()));
+ }
+ });
+ }
+ return PageData.from(bikeLogDTOIPage);
+ }
}
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/PricingDetailServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/PricingDetailServiceImpl.java
index 38930db..6e6cdf2 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/PricingDetailServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/PricingDetailServiceImpl.java
@@ -1,20 +1,31 @@
package com.doumee.service.business.impl;
+import com.doumee.core.constants.Constants;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.PricingDetailMapper;
+import com.doumee.dao.business.join.PricingDetailJoinMapper;
+import com.doumee.dao.business.model.BaseParam;
import com.doumee.dao.business.model.PricingDetail;
import com.doumee.service.business.PricingDetailService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import java.util.Date;
import java.util.List;
+import java.util.Objects;
/**
* 瀹氫环鏂规鏄庣粏閰嶇疆Service瀹炵幇
@@ -27,8 +38,54 @@
@Autowired
private PricingDetailMapper pricingDetailMapper;
+ @Autowired
+ PricingDetailJoinMapper pricingDetailJoinMapper;
+
@Override
public String create(PricingDetail pricingDetail) {
+
+ if ((pricingDetail.getBaseTime() < 0) &&
+ Objects.isNull(pricingDetail.getBasePrice())){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"涓�鍙d环浠锋牸涓嶅彲涓虹┖");
+ }
+
+ if ((pricingDetail.getBaseTime() > 0) &&
+ (Objects.isNull(pricingDetail.getBasePrice())
+ || Objects.isNull(pricingDetail.getUnitTime())
+ || Objects.isNull(pricingDetail.getUnitPrice()))){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"闃舵瀹氫环鍙傛暟涓嶅彲涓虹┖");
+ }
+
+ if ((pricingDetail.getHolidayBasePrice() < 0) &&
+ Objects.isNull(pricingDetail.getBasePrice()) ){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鑺傚亣涓�鍙d环浠锋牸涓嶅彲涓虹┖");
+ }
+
+ if ((pricingDetail.getHolidayBasePrice() > 0) &&
+ (Objects.isNull(pricingDetail.getHolidayBasePrice())
+ || Objects.isNull(pricingDetail.getHolidayBasePrice())
+ || Objects.isNull(pricingDetail.getHolidayBasePrice()))){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鑺傚亣闃舵瀹氫环鍙傛暟涓嶅彲涓虹┖");
+ }
+ LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ PricingDetail insert = new PricingDetail();
+ insert.setCreateDate(new Date());
+ insert.setCreator(principal.getId());
+ insert.setEditDate(new Date());
+ insert.setEditor(principal.getId());
+ insert.setIsdeleted(Constants.ZERO);
+ insert.setPricePramId(pricingDetail.getPricePramId());
+ insert.setBikeTypeId(pricingDetail.getBikeTypeId());
+ insert.setBaseTime(pricingDetail.getBaseTime());
+ insert.setBasePrice(pricingDetail.getBasePrice());
+ insert.setUnitTime(pricingDetail.getUnitTime());
+ insert.setUnitPrice(pricingDetail.getUnitPrice());
+ insert.setHolidayBaseTime(pricingDetail.getHolidayBaseTime());
+ insert.setHolidayBasePrice(pricingDetail.getHolidayBasePrice());
+ insert.setHolidayUnitTime(pricingDetail.getHolidayUnitTime());
+ insert.setHolidayUnitPrice(pricingDetail.getHolidayUnitPrice());
+ insert.setInfo(pricingDetail.getInfo());
+ insert.setTitle(pricingDetail.getTitle());
pricingDetailMapper.insert(pricingDetail);
return pricingDetail.getId();
}
@@ -80,10 +137,14 @@
@Override
public List<PricingDetail> findList(PricingDetail pricingDetail) {
- QueryWrapper<PricingDetail> wrapper = new QueryWrapper<>(pricingDetail);
- return pricingDetailMapper.selectList(wrapper);
+ MPJLambdaWrapper<PricingDetail> wrapper = new MPJLambdaWrapper<>();
+ wrapper.leftJoin(BaseParam.class,BaseParam::getId,PricingDetail::getBikeTypeId)
+ .eq(BaseParam::getType,Constants.THREE);
+ wrapper.selectAll(PricingDetail.class)
+ .selectAs(BaseParam::getName,PricingDetail::getBikeTypeName);
+ return pricingDetailJoinMapper.selectJoinList(PricingDetail.class,wrapper);
}
-
+
@Override
public PageData<PricingDetail> findPage(PageWrap<PricingDetail> pageWrap) {
IPage<PricingDetail> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/PricingParamServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/PricingParamServiceImpl.java
index a598e9b..b5d1112 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/PricingParamServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/PricingParamServiceImpl.java
@@ -1,5 +1,7 @@
package com.doumee.service.business.impl;
+import com.doumee.core.constants.Constants;
+import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Utils;
@@ -10,10 +12,12 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import java.util.Date;
import java.util.List;
/**
@@ -29,6 +33,19 @@
@Override
public String create(PricingParam pricingParam) {
+
+ LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ PricingParam insert = new PricingParam();
+ insert.setCreateDate(new Date());
+ insert.setCreator(principal.getId());
+ insert.setEditDate(new Date());
+ insert.setEditor(principal.getId());
+ insert.setIsdeleted(Constants.ZERO);
+ insert.setName(pricingParam.getName());
+ insert.setStartDate(pricingParam.getStartDate());
+ insert.setEndDate(pricingParam.getEndDate());
+ insert.setSortnum(pricingParam.getSortnum());
+ insert.setStatus(Constants.ZERO);
pricingParamMapper.insert(pricingParam);
return pricingParam.getId();
}
@@ -51,6 +68,19 @@
}
pricingParamMapper.deleteBatchIds(ids);
}
+
+ @Override
+ public void update(PricingParam pricingParam) {
+ UpdateWrapper<PricingParam> wrapper = new UpdateWrapper<>();
+ wrapper.lambda()
+ .eq(PricingParam::getId,pricingParam.getId())
+ .set(PricingParam::getName,pricingParam.getName())
+ .set(PricingParam::getStartDate,pricingParam.getStartDate())
+ .set(PricingParam::getEndDate,pricingParam.getEndDate())
+ .set(PricingParam::getSortnum,pricingParam.getSortnum());
+ pricingParamMapper.update(null,wrapper);
+ }
+
@Override
public void updateById(PricingParam pricingParam) {
@@ -83,7 +113,7 @@
QueryWrapper<PricingParam> wrapper = new QueryWrapper<>(pricingParam);
return pricingParamMapper.selectList(wrapper);
}
-
+
@Override
public PageData<PricingParam> findPage(PageWrap<PricingParam> pageWrap) {
IPage<PricingParam> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
--
Gitblit v1.9.3