From c3019597126f19e8508bd22e7da3a39058033510 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 23 一月 2025 11:41:24 +0800
Subject: [PATCH] bug修改

---
 manage/src/main/resources/mapping/SecUserMapper.xml                              |    1 
 manage/src/main/java/com/jilongda/manage/controller/TCouponController.java       |   11 ++++-
 common/src/main/java/com/jilongda/common/Ticket/TicketUtil.java                  |    2 
 common/src/main/java/com/jilongda/common/config/DataUpdateHandlerConfig.java     |   12 ++++--
 applet/src/main/java/com/jilongda/applet/controller/TLineUpController.java       |    6 ++
 manage/src/main/java/com/jilongda/manage/vo/TCouponInfoVO.java                   |    3 +
 manage/src/main/java/com/jilongda/manage/controller/TModelController.java        |   45 ++++++++++++++++------
 manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java |    4 +-
 8 files changed, 61 insertions(+), 23 deletions(-)

diff --git a/applet/src/main/java/com/jilongda/applet/controller/TLineUpController.java b/applet/src/main/java/com/jilongda/applet/controller/TLineUpController.java
index fb8fb23..5ba76d3 100644
--- a/applet/src/main/java/com/jilongda/applet/controller/TLineUpController.java
+++ b/applet/src/main/java/com/jilongda/applet/controller/TLineUpController.java
@@ -19,6 +19,8 @@
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * <p>
@@ -65,10 +67,12 @@
     @GetMapping(value = "/getUserLineUpByStoreId")
     public ApiResult getUserLineUpByStoreId(@RequestParam Integer storeId) {
         long userId = loginInfoUtil.getUserId();
+        List<Integer> list = Arrays.asList(1, 2);
+
         TLineUp lineUp = tLineUpService.getOne(Wrappers.lambdaQuery(TLineUp.class)
                 .eq(TLineUp::getUserId, userId)
                 .eq(TLineUp::getStoreId, storeId)
-                .eq(TLineUp::getStatus, 1)
+                .in(TLineUp::getStatus, list)
                 .orderByDesc(TLineUp::getCreateTime)
                 .last("LIMIT 1"));
         TLineUpVO tLineUpVO = new TLineUpVO();
diff --git a/common/src/main/java/com/jilongda/common/Ticket/TicketUtil.java b/common/src/main/java/com/jilongda/common/Ticket/TicketUtil.java
index 65d94be..8bb4526 100644
--- a/common/src/main/java/com/jilongda/common/Ticket/TicketUtil.java
+++ b/common/src/main/java/com/jilongda/common/Ticket/TicketUtil.java
@@ -109,7 +109,7 @@
 			tAddOptometryVO.setOptometryDetailVOS(temp);
 			tAddOptometryVO.setShopName("天府新谷门店");
 			tAddOptometryVO.setOptometristName("无关风月");
-			tAddOptometryVO.setTime("2025-11-11");
+			tAddOptometryVO.setTime("2025-11-11 11:11:11");
 			tAddOptometryVO.setPhone("19983174515");
 			tAddOptometryVO.setSn("922440578");
 			String method = print(tAddOptometryVO);
diff --git a/common/src/main/java/com/jilongda/common/config/DataUpdateHandlerConfig.java b/common/src/main/java/com/jilongda/common/config/DataUpdateHandlerConfig.java
index 1f58a37..83d7d3b 100644
--- a/common/src/main/java/com/jilongda/common/config/DataUpdateHandlerConfig.java
+++ b/common/src/main/java/com/jilongda/common/config/DataUpdateHandlerConfig.java
@@ -31,6 +31,9 @@
         //  获取登录信息
         String userName = JwtTokenUtils.getUsername();
         if (StringUtils.isNotBlank(userName)) {
+            if (userName.equals("admin")){
+                userName = "超级管理员";
+            }
             this.setFieldValByName("createBy", userName, metaObject);
             this.setFieldValByName("updateBy", userName, metaObject);
         } else {
@@ -47,13 +50,14 @@
     @Override
     public void updateFill(MetaObject metaObject) {
         //  获取登录信息
-        /*String userName = JwtTokenUtils.getUsername();
+        String userName = JwtTokenUtils.getUsername();
         if (StringUtils.isNotBlank(userName)) {
-            this.setFieldValByName("createBy", userName, metaObject);
+            if (userName.equals("admin")){
+                userName = "超级管理员";
+            }
             this.setFieldValByName("updateBy", userName, metaObject);
         } else {
-            this.setFieldValByName("createBy", "", metaObject);
             this.setFieldValByName("updateBy", "", metaObject);
-        }*/
+        }
     }
 }
