Kaynağa Gözat

bugfix:订单+我的钱包
add:打卡广场

lyx 2 ay önce
ebeveyn
işleme
bbe89a67a8

+ 21 - 0
alien-entity/src/main/java/shop/alien/mapper/StoreIncomeDetailsRecordMapper.java

@@ -1,5 +1,6 @@
 package shop.alien.mapper;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
@@ -32,4 +33,24 @@ public interface StoreIncomeDetailsRecordMapper extends BaseMapper<StoreIncomeDe
     @Update("UPDATE store_income_details_record SET cash_out_id = NULL WHERE delete_flag=0 AND store_id = #{storeId} AND cash_out_id = #{cashOutId}")
     int updateByCashOutId(@Param("storeId") Integer storeId,
                                  @Param("cashOutId") Integer cashOutId);
+
+    @Select("with totalCoupon as (\n" +
+            "select lc.name,1 type,lc.id\n" +
+            "from life_coupon lc  where lc.delete_flag = 0\n" +
+            "union all\n" +
+            "select lgbm.group_name,2 type,lgbm.id\n" +
+            "from life_group_buy_main lgbm where lgbm.delete_flag = 0 \n" +
+            ")            \n" +
+            "SELECT\n" +
+            "\tsidr.id,sidr.updated_time,sidr.created_user_id,sidr.income_type,sidr.business_id,sidr.cash_out_id,sidr.store_id,sidr.user_order_id,sidr.delete_flag,sidr.money,sidr.commission,sidr.updated_user_id,\n" +
+            "\tluo.buy_time orderTime,\n" +
+            "\tocm.created_time checkTime,\n" +
+            "\tADDDATE(sidr.created_time, 4) incomeTime,\n" +
+            "\ttc.name couponName\n" +
+            "FROM\n" +
+            "\tstore_income_details_record sidr\n" +
+            "left join order_coupon_middle ocm on ocm.id = sidr.user_order_id and ocm.delete_flag = 0\n" +
+            "left join life_user_order luo on luo.id  = ocm.order_id and luo.delete_flag = 0\n" +
+            "left join totalCoupon tc on tc.id = sidr.business_id and tc.type = luo.coupon_type")
+    List<StoreIncomeDetailsRecordVo> selectRecordList(LambdaQueryWrapper<StoreIncomeDetailsRecord> wrapper);
 }

+ 10 - 4
alien-store/src/main/java/shop/alien/store/controller/StoreClockInController.java

@@ -30,11 +30,17 @@ public class StoreClockInController {
 
     @ApiOperation("打卡列表")
     @ApiOperationSupport(order = 2)
-    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", paramType = "query"), @ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", defaultValue = "1", paramType = "query"), @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", defaultValue = "10", paramType = "query"), @ApiImplicitParam(name = "phoneId", value = "'user_' + 手机号", dataType = "String", paramType = "query"), @ApiImplicitParam(name = "mySelf", value = "是否只查看自己(0-否  1-是)", dataType = "Integer", defaultValue = "0", paramType = "query")})
+    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", defaultValue = "1", paramType = "query"),
+            @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", defaultValue = "10", paramType = "query"),
+            @ApiImplicitParam(name = "phoneId", value = "'user_' + 手机号", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "mySelf", value = "是否只查看自己(0-否  1-是)", dataType = "Integer", defaultValue = "0", paramType = "query"),
+            @ApiImplicitParam(name = "storeId", value = "店铺id", dataType = "Integer", paramType = "query")
+    })
     @GetMapping("/getStoreClockInList")
-    public R<IPage<StoreClockInVo>> getStoreClockInList(Integer userId, int page, int size, String phoneId, int mySelf) {
-        log.info("StoreClockInController.getStoreClockInList?userId={},page={},size={},phoneId={},mySelf={}", userId, page, size, phoneId, mySelf);
-        return R.data(storeClockInService.getStoreClockInList(userId, page, size, phoneId, mySelf));
+    public R<IPage<StoreClockInVo>> getStoreClockInList(Integer userId, int page, int size, String phoneId, int mySelf, @RequestParam(required = false) Integer storeId) {
+        log.info("StoreClockInController.getStoreClockInList?userId={},page={},size={},phoneId={},mySelf={},storeId={}", userId, page, size, phoneId, mySelf,storeId);
+        return R.data(storeClockInService.getStoreClockInList(userId, page, size, phoneId, mySelf,storeId));
     }
 
     @ApiOperation("删除打卡记录")

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/StoreClockInService.java

@@ -20,7 +20,7 @@ public interface StoreClockInService extends IService<StoreClockIn> {
 
     StoreClockIn addStoreClockIn(StoreClockIn storeClockIn);
 
-    IPage<StoreClockInVo> getStoreClockInList(Integer userId, int page, int size, String phoneId, int mySelf);
+    IPage<StoreClockInVo> getStoreClockInList(Integer userId, int page, int size, String phoneId, int mySelf,Integer storeId);
 
     int deleteClockIn(Integer id);
 

+ 28 - 7
alien-store/src/main/java/shop/alien/store/service/impl/StoreClockInServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import shop.alien.entity.store.*;
 import shop.alien.entity.store.vo.StoreClockInVo;
@@ -51,8 +52,33 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
     }
 
     @Override
-    public IPage<StoreClockInVo> getStoreClockInList(Integer userId, int page, int size, String phoneId, int mySelf) {
+    public IPage<StoreClockInVo> getStoreClockInList(Integer userId, int page, int size, String phoneId, int mySelf,Integer storeId) {
         IPage<StoreClockIn> iPage = new Page<>(page, size);
+        // 查询我的点赞
+        LambdaQueryWrapper<LifeLikeRecord> likeWrapper = new LambdaQueryWrapper<>();
+        likeWrapper.eq(LifeLikeRecord::getDianzanId, phoneId);
+        likeWrapper.eq(LifeLikeRecord::getType, "5");
+        List<LifeLikeRecord> lifeLikeList = lifeLikeRecordMapper.selectList(likeWrapper);
+        List<String> likeList = lifeLikeList.stream().map(LifeLikeRecord::getHuifuId).collect(Collectors.toList());
+
+
+        if(StringUtils.isNotBlank(String.valueOf(storeId)) && !String.valueOf(storeId).equals("null")){
+            IPage<StoreClockInVo> storeClockInIPage1 = storeClockInMapper.getStoreClockInList(iPage, new QueryWrapper<StoreClockIn>()
+                    .eq("clock.user_id", userId)
+                    .eq("clock.store_id", storeId)
+                    .eq("clock.delete_flag", 0)
+                    .eq("user.delete_flag", 0)
+                    .eq("store.delete_flag", 0)
+                    .orderByDesc("created_time"));
+            storeClockInIPage1.getRecords().forEach(vo -> {
+                if (likeList.contains(String.valueOf(vo.getId()))) {
+                    vo.setIsLike("1");
+                } else {
+                    vo.setIsLike("0");
+                }
+            });
+            return storeClockInIPage1;
+        }
         QueryWrapper<StoreClockIn> wrapper = new QueryWrapper<>();
         wrapper.eq(1 == mySelf, "clock.user_id", userId);
         wrapper.eq("clock.delete_flag", 0);
@@ -73,12 +99,7 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
         lifeFansList = lifeFansMapper.selectList(lifeFansWrapper);
         List<String> fansList = lifeFansList.stream().map(LifeFans::getFansId).collect(Collectors.toList());
 
-        // 查询我的点赞
-        LambdaQueryWrapper<LifeLikeRecord> likeWrapper = new LambdaQueryWrapper<>();
-        likeWrapper.eq(LifeLikeRecord::getDianzanId, phoneId);
-        likeWrapper.eq(LifeLikeRecord::getType, "5");
-        List<LifeLikeRecord> lifeLikeList = lifeLikeRecordMapper.selectList(likeWrapper);
-        List<String> likeList = lifeLikeList.stream().map(LifeLikeRecord::getHuifuId).collect(Collectors.toList());
+
 
         // 查询我的收藏
         LambdaQueryWrapper<LifeCollect> collectWrapper = new LambdaQueryWrapper<>();

+ 6 - 8
alien-store/src/main/java/shop/alien/store/service/impl/StoreIncomeDetailsRecordServiceImpl.java

@@ -403,7 +403,7 @@ public class StoreIncomeDetailsRecordServiceImpl extends ServiceImpl<StoreIncome
             }
         }
         // 计算总钱数
-        List<StoreIncomeDetailsRecord> list = this.list(wrapper);
+        List<StoreIncomeDetailsRecordVo> list = storeIncomeDetailsRecordMapper.selectRecordList(wrapper);
 /*        Map<String, Integer> groupedByCreatedTime = list.stream().collect(
                 Collectors.groupingBy(
                         item -> item.getCreatedTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().toString(),
@@ -428,16 +428,14 @@ public class StoreIncomeDetailsRecordServiceImpl extends ServiceImpl<StoreIncome
             vo.setDate(key);
             resultList.add(vo);
         });*/
-        List<StoreIncomeDetailsRecordVo> resultList = new ArrayList<>();
-        for (StoreIncomeDetailsRecord storeIncomeDetailsRecord : list) {
+        for (StoreIncomeDetailsRecordVo storeIncomeDetailsRecord : list) {
             StoreIncomeDetailsRecordVo vo = new StoreIncomeDetailsRecordVo();
             BeanUtils.copyProperties(storeIncomeDetailsRecord, vo);
-            vo.setMoneyStr(new BigDecimal(vo.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).toString());
-            String format = df.format(vo.getCreatedTime());
-            vo.setDate(format);
-            resultList.add(vo);
+            storeIncomeDetailsRecord.setMoneyStr(new BigDecimal(vo.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).toString());
+            String format = df.format(storeIncomeDetailsRecord.getCreatedTime());
+            storeIncomeDetailsRecord.setDate(format);
         }
-        jsonObject.put("data", ListToPage.setPage(resultList, page, size));
+        jsonObject.put("data", ListToPage.setPage(list, page, size));
         jsonObject.put("money", new BigDecimal(list.stream().mapToInt(StoreIncomeDetailsRecord::getMoney).sum()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).toString());
         return jsonObject;
     }