xiaoyong931011
2021-06-30 44400f2f3427791c5382b02d70c4c0ef8d0c49ed
Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop
1 files added
16 files modified
119 ■■■■ changed files
gc-core/src/main/java/com/xzx/gc/config/SwaggerConfig.java 2 ●●● patch | view | raw | blame | history
gc-order/src/main/resources/application-xc.yml 2 ●●● patch | view | raw | blame | history
gc-pay/src/main/resources/application-xc.yml 2 ●●● patch | view | raw | blame | history
gc-role/src/main/resources/application-xc.yml 2 ●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/controller/ApiGoodsController.java 4 ●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/controller/ApiOrderController.java 11 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreDetailsMapper.java 3 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreOrderMapper.java 3 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java 19 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/vo/StatisticsVo.java 30 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/vo/XcxOrderDetailsVo.java 10 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/resources/application-xc.yml 2 ●●● patch | view | raw | blame | history
gc-shop/src/main/resources/mapper/shop/ScoreDetailsMapper.xml 6 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/resources/mapper/shop/ScoreGoodsMapper.xml 2 ●●● patch | view | raw | blame | history
gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml 17 ●●●●● patch | view | raw | blame | history
gc-sys/src/main/resources/application-xc.yml 2 ●●● patch | view | raw | blame | history
gc-user/src/main/resources/application-xc.yml 2 ●●● patch | view | raw | blame | history
gc-core/src/main/java/com/xzx/gc/config/SwaggerConfig.java
@@ -31,7 +31,7 @@
 */
@Configuration
@EnableSwagger2
@Profile(value = {"dev","test","check", "xctest"})
@Profile(value = {"dev","test","check", "xctest", "xc"})
public class SwaggerConfig {
gc-order/src/main/resources/application-xc.yml
@@ -6,7 +6,7 @@
    password: 123456
    virtual-host: /
  datasource:
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true&serverTimezone=GMT%2b8
    username: ct_test
    password: 123456
  redis:
gc-pay/src/main/resources/application-xc.yml
@@ -6,7 +6,7 @@
    password: 123456
    virtual-host: /
  datasource:
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true&serverTimezone=GMT%2b8
    username: ct_test
    password: 123456
  redis:
gc-role/src/main/resources/application-xc.yml
@@ -6,7 +6,7 @@
    password: 123456
    virtual-host: /
  datasource:
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true&serverTimezone=GMT%2b8
    username: ct_test
    password: 123456
  redis:
gc-shop/src/main/java/com/xzx/gc/shop/controller/ApiGoodsController.java
@@ -3,6 +3,7 @@
import com.github.pagehelper.PageInfo;
import com.xzx.gc.common.Result;
import com.xzx.gc.common.annotations.PassToken;
import com.xzx.gc.common.request.BaseController;
import com.xzx.gc.model.JsonResult;
import com.xzx.gc.service.BaseAccountService;
@@ -31,6 +32,7 @@
    @Autowired
    private GoodsService goodsService;
    @PassToken
    @ApiOperation("分类列表")
    @ApiResponses(
            @ApiResponse(code = 200, message = "success", response = GoodsCategoryVo.class)
@@ -40,6 +42,7 @@
        return JsonResult.success(goodsService.findCategoryWithChildren());
    }
    @PassToken
    @ApiOperation("商品列表")
    @ApiResponses(
            @ApiResponse(code = 200, message = "success", response = XcxGoodsListVo.class)
@@ -51,6 +54,7 @@
        return JsonResult.success(goodsService.findGoodsListInPage(xcxGoodsListDto));
    }
    @PassToken
    @ApiOperation("商品详情")
    @ApiResponses(
            @ApiResponse(code = 200, message = "success", response = XcxGoodsDetailVo.class)
gc-shop/src/main/java/com/xzx/gc/shop/controller/ApiOrderController.java
@@ -8,6 +8,7 @@
import com.xzx.gc.shop.dto.AddGoodsOrderDto;
import com.xzx.gc.shop.dto.XcxOrderListDto;
import com.xzx.gc.shop.service.OrderService;
import com.xzx.gc.shop.vo.StatisticsVo;
import com.xzx.gc.shop.vo.XcxOrderDetailsVo;
import com.xzx.gc.shop.vo.XcxOrderListVo;
import io.swagger.annotations.Api;
@@ -16,10 +17,7 @@
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@@ -79,4 +77,9 @@
    }
    @ApiOperation("首页统计")
    @GetMapping(value = "/order/statistics")
    public JsonResult<StatisticsVo> orderStatistics(HttpServletRequest request) {
        return JsonResult.success(orderService.orderStatistics(getUserId(request)));
    }
}
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreDetailsMapper.java
@@ -8,6 +8,7 @@
import com.xzx.gc.util.GcMapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
public interface ScoreDetailsMapper extends GcMapper<ScoreDetails> {
@@ -15,4 +16,6 @@
    List<QueryScoreDetailsListVo> queryScoreDetailsList(@Param("record") QueryScoreDetailsListDto model);
    List<XcxScoreDetailsVo> selectXcxScoreDetailsList(@Param("record") XcxScoreDetailsDto xcxScoreDetailsDto);
    BigDecimal selectTotalScoreByUserId(@Param("userId") String userId, @Param("type") Integer type);
}
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreOrderMapper.java
@@ -11,6 +11,7 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface ScoreOrderMapper extends GcMapper<ScoreOrder> {
@@ -25,4 +26,6 @@
    XcxOrderDetailsVo selectXcxOrderDetails(@Param("id") Long id);
    int updateOrderStatus(@Param("id") Long id, @Param("status") Integer status, @Param("userId") String userId);
    Map<String, Object> selectOrderStastics(@Param("userId") String userId);
}
gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java
@@ -382,4 +382,23 @@
            }
        }
    }
    public StatisticsVo orderStatistics(String userId) {
        BigDecimal score = scoreDetailsMapper.selectTotalScoreByUserId(userId, ScoreDetails.SCORE_TYPE_EXCHANGE);
        Map<String, Object> userData = scoreOrderMapper.selectOrderStastics(userId);
        Map<String, Object> allData = scoreOrderMapper.selectOrderStastics(null);
        StatisticsVo statisticsVo = new StatisticsVo();
        statisticsVo.setScore(score);
        BigDecimal userPrice = (BigDecimal) userData.get("totalPrice");
        statisticsVo.setReduceCarbon(userPrice.divide(BigDecimal.TEN, 2, BigDecimal.ROUND_DOWN));
        statisticsVo.setOrderCnt(Integer.parseInt(userData.get("totalOrder").toString()));
        BigDecimal totalPrice = (BigDecimal) allData.get("totalPrice");
        statisticsVo.setTotalReduceCarbon(totalPrice.divide(BigDecimal.TEN, 2, BigDecimal.ROUND_DOWN));
        statisticsVo.setTotalOrderCnt(Integer.parseInt(allData.get("totalOrder").toString()));
        statisticsVo.setTotalBuyCnt(Integer.parseInt(allData.get("totalBuy").toString()));
        return statisticsVo;
    }
}
gc-shop/src/main/java/com/xzx/gc/shop/vo/StatisticsVo.java
New file
@@ -0,0 +1,30 @@
package com.xzx.gc.shop.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "StatisticsVo", description = "统计")
public class StatisticsVo {
    @ApiModelProperty(value = "个人参与次数")
    private Integer orderCnt;
    @ApiModelProperty(value = "获得积分")
    private BigDecimal score;
    @ApiModelProperty(value = "减少碳排放量")
    private BigDecimal reduceCarbon;
    @ApiModelProperty(value = "用户参与次数")
    private Integer totalOrderCnt;
    @ApiModelProperty(value = "积分兑换次数")
    private Integer totalBuyCnt;
    @ApiModelProperty(value = "总减少排放量")
    private BigDecimal totalReduceCarbon;
}
gc-shop/src/main/java/com/xzx/gc/shop/vo/XcxOrderDetailsVo.java
@@ -1,5 +1,6 @@
package com.xzx.gc.shop.vo;
import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -17,7 +18,10 @@
    @ApiModelProperty(value = "下单时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;
    private Date createdTime;
    @ApiModelProperty(value = "下单时间")
    private String createTime;
    @ApiModelProperty(value = "缩略图")
    private String thumb;
@@ -59,4 +63,8 @@
    private String phone;
    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
        this.createTime = DateUtil.format(createdTime, "yyyy-MM-dd HH:mm:ss");
    }
}
gc-shop/src/main/resources/application-xc.yml
@@ -6,7 +6,7 @@
    password: 123456
    virtual-host: /
  datasource:
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true&serverTimezone=GMT%2b8
    username: ct_test
    password: 123456
  redis:
