From 380854ead73ee1a3da277fd48f7f692f17e4781e Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期三, 08 一月 2025 11:19:43 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java                |   24 +++++++----
 manage/src/main/resources/mapping/TFrameWarehousingDetailMapper.xml                          |    2 
 manage/src/main/java/com/jilongda/manage/controller/TOrderController.java                    |    2 
 manage/src/main/java/com/jilongda/manage/controller/TOptometristController.java              |    8 ++++
 optometrist/src/main/java/com/jilongda/optometrist/authority/controller/LoginController.java |    8 ++++
 manage/src/main/java/com/jilongda/manage/authority/controller/LoginController.java           |   16 ++++++++
 manage/src/main/java/com/jilongda/manage/vo/TInventoryInfoVO.java                            |    2 
 manage/src/main/resources/mapping/TOrderMapper.xml                                           |    9 ++++
 manage/src/main/java/com/jilongda/manage/model/TInventoryLensDetail.java                     |    3 +
 manage/src/main/java/com/jilongda/manage/query/TOptometryQuery.java                          |    1 
 manage/src/main/java/com/jilongda/manage/service/impl/TWarehousingServiceImpl.java           |    1 
 manage/src/main/resources/mapping/TStoreMapper.xml                                           |    1 
 manage/src/main/resources/mapping/TOptometristMapper.xml                                     |    7 ++-
 optometrist/src/main/java/com/jilongda/optometrist/controller/TOptometristController.java    |   11 +++++
 manage/src/main/java/com/jilongda/manage/query/TOrderQuery.java                              |    2 +
 manage/src/main/java/com/jilongda/manage/controller/TOrderAftersalesController.java          |    5 ++
 16 files changed, 85 insertions(+), 17 deletions(-)

diff --git a/manage/src/main/java/com/jilongda/manage/authority/controller/LoginController.java b/manage/src/main/java/com/jilongda/manage/authority/controller/LoginController.java
index fa11931..16c7952 100644
--- a/manage/src/main/java/com/jilongda/manage/authority/controller/LoginController.java
+++ b/manage/src/main/java/com/jilongda/manage/authority/controller/LoginController.java
@@ -1,6 +1,9 @@
 package com.jilongda.manage.authority.controller;
 
 import com.jilongda.manage.authority.dto.LoginDTO;
+import com.jilongda.manage.authority.model.SecUser;
+import com.jilongda.manage.model.TStore;
+import com.jilongda.manage.service.TStoreService;
 import com.jilongda.manage.utils.MsgUtils;
 import com.jilongda.common.basic.ApiResult;
 import com.jilongda.common.basic.Constant;
@@ -47,6 +50,8 @@
     private final RedisAutoTemplate redisAutoTemplate;
     private final MsgUtils msgUtils;
     private final SecUserService secUserService;
