Ver código fonte

计算卡种会员价格

Memory_LG 3 semanas atrás
pai
commit
f268a57fcb

+ 7 - 0
qmjszx-admin/src/main/java/beilv/web/controller/carinformation/CardAppController.java

@@ -42,6 +42,8 @@ import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.temporal.ChronoUnit;
@@ -234,6 +236,11 @@ public class CardAppController extends BaseController {
     public AjaxResult cardInformationlist(CarInformation carInformation) {
         startPage();
         List<CarInformation> list = carInformationService.selectCarInformationList(carInformation);
+        //查询会员等级
+        String vipLevel = vipCardService.selectVipCardByUserId(carInformation.getUserId()).getVipLevel();
+        //查询会员折扣
+        BigDecimal coefficient = BigDecimal.valueOf(Double.parseDouble(StringUtils.isEmpty(configService.selectConfigByKey(vipLevel))? "1" : configService.selectConfigByKey(vipLevel)));
+        list.forEach(carInformation1 -> carInformation1.setMemberPrice(carInformation1.getOriginalPrice().multiply(coefficient).setScale(2, RoundingMode.HALF_UP)));
         return AjaxResult.success(getDataTable(list).getRows());
     }
 

+ 6 - 0
qmjszx-admin/src/main/java/beilv/web/controller/stadium/StadiumController.java

@@ -20,6 +20,7 @@ import beilv.system.service.ISysConfigService;
 import beilv.vipCard.service.IVipCardService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import org.apache.commons.collections4.MapUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -55,6 +56,9 @@ public class StadiumController extends BaseController {
         startPage();
         competition.setCompetitionState("competiton_state_2");
         List<Competition> list = competitionService.selectCompetitionList(competition);
+        Map<String, String> competitionType = DictUtils.getDictCacheToMap("competition_type");
+        Map<String, String> competitionState = DictUtils.getDictCacheToMap("competition_state");
+
 
         String vipLevel = vipCardService.selectVipCardByUserId(competition.getUserId()).getVipLevel();
         //查询会员折扣
@@ -62,6 +66,8 @@ public class StadiumController extends BaseController {
         list.forEach(competition1 -> {
             competition1.setCompetitionPrice(new PriceOptions(competition1.getCompetitionExpense(), coefficient));
             competition1.setViewingPrice(new PriceOptions(competition1.getViewingTicket(), coefficient));
+            competition1.setCompetitionTypeLabel(MapUtils.getString(competitionType, competition1.getCompetitionType()));
+            competition1.setCompetitionStateLabel(MapUtils.getString(competitionState, competition1.getCompetitionState()));
         });
 
         return AjaxResult.success(getDataTable(list).getRows());

+ 7 - 7
qmjszx-admin/src/main/resources/templates/information/add.html

@@ -44,10 +44,10 @@
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-2 control-label is-required">会员价格:</label>
+                    <!--<label class="col-sm-2 control-label is-required">会员价格:</label>
                     <div class="col-sm-4">
                         <input name="memberPrice" class="form-control" type="number" min="0" step="0.01" maxlength="8" required>
-                    </div>
+                    </div>-->
                     <label class="col-sm-2 control-label is-required">单次积分:</label>
                     <div class="col-sm-4">
                         <input name="point" class="form-control" type="number" min="0" step="1" maxlength="8" required>
@@ -90,12 +90,12 @@
         function submitHandler() {
             if ($.validate.form()) {
                 const originalPrice = parseInt(document.getElementsByName("originalPrice")[0].value);
-                const memberPrice = parseInt(document.getElementsByName("memberPrice")[0].value);
-                if (memberPrice>originalPrice){
-                    alert("会员价格不能大于原价格")
-                }else {
+                // const memberPrice = parseInt(document.getElementsByName("memberPrice")[0].value);
+                // if (memberPrice>originalPrice){
+                //     alert("会员价格不能大于原价格")
+                // }else {
                     $.operate.save(prefix + "/add", $('#form-information-add').serialize());
-                }
+                // }
             }
         }
 

+ 7 - 7
qmjszx-admin/src/main/resources/templates/information/edit.html

@@ -45,10 +45,10 @@
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-2 control-label is-required">会员价格:</label>
+                    <!--<label class="col-sm-2 control-label is-required">会员价格:</label>
                     <div class="col-sm-4">
                         <input name="memberPrice" th:field="*{memberPrice}" class="form-control" type="number" min="0" step="0.01" maxlength="8">
-                    </div>
+                    </div>-->
                     <label class="col-sm-2 control-label is-required">单次积分:</label>
                     <div class="col-sm-4">
                         <input name="point" th:field="*{point}" class="form-control" type="number" min="0" step="1" maxlength="8">
@@ -91,12 +91,12 @@
         function submitHandler() {
             if ($.validate.form()) {
                 const originalPrice = parseInt(document.getElementsByName("originalPrice")[0].value);
-                const memberPrice = parseInt(document.getElementsByName("memberPrice")[0].value);
-                if (memberPrice>originalPrice){
-                    alert("会员价格不能大于原价格")
-                }else {
+                // const memberPrice = parseInt(document.getElementsByName("memberPrice")[0].value);
+                // if (memberPrice>originalPrice){
+                //     alert("会员价格不能大于原价格")
+                // }else {
                     $.operate.save(prefix + "/edit", $('#form-information-edit').serialize());
-                }
+                // }
             }
         }
 

+ 2 - 2
qmjszx-admin/src/main/resources/templates/information/information.html

@@ -103,10 +103,10 @@
                     field: 'originalPrice',
                     title: '原价格'
                 },
-                {
+                /*{
                     field: 'memberPrice',
                     title: '会员价格'
-                },
+                },*/
                 {
                     field: 'point',
                     title: '单次积分'

+ 6 - 120
qmjszx-business/src/main/java/beilv/carinformation/domain/CarInformation.java

@@ -3,7 +3,10 @@ package beilv.carinformation.domain;
 import java.math.BigDecimal;
 import java.util.Date;
 
+import beilv.common.constant.PriceOptions;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import beilv.common.annotation.Excel;
@@ -15,6 +18,8 @@ import beilv.common.core.domain.BaseEntity;
  * @author ruoyi
  * @date 2025-01-02
  */
+@Setter
+@Getter
 public class CarInformation extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
@@ -85,125 +90,6 @@ public class CarInformation extends BaseEntity {
     //图片
     private String file;
 
-    public String getFile() {
-        return file;
-    }
+    private String userId;
 
-    public void setFile(String file) {
-        this.file = file;
-    }
-
-    public BigDecimal getOriginalPrice() {
-        return originalPrice;
-    }
-
-    public void setOriginalPrice(BigDecimal originalPrice) {
-        this.originalPrice = originalPrice;
-    }
-
-    public BigDecimal getMemberPrice() {
-        return memberPrice;
-    }
-
-    public void setMemberPrice(BigDecimal memberPrice) {
-        this.memberPrice = memberPrice;
-    }
-
-    public String getCardState() {
-        return cardState;
-    }
-
-    public void setCardState(String cardState) {
-        this.cardState = cardState;
-    }
-
-    public String getCardStateLabel() {
-        return cardStateLabel;
-    }
-
-    public void setCardStateLabel(String cardStateLabel) {
-        this.cardStateLabel = cardStateLabel;
-    }
-
-    public String getTypeLabel() {
-        return typeLabel;
-    }
-
-    public void setTypeLabel(String typeLabel) {
-        this.typeLabel = typeLabel;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setTotalNumber(Integer totalNumber) {
-        this.totalNumber = totalNumber;
-    }
-
-    public Integer getTotalNumber() {
-        return totalNumber;
-    }
-
-    public void setPoint(Integer point) {
-        this.point = point;
-    }
-
-    public Integer getPoint() {
-        return point;
-    }
-
-    public void setExpirationDate(Date expirationDate) {
-        this.expirationDate = expirationDate;
-    }
-
-    public Date getExpirationDate() {
-        return expirationDate;
-    }
-
-    public void setNotes(String notes) {
-        this.notes = notes;
-    }
-
-    public String getNotes() {
-        return notes;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-                .append("id", getId())
-                .append("name", getName())
-                .append("type", getType())
-                .append("totalNumber", getTotalNumber())
-                .append("point", getPoint())
-                .append("expirationDate", getExpirationDate())
-                .append("notes", getNotes())
-                .append("cardState", getCardState())
-                .append("createBy", getCreateBy())
-                .append("createTime", getCreateTime())
-                .append("updateBy", getUpdateBy())
-                .append("updateTime", getUpdateTime())
-                .toString();
-    }
 }

+ 2 - 0
qmjszx-business/src/main/java/beilv/competition/domain/Competition.java

@@ -41,6 +41,7 @@ public class Competition extends BaseEntity {
      */
     @Excel(name = "赛事类型")
     private String competitionType;
+    private String competitionTypeLabel;
 
     /**
      * 团队最大人数
@@ -115,6 +116,7 @@ public class Competition extends BaseEntity {
      */
     @Excel(name = "赛事状态")
     private String competitionState;
+    private String competitionStateLabel;
 
     /**
      * 创建人姓名