Ver código fonte

Merge branch 'master' of http://8.152.195.41:3000/alien/alien_cloud into zjy

zjy 2 meses atrás
pai
commit
b620330a85
25 arquivos alterados com 310 adições e 59 exclusões
  1. 2 0
      alien-entity/src/main/java/shop/alien/entity/store/LifeUserOrder.java
  2. 1 1
      alien-entity/src/main/java/shop/alien/entity/store/StoreInfo.java
  3. 3 0
      alien-entity/src/main/java/shop/alien/entity/store/dto/LifeUserOrderDto.java
  4. 1 1
      alien-entity/src/main/java/shop/alien/entity/store/dto/StoreInfoDto.java
  5. 1 1
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyThaliVo.java
  6. 3 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserDynamicsVo.java
  7. 10 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserOrderVo.java
  8. 33 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/SystemConfigVo.java
  9. 2 2
      alien-entity/src/main/java/shop/alien/mapper/LifeUserDynamicsMapper.java
  10. 2 2
      alien-entity/src/main/java/shop/alien/mapper/LifeUserOrderMapper.java
  11. 5 0
      alien-entity/src/main/java/shop/alien/mapper/StoreInfoMapper.java
  12. 10 6
      alien-entity/src/main/resources/mapper/LifeUserOrderMapper.xml
  13. 1 1
      alien-job/src/main/java/shop/alien/job/feign/SecondGoodsFeign.java
  14. 2 7
      alien-second/src/main/java/shop/alien/second/controller/SecondGoodsController.java
  15. 7 0
      alien-second/src/main/java/shop/alien/second/service/SecondGoodsService.java
  16. 102 19
      alien-second/src/main/java/shop/alien/second/service/impl/SecondGoodsServiceImpl.java
  17. 4 4
      alien-store/src/main/java/shop/alien/store/controller/LifeUserDynamicsController.java
  18. 16 0
      alien-store/src/main/java/shop/alien/store/controller/StoreDictController.java
  19. 28 6
      alien-store/src/main/java/shop/alien/store/service/LifeUserDynamicsService.java
  20. 17 2
      alien-store/src/main/java/shop/alien/store/service/LifeUserOrderService.java
  21. 16 0
      alien-store/src/main/java/shop/alien/store/service/StoreDictService.java
  22. 4 4
      alien-store/src/main/java/shop/alien/store/service/impl/LifeCouponServiceImpl.java
  23. 4 3
      alien-store/src/main/java/shop/alien/store/service/impl/LifeGroupBuyServiceImpl.java
  24. 1 0
      alien-store/src/main/java/shop/alien/store/service/impl/PlatformStoreCouponServiceImpl.java
  25. 35 0
      alien-store/src/main/java/shop/alien/store/service/impl/StoreDictServiceImpl.java

+ 2 - 0
alien-entity/src/main/java/shop/alien/entity/store/LifeUserOrder.java