diff --git a/manage/src/main/java/com/jilongda/manage/controller/TCouponController.java b/manage/src/main/java/com/jilongda/manage/controller/TCouponController.java
index df84469..35c71de 100644
--- a/manage/src/main/java/com/jilongda/manage/controller/TCouponController.java
+++ b/manage/src/main/java/com/jilongda/manage/controller/TCouponController.java
@@ -45,6 +45,7 @@
 import java.awt.image.BufferedImage;
 import java.io.IOException;
 import java.io.InputStream;
+import java.math.BigDecimal;
 import java.nio.charset.StandardCharsets;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -77,6 +78,9 @@
     @ApiOperation(value = "添加优惠券")
     @PostMapping(value = "/add")
     public ApiResult<String> add( @RequestBody TCoupon dto) throws Exception {
+        if (dto.getTime()!=null && dto.getTime()>365){
+            return ApiResult.failed("优惠券有效期不能大于365天");
+        }
         if (dto.getType()==1||dto.getType()==4)dto.setGrantStatus(1);
         couponService.save(dto);
         switch (dto.getType()){
@@ -157,10 +161,11 @@
         int size = couponReceiveService.list(new LambdaQueryWrapper<TCouponReceive>()
                 .eq(TCouponReceive::getCouponId, id)).size();
         tCouponInfoVO.setGrantCout(size);
-        int size1 = couponReceiveService.list(new LambdaQueryWrapper<TCouponReceive>()
+        List<TCouponReceive> list = couponReceiveService.list(new LambdaQueryWrapper<TCouponReceive>()
                 .eq(TCouponReceive::getCouponId, id)
-                .eq(TCouponReceive::getStatus, 2)).size();
-        tCouponInfoVO.setUseCount(size1);
+                .eq(TCouponReceive::getStatus, 2));
+        list.stream().map(TCouponReceive::getAmount).reduce(BigDecimal::add).ifPresent(tCouponInfoVO::setUseMoney);
+        tCouponInfoVO.setUseCount(list.size());
         if (byId.getType()==3){
             // 查询领取人
             List<Integer> collect = couponReceiveService.lambdaQuery()
diff --git a/manage/src/main/java/com/jilongda/manage/controller/TModelController.java b/manage/src/main/java/com/jilongda/manage/controller/TModelController.java
index 8793aec..a2e2e5a 100644
--- a/manage/src/main/java/com/jilongda/manage/controller/TModelController.java
+++ b/manage/src/main/java/com/jilongda/manage/controller/TModelController.java
@@ -89,20 +89,41 @@
     @ApiOperation(value = "修改镜架型号")
     @PostMapping(value = "/update")
     public ApiResult<String> update(@RequestBody TModelDTO dto) {
-
-        modelService.remove(Wrappers.lambdaQuery(TModel.class)
-                .eq(TModel::getName,dto.getName()));
-
+        List<TModel> list = modelService.lambdaQuery()
+                .eq(TModel::getName, dto.getName()).list();
         List<String> colorList = dto.getColorList();
-        List<TModel> models = new ArrayList<>();
-        for (String s : colorList) {
-            TModel model = new TModel();
-            BeanUtils.copyProperties(dto, model);
-            model.setId(null);
-            model.setColor(s);
-            models.add(model);
+        if (list.size()<colorList.size()){
+            for (int i = 0; i < colorList.size(); i++) {
+                if (i>list.size()){
+                    TModel model = new TModel();
+                    BeanUtils.copyProperties(dto, model);
+                    model.setId(null);
+                    model.setColor(colorList.get(i));
+                    list.add(model);
+                }else {
+                    list.get(i).setColor(colorList.get(i));
+                }
+            }
+        }else if (list.size()>colorList.size()){
+            list = list.subList(0, colorList.size());
+            for (int i = 0; i < colorList.size(); i++) {
+                list.get(i).setColor(colorList.get(i));
+            }
+        }else {
+            for (int i = 0; i < list.size(); i++) {
+                list.get(i).setColor(colorList.get(i));
+            }
         }
-        modelService.saveBatch(models);
+        modelService.saveOrUpdateBatch(list);
+//        List<TModel> models = new ArrayList<>();
+//        for (String s : colorList) {
+//            TModel model = new TModel();
+//            BeanUtils.copyProperties(dto, model);
+//            model.setId(null);
+//            model.setColor(s);
+//            models.add(model);
+//        }
+//        modelService.saveBatch(models);
         return ApiResult.success();
     }
 
diff --git a/manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java b/manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java
index 3d6e7cb..283931c 100644
--- a/manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java
+++ b/manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java
@@ -70,7 +70,7 @@
                             JSONObject jsonObject = (JSONObject) object;
                             String cost = jsonObject.getString("refractiveIndex");
                             if (tFrameGoodsVO.getRefractiveIndex().equals(cost)){
-                                tFrameGoodsVO.setSale(jsonObject.getString("sale"));
+                                tFrameGoodsVO.setSale(jsonObject.getString("sales"));
                                 tFrameGoodsVO.setCost(jsonObject.getString("cost"));
                                 break;
                             }
@@ -86,7 +86,7 @@
                             JSONObject jsonObject = (JSONObject) object;
                             String cost = jsonObject.getString("refractiveIndex");
                             if (tFrameGoodsVO.getRefractiveIndex().equals(cost)){
-                                tFrameGoodsVO.setSale(jsonObject.getString("sale"));
+                                tFrameGoodsVO.setSale(jsonObject.getString("sales"));
                                 tFrameGoodsVO.setCost(jsonObject.getString("cost"));
                                 break;
                             }
diff --git a/manage/src/main/java/com/jilongda/manage/vo/TCouponInfoVO.java b/manage/src/main/java/com/jilongda/manage/vo/TCouponInfoVO.java
index 6ea7659..894b2c2 100644
--- a/manage/src/main/java/com/jilongda/manage/vo/TCouponInfoVO.java
+++ b/manage/src/main/java/com/jilongda/manage/vo/TCouponInfoVO.java
@@ -6,6 +6,7 @@
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 @Data
@@ -18,6 +19,8 @@
     private Integer grantCout;
     @ApiModelProperty(value = "使用数量")
     private Integer useCount;
+    @ApiModelProperty(value = "总计使用金额")
+    private BigDecimal useMoney;
     @ApiModelProperty(value = "指定发放-用户ids")
     private List<Integer> userIds;
     @ApiModelProperty(value = "指定发放-用户列表")
diff --git a/manage/src/main/resources/mapping/SecUserMapper.xml b/manage/src/main/resources/mapping/SecUserMapper.xml
index 657452b..756091c 100644
--- a/manage/src/main/resources/mapping/SecUserMapper.xml
+++ b/manage/src/main/resources/mapping/SecUserMapper.xml
@@ -93,6 +93,7 @@
             <if test="dto.roleId != null">
                 AND sr.id = #{dto.roleId}
             </if>
+                                   and su.id !=1
             AND su.isDelete = ${@com.jilongda.common.enums.DisabledEnum@NO.getCode()}
         </where>
         ORDER BY su.createTime DESC

--
Gitblit v1.7.1