Просмотр исходного кода

[优化砍价营销数据][修改]:优化展示砍价营销数据

# Conflicts:
#	mallinkService/src/main/resources/mapper/WxCouponMapper.xml
release_toaliyun_real
Stormeye Wu 7 лет назад
Родитель
Сommit
fb0e8049f6
8 измененных файлов: 77 добавлений и 45 удалений
  1. +6
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
  2. +1
    -1
      mallinkAdmin/src/main/resources/application-dev.yml
  3. +1
    -1
      mallinkAdmin/src/main/resources/application-prod.yml
  4. +1
    -1
      mallinkAdmin/src/main/resources/application-test.yml
  5. +1
    -1
      mallinkAdmin/src/main/resources/application.yml
  6. +7
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  7. +7
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  8. +53
    -39
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

+ 6
- 1
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java Просмотреть файл

@@ -274,7 +274,12 @@ public class WxCouponController extends BaseController {
wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"));
}
wxCoupon.setTenantId(getTenantId());
return new ResultData(wxCouponService.findPressData(wxCoupon,pageNum,pageSize));
PageInfo<WxCouponStatisVo> pages = wxCouponService.findPressData(wxCoupon,pageNum,pageSize);
List<Long> ids = new ArrayList<>();
for(WxCouponStatisVo vo: pages.getList()) {
ids.add(vo.getId());
}
return new ResultData(pages);
}

}

+ 1
- 1
mallinkAdmin/src/main/resources/application-dev.yml Просмотреть файл

@@ -21,7 +21,7 @@ spring:
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000"
connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=60000"
#jackson:
#date-format: yyyy-MM-dd HH:mm:ss
# REDIS


+ 1
- 1
mallinkAdmin/src/main/resources/application-prod.yml Просмотреть файл

@@ -21,7 +21,7 @@ spring:
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000"
connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=60000"
# REDIS
redis:
host: 127.0.0.1


+ 1
- 1
mallinkAdmin/src/main/resources/application-test.yml Просмотреть файл

@@ -21,7 +21,7 @@ spring:
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000"
connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=60000"
# REDIS
redis:
host: 127.0.0.1


+ 1
- 1
mallinkAdmin/src/main/resources/application.yml Просмотреть файл

@@ -60,7 +60,7 @@ mybatis:
lazy-loading-enabled: true
use-generated-keys: true
default-fetch-size: 100
default-statement-timeout: 10
default-statement-timeout: 10000


#PageHelper


+ 7
- 1
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java Просмотреть файл

@@ -10,7 +10,13 @@ import com.iformall.domain.po.WxCoupon;

public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
List<WxCouponStatisVo> findPressData(WxCoupon wxCoupon);
List<WxCouponStatisVo> findCouponData(WxCoupon wxCoupon);
void updatePressData1(WxCoupon wxCoupon);
void updatePressData2(WxCoupon wxCoupon);
void updatePressData3(WxCoupon wxCoupon);
void updatePressData4(WxCoupon wxCoupon);
void updatePressData5(WxCoupon wxCoupon);

List<WxCouponStatisVo> findCouponData(WxCoupon wxCoupon);
List<WxCouponStatisVo> findCountData(WxCoupon wxCoupon);

List<WxCoupon> findList(WxCoupon wxCoupon);


+ 7
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -442,6 +442,13 @@ public class WxCouponServiceImpl implements WxCouponService {

@Override
public PageInfo<WxCouponStatisVo> findPressData(WxCoupon record, Integer pageNum, Integer pageSize) {
if(pageNum == 0) {
wxCouponMapper.updatePressData1(record);
wxCouponMapper.updatePressData2(record);
wxCouponMapper.updatePressData3(record);
wxCouponMapper.updatePressData4(record);
wxCouponMapper.updatePressData5(record);
}
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findPressData(record));
}



+ 53
- 39
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -624,54 +624,68 @@
</select>

<select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap">
select c.*,
IFNULL(round((select count(wo.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
where wo.order_status = 1 and wc.id = c.id)/(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wop.first = 1 and wc.id = c.id)*100,2),0) change_rate

,(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wop.first = 1 and wc.id = c.id) as press_count,

(select count(wo.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
where wo.order_status = 1 and wc.id = c.id) as press_succ_count,

(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wc.id = c.id) as join_count,

round(
(select count(wco.id) xcount from wx_coupon wc
left join wx_coupon_order wco on wco.coupon_id = wc.id
where wc.type = 8 and wco.coupon_order_status = 1
and wc.id = c.id)
/
(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wop.first = 1 and wc.id = c.id)
*100,2) as payment_rate

from wx_coupon c where c.type = 8
<if test="tenantId != null">
and c.tenant_id=#{tenantId}
select cpd.id, cpd.`cover_img`,cpd.`title`,cpd.`sale_price`,cpd.`price`,
cpd.change_rate, cpd.press_count, cpd.press_succ_count, cpd.join_count, cpd.payment_rate
from wx_coupon_press_data cpd
left join wx_coupon c on c.id = cpd.id
<if test="id != null">
and cpd.tenant_id=#{tenantId}
</if>
<if test="id != null">
and c.id = #{id}
and cpd.id = #{id}
</if>
<if test="title != null and title != ''">
and c.title like concat('%', #{title},'%')
and cpd.title like concat('%', #{title},'%')
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns"> order by c.status asc,c.create_date desc </if>
</select>

<update id="updatePressData1" parameterType="com.iformall.domain.po.WxCoupon" >
update wx_coupon_press_data cpd set change_rate =
IFNULL(round((select count(o.id) from wx_order o
where o.tenant_id = #{tenantId} and o.order_status = 1 and o.product_id = cpd.id)/
(select count(wop.id) from wx_order o
left join wx_order_press wop on wop.order_id = o.id
where o.product_id = cpd.id and o.tenant_id = #{tenantId} and wop.first = 1)*100,2),0)
where cpd.tenant_id = #{tenantId}
</update>

<update id="updatePressData2" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon_press_data cpd set press_count= (select count(wop.id) from wx_order o
left join wx_order_press wop on wop.order_id = o.id
where o.product_id = cpd.id and o.tenant_id = #{tenantId} and wop.first = 1)
where cpd.tenant_id=#{tenantId}
</update>

<update id="updatePressData3" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon_press_data cpd set
press_succ_count =
(select count(o.id) from wx_order o
where o.product_id = cpd.id and o.tenant_id = #{tenantId} and o.order_status = 1)
where cpd.tenant_id=#{tenantId}
</update>

<update id="updatePressData4" parameterType="com.iformall.domain.po.WxCoupon" >
update wx_coupon_press_data cpd set join_count =
(select count(wop.id) from wx_order o
left join wx_order_press wop on wop.order_id = o.id
where o.tenant_id = #{tenantId} and o.product_id = cpd.id and o.payment_type = 0)
where cpd.tenant_id=#{tenantId}
</update>

<select id="updatePressData5" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon_press_data cpd set payment_rate = round(
(select count(wco.id) xcount from wx_coupon_order wco
where wco.tenant_id = #{tenantId} and wco.coupon_id = cpd.id and wco.coupon_order_status = 1)
/
(select count(wop.id) from wx_order o
left join wx_order_press wop on wop.order_id = o.id
where o.tenant_id = #{tenantId} and o.product_id = cpd.id and wop.first = 1 )
*100,2)
where cpd.tenant_id=#{tenantId}
</select>

<select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c
left join wx_coupon_order wco on c.id = wco.coupon_id


Загрузка…
Отмена
Сохранить