+    @Autowired
+    private TStoreService storeService;
 
     @Autowired
     public LoginController(AuthenticationManager authenticationManager, SecurityUtils securityUtils, PasswordEncoder passwordEncoder, RedisAutoTemplate redisAutoTemplate, MsgUtils msgUtils, SecUserService secUserService) {
@@ -75,6 +80,17 @@
         // 先检验是否登录
         String username = loginDto.getAccount();
         String password = loginDto.getPassword();
+        // 超级管理员不做校验
+        if (!username.equals("admin")){
+            SecUser user = secUserService.lambdaQuery().eq(SecUser::getAccount, username).one();
+            TStore store = storeService.getById(user.getStoreId());
+            if (store==null){
+                return ApiResult.failed(500, "门店不存在");
+            }
+            if (store.getStatus() == 2){
+                return ApiResult.failed(500, "门店已被禁用");
+            }
+        }
         try {
             Map<String, Object> token = securityUtils.login(username, password, authenticationManager, SecurityUserDetails.class, 1);
             return ApiResult.success(token);
diff --git a/manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java b/manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java
index 1a34c04..fac1b2e 100644
--- a/manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java
+++ b/manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java
@@ -17,6 +17,7 @@
 import com.jilongda.manage.vo.TInventoryVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import io.swagger.models.auth.In;
 import org.springframework.beans.BeanUtils;
 import org.springframework.context.annotation.Bean;
@@ -93,12 +94,14 @@
     }
 
     @ApiOperation(value = "镜架-根据品牌id查询对应库存")
-    @PostMapping(value = "/getCountByBrandId")
-    public ApiResult getCountByBrandId(Integer id) {
+    @GetMapping(value = "/getCountByBrandId")
+    public ApiResult getCountByBrandId(Integer id,Integer storeId) {
         List<Integer> collect = modelService.lambdaQuery().eq(TModel::getBrandId, id)
                 .list().stream().map(TModel::getId).distinct().collect(Collectors.toList());
         if (collect.isEmpty())collect.add(-1);
-        List<TFrameGoods> list = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect).list();
+        List<TFrameGoods> list = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect)
+                .eq(TFrameGoods::getStoreId,storeId)
+                .list();
         if (list.isEmpty())return ApiResult.success("0");
         int i = 0;
         for (TFrameGoods tFrameGoods : list) {
@@ -107,12 +110,13 @@
         return ApiResult.success(i);
     }
     @ApiOperation(value = "镜架-根据材质id查询对应库存")
-    @PostMapping(value = "/getCountByMaterialId")
-    public ApiResult getCountByMaterialId(Integer id) {
+    @GetMapping(value = "/getCountByMaterialId")
+    public ApiResult getCountByMaterialId(Integer id,Integer storeId) {
         List<Integer> collect = modelService.lambdaQuery().eq(TModel::getMaterialId, id)
                 .list().stream().map(TModel::getId).distinct().collect(Collectors.toList());
         if (collect.isEmpty())collect.add(-1);
-        List<TFrameGoods> list = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect).list();
+        List<TFrameGoods> list = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect).
+        eq(TFrameGoods::getStoreId,storeId).list();
         if (list.isEmpty())return ApiResult.success("0");
         int i = 0;
         for (TFrameGoods tFrameGoods : list) {
@@ -131,6 +135,7 @@
                 .list().stream().map(TModel::getId).collect(Collectors.toList());
         if (collect.isEmpty())collect.add(-1);
         TFrameGoods one = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect)
+                .eq(TFrameGoods::getStoreId,getCurrentByParam.getStoreId())
                 .eq(TFrameGoods::getColor, getCurrentByParam.getColor()).one();
         if (one!=null){
             return ApiResult.success(one.getTotal());
@@ -143,9 +148,10 @@
     public ApiResult<Integer> getCurrentByParamLens(@RequestBody GetCurrentByParamLens dto) {
         TLensGoods one = lensGoodsService.lambdaQuery().in(TLensGoods::getSeriesId, dto.getSeriesId())
                 .eq(dto.getLensType()!=null,TLensGoods::getLensType, dto.getLensType())
-                .eq(dto.getRefractiveIndex()!=null,TLensGoods::getRefractiveIndex, dto.getRefractiveIndex())
-                .eq(dto.getBallMirror()!=null,TLensGoods::getBallMirror, dto.getBallMirror())
-                .eq(dto.getColumnMirror()!=null,TLensGoods::getColumnMirror, dto.getColumnMirror())
+                .eq(StringUtils.hasLength(dto.getRefractiveIndex()),TLensGoods::getRefractiveIndex, dto.getRefractiveIndex())
+                .eq(StringUtils.hasLength(dto.getBallMirror()),TLensGoods::getBallMirror, dto.getBallMirror())
+                .eq(StringUtils.hasLength(dto.getColumnMirror()),TLensGoods::getColumnMirror, dto.getColumnMirror())
+                .eq(dto.getStoreId()!=null,TLensGoods::getStoreId, dto.getStoreId())
                 .one();
         if (one!=null){
             return ApiResult.success(one.getTotal());
diff --git a/manage/src/main/java/com/jilongda/manage/controller/TOptometristController.java b/manage/src/main/java/com/jilongda/manage/controller/TOptometristController.java
index 0ce931a..8a9e317 100644
--- a/manage/src/main/java/com/jilongda/manage/controller/TOptometristController.java
+++ b/manage/src/main/java/com/jilongda/manage/controller/TOptometristController.java
@@ -4,6 +4,8 @@
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.jilongda.common.basic.ApiResult;
 import com.jilongda.common.basic.PageInfo;
+import com.jilongda.manage.authority.model.SecUser;
+import com.jilongda.manage.authority.service.SecUserService;
 import com.jilongda.manage.model.TOptometrist;
 import com.jilongda.manage.query.TOptometristQuery;
 import com.jilongda.manage.query.TicketQuery;
@@ -32,6 +34,8 @@
 public class TOptometristController {
     @Autowired
     private TOptometristService optometristService;
+    @Autowired
+    private SecUserService secUserService;
 
     @ApiOperation(value = "验光师列表")
     @PostMapping(value = "/pageList")
@@ -60,6 +64,8 @@
         if (count>0){
             return ApiResult.failed("当前号码已存在");
         }
+        List<SecUser> list = secUserService.lambdaQuery().eq(SecUser::getPhone, dto.getPhone()).list();
+        if (!list.isEmpty())return ApiResult.failed("当前号码在员工管理已存在");
         optometristService.save(dto);
         return ApiResult.success();
     }
@@ -77,6 +83,8 @@
         if (count>0){
             return ApiResult.failed("当前号码已存在");
         }
+        List<SecUser> list = secUserService.lambdaQuery().eq(SecUser::getPhone, dto.getPhone()).list();
+        if (!list.isEmpty())return ApiResult.failed("当前号码在员工管理已存在");
         optometristService.updateById(dto);
         return ApiResult.success();
     }
diff --git a/manage/src/main/java/com/jilongda/manage/controller/TOrderAftersalesController.java b/manage/src/main/java/com/jilongda/manage/controller/TOrderAftersalesController.java
index 5da3b88..d169bb7 100644
--- a/manage/src/main/java/com/jilongda/manage/controller/TOrderAftersalesController.java
+++ b/manage/src/main/java/com/jilongda/manage/controller/TOrderAftersalesController.java
@@ -69,6 +69,11 @@
     @ApiOperation(value = "订单售后添加")
     @PostMapping(value = "/add")
     public ApiResult<String> add(@RequestBody TOrderAftersales dto) {
+        List<TOrderAftersales> list = orderAftersalesService.lambdaQuery()
+                .eq(TOrderAftersales::getOrderId, dto.getOrderId()).list();
+        if (!list.isEmpty()){
+            return ApiResult.failed("该订单已售后,不可再次操作!");
+        }
         dto.setCode(WarehousingConstant.ASTER_SALES+ CodeGenerateUtils.generateVolumeSn());
         orderAftersalesService.save(dto);
         return ApiResult.success();
diff --git a/manage/src/main/java/com/jilongda/manage/controller/TOrderController.java b/manage/src/main/java/com/jilongda/manage/controller/TOrderController.java
index 6314de8..5770045 100644
--- a/manage/src/main/java/com/jilongda/manage/controller/TOrderController.java
+++ b/manage/src/main/java/com/jilongda/manage/controller/TOrderController.java
@@ -104,7 +104,7 @@
         List<Integer> collect1 = orderGoodsService.lambdaQuery()
                 .eq(StringUtils.hasLength(query.getBrandLens()), TOrderGoods::getBrandName, query.getBrandLens())
                 .eq(StringUtils.hasLength(query.getSeries()), TOrderGoods::getSeriesName, query.getSeries())
-                .eq((query.getType() != null), TOrderGoods::getType, query.getType())
+                .eq(query.getType() != null, TOrderGoods::getType, query.getType())
                 .eq(StringUtils.hasLength(query.getRefractiveIndex()), TOrderGoods::getRefractiveIndex, query.getRefractiveIndex()).list()
                 .stream().map(TOrderGoods::getOrderId).collect(Collectors.toList());
         if (StringUtils.hasLength(query.getBrandLens())||StringUtils.hasLength(query.getSeries())||query.getType() != null||
diff --git a/manage/src/main/java/com/jilongda/manage/model/TInventoryLensDetail.java b/manage/src/main/java/com/jilongda/manage/model/TInventoryLensDetail.java
index 2b60b81..db146a3 100644
--- a/manage/src/main/java/com/jilongda/manage/model/TInventoryLensDetail.java
+++ b/manage/src/main/java/com/jilongda/manage/model/TInventoryLensDetail.java
@@ -40,6 +40,9 @@
     @ApiModelProperty(value = "系列")
     @TableField("series")
     private String series;
+    @ApiModelProperty(value = "品牌")
+    @TableField("brand")
+    private String brand;
 
     @ApiModelProperty(value = "1球面 2非球面 3双非")
     @TableField("type")
diff --git a/manage/src/main/java/com/jilongda/manage/query/TOptometryQuery.java b/manage/src/main/java/com/jilongda/manage/query/TOptometryQuery.java
index f230833..4cc7b0f 100644
--- a/manage/src/main/java/com/jilongda/manage/query/TOptometryQuery.java
+++ b/manage/src/main/java/com/jilongda/manage/query/TOptometryQuery.java
@@ -24,7 +24,6 @@
     @ApiModelProperty(value = "验光师id")
     private Integer optometristId;
     @ApiModelProperty(value = "用户id")
-    @NotNull(message = "用户id不能为空")
     private Integer userId;
     @ApiModelProperty(value = "开始时间 前端忽略")
     private String startTime;
diff --git a/manage/src/main/java/com/jilongda/manage/query/TOrderQuery.java b/manage/src/main/java/com/jilongda/manage/query/TOrderQuery.java
index ed897db..8f9074d 100644
--- a/manage/src/main/java/com/jilongda/manage/query/TOrderQuery.java
+++ b/manage/src/main/java/com/jilongda/manage/query/TOrderQuery.java
@@ -49,4 +49,6 @@
     private List<Integer> userIds;
     @ApiModelProperty(value = "订单ids 前端忽略")
     private List<Integer> orderIds;
+    @ApiModelProperty(value = "用户id")
+    private Integer userId;
 }
diff --git a/manage/src/main/java/com/jilongda/manage/service/impl/TWarehousingServiceImpl.java b/manage/src/main/java/com/jilongda/manage/service/impl/TWarehousingServiceImpl.java
index c92b421..6a960eb 100644
--- a/manage/src/main/java/com/jilongda/manage/service/impl/TWarehousingServiceImpl.java
+++ b/manage/src/main/java/com/jilongda/manage/service/impl/TWarehousingServiceImpl.java
@@ -60,6 +60,7 @@
                     tFrameWarehousingDetailVO.setStoreName(store.getName());
                 }
             }
+//            tFrameWarehousingDetailVO.setStatus();
         }
         pageInfo.setRecords(list);
         return pageInfo;
diff --git a/manage/src/main/java/com/jilongda/manage/vo/TInventoryInfoVO.java b/manage/src/main/java/com/jilongda/manage/vo/TInventoryInfoVO.java
index 30e5424..edc1930 100644
--- a/manage/src/main/java/com/jilongda/manage/vo/TInventoryInfoVO.java
+++ b/manage/src/main/java/com/jilongda/manage/vo/TInventoryInfoVO.java
@@ -16,6 +16,6 @@
     private String store;
     @ApiModelProperty(value = "镜片盘点明细")
     private List<TInventoryLensDetail> lensList;
-    @ApiModelProperty(value = "镜片盘点明细")
+    @ApiModelProperty(value = "镜架盘点明细")
     private List<TInventoryFrameDetail> frameList;
 }
