|
@@ -4,6 +4,7 @@ import cn.cslg.pas.common.model.cronModel.ReGroupDataVO;
|
|
|
import cn.cslg.pas.common.vo.GroupMarketDataVO;
|
|
|
import cn.cslg.pas.mapper.ProductMarketDataMapper;
|
|
|
import cn.cslg.pas.service.business.MatterService;
|
|
|
+import cn.cslg.pas.service.business.ProductService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -19,25 +20,39 @@ import java.util.Map;
|
|
|
public class GetMarketDataSeasonGroup implements QueryGroupImp {
|
|
|
@Autowired
|
|
|
private ProductMarketDataMapper productMarketDataMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
- private MatterService matterService;
|
|
|
+ private ProductService productService;
|
|
|
|
|
|
@Override
|
|
|
public ReGroupDataVO getGroup(List<String> sqls, String tableName, String groupField) {
|
|
|
ReGroupDataVO reGroupDataVO =new ReGroupDataVO();
|
|
|
List<Map<String, Object>> maps = new ArrayList<>();
|
|
|
- groupField = "concat(date_format("+ groupField+", '%Y'),FLOOR((date_format(create_time, '%m')+2)/3))";
|
|
|
+ groupField = "CONCAT(DATE_FORMAT("+ groupField+", '%Y'),'年第', CEIL(MONTH(" + groupField + ") / 3),'季度')";
|
|
|
String selectField = groupField;
|
|
|
//统计营销数据
|
|
|
List<GroupMarketDataVO> groupMarketDataVOS = productMarketDataMapper.getGroups(sqls, tableName, groupField, selectField);
|
|
|
groupMarketDataVOS.forEach(item->{
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
- map.put("productId", item.getProductId());
|
|
|
map.put("marketDate",item.getMarketDate());
|
|
|
map.put("customLicenseMoney",item.getCustomLicenseMoney());
|
|
|
map.put("saleMoneyTotal",item.getSaleMoneyTotal());
|
|
|
maps.add(map);
|
|
|
});
|
|
|
+ if (sqls.get(0) != "") {
|
|
|
+ if (sqls.get(0).contains("category_id")) {
|
|
|
+ List<GroupMarketDataVO> groupPartMarketDataVOS = productMarketDataMapper.getPartGroups(sqls, tableName, groupField, selectField);
|
|
|
+ groupPartMarketDataVOS.forEach(item ->{
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("productId",item.getProductId());
|
|
|
+ map.put("productName",productService.getById(item.getProductId()).getName());
|
|
|
+ map.put("marketDate",item.getMarketDate());
|
|
|
+ map.put("customLicenseMoney",item.getCustomLicenseMoney());
|
|
|
+ map.put("saleMoneyTotal",item.getSaleMoneyTotal());
|
|
|
+ maps.add(map);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
reGroupDataVO.setValues(maps);
|
|
|
return reGroupDataVO;
|
|
|
}
|