提交 d3986c4e authored 作者: 000516's avatar 000516

店内执行:大区看板添加汇总行;新增经销商看板;新增填报备注列

...@@ -40,4 +40,13 @@ public class APReportQueryController { ...@@ -40,4 +40,13 @@ public class APReportQueryController {
return apDisplayQueryService.queryDeptAPReport(request); return apDisplayQueryService.queryDeptAPReport(request);
} }
/**
* 店内执行-经销商维度
*/
@GetMapping("/dist_cm")
@SalesPermissionCheck(value = SalesPermissionCheck.CheckType.USER)
public Object queryDistAPReport(SalesApRequest request) {
return apDisplayQueryService.queryDistAPReport(request);
}
} }
...@@ -23,10 +23,10 @@ public interface ISalesApDisplayDao { ...@@ -23,10 +23,10 @@ public interface ISalesApDisplayDao {
Object queryDeptAPReport(SalesApWq build); Object queryDeptAPReport(SalesApWq build);
Object queryDistAPReport(SalesApWq build);
List<SalesApDisplay> queryDataListByCondition(SalesApWq build); List<SalesApDisplay> queryDataListByCondition(SalesApWq build);
List<SalesApDisplay> queryByCondition(List<SalesApDisplayImportExcelDto> validDtoList); List<SalesApDisplay> queryByCondition(List<SalesApDisplayImportExcelDto> validDtoList);
boolean batchUpdate( List<SalesApDisplay> updateEntityList); boolean batchUpdate( List<SalesApDisplay> updateEntityList);
} }
...@@ -65,13 +65,25 @@ public class SalesApDisplayDaoImpl implements ISalesApDisplayDao { ...@@ -65,13 +65,25 @@ public class SalesApDisplayDaoImpl implements ISalesApDisplayDao {
public Object queryDeptAPReport(SalesApWq build) { public Object queryDeptAPReport(SalesApWq build) {
List<Map<String, Object>> mapZ = salesapdisMapper.queryDeptAPReportZQ(build); List<Map<String, Object>> mapZ = salesapdisMapper.queryDeptAPReportZQ(build);
List<Map<String, Object>> mapD = salesapdisMapper.queryDeptAPReportDQ(build); List<Map<String, Object>> mapD = salesapdisMapper.queryDeptAPReportDQ(build);
List<Map<String, Object>> mapHZ = salesapdisMapper.queryDeptAPHZReportDQ(build);
Map<String,Object> r = new HashMap<>(); Map<String,Object> r = new HashMap<>();
r.put("zq",mapZ); r.put("zq",mapZ);
r.put("dq",mapD); r.put("dq",mapD);
r.put("hz",mapHZ);
return r; return r;
} }
@Override
public Object queryDistAPReport(SalesApWq build) {
List<Map<String, Object>> mapDist = salesapdisMapper.queryDistAPReport(build);
List<Map<String, Object>> mapDistHz = salesapdisMapper.queryDistAPHZReport(build);
Map<String,Object> r = new HashMap<>();
r.put("dist",mapDist);
r.put("hz",mapDistHz);
return r;
}
@Override @Override
public List<SalesApDisplay> queryDataListByCondition(SalesApWq build) { public List<SalesApDisplay> queryDataListByCondition(SalesApWq build) {
LambdaQueryWrapper<SalesApDisplay> queryWrapper = buildWq(build); LambdaQueryWrapper<SalesApDisplay> queryWrapper = buildWq(build);
...@@ -123,7 +135,6 @@ public class SalesApDisplayDaoImpl implements ISalesApDisplayDao { ...@@ -123,7 +135,6 @@ public class SalesApDisplayDaoImpl implements ISalesApDisplayDao {
return affectRows > 0; return affectRows > 0;
} }
private LambdaQueryWrapper<SalesApDisplay> buildWq(SalesApWq salesApWq) { private LambdaQueryWrapper<SalesApDisplay> buildWq(SalesApWq salesApWq) {
LambdaQueryWrapper<SalesApDisplay> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SalesApDisplay> qw = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(salesApWq.getDealerCode())) { if (StringUtils.isNotBlank(salesApWq.getDealerCode())) {
......
...@@ -381,11 +381,10 @@ public class SalesApDisplay implements Serializable { ...@@ -381,11 +381,10 @@ public class SalesApDisplay implements Serializable {
* 更新时间 * 更新时间
*/ */
private Date updateTime; private Date updateTime;
/** /**
* 备注 未执行原因 * 活动备注
*/ */
private String remark; private String remark;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -162,6 +162,10 @@ public class SalesApDisplayJ implements Serializable { ...@@ -162,6 +162,10 @@ public class SalesApDisplayJ implements Serializable {
* 更新时间 * 更新时间
*/ */
private Date updateTime; private Date updateTime;
/**
* 活动备注
*/
private String remark;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -162,6 +162,10 @@ public class SalesApDisplayS implements Serializable { ...@@ -162,6 +162,10 @@ public class SalesApDisplayS implements Serializable {
* 更新时间 * 更新时间
*/ */
private Date updateTime; private Date updateTime;
/**
* 活动备注
*/
private String remark;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -401,6 +401,10 @@ public class SalesApPromotion implements Serializable { ...@@ -401,6 +401,10 @@ public class SalesApPromotion implements Serializable {
* 更新时间 * 更新时间
*/ */
private Date updateTime; private Date updateTime;
/**
* 活动备注
*/
private String remark;
@TableField(exist = false) @TableField(exist = false)
private Boolean isActualPromotionStartDate; private Boolean isActualPromotionStartDate;
@TableField(exist = false) @TableField(exist = false)
......
...@@ -299,6 +299,10 @@ public class SalesApPromotionDisplay implements Serializable { ...@@ -299,6 +299,10 @@ public class SalesApPromotionDisplay implements Serializable {
private String updateBy; private String updateBy;
private Date updateTime; private Date updateTime;
/**
* 活动备注
*/
private String remark;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -191,6 +191,10 @@ public class SalesApSnacksDisplay implements Serializable { ...@@ -191,6 +191,10 @@ public class SalesApSnacksDisplay implements Serializable {
private String updateBy; private String updateBy;
private Date updateTime; private Date updateTime;
/**
* 活动备注
*/
private String remark;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -24,6 +24,11 @@ public interface SalesApDisplayMapper extends BaseMapper<SalesApDisplay> { ...@@ -24,6 +24,11 @@ public interface SalesApDisplayMapper extends BaseMapper<SalesApDisplay> {
List<Map<String, Object>> queryDeptAPReportDQ(SalesApWq build); List<Map<String, Object>> queryDeptAPReportDQ(SalesApWq build);
List<Map<String,Object>> queryDistAPReport(SalesApWq build);
List<Map<String,Object>> queryDistAPHZReport(SalesApWq build);
List<Map<String, Object>> queryDeptAPHZReportDQ(SalesApWq build);
int batchUpdate(@Param("list") List<SalesApDisplay> validEntities); int batchUpdate(@Param("list") List<SalesApDisplay> validEntities);
} }
......
...@@ -184,6 +184,10 @@ public class SalesApRequest { ...@@ -184,6 +184,10 @@ public class SalesApRequest {
* 挂条-是否执行 * 挂条-是否执行
*/ */
private String hangingStripExecuted; private String hangingStripExecuted;
/**
* 活动备注
*/
private String remark;
} }
@Data @Data
...@@ -281,6 +285,10 @@ public class SalesApRequest { ...@@ -281,6 +285,10 @@ public class SalesApRequest {
* 海报是否执行 * 海报是否执行
*/ */
private String posterExecutionStatus; private String posterExecutionStatus;
/**
* 活动备注
*/
private String remark;
} }
@Data @Data
private static class SnackDisplay { private static class SnackDisplay {
...@@ -306,6 +314,10 @@ public class SalesApRequest { ...@@ -306,6 +314,10 @@ public class SalesApRequest {
* 零食陈列是否执行 * 零食陈列是否执行
*/ */
private String snackDisplayExecuted; private String snackDisplayExecuted;
/**
* 活动备注
*/
private String remark;
} }
@Data @Data
private static class PromotionDisplay { private static class PromotionDisplay {
...@@ -349,6 +361,10 @@ public class SalesApRequest { ...@@ -349,6 +361,10 @@ public class SalesApRequest {
* 档期陈列是否执行 * 档期陈列是否执行
*/ */
private String promotionDisplayExecuted; private String promotionDisplayExecuted;
/**
* 活动备注
*/
private String remark;
} }
@Data @Data
private static class DisplayS{ private static class DisplayS{
...@@ -360,6 +376,10 @@ public class SalesApRequest { ...@@ -360,6 +376,10 @@ public class SalesApRequest {
* 60g挂条陈列-是否执行 * 60g挂条陈列-是否执行
*/ */
private String displayQtyExecuted60; private String displayQtyExecuted60;
/**
* 活动备注
*/
private String remark;
} }
@Data @Data
private static class DisplayJ { private static class DisplayJ {
...@@ -371,6 +391,10 @@ public class SalesApRequest { ...@@ -371,6 +391,10 @@ public class SalesApRequest {
* 六小金刚批发挂网-是否执行(Y=是,N=否) * 六小金刚批发挂网-是否执行(Y=是,N=否)
*/ */
private String gwExecuted6; private String gwExecuted6;
/**
* 活动备注
*/
private String remark;
} }
} }
......
...@@ -84,5 +84,9 @@ public class SalesApDisplayDto { ...@@ -84,5 +84,9 @@ public class SalesApDisplayDto {
* 挂条-是否执行 * 挂条-是否执行
*/ */
private String hangingStripExecuted; private String hangingStripExecuted;
/**
* 活动备注
*/
private String remark;
} }
...@@ -19,4 +19,8 @@ public class SalesApDisplayJDto { ...@@ -19,4 +19,8 @@ public class SalesApDisplayJDto {
*/ */
private String gwExecuted6; private String gwExecuted6;
private String updateBy; private String updateBy;
/**
* 活动备注
*/
private String remark;
} }
...@@ -19,4 +19,8 @@ public class SalesApDisplaySDto { ...@@ -19,4 +19,8 @@ public class SalesApDisplaySDto {
*/ */
private String displayQtyExecuted60; private String displayQtyExecuted60;
private String updateBy; private String updateBy;
/**
* 活动备注
*/
private String remark;
} }
...@@ -51,5 +51,9 @@ public class SalesApPromotionDisplayDto { ...@@ -51,5 +51,9 @@ public class SalesApPromotionDisplayDto {
*/ */
private String promotionDisplayExecuted; private String promotionDisplayExecuted;
private String updateBy; private String updateBy;
/**
* 活动备注
*/
private String remark;
} }
...@@ -95,4 +95,8 @@ public class SalesApPromotionDto { ...@@ -95,4 +95,8 @@ public class SalesApPromotionDto {
*/ */
private String posterExecutionStatus; private String posterExecutionStatus;
private String updateBy; private String updateBy;
/**
* 活动备注
*/
private String remark;
} }
...@@ -33,4 +33,8 @@ public class SalesApSnacksDisplayDto { ...@@ -33,4 +33,8 @@ public class SalesApSnacksDisplayDto {
*/ */
private String snackDisplayExecuted; private String snackDisplayExecuted;
private String updateBy; private String updateBy;
/**
* 活动备注
*/
private String remark;
} }
...@@ -28,7 +28,8 @@ public interface IApDisplayQueryService { ...@@ -28,7 +28,8 @@ public interface IApDisplayQueryService {
Object queryStoreAPReport(SalesApRequest request); Object queryStoreAPReport(SalesApRequest request);
Object queryDeptAPReport(SalesApRequest request); Object queryDeptAPReport(SalesApRequest request);
List<SalesApDisplay> queryDataListByCondition(SalesApRequest build);
Object queryDistAPReport(SalesApRequest request);
List<SalesApDisplay> queryDataListByCondition(SalesApRequest build);
List<SalesApDisplay> queryByCondition(List<SalesApDisplayImportExcelDto> queryParam); List<SalesApDisplay> queryByCondition(List<SalesApDisplayImportExcelDto> queryParam);
} }
...@@ -12,7 +12,6 @@ import com.sfa.operation.pojo.sales.request.SalesApRequest; ...@@ -12,7 +12,6 @@ import com.sfa.operation.pojo.sales.request.SalesApRequest;
import com.sfa.operation.service.sales.IApDisplayQueryService; import com.sfa.operation.service.sales.IApDisplayQueryService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
/** /**
...@@ -75,6 +74,11 @@ public class ApDisplayQueryServiceImpl implements IApDisplayQueryService { ...@@ -75,6 +74,11 @@ public class ApDisplayQueryServiceImpl implements IApDisplayQueryService {
return salesApDisplayDao.queryDeptAPReport(build(request)); return salesApDisplayDao.queryDeptAPReport(build(request));
} }
@Override
public Object queryDistAPReport(SalesApRequest request) {
return salesApDisplayDao.queryDistAPReport(build(request));
}
@Override @Override
public List<SalesApDisplay> queryDataListByCondition(SalesApRequest request) { public List<SalesApDisplay> queryDataListByCondition(SalesApRequest request) {
return salesApDisplayDao.queryDataListByCondition(build(request)); return salesApDisplayDao.queryDataListByCondition(build(request));
...@@ -89,12 +93,6 @@ public class ApDisplayQueryServiceImpl implements IApDisplayQueryService { ...@@ -89,12 +93,6 @@ public class ApDisplayQueryServiceImpl implements IApDisplayQueryService {
SalesApWq salesApWq = new SalesApWq(); SalesApWq salesApWq = new SalesApWq();
BeanUtils.copyProperties(salesApRequest,salesApWq); BeanUtils.copyProperties(salesApRequest,salesApWq);
salesApWq.setSalesMonth(salesApRequest.getSalesMonth() != null ? DateUtil.parse(salesApRequest.getSalesMonth() + "-01", DatePattern.NORM_DATE_PATTERN) : null); salesApWq.setSalesMonth(salesApRequest.getSalesMonth() != null ? DateUtil.parse(salesApRequest.getSalesMonth() + "-01", DatePattern.NORM_DATE_PATTERN) : null);
// if (StringUtils.isNotBlank(salesApRequest.getDeptName())){
// List<String> deptNames = CollectionUtils.isEmpty(salesApWq.getDeptNames()) ? new ArrayList<>() : salesApWq.getDeptNames();
// deptNames.add(salesApRequest.getDeptName());
// salesApWq.setDeptNames(deptNames);
// }
return salesApWq; return salesApWq;
} }
......
...@@ -530,7 +530,6 @@ ...@@ -530,7 +530,6 @@
</if> </if>
</sql> </sql>
<select id="queryDeptAPReportDQ" parameterType="com.sfa.operation.domain.sales.wq.SalesApWq" resultType="java.util.Map"> <select id="queryDeptAPReportDQ" parameterType="com.sfa.operation.domain.sales.wq.SalesApWq" resultType="java.util.Map">
SELECT ar.region_name as regionName, SELECT ar.region_name as regionName,
d.主货架计划网点数 as planMsStoreCnt, d.主货架计划网点数 as planMsStoreCnt,
d.主货架执行网点数 as execMsStoreCnt, d.主货架执行网点数 as execMsStoreCnt,
...@@ -713,6 +712,489 @@ ...@@ -713,6 +712,489 @@
on ar.region_name = sp.region_name order by ar.region_name on ar.region_name = sp.region_name order by ar.region_name
</select> </select>
<select id="queryDeptAPHZReportDQ" parameterType="com.sfa.operation.domain.sales.wq.SalesApWq" resultType="java.util.Map">
SELECT '合计:' as regionName,
d.主货架计划网点数 as planMsStoreCnt,
d.主货架执行网点数 as execMsStoreCnt,
if(d.主货架计划网点数 is null, null,concat( round( coalesce(d.主货架执行网点数,0) / d.主货架计划网点数 *
100,2) ,'%')) as msExecRate,
d.常规端架计划网点数 as planRegEndcapStoreCnt,
d.常规端架执行网点数 as execRegEndcapStoreCnt,
if(d.常规端架计划网点数 is null, null,concat( round( coalesce(d.常规端架执行网点数,0) / d.常规端架计划网点数
* 100,2) ,'%')) as endcapExecRate,
d.常规地堆计划网点数 as planRegGsStoreCnt,
d.常规地堆执行网点数 as execRegGsStoreCnt,
if(d.常规地堆计划网点数 is null, null,concat( round( coalesce(d.常规地堆执行网点数,0) / d.常规地堆计划网点数
* 100,2) ,'%')) as gsExecRate,
d.多点陈列计划网点数 as planMpDispStoreCnt,
d.多点陈列执行网点数 as execMpDispStoreCnt,
if(d.多点陈列计划网点数 is null, null,concat( round( coalesce(d.多点陈列执行网点数,0) / d.多点陈列计划网点数
* 100,2) ,'%')) as mpDispExecRate,
d.挂条计划网点数 as planHsStoreCnt,
d.挂条执行网点数 as execHsStoreCnt,
if(d.挂条计划网点数 is null, null,concat( round( coalesce(d.挂条执行网点数,0) / d.挂条计划网点数 * 100,2)
,'%')) as HsExecRate,
s.三米两秒挂条计划网点数 as planSLStoreCnt,
s.三米两秒挂条执行网点数 as execSLStoreCnt,
if(s.三米两秒挂条计划网点数 is null, null,concat( round( coalesce(s.三米两秒挂条执行网点数,0) /
s.三米两秒挂条计划网点数 * 100,2) ,'%')) as SLExecRate,
j.批发挂网计划网点数 as planSixJdStoreCnt,
j.批发挂网执行网点数 as execSixJdStoreCnt,
if(j.批发挂网计划网点数 is null, null,concat( round( coalesce(j.批发挂网执行网点数,0) / j.批发挂网计划网点数
* 100,2) ,'%')) as sixJdExecRate,
pd.端架计划网点数 as planEndcapStoreCnt,
pd.端架执行网点数 as execEndcapStoreCnt,
if(pd.端架计划网点数 is null, null,concat( round( coalesce(pd.端架执行网点数,0) / pd.端架计划网点数 * 100,2)
,'%')) as endcapExecRatePromoPeriDisp,
pd.地堆计划网点数 as planGsStoreCnt,
pd.地堆执行网点数 as execGsStoreCnt,
if(pd.地堆计划网点数 is null, null,concat( round( coalesce(pd.地堆执行网点数,0) / pd.地堆计划网点数 * 100,2)
,'%')) as gsExecRatePromoPeriDisp,
pd.其他陈列计划网点数 as planOtherDispStoreCnt,
pd.其他陈列执行网点数 as execOtherDispStoreCnt,
if(pd.其他陈列计划网点数 is null, null,concat( round( coalesce(pd.其他陈列执行网点数,0) / pd.其他陈列计划网点数
* 100,2) ,'%')) as otherDispExecRatePromoPeriDisp,
sd.零食计划网点数 as planSnackStoreCnt,
sd.零食执行网点数 as execSnackStoreCnt,
if(sd.零食计划网点数 is null, null,concat( round( coalesce(sd.零食执行网点数,0) / sd.零食计划网点数 * 100,2)
,'%')) as snackExecRate,
sp.档期计划网点数 as planPromoPeriStoreCnt,
sp.档期开展网点数 as launchPromoPeriStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.档期开展网点数,0) / sp.档期计划网点数 * 100,2)
,'%')) as launchRatePromoPeriExec,
sp.促销规格执行网点数 as execPsStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.促销规格执行网点数,0) / sp.档期计划网点数 *
100,2) ,'%')) as psExecRatePromoPeriExec,
sp.促销口味执行网点数 as execPfStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.促销口味执行网点数,0) / sp.档期计划网点数 *
100,2) ,'%')) as pfExecRatePromoPeriExec,
sp.促销价执行网点数 as execPpStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.促销价执行网点数,0) / sp.档期计划网点数 *
100,2) ,'%')) as ppExecRatePromoPeriExec,
sp.海报计划网点数 as planPosterStoreCnt,
sp.海报执行网点数 as execPosterStoreCnt,
if(sp.海报计划网点数 is null, null,concat( round( coalesce(sp.海报执行网点数,0) / sp.海报计划网点数 * 100,2)
,'%')) as posterExecRate
FROM (select sum(main_shelf_type_sn) as 主货架计划网点数,
sum(if(actual_main_shelf_executed is not null and actual_main_shelf_executed = '执行', 1,
0)) as 主货架执行网点数,
sum(end_cap_qty_sn) as 常规端架计划网点数,
sum(if(actual_end_cap_executed is not null and actual_end_cap_executed = '执行', 1,
0)) as 常规端架执行网点数,
sum(floor_stack_area_sn) as 常规地堆计划网点数,
sum(if(actual_floor_stack_executed is not null and actual_floor_stack_executed = '执行', 1,
0)) as 常规地堆执行网点数,
sum(multi_point_display_sn) as 多点陈列计划网点数,
sum(if(actual_multi_display_executed is not null and actual_multi_display_executed = '执行',
1,
0)) as 多点陈列执行网点数,
sum(hanging_strip_sn) as 挂条计划网点数,
sum(if(hanging_strip_executed is not null and hanging_strip_executed = '执行', 1,
0)) as 挂条执行网点数
from sales_ap_display
<where>
<include refid="deptDQQuery"/>
</where>
) d,(select region_name,
sum(display_sn60) 三米两秒挂条计划网点数,
sum(actual_display_qty60) 三米两秒挂条执行网点数
from sales_ap_display_s
<where>
<include refid="deptDQQuery"/>
</where>
) s,(select region_name,
sum(gw_sn6) 批发挂网计划网点数,
sum(actual_gw6) 批发挂网执行网点数
from sales_ap_display_j
<where>
<include refid="deptDQQuery"/>
</where>
) j,(select region_name,
sum(end_cap_sn) 端架计划网点数,
sum(if(actual_end_cap_executed is not null and actual_end_cap_executed = '执行', 1,
0)) as 端架执行网点数,
sum(floor_stack_sn) 地堆计划网点数,
sum(if(actual_floor_stack_executed is not null and actual_floor_stack_executed = '执行', 1,
0)) as 地堆执行网点数,
sum(other_display_sn) 其他陈列计划网点数,
sum(if(actual_other_display_executed is not null and actual_other_display_executed = '执行',
1, 0)) as 其他陈列执行网点数
from sales_ap_promotion_display
<where>
<include refid="deptDQQuery"/>
</where>
) pd,(select region_name,
sum(actual_display_sn) 零食计划网点数,
sum(if(actual_display_sn = 1, if(snack_display_executed = '执行', 1, 0),
if(snack_display_executed = '执行', actual_end_cap_qty, 0))) 零食执行网点数
from sales_ap_snacks_display
<where>
<include refid="deptDQQuery"/>
</where>
) sd,(select region_name,
sum(promotion_sn) 档期计划网点数,
sum(if(promotion_implementation_status = '是', 1, 0)) 档期开展网点数,
sum(if(spec_execution_status = '执行', 1, 0)) 促销规格执行网点数,
sum(if(flavor_execution_status = '执行', 1, 0)) 促销口味执行网点数,
sum(if(promotion_price_execution_status = '执行', 1, 0)) 促销价执行网点数,
sum(poster_sn) 海报计划网点数,
sum(if(poster_sn is null, null, if(poster_execution_status = '执行', 1, 0))) 海报执行网点数
from sales_ap_promotion
<where>
<include refid="deptDQQuery"/>
</where>
) sp
</select>
<sql id = "commonQueryDists">
<if test="salesMonth != null">
and sales_month = #{salesMonth}
</if>
<if test="dealerCodes != null">
and dealer_code in
<foreach collection="dealerCodes" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="deptNames != null">
and (region_name in
<foreach collection="deptNames" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
or
district_name in
<foreach collection="deptNames" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
)
</if>
</sql>
<select id="queryDistAPReport" parameterType="com.sfa.operation.domain.sales.wq.SalesApWq" resultType="java.util.Map">
SELECT ar.dealer_code as dealerCode,
ar.dealer_name as dealerName,
d.主货架计划网点数 as planMsStoreCnt,
d.主货架执行网点数 as execMsStoreCnt,
if(d.主货架计划网点数 is null, null,concat( round( coalesce(d.主货架执行网点数,0) / d.主货架计划网点数 *
100,2) ,'%')) as msExecRate,
d.常规端架计划网点数 as planRegEndcapStoreCnt,
d.常规端架执行网点数 as execRegEndcapStoreCnt,
if(d.常规端架计划网点数 is null, null,concat( round( coalesce(d.常规端架执行网点数,0) / d.常规端架计划网点数
* 100,2) ,'%')) as endcapExecRate,
d.常规地堆计划网点数 as planRegGsStoreCnt,
d.常规地堆执行网点数 as execRegGsStoreCnt,
if(d.常规地堆计划网点数 is null, null,concat( round( coalesce(d.常规地堆执行网点数,0) / d.常规地堆计划网点数
* 100,2) ,'%')) as gsExecRate,
d.多点陈列计划网点数 as planMpDispStoreCnt,
d.多点陈列执行网点数 as execMpDispStoreCnt,
if(d.多点陈列计划网点数 is null, null,concat( round( coalesce(d.多点陈列执行网点数,0) / d.多点陈列计划网点数
* 100,2) ,'%')) as mpDispExecRate,
d.挂条计划网点数 as planHsStoreCnt,
d.挂条执行网点数 as execHsStoreCnt,
if(d.挂条计划网点数 is null, null,concat( round( coalesce(d.挂条执行网点数,0) / d.挂条计划网点数 * 100,2)
,'%')) as HsExecRate,
s.三米两秒挂条计划网点数 as planSLStoreCnt,
s.三米两秒挂条执行网点数 as execSLStoreCnt,
if(s.三米两秒挂条计划网点数 is null, null,concat( round( coalesce(s.三米两秒挂条执行网点数,0) /
s.三米两秒挂条计划网点数 * 100,2) ,'%')) as SLExecRate,
j.批发挂网计划网点数 as planSixJdStoreCnt,
j.批发挂网执行网点数 as execSixJdStoreCnt,
if(j.批发挂网计划网点数 is null, null,concat( round( coalesce(j.批发挂网执行网点数,0) / j.批发挂网计划网点数
* 100,2) ,'%')) as sixJdExecRate,
pd.端架计划网点数 as planEndcapStoreCnt,
pd.端架执行网点数 as execEndcapStoreCnt,
if(pd.端架计划网点数 is null, null,concat( round( coalesce(pd.端架执行网点数,0) / pd.端架计划网点数 * 100,2)
,'%')) as endcapExecRatePromoPeriDisp,
pd.地堆计划网点数 as planGsStoreCnt,
pd.地堆执行网点数 as execGsStoreCnt,
if(pd.地堆计划网点数 is null, null,concat( round( coalesce(pd.地堆执行网点数,0) / pd.地堆计划网点数 * 100,2)
,'%')) as gsExecRatePromoPeriDisp,
pd.其他陈列计划网点数 as planOtherDispStoreCnt,
pd.其他陈列执行网点数 as execOtherDispStoreCnt,
if(pd.其他陈列计划网点数 is null, null,concat( round( coalesce(pd.其他陈列执行网点数,0) / pd.其他陈列计划网点数
* 100,2) ,'%')) as otherDispExecRatePromoPeriDisp,
sd.零食计划网点数 as planSnackStoreCnt,
sd.零食执行网点数 as execSnackStoreCnt,
if(sd.零食计划网点数 is null, null,concat( round( coalesce(sd.零食执行网点数,0) / sd.零食计划网点数 * 100,2)
,'%')) as snackExecRate,
sp.档期计划网点数 as planPromoPeriStoreCnt,
sp.档期开展网点数 as launchPromoPeriStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.档期开展网点数,0) / sp.档期计划网点数 * 100,2)
,'%')) as launchRatePromoPeriExec,
sp.促销规格执行网点数 as execPsStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.促销规格执行网点数,0) / sp.档期计划网点数 *
100,2) ,'%')) as psExecRatePromoPeriExec,
sp.促销口味执行网点数 as execPfStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.促销口味执行网点数,0) / sp.档期计划网点数 *
100,2) ,'%')) as pfExecRatePromoPeriExec,
sp.促销价执行网点数 as execPpStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.促销价执行网点数,0) / sp.档期计划网点数 *
100,2) ,'%')) as ppExecRatePromoPeriExec,
sp.海报计划网点数 as planPosterStoreCnt,
sp.海报执行网点数 as execPosterStoreCnt,
if(sp.海报计划网点数 is null, null,concat( round( coalesce(sp.海报执行网点数,0) / sp.海报计划网点数 * 100,2)
,'%')) as posterExecRate
FROM (
SELECT dealer_code, dealer_name
FROM sales_ap_display
<where>
<include refid="commonQueryDists"/>
</where>
UNION
SELECT dealer_code, dealer_name
FROM sales_ap_display_s
<where>
<include refid="commonQueryDists"/>
</where>
UNION
SELECT dealer_code, dealer_name
FROM sales_ap_display_j
<where>
<include refid="commonQueryDists"/>
</where>
UNION
SELECT dealer_code, dealer_name
FROM sales_ap_promotion_display
<where>
<include refid="commonQueryDists"/>
</where>
UNION
SELECT dealer_code, dealer_name
FROM sales_ap_snacks_display
<where>
<include refid="commonQueryDists"/>
</where>
UNION
SELECT dealer_code, dealer_name
FROM sales_ap_promotion
<where>
<include refid="commonQueryDists"/>
</where>
) AS ar
LEFT JOIN (select dealer_code, dealer_name,
sum(main_shelf_type_sn) as 主货架计划网点数,
sum(if(actual_main_shelf_executed is not null and actual_main_shelf_executed = '执行', 1,
0)) as 主货架执行网点数,
sum(end_cap_qty_sn) as 常规端架计划网点数,
sum(if(actual_end_cap_executed is not null and actual_end_cap_executed = '执行', 1,
0)) as 常规端架执行网点数,
sum(floor_stack_area_sn) as 常规地堆计划网点数,
sum(if(actual_floor_stack_executed is not null and actual_floor_stack_executed = '执行', 1,
0)) as 常规地堆执行网点数,
sum(multi_point_display_sn) as 多点陈列计划网点数,
sum(if(actual_multi_display_executed is not null and actual_multi_display_executed = '执行',
1,
0)) as 多点陈列执行网点数,
sum(hanging_strip_sn) as 挂条计划网点数,
sum(if(hanging_strip_executed is not null and hanging_strip_executed = '执行', 1,
0)) as 挂条执行网点数
from sales_ap_display
<where>
<include refid="commonQueryDists"/>
</where>
group by dealer_code, dealer_name) d
ON ar.dealer_code = d.dealer_code AND ar.dealer_name = d.dealer_name
LEFT JOIN (select dealer_code, dealer_name,
sum(display_sn60) 三米两秒挂条计划网点数,
sum(actual_display_qty60) 三米两秒挂条执行网点数
from sales_ap_display_s
<where>
<include refid="commonQueryDists"/>
</where>
group by dealer_code, dealer_name) s
ON ar.dealer_code = s.dealer_code AND ar.dealer_name = s.dealer_name
LEFT JOIN (select dealer_code, dealer_name,
sum(gw_sn6) 批发挂网计划网点数,
sum(actual_gw6) 批发挂网执行网点数
from sales_ap_display_j
<where>
<include refid="commonQueryDists"/>
</where>
group by dealer_code, dealer_name) j
ON ar.dealer_code = j.dealer_code AND ar.dealer_name = j.dealer_name
left join (select dealer_code, dealer_name,
sum(end_cap_sn) 端架计划网点数,
sum(if(actual_end_cap_executed is not null and actual_end_cap_executed = '执行', 1,
0)) as 端架执行网点数,
sum(floor_stack_sn) 地堆计划网点数,
sum(if(actual_floor_stack_executed is not null and actual_floor_stack_executed = '执行', 1,
0)) as 地堆执行网点数,
sum(other_display_sn) 其他陈列计划网点数,
sum(if(actual_other_display_executed is not null and actual_other_display_executed = '执行',
1, 0)) as 其他陈列执行网点数
from sales_ap_promotion_display
<where>
<include refid="commonQueryDists"/>
</where>
group by dealer_code, dealer_name) pd
on ar.dealer_code = pd.dealer_code and ar.dealer_name = pd.dealer_name
left join (select dealer_code, dealer_name,
sum(actual_display_sn) 零食计划网点数,
sum(if(actual_display_sn = 1, if(snack_display_executed = '执行', 1, 0),
if(snack_display_executed = '执行', actual_end_cap_qty, 0))) 零食执行网点数
from sales_ap_snacks_display
<where>
<include refid="commonQueryDists"/>
</where>
group by dealer_code, dealer_name) sd
on ar.dealer_code = sd.dealer_code and ar.dealer_name = sd.dealer_name
left join (select dealer_code, dealer_name,
sum(promotion_sn) 档期计划网点数,
sum(if(promotion_implementation_status = '是', 1, 0)) 档期开展网点数,
sum(if(spec_execution_status = '执行', 1, 0)) 促销规格执行网点数,
sum(if(flavor_execution_status = '执行', 1, 0)) 促销口味执行网点数,
sum(if(promotion_price_execution_status = '执行', 1, 0)) 促销价执行网点数,
sum(poster_sn) 海报计划网点数,
sum(if(poster_sn is null, null, if(poster_execution_status = '执行', 1, 0))) 海报执行网点数
from sales_ap_promotion
<where>
<include refid="commonQueryDists"/>
</where>
group by dealer_code, dealer_name) sp
on ar.dealer_code = sp.dealer_code and ar.dealer_name = sp.dealer_name order by ar.dealer_code
</select>
<select id="queryDistAPHZReport" parameterType="com.sfa.operation.domain.sales.wq.SalesApWq" resultType="java.util.Map">
SELECT '' as dealerCode,
'合计:' as dealerName,
d.主货架计划网点数 as planMsStoreCnt,
d.主货架执行网点数 as execMsStoreCnt,
if(d.主货架计划网点数 is null, null,concat( round( coalesce(d.主货架执行网点数,0) / d.主货架计划网点数 *
100,2) ,'%')) as msExecRate,
d.常规端架计划网点数 as planRegEndcapStoreCnt,
d.常规端架执行网点数 as execRegEndcapStoreCnt,
if(d.常规端架计划网点数 is null, null,concat( round( coalesce(d.常规端架执行网点数,0) / d.常规端架计划网点数
* 100,2) ,'%')) as endcapExecRate,
d.常规地堆计划网点数 as planRegGsStoreCnt,
d.常规地堆执行网点数 as execRegGsStoreCnt,
if(d.常规地堆计划网点数 is null, null,concat( round( coalesce(d.常规地堆执行网点数,0) / d.常规地堆计划网点数
* 100,2) ,'%')) as gsExecRate,
d.多点陈列计划网点数 as planMpDispStoreCnt,
d.多点陈列执行网点数 as execMpDispStoreCnt,
if(d.多点陈列计划网点数 is null, null,concat( round( coalesce(d.多点陈列执行网点数,0) / d.多点陈列计划网点数
* 100,2) ,'%')) as mpDispExecRate,
d.挂条计划网点数 as planHsStoreCnt,
d.挂条执行网点数 as execHsStoreCnt,
if(d.挂条计划网点数 is null, null,concat( round( coalesce(d.挂条执行网点数,0) / d.挂条计划网点数 * 100,2)
,'%')) as HsExecRate,
s.三米两秒挂条计划网点数 as planSLStoreCnt,
s.三米两秒挂条执行网点数 as execSLStoreCnt,
if(s.三米两秒挂条计划网点数 is null, null,concat( round( coalesce(s.三米两秒挂条执行网点数,0) /
s.三米两秒挂条计划网点数 * 100,2) ,'%')) as SLExecRate,
j.批发挂网计划网点数 as planSixJdStoreCnt,
j.批发挂网执行网点数 as execSixJdStoreCnt,
if(j.批发挂网计划网点数 is null, null,concat( round( coalesce(j.批发挂网执行网点数,0) / j.批发挂网计划网点数
* 100,2) ,'%')) as sixJdExecRate,
pd.端架计划网点数 as planEndcapStoreCnt,
pd.端架执行网点数 as execEndcapStoreCnt,
if(pd.端架计划网点数 is null, null,concat( round( coalesce(pd.端架执行网点数,0) / pd.端架计划网点数 * 100,2)
,'%')) as endcapExecRatePromoPeriDisp,
pd.地堆计划网点数 as planGsStoreCnt,
pd.地堆执行网点数 as execGsStoreCnt,
if(pd.地堆计划网点数 is null, null,concat( round( coalesce(pd.地堆执行网点数,0) / pd.地堆计划网点数 * 100,2)
,'%')) as gsExecRatePromoPeriDisp,
pd.其他陈列计划网点数 as planOtherDispStoreCnt,
pd.其他陈列执行网点数 as execOtherDispStoreCnt,
if(pd.其他陈列计划网点数 is null, null,concat( round( coalesce(pd.其他陈列执行网点数,0) / pd.其他陈列计划网点数
* 100,2) ,'%')) as otherDispExecRatePromoPeriDisp,
sd.零食计划网点数 as planSnackStoreCnt,
sd.零食执行网点数 as execSnackStoreCnt,
if(sd.零食计划网点数 is null, null,concat( round( coalesce(sd.零食执行网点数,0) / sd.零食计划网点数 * 100,2)
,'%')) as snackExecRate,
sp.档期计划网点数 as planPromoPeriStoreCnt,
sp.档期开展网点数 as launchPromoPeriStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.档期开展网点数,0) / sp.档期计划网点数 * 100,2)
,'%')) as launchRatePromoPeriExec,
sp.促销规格执行网点数 as execPsStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.促销规格执行网点数,0) / sp.档期计划网点数 *
100,2) ,'%')) as psExecRatePromoPeriExec,
sp.促销口味执行网点数 as execPfStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.促销口味执行网点数,0) / sp.档期计划网点数 *
100,2) ,'%')) as pfExecRatePromoPeriExec,
sp.促销价执行网点数 as execPpStoreCnt,
if(sp.档期计划网点数 is null, null,concat( round( coalesce(sp.促销价执行网点数,0) / sp.档期计划网点数 *
100,2) ,'%')) as ppExecRatePromoPeriExec,
sp.海报计划网点数 as planPosterStoreCnt,
sp.海报执行网点数 as execPosterStoreCnt,
if(sp.海报计划网点数 is null, null,concat( round( coalesce(sp.海报执行网点数,0) / sp.海报计划网点数 * 100,2)
,'%')) as posterExecRate
FROM (select
sum(main_shelf_type_sn) as 主货架计划网点数,
sum(if(actual_main_shelf_executed is not null and actual_main_shelf_executed = '执行', 1,
0)) as 主货架执行网点数,
sum(end_cap_qty_sn) as 常规端架计划网点数,
sum(if(actual_end_cap_executed is not null and actual_end_cap_executed = '执行', 1,
0)) as 常规端架执行网点数,
sum(floor_stack_area_sn) as 常规地堆计划网点数,
sum(if(actual_floor_stack_executed is not null and actual_floor_stack_executed = '执行', 1,
0)) as 常规地堆执行网点数,
sum(multi_point_display_sn) as 多点陈列计划网点数,
sum(if(actual_multi_display_executed is not null and actual_multi_display_executed = '执行',
1,
0)) as 多点陈列执行网点数,
sum(hanging_strip_sn) as 挂条计划网点数,
sum(if(hanging_strip_executed is not null and hanging_strip_executed = '执行', 1,
0)) as 挂条执行网点数
from sales_ap_display
<where>
<include refid="commonQueryDists"/>
</where>
) d,
(select
sum(display_sn60) 三米两秒挂条计划网点数,
sum(actual_display_qty60) 三米两秒挂条执行网点数
from sales_ap_display_s
<where>
<include refid="commonQueryDists"/>
</where>
) s,
(select
sum(gw_sn6) 批发挂网计划网点数,
sum(actual_gw6) 批发挂网执行网点数
from sales_ap_display_j
<where>
<include refid="commonQueryDists"/>
</where>
) j,
(select
sum(end_cap_sn) 端架计划网点数,
sum(if(actual_end_cap_executed is not null and actual_end_cap_executed = '执行', 1,
0)) as 端架执行网点数,
sum(floor_stack_sn) 地堆计划网点数,
sum(if(actual_floor_stack_executed is not null and actual_floor_stack_executed = '执行', 1,
0)) as 地堆执行网点数,
sum(other_display_sn) 其他陈列计划网点数,
sum(if(actual_other_display_executed is not null and actual_other_display_executed = '执行',
1, 0)) as 其他陈列执行网点数
from sales_ap_promotion_display
<where>
<include refid="commonQueryDists"/>
</where>
) pd,
(select
sum(actual_display_sn) 零食计划网点数,
sum(if(actual_display_sn = 1, if(snack_display_executed = '执行', 1, 0),
if(snack_display_executed = '执行', actual_end_cap_qty, 0))) 零食执行网点数
from sales_ap_snacks_display
<where>
<include refid="commonQueryDists"/>
</where>
) sd,
(select
sum(promotion_sn) 档期计划网点数,
sum(if(promotion_implementation_status = '是', 1, 0)) 档期开展网点数,
sum(if(spec_execution_status = '执行', 1, 0)) 促销规格执行网点数,
sum(if(flavor_execution_status = '执行', 1, 0)) 促销口味执行网点数,
sum(if(promotion_price_execution_status = '执行', 1, 0)) 促销价执行网点数,
sum(poster_sn) 海报计划网点数,
sum(if(poster_sn is null, null, if(poster_execution_status = '执行', 1, 0))) 海报执行网点数
from sales_ap_promotion
<where>
<include refid="commonQueryDists"/>
</where>
) sp;
</select>
<!-- 批量更新SQL --> <!-- 批量更新SQL -->
<update id="batchUpdate"> <update id="batchUpdate">
UPDATE sales_ap_display UPDATE sales_ap_display
......
...@@ -143,6 +143,9 @@ ...@@ -143,6 +143,9 @@
<if test="posterExecutionStatus != null"> <if test="posterExecutionStatus != null">
poster_execution_status = #{posterExecutionStatus}, poster_execution_status = #{posterExecutionStatus},
</if> </if>
<if test="remark != null">
remark = #{remark},
</if>
</set> </set>
WHERE sap_id = #{sapId} WHERE sap_id = #{sapId}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论