gc-shop/src/main/resources/mapper/shop/ScoreDetailsMapper.xml
@@ -35,4 +35,10 @@
        where user_id=#{record.userId}
        order by id desc
    </select>
    <select id="selectTotalScoreByUserId" resultType="java.math.BigDecimal">
        select sum(change_score)
        from xzx_score_details
        where user_id=#{userId} and type=#{type}
    </select>
</mapper>
gc-shop/src/main/resources/mapper/shop/ScoreGoodsMapper.xml
@@ -47,7 +47,7 @@
        <where>
            a.del_flag=0 and a.is_sale=1
            <if test="record.minScore != null" >
                and b.present_price >= #{minScore}
                and b.present_price >= #{record.minScore}
            </if>
            <if test="record.maxScore != null">
                and #{record.maxScore} > b.present_price
gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml
@@ -82,4 +82,21 @@
        set status=#{status}
        where id=#{id} and user_id=#{userId}
    </update>
    <select id="selectOrderStastics" resultType="java.util.Map">
        select
            IFNULL(count(1), 0) totalBuy,
            IFNULL(sum(IFNULL(total_price,0)),0) totalPrice,
            (
                select IFNULL(count(1),0) from xzx_jhy_order where status = 3
                <if test="userId != null and userId != ''">
                    and user_id=#{userId}
                </if>
            ) totalOrder
        from xzx_score_order
        where status=3
        <if test="userId != null and userId != ''">
            and user_id=#{userId}
        </if>
    </select>
</mapper>
gc-sys/src/main/resources/application-xc.yml
@@ -6,7 +6,7 @@
    password: 123456
    virtual-host: /
  datasource:
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true&serverTimezone=GMT%2b8
    username: ct_test
    password: 123456
  redis:
gc-user/src/main/resources/application-xc.yml
@@ -6,7 +6,7 @@
    password: 123456
    virtual-host: /
  datasource:
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true
    url: jdbc:mysql://120.27.238.55:3306/db_xzx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useAffectedRows=true&serverTimezone=GMT%2b8
    username: ct_test
    password: 123456
  redis: