Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop
1 files added
16 files modified
| | |
| | | */ |
| | | @Configuration |
| | | @EnableSwagger2 |
| | | @Profile(value = {"dev","test","check", "xctest"}) |
| | | @Profile(value = {"dev","test","check", "xctest", "xc"}) |
| | | public class SwaggerConfig { |
| | | |
| | | |
| | |
| | | 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: |
| | |
| | | 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: |
| | |
| | | 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: |
| | |
| | | |
| | | 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; |
| | |
| | | @Autowired |
| | | private GoodsService goodsService; |
| | | |
| | | @PassToken |
| | | @ApiOperation("分类列表") |
| | | @ApiResponses( |
| | | @ApiResponse(code = 200, message = "success", response = GoodsCategoryVo.class) |
| | |
| | | return JsonResult.success(goodsService.findCategoryWithChildren()); |
| | | } |
| | | |
| | | @PassToken |
| | | @ApiOperation("商品列表") |
| | | @ApiResponses( |
| | | @ApiResponse(code = 200, message = "success", response = XcxGoodsListVo.class) |
| | |
| | | return JsonResult.success(goodsService.findGoodsListInPage(xcxGoodsListDto)); |
| | | } |
| | | |
| | | @PassToken |
| | | @ApiOperation("商品详情") |
| | | @ApiResponses( |
| | | @ApiResponse(code = 200, message = "success", response = XcxGoodsDetailVo.class) |
| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation("首页统计") |
| | | @GetMapping(value = "/order/statistics") |
| | | public JsonResult<StatisticsVo> orderStatistics(HttpServletRequest request) { |
| | | return JsonResult.success(orderService.orderStatistics(getUserId(request))); |
| | | } |
| | | } |
| | |
| | | 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> { |
| | |
| | | List<QueryScoreDetailsListVo> queryScoreDetailsList(@Param("record") QueryScoreDetailsListDto model); |
| | | |
| | | List<XcxScoreDetailsVo> selectXcxScoreDetailsList(@Param("record") XcxScoreDetailsDto xcxScoreDetailsDto); |
| | | |
| | | BigDecimal selectTotalScoreByUserId(@Param("userId") String userId, @Param("type") Integer type); |
| | | } |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface ScoreOrderMapper extends GcMapper<ScoreOrder> { |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | @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; |
| | |
| | | private String phone; |
| | | |
| | | |
| | | public void setCreatedTime(Date createdTime) { |
| | | this.createdTime = createdTime; |
| | | this.createTime = DateUtil.format(createdTime, "yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | } |
| | |
| | | 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: |
| | |
| | | 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> |
| | |
| | | <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 |
| | |
| | | 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> |
| | |
| | | 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: |
| | |
| | | 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: |