diff --git a/manage/src/main/resources/mapping/TFrameWarehousingDetailMapper.xml b/manage/src/main/resources/mapping/TFrameWarehousingDetailMapper.xml
index 75970c0..08639fe 100644
--- a/manage/src/main/resources/mapping/TFrameWarehousingDetailMapper.xml
+++ b/manage/src/main/resources/mapping/TFrameWarehousingDetailMapper.xml
@@ -27,7 +27,7 @@
     </sql>
     <select id="pageList" resultType="com.jilongda.manage.vo.TFrameWarehousingDetailVO">
         select tfwd.id, tfwd.warehousingId, tfwd.brand, tfwd.supplier, tfwd.material, tfwd.total, tfwd.color, tfwd.model, tfwd.code, tfwd.createTime,
-               tfwd.updateTime, tfwd.createBy, tfwd.updateBy, tfwd.isDelete, tfwd.modelId,tw.storeId
+               tfwd.updateTime, tfwd.createBy, tfwd.updateBy, tfwd.isDelete, tfwd.modelId,tw.storeId,tw.status
         from t_frame_warehousing_detail tfwd
         left join t_warehousing tw on tfwd.warehousingId = tw.id
         <where>
diff --git a/manage/src/main/resources/mapping/TOptometristMapper.xml b/manage/src/main/resources/mapping/TOptometristMapper.xml
index 5ba7db0..3005ab6 100644
--- a/manage/src/main/resources/mapping/TOptometristMapper.xml
+++ b/manage/src/main/resources/mapping/TOptometristMapper.xml
@@ -46,12 +46,15 @@
             <if test="query.phone != null and query.phone != ''">
                 and t1.phone like  concat('%',#{query.phone},'%')
             </if>
-            <if test="query.storeId != null and query.storeId != ''">
+            <if test="query.storeId != null ">
                 and t1.storeId =  #{query.storeId}
             </if>
-            <if test="query.optometristId != null and query.optometristId != ''">
+            <if test="query.optometristId != null ">
                 and t1.optometristId =  #{query.optometristId}
             </if>
+            <if test="query.userId != null ">
+                and t1.userId =  #{query.userId}
+            </if>
             <if test="query.startTime != null and query.startTime!=''">
                 and (t1.createTime between #{query.startTime} and #{query.endTime})
             </if>
diff --git a/manage/src/main/resources/mapping/TOrderMapper.xml b/manage/src/main/resources/mapping/TOrderMapper.xml
index 3c6903d..b0b423f 100644
--- a/manage/src/main/resources/mapping/TOrderMapper.xml
+++ b/manage/src/main/resources/mapping/TOrderMapper.xml
@@ -71,13 +71,19 @@
             and orderMoney between #{query.startMoney} and #{query.endMoney}
         </if>
         <if test="query.realName != null and query.realName != ''">
-            and `name` like concat('%',#{query.realName},'%')
+            and realName like concat('%',#{query.realName},'%')
+        </if>
+          <if test="query.phone != null and query.phone != ''">
+            and phone like concat('%',#{query.phone},'%')
         </if>
         <if test="query.storeId != null">
             and storeId = #{query.storeId}
         </if>
         <if test="query.sysId != null">
             and sysId = #{query.sysId}
+        </if>
+          <if test="query.userId != null">
+            and userId = #{query.userId}
         </if>
         <if test="query.userIds != null and query.userIds.size()>0">
             AND userId IN
@@ -91,5 +97,6 @@
                 #{id}
             </foreach>
         </if>
+        order by createTime desc
     </select>
 </mapper>
diff --git a/manage/src/main/resources/mapping/TStoreMapper.xml b/manage/src/main/resources/mapping/TStoreMapper.xml
index eba0034..bee887d 100644
--- a/manage/src/main/resources/mapping/TStoreMapper.xml
+++ b/manage/src/main/resources/mapping/TStoreMapper.xml
@@ -39,7 +39,6 @@
             </if>
             AND isDelete = ${@com.jilongda.common.enums.DisabledEnum@NO.getCode()}
         </where>
-        ORDER BY createTime DESC
     </select>
 
 </mapper>
diff --git a/optometrist/src/main/java/com/jilongda/optometrist/authority/controller/LoginController.java b/optometrist/src/main/java/com/jilongda/optometrist/authority/controller/LoginController.java
index a5974cb..ae5d773 100644
--- a/optometrist/src/main/java/com/jilongda/optometrist/authority/controller/LoginController.java
+++ b/optometrist/src/main/java/com/jilongda/optometrist/authority/controller/LoginController.java
@@ -13,8 +13,10 @@
 import com.jilongda.optometrist.authority.model.SecUser;
 import com.jilongda.optometrist.authority.service.SecUserService;
 import com.jilongda.optometrist.model.TOptometrist;
+import com.jilongda.optometrist.model.TStore;
 import com.jilongda.optometrist.security.SecurityUserDetails;
 import com.jilongda.optometrist.service.TOptometristService;
+import com.jilongda.optometrist.service.TStoreService;
 import com.jilongda.optometrist.utils.MsgUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -52,6 +54,8 @@
     private final SecUserService secUserService;
     @Autowired
     private TOptometristService optometristService;
+    @Autowired
+    private TStoreService storeService;
 
     @Autowired
     public LoginController(AuthenticationManager authenticationManager, SecurityUtils securityUtils, PasswordEncoder passwordEncoder, RedisAutoTemplate redisAutoTemplate, MsgUtils msgUtils, SecUserService secUserService) {
@@ -78,6 +82,10 @@
         if (two!=null){
             return ApiResult.failed(500, "账号已被禁用");
         }
+        TStore store = storeService.getById(one.getStoreId());
+        if (store.getStatus()==2){
+            return ApiResult.failed(500, "门店已被禁用");
+        }
         // 先检验是否登录
         String phone = dto.getPhone();
         String code = dto.getCode();
diff --git a/optometrist/src/main/java/com/jilongda/optometrist/controller/TOptometristController.java b/optometrist/src/main/java/com/jilongda/optometrist/controller/TOptometristController.java
index df87c99..40a84e5 100644
--- a/optometrist/src/main/java/com/jilongda/optometrist/controller/TOptometristController.java
+++ b/optometrist/src/main/java/com/jilongda/optometrist/controller/TOptometristController.java
@@ -23,6 +23,7 @@
 
 import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -108,7 +109,17 @@
         tOptometristVO.setStoreName(byId1.getName());
         tOptometristVO.setName(byId.getName());
         tOptometristVO.setPhone(byId.getPhone());
+        Date start = new Date();
+        Date end = new Date();
+        // 获取今日凌晨00:00:00和今日23:59:59
+        start.setHours(0);
+        start.setMinutes(0);
+        start.setSeconds(0);
+        end.setHours(23);
+        end.setMinutes(59);
+        end.setSeconds(59);
         int size = optometryService.lambdaQuery().eq(TOptometry::getOptometristId, userId)
+                .between(TOptometry::getCreateTime, start, end)
                 .eq(TOptometry::getStatus, 3).list().size();
         tOptometristVO.setOptometryCount(size);
         // 查询今日的排号列表

--
Gitblit v1.7.1