@@ -29,6 +29,8 @@ public class LifeUserOrder {
 
     private String orderNo;
 
+    private String orderStr;
+
     private Integer status;
 
     private String price;

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/StoreInfo.java

@@ -39,7 +39,7 @@ public class StoreInfo {
 
     @ApiModelProperty(value = "容纳人数")
     @TableField("store_capacity")
-    private Integer storeCapacity;
+    private String storeCapacity;
 
     @ApiModelProperty(value = "门店面积(1:小于20平米, 2:20~50平米, 3:50~100平米, 4:100~300平米, 5:500~1000平米, 6:大于1000平米)")
     @TableField("store_area")

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/dto/LifeUserOrderDto.java

@@ -30,6 +30,9 @@ public class LifeUserOrderDto {
     @ApiModelProperty(value = "订单编号")
     private String orderNo;
 
+    @ApiModelProperty(value = "订单字符串")
+    private String orderStr;
+
     @ApiModelProperty(value = "优惠券券id(life_discount_coupon_user)")
     private String yhquanId;
 

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/dto/StoreInfoDto.java

@@ -45,7 +45,7 @@ public class StoreInfoDto {
     private String storeTel;
 
     @ApiModelProperty(value = "容纳人数")
-    private Integer storeCapacity;
+    private String storeCapacity;
 
     @ApiModelProperty(value = "门店面积(1:小于20平米, 2:20~50平米, 3:50~100平米, 4:100~300平米, 5:500~1000平米, 6:大于1000平米)")
     private Integer storeArea;

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyThaliVo.java

@@ -61,7 +61,7 @@ public class LifeGroupBuyThaliVo {
     @ApiModelProperty(value = "图片id")
     @TableField("image_id")
     private String imageId;
-    private String imageValueStr;
+    private List<String> imageValueStr;
 
     /**
      * 团购名称

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserDynamicsVo.java

@@ -65,4 +65,7 @@ public class LifeUserDynamicsVo extends LifeUserDynamics {
 
     @ApiModelProperty(value = "动态图片列表")
     private List<String> imagePathList;
+
+    @ApiModelProperty(value = "商家名称")
+    private String storeName;
 }

+ 10 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserOrderVo.java

@@ -75,9 +75,13 @@ public class LifeUserOrderVo {
 
     private String storeAddress;
 
+    private Integer collectNum;
+
     private String storeTel;
     @ApiModelProperty(value = "团购/代金券优惠金额")
     private String offprice;
+    @ApiModelProperty(value = "团购/代金券原金额")
+    private String originalPrice;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date totalRefundTime;
@@ -130,6 +134,9 @@ public class LifeUserOrderVo {
     @ApiModelProperty(value = "预约规则")
     private String reservationRules;
 
+    @ApiModelProperty(value = "订单字符串")
+    private String orderStr;
+
     @ApiModelProperty(value = "营业时间类型")
     private String businessType;
     @ApiModelProperty(value = "营业日")
@@ -147,6 +154,9 @@ public class LifeUserOrderVo {
     @ApiModelProperty(value = "营业状态")
     private String businessStatus;
 
+    @ApiModelProperty(value = "营业状态")
+    private String storeStatus;
+
     @ApiModelProperty(value = "商户状态")
     private String abnormalStateFlag;
 

+ 33 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/SystemConfigVo.java

@@ -0,0 +1,33 @@
+package shop.alien.entity.store.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import shop.alien.entity.store.ActivityPeriod;
+import shop.alien.entity.store.ActivitySignInConfig;
+import shop.alien.entity.store.ActivitySignInReward;
+
+import java.util.List;
+
+/**
+ * @author zhangchen
+ * @version 1.0
+ * @date 2025/9/8 10:00
+ */
+@EqualsAndHashCode(callSuper = false)
+@Data
+@JsonInclude
+@ApiModel(value = "SystemConfigVo对象", description = "SystemConfigVo")
+public class SystemConfigVo {
+
+    @ApiModelProperty(value = "key值")
+    private String dictType;
+
+    @ApiModelProperty(value = "配置信息1(是否有冻结期0-无冻结期,1-有冻结期)")
+    private String configValue1;
+
+    @ApiModelProperty(value = "配置信息2(解冻时间)")
+    private String configValue2;
+}

+ 2 - 2
alien-entity/src/main/java/shop/alien/mapper/LifeUserDynamicsMapper.java

@@ -17,9 +17,9 @@ public interface LifeUserDynamicsMapper extends BaseMapper<LifeUserDynamics> {
     @Select("select dyna1.* from (with dynamice as( " +
             "    select id, top_status, top_time,  title, phone_id phoneId, context, image_path, address,address_name,address_context, liulan_count, dianzan_count, type, created_time, substring_index(phone_id, '_', 1) flag, substring_index(phone_id, '_', -1) phone, draft , address_province" +
             "    from life_user_dynamics " +
-            "    where delete_flag = 0 and draft = 0 order by created_time desc" +
+            "    where delete_flag = 0  and enable_status = 0 and draft = 0 order by created_time desc" +
             ") " +
-            "select dynamice.*, user.nick_name userName, user.head_img userImage, info.id storeUserId, user.id storeOrUserId, 0 isExpert " +
+            "select dynamice.*, info.store_name userName, user.head_img userImage, info.id storeUserId, user.id storeOrUserId, 0 isExpert " +
             "from dynamice " +
             "join store_user user on dynamice.phone = user.phone and user.delete_flag = 0 " +
             "join store_info info on info.id = user.store_id and info.delete_flag = 0 " +

+ 2 - 2
alien-entity/src/main/java/shop/alien/mapper/LifeUserOrderMapper.java

@@ -42,8 +42,8 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
             "\tselect id coupon_id,1 coupon_type,lc.name coupon_name, SUBSTRING_INDEX(image_path, ',', 1) AS image_id,0 effective_date_type,expiration_date effective_date_value \n" +
             "from life_coupon lc where lc.delete_flag = 0\n" +
             ")\n" +
-            "select luo.id,luo.buy_time,luo.status,luo.price,luo.final_price,luo.user_id,luo.store_id,luo.order_no,luo.pay_time,luo.cancel_time,luo.finish_time,\n" +
-            "si.store_name,si.commission_rate,si.business_section store_type,si.business_status,\n" +
+            "select luo.id,luo.buy_time,luo.status,luo.price,luo.final_price,luo.user_id,luo.store_id,luo.order_no,luo.pay_time,luo.cancel_time,luo.finish_time,luo.order_str,\n" +
+            "si.store_name,si.commission_rate,si.business_section store_type,si.store_status,si.business_status,\n" +
             "count(ocm.coupon_code) coupon_count,\n" +
             "simg.img_url,\n" +
             "lu.user_phone,\n" +

+ 5 - 0
alien-entity/src/main/java/shop/alien/mapper/StoreInfoMapper.java

@@ -105,4 +105,9 @@ public interface StoreInfoMapper extends BaseMapper<StoreInfo> {
             "left join store_dictionary dict2 on dict2.type_name = 'businessStatus' and a.business_status = dict2.dict_id and dict2.delete_flag = 0 " +
             "left join store_img d on d.store_id = a.id and d.img_type = 10 and d.delete_flag = 0 ${ew.customSqlSegment}")
     IPage<StoreInfoVo> getPageForDistance(IPage<StoreInfoVo> page,  @Param("position") String position,@Param(Constants.WRAPPER) QueryWrapper<StoreInfoVo> queryWrapper);
+
+
+    @Select("SELECT a.* FROM store_info a " +
+            "left join store_user b on a.id =b.store_id  where b.phone = #{phoneIdNew} limit 1")
+    StoreMainInfoVo getStoreNameByPhone(String phoneIdNew);
 }

+ 10 - 6
alien-entity/src/main/resources/mapper/LifeUserOrderMapper.xml

@@ -42,13 +42,17 @@
         <result column="quan_id" property="quanId"/>
         <result column="total_refund_time" property="totalRefundTime"/>
         <result column="business_status" property="businessStatus"/>
+        <result column="type" property="type"/>
 
         <result column="business_type" property="businessType"/>
+        <result column="collect_num" property="collectNum"/>
         <result column="business_date" property="businessDate"/>
         <result column="start_time" property="startTime"/>
         <result column="end_time" property="endTime"/>
         <result column="end_date" property="endDate"/>
         <result column="reservation_rules" property="reservationRules"/>
+        <result column="original_price" property="originalPrice"/>
+        <result column="order_str" property="orderStr"/>
 
         <collection property="orderCouponMiddleList" ofType="shop.alien.entity.store.vo.OrderCouponMiddleVo">
             <id column="ocmId" property="id" />
@@ -64,21 +68,21 @@
     <!-- 查询用户订单详情 -->
     <select id="queryUserOrderDetail" resultMap="BaseResultMap">
         with total_coupon as(
-        select id coupon_id,2 coupon_type,lgbm.group_name coupon_name,preferential_price offprice,SUBSTRING_INDEX(image_id, ',', 1) AS image_id,
+        select id coupon_id,2 coupon_type,lgbm.group_name coupon_name,preferential_price offprice,original_price, SUBSTRING_INDEX(image_id, ',', 1) AS image_id,
                effective_date_type,effective_date_value,use_rules,reservation_rules,applicable_num,quota_type,quota_value,inventory_num single_qty
         from life_group_buy_main lgbm where lgbm.delete_flag = 0
         union all
-        select id coupon_id,1 coupon_type,lc.name coupon_name,lc.offprice offprice,SUBSTRING_INDEX(image_path, ',', 1) AS image_id,
+        select id coupon_id,1 coupon_type,lc.name coupon_name,lc.offprice offprice,price original_price,SUBSTRING_INDEX(image_path, ',', 1) AS image_id,
                0 effective_date_type,expiration_date effective_date_value,use_rule use_rules,reservation_rules,applicable_num,1 quota_type,buy_limit quota_value,single_qty
         from life_coupon lc where lc.delete_flag = 0
         )
-        select luo.id,luo.order_no,luo.created_time , luo.price ,luo.final_price
-        ,luo.pay_method,luo.buy_time,luo.cancel_time,luo.pay_time,luo.finish_time,luo.status order_status,luo.quan_id,luo.refund_time total_refund_time,
+        select luo.id,luo.order_no,luo.created_time , luo.price ,luo.final_price,luo.order_str,
+        luo.pay_method,luo.buy_time,luo.cancel_time,luo.pay_time,luo.finish_time,luo.status order_status,luo.quan_id,luo.refund_time total_refund_time,
         tc.*,
-        ldc.nominal_value,
+        ldc.nominal_value,ldc.type,
         lu.user_phone,lu.user_name,lu.id user_id,
         ocm.id ocmId,ocm.status,ocm.coupon_code,ocm.refund_time,ocm.refund_reason,ocm.price refundPrice,
-        si.id store_id,si.store_name,si.commission_rate,si.store_address,si.store_tel,si.business_status,
+        si.id store_id,si.store_name,si.commission_rate,si.store_address,si.store_tel,si.business_status,si.collect_num,
         <if test="position != null and position != ''">
             ROUND(
             ST_Distance_Sphere(

+ 1 - 1
alien-job/src/main/java/shop/alien/job/feign/SecondGoodsFeign.java

@@ -4,7 +4,7 @@ import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
-@FeignClient(name = "alien-second", url = "http://localhost:9999")
+@FeignClient(name = "alien-second", url = "${feign.alienSecond.url}")
 public interface SecondGoodsFeign {
     
     /**

+ 2 - 7
alien-second/src/main/java/shop/alien/second/controller/SecondGoodsController.java

@@ -117,13 +117,8 @@ public class SecondGoodsController {
     @NoRepeatSubmit(expireTime = 3, message = "请勿重复提交下架商品请求")
     public R<Void> shelveSecondGoods(@ApiParam("下架二手商品") @RequestBody SecondGoodsVo secondGoods) {
         log.info("SecondGoodsController.shelveSecondGoods?secondGoods={}", secondGoods.toString());
-        // 修改商品状态为4 - 已下架
-        secondGoods.setGoodsStatus(4);
-        boolean updateResult = secondGoodsService.updateById(secondGoods);
-        if (updateResult) {
-            // 获取最新的商品信息并记录操作历史
-            SecondGoods updatedGoods = secondGoodsService.getById(secondGoods.getId());
-            secondGoodsService.recordGoodsOperation(updatedGoods,"下架商品");
+        boolean shelveResult = secondGoodsService.shelveSecondGoods(secondGoods);
+        if (shelveResult) {
             return R.success("下架成功");
         } else {
             return R.fail("下架失败");

+ 7 - 0
alien-second/src/main/java/shop/alien/second/service/SecondGoodsService.java

@@ -189,6 +189,13 @@ public interface SecondGoodsService extends IService<SecondGoods> {
     SecondGoodsRecordDetailVo getAdminGoodsRecordDetail(Integer recordId);
 
     /**
+     * 下架商品
+     * @param secondGoods 商品信息
+     * @return 是否下架成功
+     */
+    boolean shelveSecondGoods(SecondGoodsVo secondGoods);
+
+    /**
      * 处理商品信息(管理后台使用)
      * @param goodsId 商品ID
      * @return 处理后的商品详情信息

+ 102 - 19
alien-second/src/main/java/shop/alien/second/service/impl/SecondGoodsServiceImpl.java

@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import shop.alien.entity.SecondVideoTask;
 import shop.alien.entity.second.*;
@@ -634,27 +635,40 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
      * 创建商品审核记录
      * @param goods 商品信息
      */
+//    @Transactional(rollbackFor = Exception.class)
     private void approveAndListGoods(SecondGoods goods) {
-        // 如果所有审核都通过,设置为上架状态
-        goods.setGoodsStatus(SecondGoodsStatusEnum.LISTED.getCode()); // 上架
-        goods.setFailedReason("");
-        goods.setReleaseTime(new Date()); // 上架时间
-        updateById(goods);
-        // 插入审核记录
-        createGoodsAudit(goods, "", Constants.AuditStatus.PASSED);
-        // 发送审核成功消息
-        sendMessage(goods);
-        // 上架 记录商品操作历史
-        String operationName = "";
-        QueryWrapper<SecondGoodsRecord> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("goods_id", goods.getId());
-        List<SecondGoodsRecord> recordList = secondGoodsRecordMapper.selectList(queryWrapper);
-        if (CollectionUtil.isNotEmpty(recordList)){
-            operationName = "重新发布";
-        }else {
-            operationName = "首次发布";
+        boolean isNotified = false;
+        try {
+            // 如果所有审核都通过,设置为上架状态
+            goods.setGoodsStatus(SecondGoodsStatusEnum.LISTED.getCode()); // 上架
+            goods.setFailedReason("");
+            goods.setReleaseTime(new Date()); // 上架时间
+            updateById(goods);
+            // 插入审核记录
+            createGoodsAudit(goods, "", Constants.AuditStatus.PASSED);
+            // 发送审核成功消息
+            sendMessage(goods);
+            isNotified = true; // 标记通知已发送
+            // 上架 记录商品操作历史
+            String operationName = "";
+            QueryWrapper<SecondGoodsRecord> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("goods_id", goods.getId());
+            List<SecondGoodsRecord> recordList = secondGoodsRecordMapper.selectList(queryWrapper);
+            if (CollectionUtil.isNotEmpty(recordList)){
+                operationName = "重新发布";
+            }else {
+                operationName = "首次发布";
+            }
+            recordGoodsOperation(goods, operationName);
+        } catch (Exception e) {
+            log.error("商品上架过程中发生异常,执行回滚", e);
+            // 如果通知已发送但后续操作失败,需要补偿
+            if (isNotified) {
+                // 发送补偿消息,比如撤销通知或标记为异常状态
+//                sendCompensationMessage(goods);
+            }
+            throw e;
         }
-        recordGoodsOperation(goods, operationName);
     }
 
     /**
@@ -1765,4 +1779,73 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
         
         return result;
     }
+
+    /**
+     * 下架商品
+     * @param secondGoods 商品信息
+     * @return 是否下架成功
+     */
+    @Override
+    public boolean shelveSecondGoods(SecondGoodsVo secondGoods) {
+        log.info("SecondGoodsServiceImpl.shelveSecondGoods?secondGoods={}", secondGoods.toString());
+        // 修改商品状态为4 - 已下架
+        secondGoods.setGoodsStatus(4);
+        boolean updateResult = updateById(secondGoods);
+        if (updateResult) {
+            // 获取最新的商品信息并记录操作历史
+            SecondGoods updatedGoods = getById(secondGoods.getId());
+            recordGoodsOperation(updatedGoods, "下架商品");
+            // 发送系统通知
+            sendShelveMessage(updatedGoods);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+
+    /**
+     * 发送商品下架消息
+     * @param goods 商品信息
+     */
+    private void sendShelveMessage(SecondGoods goods) {
+        try {
+            // 根据 goods.getUserId() 获取用户信息
+            LifeUser lifeUser = lifeUserMapper.selectById(goods.getUserId());
+            String phone = lifeUser.getUserPhone();
+            // 调取feign接口 发送消息 life_notice表
+            LifeNotice lifeNotice = new LifeNotice();
+            lifeNotice.setSenderId("system");
+            lifeNotice.setReceiverId("user_"+ phone);
+            lifeNotice.setBusinessId(goods.getId());
+            lifeNotice.setTitle("商品下架通知");
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("goodsId", goods.getId());
+//            jsonObject.put("status", "true");
+            jsonObject.put("message", "您的商品:"+ goods.getTitle() + "已下架");
+            lifeNotice.setContext(jsonObject.toJSONString());
+            lifeNotice.setNoticeType(Constants.Notice.SYSTEM_NOTICE); // 系统通知
+            lifeNotice.setIsRead(0);
+            lifeNoticeMapper.insert(lifeNotice);
+            sendShelveNotice("user_"+ phone, lifeNotice);
+        } catch (Exception e) {
+            log.error("发送消息通知失败,goods: {}", goods, e);
+        }
+    }
+
+    private void sendShelveNotice(String receiverId, LifeNotice lifeNotice) {
+        try {
+            WebSocketVo webSocketVo = new WebSocketVo();
+            webSocketVo.setSenderId("system");
+            webSocketVo.setReceiverId(receiverId);
+            webSocketVo.setCategory("notice");
+            webSocketVo.setNoticeType("1");
+            webSocketVo.setIsRead(0);
+            webSocketVo.setText(JSONObject.from(lifeNotice).toJSONString());
+            alienStoreFeign.sendMsgToClientByPhoneId(receiverId, JSONObject.from(webSocketVo).toJSONString());
+        } catch (Exception e) {
+            log.error("发送消息通知失败,receiverId: {}", receiverId, e);
+        }
+    }
+
 }

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

@@ -186,7 +186,7 @@ public class LifeUserDynamicsController {
     @ApiOperationSupport(order = 1)
     @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "String", paramType = "query", required = true),
             @ApiImplicitParam(name = "size", value = "分页条数", dataType = "String", paramType = "query", required = true),
-            @ApiImplicitParam(name = "nickName", value = "昵称", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "userName", value = "昵称", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "userType", value = "user-用户 store-商户", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "dynamicsType", value = "1-图片 2-视频", dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "releaseStartTime", value = "发布开始时间", dataType = "String", paramType = "query"),
@@ -194,13 +194,13 @@ public class LifeUserDynamicsController {
     @GetMapping("/getDynamicsList")
     public R<IPage<LifeUserDynamicsVo>> getDynamicsList(@RequestParam(defaultValue = "1") Integer page,
                                                         @RequestParam(defaultValue = "10") Integer size,
-                                                        @RequestParam(required = false) String nickName,
+                                                        @RequestParam(required = false) String userName,
                                                         @RequestParam(required = false) String userType,
                                                         @RequestParam(defaultValue = "0",required = false) Integer dynamicsType,
                                                         @RequestParam(required = false) String releaseStartTime,
                                                         @RequestParam(required = false) String releaseEndTime) {
-        log.info("LifeUserDynamicsController.getDynamicsList?page={}&size={}&nickName={}&userType={}&dynamicsType={}", page, size, nickName, userType, dynamicsType);
-        List<LifeUserDynamicsVo> stores = lifeUserDynamicsService.getDynamicsList(page, size, nickName, userType, dynamicsType, releaseStartTime, releaseEndTime);
+        log.info("LifeUserDynamicsController.getDynamicsList?page={}&size={}&nickName={}&userType={}&dynamicsType={}", page, size, userName, userType, dynamicsType);
+        List<LifeUserDynamicsVo> stores = lifeUserDynamicsService.getDynamicsList(page, size, userName, userType, dynamicsType, releaseStartTime, releaseEndTime);
         return R.data(ListToPage.setPage(stores, page, size));
     }
 

+ 16 - 0
alien-store/src/main/java/shop/alien/store/controller/StoreDictController.java

@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.StoreDictionary;
+import shop.alien.entity.store.vo.SystemConfigVo;
 import shop.alien.store.service.StoreDictService;
 
 import java.util.Date;
@@ -99,4 +100,19 @@ public class StoreDictController {
     public R<Map<String, List<StoreDictionary>>> getDictList() {
         return R.data(storeDictService.getDictList());
     }
+
+    @ApiOperation("获取配置")
+    @ApiOperationSupport(order = 1)
+    @ApiImplicitParams({@ApiImplicitParam(name = "dictType", value = "字典类型", dataType = "String", paramType = "query", required = true)})
+    @GetMapping("/getConfig")
+    public R<SystemConfigVo> getConfig(String dictType) {
+        return R.data(storeDictService.getConfig(dictType));
+    }
+
+    @ApiOperation("修改配置")
+    @PutMapping(value = "editConfig")
+    private R editConfig(@RequestBody SystemConfigVo systemConfigVo) {
+        storeDictService.editConfig(systemConfigVo);
+        return R.success("成功");
+    }
 }

+ 28 - 6
alien-store/src/main/java/shop/alien/store/service/LifeUserDynamicsService.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
@@ -50,6 +51,8 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
 
     private final StoreCommentMapper storeCommentMapper;
 
+    private final StoreInfoMapper storeInfoMapper;
+
     public int addLiulanCount(String id) {
         LambdaUpdateWrapper<LifeUserDynamics> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
         lambdaUpdateWrapper.eq(LifeUserDynamics::getId, id);
@@ -91,6 +94,12 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
             store.setCreatedTime(new java.sql.Timestamp(nowDate.getTime()));
             return lifeUserDynamicsMapper.insert(store);
         } else {
+            //如果发布,则将创建时间修改为当前时间
+            LifeUserDynamics lifeUserDynamics = lifeUserDynamicsMapper.selectById(store.getId());
+            int draft = lifeUserDynamics.getDraft();
+            if(draft == 1 && store.getDraft() == 0){
+                store.setCreatedTime(new Date());
+            }
             return lifeUserDynamicsMapper.updateById(store);
         }
     }
@@ -146,6 +155,14 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
     public List<LifeUserDynamicsVo> getUserDynamics(String myself, String type, String isFollowed, String phoneId) {
         // 查询动态数据并按类型过滤
         List<LifeUserDynamicsVo> lifeUserDynamicsVoList = lifeUserDynamicsMapper.getLifeUserDynamicsList();
+
+        //对lifeUserDynamicsVoList数据进行处理,当type为2的时候,把userName的数值赋值到storeName
+        lifeUserDynamicsVoList.forEach(item -> {
+            if (item.getType().equals("2")) {
+                item.setStoreName(item.getUserName());
+            }
+        });
+
         if (!StringUtils.isEmpty(type)) {
             lifeUserDynamicsVoList = lifeUserDynamicsVoList.stream().filter(item -> type.equals(item.getType())).collect(Collectors.toList());
         }
@@ -471,9 +488,16 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
         List<LifeUserDynamicsVo> lifeUserDynamicsVos = lifeUserDynamicsMapper.selectDianZanList(phoneId);
         if (!CollectionUtils.isEmpty(lifeUserDynamicsVos)){
             for (LifeUserDynamicsVo lifeUserDynamicsVo : lifeUserDynamicsVos) {
-                String phoneIdNew = lifeUserDynamicsVo.getPhoneId().substring(6);
-                StoreUser storeUser = storeUserService.getUserByPhone(phoneIdNew);
-                lifeUserDynamicsVo.setUserName(storeUser.getNickName());
+                if (lifeUserDynamicsVo.getType().equals("2")){
+                    String phoneIdNew = lifeUserDynamicsVo.getPhoneId().substring(6);
+                     StoreInfo storeInfo=storeInfoMapper.getStoreNameByPhone(phoneIdNew);
+                    lifeUserDynamicsVo.setStoreName(storeInfo.getStoreName());
+                } else if (lifeUserDynamicsVo.getType().equals("1")) {
+                    String phoneIdNew = lifeUserDynamicsVo.getPhoneId().substring(5);
+                    //根据手机号查询用户表
+                    LifeUser lifeUser = lifeUserMapper.selectOne(new QueryWrapper<LifeUser>().eq("user_phone", phoneIdNew));
+                    lifeUserDynamicsVo.setUserName(lifeUser.getUserName());
+                }
             }
         }
         return  lifeUserDynamicsVos;
@@ -481,9 +505,7 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
 
     public List<LifeUserDynamicsVo> getDynamicsList(Integer page, Integer size, String nickName, String userType, Integer dynamicsType, String releaseStartTime, String releaseEndTime) {
         // 查询动态数据并按类型过滤
-        List<LifeUserDynamicsVo> lifeUserDynamicsVoList = lifeUserDynamicsMapper.getDynamicsList(nickName, userType, dynamicsType, releaseStartTime, releaseEndTime);
-
-        return lifeUserDynamicsVoList;
+        return lifeUserDynamicsMapper.getDynamicsList(nickName, userType, dynamicsType, releaseStartTime, releaseEndTime);
     }
 
     public LifeUserDynamicsVo getDynamicsDetail(Integer id) {

+ 17 - 2
alien-store/src/main/java/shop/alien/store/service/LifeUserOrderService.java

@@ -709,6 +709,8 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
         lifeUserOrder.setStoreId(lifeUserOrderDto.getStoreId());
         // 订单号
         lifeUserOrder.setOrderNo(lifeUserOrderDto.getOrderNo());
+        // 订单订单字符串
+        lifeUserOrder.setOrderStr(lifeUserOrderDto.getOrderStr());
         // 优惠券id
         lifeUserOrder.setQuanId(lifeUserOrderDto.getYhquanId());
         // 原价金额
@@ -919,7 +921,8 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
             if("3".equals(record.getType()) && org.apache.commons.lang3.StringUtils.isNotBlank(record.getStoreId())){
                 // 如果付款为0,商家收入为套餐原价
                 if(record.getFinalPrice().equals("0")){
-                    record.setFinalPrice(record.getPrice());
+                    // 如果付款为0,商家收入为套餐原价*数量
+                    record.setFinalPrice(new BigDecimal(record.getPrice()).multiply(new BigDecimal(record.getCouponCount().toString())).toString());
                 }else {
                     record.setFinalPrice(record.getNominalValue().add(new BigDecimal(record.getFinalPrice())).toString());
                 }
@@ -955,7 +958,19 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
             refundAmount = refundList.stream().map(OrderCouponMiddle::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
         }
         // 预计收入
-        BigDecimal expectIncome = new BigDecimal(lifeUserOrderVo.getFinalPrice()).subtract(refundAmount);
+        BigDecimal expectIncome = BigDecimal.ZERO;
+        // 如果使用了平台优惠券则预计收入特殊处理
+        if("3".equals(lifeUserOrderVo.getType())){
+            if(lifeUserOrderVo.getFinalPrice().equals("0")){
+                // 如果付款为0,商家收入为套餐原价*数量
+                expectIncome = new BigDecimal(lifeUserOrderVo.getPrice()).multiply(new BigDecimal(orderCouponMiddleList.size()));
+            } else {
+                expectIncome = new BigDecimal(lifeUserOrderVo.getFinalPrice()).add(lifeUserOrderVo.getNominalValue());
+            }
+        } else {
+            expectIncome = new BigDecimal(lifeUserOrderVo.getFinalPrice());
+        }
+        expectIncome = expectIncome.subtract(refundAmount);
         String commissionRateStr = lifeUserOrderVo.getCommissionRate();
         BigDecimal commissionRate = BigDecimal.ZERO;
         if (org.apache.commons.lang3.StringUtils.isNotBlank(commissionRateStr)) {

+ 16 - 0
alien-store/src/main/java/shop/alien/store/service/StoreDictService.java

@@ -3,6 +3,7 @@ package shop.alien.store.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import shop.alien.entity.store.StoreDictionary;
 import shop.alien.entity.store.vo.StoreDictionaryVo;
+import shop.alien.entity.store.vo.SystemConfigVo;
 
 import java.util.List;
 import java.util.Map;
@@ -42,4 +43,19 @@ public interface StoreDictService extends IService<StoreDictionary> {
 
     Map<String, List<StoreDictionary>> getDictList();
 
+    /**
+     * 查询字典值
+     *
+     * @param dictType 字典类型
+     * @return list
+     */
+    SystemConfigVo getConfig(String dictType);
+
+    /**
+     * 新增字典
+     *
+     * @param systemConfigVo 字典类
+     */
+    void editConfig(SystemConfigVo systemConfigVo);
+
 }

+ 4 - 4
alien-store/src/main/java/shop/alien/store/service/impl/LifeCouponServiceImpl.java

@@ -145,10 +145,10 @@ public class LifeCouponServiceImpl extends ServiceImpl<LifeCouponMapper, LifeCou
         lifeCouponNew.setStatus(4);
         lifeCouponMapper.update(lifeCouponNew, new LambdaUpdateWrapper<LifeCoupon>().eq(LifeCoupon::getSingleQty, 0));
         //如果当前时间小于开始时间,则修改status状态为未开始 状态为2
-        LifeCoupon lifeCouponNew1 = new LifeCoupon();
-        lifeCouponNew1.setStoreId(storeId);
-        lifeCouponNew1.setStatus(2);
-        lifeCouponMapper.update(lifeCouponNew1, new LambdaUpdateWrapper<LifeCoupon>().gt(LifeCoupon::getStartDate, LocalDateTime.now()));
+//        LifeCoupon lifeCouponNew1 = new LifeCoupon();
+//        lifeCouponNew1.setStoreId(storeId);
+//        lifeCouponNew1.setStatus(2);
+//        lifeCouponMapper.update(lifeCouponNew1, new LambdaUpdateWrapper<LifeCoupon>().gt(LifeCoupon::getStartDate, LocalDateTime.now()));
         return lifeCouponMapper.selectPage(lifeCouponIPage, wrapper);
     }
 

+ 4 - 3
alien-store/src/main/java/shop/alien/store/service/impl/LifeGroupBuyServiceImpl.java

@@ -220,10 +220,11 @@ public class LifeGroupBuyServiceImpl extends ServiceImpl<LifeGroupBuyMainMapper,
             List<String> imgIds = Arrays.asList(record.getImageId().split(","));
             List<StoreImg> storeImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().in(StoreImg::getId, imgIds));
             if (ObjectUtils.isNotEmpty(storeImgs)) {
-                String imgs = storeImgs.stream()
+                /*String imgs = storeImgs.stream()
                         .map(StoreImg::getImgUrl)
-                        .collect(Collectors.joining(","));
-                record.setImageValueStr(imgs);
+                        .collect(Collectors.joining("*"));
+                record.setImageValueStr(imgs);*/
+                record.setImageValueStr(storeImgs.stream().map(StoreImg::getImgUrl).collect(Collectors.toList()));
             }
         }
         //不可用日期

+ 1 - 0
alien-store/src/main/java/shop/alien/store/service/impl/PlatformStoreCouponServiceImpl.java

@@ -244,6 +244,7 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
                 status = 5;
             }
             coupon.setStatus(status);
+            coupon.setStartDate(now);
             // 将待办列表状态设置为已审核
             LambdaUpdateWrapper<WebAudit> wrapper = new LambdaUpdateWrapper<>();
             wrapper.eq(WebAudit::getCouponId, id);

+ 35 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreDictServiceImpl.java

@@ -3,13 +3,16 @@ package shop.alien.store.service.impl;
 import com.alibaba.excel.util.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import shop.alien.entity.store.StoreDictionary;
 import shop.alien.entity.store.StoreMenu;
 import shop.alien.entity.store.vo.StoreDictionaryVo;
+import shop.alien.entity.store.vo.SystemConfigVo;
 import shop.alien.mapper.StoreDictionaryMapper;
 import shop.alien.store.service.StoreDictService;
 import shop.alien.store.util.CommonConstant;
@@ -96,6 +99,38 @@ public class StoreDictServiceImpl extends ServiceImpl<StoreDictionaryMapper, Sto
                 .collect(Collectors.groupingBy(StoreDictionary::getTypeName));
     }
 
+    @Override
+    public SystemConfigVo getConfig(String dictType) {
+        SystemConfigVo systemConfigVo = new SystemConfigVo();
+        systemConfigVo.setDictType(dictType);
+        LambdaQueryWrapper<StoreDictionary> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(StoreDictionary::getTypeName, dictType);
+        queryWrapper.eq(StoreDictionary::getDeleteFlag, 0);
+        List<StoreDictionary> storeDictionaryList = this.list(queryWrapper);
+        if(!CollectionUtils.isEmpty(storeDictionaryList)){
+            StoreDictionary storeDictionary = storeDictionaryList.get(0);
+            systemConfigVo.setConfigValue1(storeDictionary.getDictId());
+            systemConfigVo.setConfigValue2(storeDictionary.getDictDetail());
+        }
+        return systemConfigVo;
+    }
+
+    @Override
+    public void editConfig(SystemConfigVo systemConfigVo) {
+        if(systemConfigVo != null && StringUtils.isNotBlank(systemConfigVo.getDictType())){
+            LambdaQueryWrapper<StoreDictionary> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(StoreDictionary::getTypeName, systemConfigVo.getDictType());
+            queryWrapper.eq(StoreDictionary::getDeleteFlag, 0);
+            List<StoreDictionary> storeDictionaryList = this.list(queryWrapper);
+            if(!CollectionUtils.isEmpty(storeDictionaryList)){
+                StoreDictionary storeDictionary = storeDictionaryList.get(0);
+                storeDictionary.setDictId(systemConfigVo.getConfigValue1());
+                storeDictionary.setDictDetail(systemConfigVo.getConfigValue2());
+                storeDictionaryMapper.updateById(storeDictionary);
+            }
+        }
+    }
+
     public List<StoreDictionary> buildTreeOptimized(List<StoreDictionary> flatList) {
         // 创建三个存储结构
         Map<Integer, StoreDictionary> nodeMap = new HashMap<>();  // ID到节点的映射