提交修改
This commit is contained in:
parent
7c2333d269
commit
991ea4cf77
@ -56,6 +56,15 @@ public class RabbitConfig {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Queue sendDingDingQueue(@Value("${eb.config.rabbitQueue.sendDingDingQueue}") String queueName) {
|
||||||
|
return new Queue(queueName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Bean(name = "accountAmountQueueSimpleRabbitListenerContainerFactory")
|
@Bean(name = "accountAmountQueueSimpleRabbitListenerContainerFactory")
|
||||||
public SimpleRabbitListenerContainerFactory accountAmountQueueSimpleRabbitListenerContainerFactory() {
|
public SimpleRabbitListenerContainerFactory accountAmountQueueSimpleRabbitListenerContainerFactory() {
|
||||||
|
|||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.heyu.api.data.dao.vv;
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 图表配置 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author quyixiao
|
||||||
|
* @since 2025-10-20
|
||||||
|
*/
|
||||||
|
import com.heyu.api.data.entity.vv.VvChartConfigEntity;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface VvChartConfigDao extends BaseMapper<VvChartConfigEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
VvChartConfigEntity selectVvChartConfigById(@Param("id")Long id);
|
||||||
|
|
||||||
|
|
||||||
|
Long insertVvChartConfig(VvChartConfigEntity vvChartConfig);
|
||||||
|
|
||||||
|
|
||||||
|
Long insertOrUpdateVvChartConfig(VvChartConfigEntity vvChartConfig);
|
||||||
|
|
||||||
|
|
||||||
|
int updateVvChartConfigById(VvChartConfigEntity vvChartConfig);
|
||||||
|
|
||||||
|
|
||||||
|
int updateCoverVvChartConfigById(VvChartConfigEntity vvChartConfig);
|
||||||
|
|
||||||
|
|
||||||
|
int deleteVvChartConfigById(@Param("id")Long id);
|
||||||
|
|
||||||
|
|
||||||
|
List<VvChartConfigEntity> selectVvChartConfigByAll();
|
||||||
|
}
|
||||||
@ -0,0 +1,201 @@
|
|||||||
|
package com.heyu.api.data.entity.vv;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.lz.mybatis.plugin.annotations.AS;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;import java.util.Date;
|
||||||
|
/**
|
||||||
|
*图表配置
|
||||||
|
* @author quyixiao
|
||||||
|
* @since 2025-10-20
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("vv_chart_config")
|
||||||
|
public class VvChartConfigEntity implements java.io.Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvChartConfigEntity:";
|
||||||
|
|
||||||
|
public final static String all = CLASS_NAME + "*";
|
||||||
|
public final static String id_ = CLASS_NAME + "id"; //
|
||||||
|
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
||||||
|
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||||
|
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||||
|
public final static String sql_config = CLASS_NAME + "sql_config"; // sql配置
|
||||||
|
public final static String params_config = CLASS_NAME + "params_config"; // 参数
|
||||||
|
public final static String run_id = CLASS_NAME + "run_id"; // 运行id
|
||||||
|
public final static String type_ = CLASS_NAME + "type"; // line_chart
|
||||||
|
public final static String cron_exp = CLASS_NAME + "cron_exp"; // 表达式
|
||||||
|
//
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
//是否删除:0 否 1 删除
|
||||||
|
private Integer isDelete;
|
||||||
|
//创建时间
|
||||||
|
private Date createTime;
|
||||||
|
//修改时间
|
||||||
|
private Date modifyTime;
|
||||||
|
//sql配置
|
||||||
|
private String sqlConfig;
|
||||||
|
//参数
|
||||||
|
private String paramsConfig;
|
||||||
|
//运行id
|
||||||
|
private String runId;
|
||||||
|
//line_chart
|
||||||
|
private String type;
|
||||||
|
//表达式
|
||||||
|
private String cronExp;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除:0 否 1 删除
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Integer getIsDelete() {
|
||||||
|
return isDelete;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 是否删除:0 否 1 删除
|
||||||
|
* @param isDelete
|
||||||
|
*/
|
||||||
|
public void setIsDelete(Integer isDelete) {
|
||||||
|
this.isDelete = isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
* @param createTime
|
||||||
|
*/
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Date getModifyTime() {
|
||||||
|
return modifyTime;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
* @param modifyTime
|
||||||
|
*/
|
||||||
|
public void setModifyTime(Date modifyTime) {
|
||||||
|
this.modifyTime = modifyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sql配置
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getSqlConfig() {
|
||||||
|
return sqlConfig;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* sql配置
|
||||||
|
* @param sqlConfig
|
||||||
|
*/
|
||||||
|
public void setSqlConfig(String sqlConfig) {
|
||||||
|
this.sqlConfig = sqlConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getParamsConfig() {
|
||||||
|
return paramsConfig;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 参数
|
||||||
|
* @param paramsConfig
|
||||||
|
*/
|
||||||
|
public void setParamsConfig(String paramsConfig) {
|
||||||
|
this.paramsConfig = paramsConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getRunId() {
|
||||||
|
return runId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 运行id
|
||||||
|
* @param runId
|
||||||
|
*/
|
||||||
|
public void setRunId(String runId) {
|
||||||
|
this.runId = runId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* line_chart
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* line_chart
|
||||||
|
* @param type
|
||||||
|
*/
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表达式
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getCronExp() {
|
||||||
|
return cronExp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 表达式
|
||||||
|
* @param cronExp
|
||||||
|
*/
|
||||||
|
public void setCronExp(String cronExp) {
|
||||||
|
this.cronExp = cronExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "VvChartConfigEntity{" +
|
||||||
|
",id=" + id +
|
||||||
|
",isDelete=" + isDelete +
|
||||||
|
",createTime=" + createTime +
|
||||||
|
",modifyTime=" + modifyTime +
|
||||||
|
",sqlConfig=" + sqlConfig +
|
||||||
|
",paramsConfig=" + paramsConfig +
|
||||||
|
",runId=" + runId +
|
||||||
|
",type=" + type +
|
||||||
|
",cronExp=" + cronExp +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package com.heyu.api.data.service.impl.vv;
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 图表配置 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author quyixiao
|
||||||
|
* @since 2025-10-20
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.heyu.api.data.dao.vv.VvChartConfigDao;
|
||||||
|
import com.heyu.api.data.entity.vv.VvChartConfigEntity;
|
||||||
|
import com.heyu.api.data.service.vv.VvChartConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
@Service
|
||||||
|
public class VvChartConfigServiceImpl extends ServiceImpl<VvChartConfigDao, VvChartConfigEntity> implements VvChartConfigService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VvChartConfigDao vvChartConfigDao;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VvChartConfigEntity selectVvChartConfigById(Long id){
|
||||||
|
return vvChartConfigDao.selectVvChartConfigById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long insertVvChartConfig(VvChartConfigEntity vvChartConfig){
|
||||||
|
return vvChartConfigDao.insertVvChartConfig(vvChartConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long insertOrUpdateVvChartConfig(VvChartConfigEntity vvChartConfig){
|
||||||
|
return vvChartConfigDao.insertOrUpdateVvChartConfig(vvChartConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateVvChartConfigById(VvChartConfigEntity vvChartConfig){
|
||||||
|
return vvChartConfigDao.updateVvChartConfigById(vvChartConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateCoverVvChartConfigById(VvChartConfigEntity vvChartConfig){
|
||||||
|
return vvChartConfigDao.updateCoverVvChartConfigById(vvChartConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteVvChartConfigById(Long id){
|
||||||
|
return vvChartConfigDao.deleteVvChartConfigById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.heyu.api.data.service.vv;
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 图表配置 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author quyixiao
|
||||||
|
* @since 2025-10-20
|
||||||
|
*/
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.heyu.api.data.entity.vv.VvChartConfigEntity;
|
||||||
|
public interface VvChartConfigService extends IService<VvChartConfigEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VvChartConfigEntity selectVvChartConfigById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
Long insertVvChartConfig(VvChartConfigEntity vvChartConfig);
|
||||||
|
|
||||||
|
|
||||||
|
Long insertOrUpdateVvChartConfig(VvChartConfigEntity vvChartConfig);
|
||||||
|
|
||||||
|
|
||||||
|
int updateVvChartConfigById(VvChartConfigEntity vvChartConfig);
|
||||||
|
|
||||||
|
|
||||||
|
int updateCoverVvChartConfigById(VvChartConfigEntity vvChartConfig);
|
||||||
|
|
||||||
|
|
||||||
|
int deleteVvChartConfigById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -51,7 +51,7 @@ public class ChartUtil {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
if (OsUtil.isLinux()) {
|
if (OsUtil.isLinux()) {
|
||||||
CHART_PATH = "/Users/quyixiao/Desktop/xxx";
|
CHART_PATH = "/mnt/admin/backup";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ public class ChartUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void makeLineAndShapeChart2(String headerName, String xName, String yName, List<LineChartDTO> list) {
|
public String makeLineAndShapeChart2(String headerName, String xName, String yName, List<LineChartDTO> list) {
|
||||||
Set<String> setName = new LinkedHashSet<>();
|
Set<String> setName = new LinkedHashSet<>();
|
||||||
|
|
||||||
Set<String> setX = new LinkedHashSet<>();
|
Set<String> setX = new LinkedHashSet<>();
|
||||||
@ -136,18 +136,18 @@ public class ChartUtil {
|
|||||||
for (int i = 0; i < rowKeys.length; i++) {
|
for (int i = 0; i < rowKeys.length; i++) {
|
||||||
double[] column = new double[columnKeys.length];
|
double[] column = new double[columnKeys.length];
|
||||||
for (int j = 0; j < columnKeys.length; j++) {
|
for (int j = 0; j < columnKeys.length; j++) {
|
||||||
String key = rowKeys[i]+ columnKeys[j];
|
String key = rowKeys[i] + columnKeys[j];
|
||||||
Double value = dataMap.get(key);
|
Double value = dataMap.get(key);
|
||||||
if(value == null){
|
if (value == null) {
|
||||||
value = new Double(0);
|
value = new Double(0);
|
||||||
}
|
}
|
||||||
column[j] = value;
|
column[j] = value;
|
||||||
}
|
}
|
||||||
data[i] = column;
|
data[i] = column;
|
||||||
}
|
}
|
||||||
log.info("makeLineAndShapeChart2 rowKeys:{},columnKeys:{},data:{}", Arrays.toString(rowKeys),Arrays.toString(columnKeys),Arrays.deepToString(data));
|
log.info("makeLineAndShapeChart2 rowKeys:{},columnKeys:{},data:{}", Arrays.toString(rowKeys), Arrays.toString(columnKeys), Arrays.deepToString(data));
|
||||||
CategoryDataset dataset = getBarData(data, rowKeys, columnKeys);
|
CategoryDataset dataset = getBarData(data, rowKeys, columnKeys);
|
||||||
createTimeXYChar(headerName, xName, yName, dataset, "/" + System.currentTimeMillis() + ".jpg");
|
return createTimeXYChar(headerName, xName, yName, dataset, "/" + System.currentTimeMillis() + ".jpg");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -129,17 +129,14 @@ public class GouDeZhaoDDUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void sendMarkDownOrder(String title,String url) throws Exception {
|
||||||
|
|
||||||
public static void sendMarkDownOrder() throws Exception {
|
|
||||||
DingTalkClient client = new DefaultDingTalkClient(dingTalkUrlPre + token);
|
DingTalkClient client = new DefaultDingTalkClient(dingTalkUrlPre + token);
|
||||||
OapiRobotSendRequest request = new OapiRobotSendRequest();
|
OapiRobotSendRequest request = new OapiRobotSendRequest();
|
||||||
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
|
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
|
||||||
request.setMsgtype("markdown");
|
request.setMsgtype("markdown");
|
||||||
markdown.setTitle("近7天下单数据");
|
markdown.setTitle(title);
|
||||||
markdown.setText("【注意】 \n" +
|
markdown.setText("【注意】 \n" +
|
||||||
"> \n" +
|
"> \n" +
|
||||||
|
|
||||||
"");
|
"");
|
||||||
request.setMarkdown(markdown);
|
request.setMarkdown(markdown);
|
||||||
|
|
||||||
@ -154,7 +151,7 @@ public class GouDeZhaoDDUtils {
|
|||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
sendMarkDownOrder();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.heyu.api.data.dao.vv.VvChartConfigDao">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ public class MysqlMain_insert {
|
|||||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||||
|
|
||||||
|
|
||||||
list.add(new TablesBean("vv_create_data_config"));
|
list.add(new TablesBean("vv_chart_config"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ public class MysqlMain_update {
|
|||||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||||
|
|
||||||
|
|
||||||
String a = "vv_all_data";
|
String a = "vv_chart_config";
|
||||||
for (String s : a.split(",")) {
|
for (String s : a.split(",")) {
|
||||||
list.add(new TablesBean(s));
|
list.add(new TablesBean(s));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.aliyun.oss.model.ObjectMetadata;
|
|||||||
import com.aliyun.oss.model.PutObjectResult;
|
import com.aliyun.oss.model.PutObjectResult;
|
||||||
import com.heyu.api.data.constants.MimeTypeEnums;
|
import com.heyu.api.data.constants.MimeTypeEnums;
|
||||||
import com.heyu.api.data.utils.ConfigProperties;
|
import com.heyu.api.data.utils.ConfigProperties;
|
||||||
|
import com.heyu.api.data.utils.DateUtils;
|
||||||
import com.heyu.api.data.utils.DigestUtil;
|
import com.heyu.api.data.utils.DigestUtil;
|
||||||
import com.heyu.api.data.utils.StringUtils;
|
import com.heyu.api.data.utils.StringUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -28,12 +29,18 @@ public class OssFileUploadServiceImpl implements OssFileUploadService {
|
|||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(OssFileUploadServiceImpl.class);
|
private static Logger log = LoggerFactory.getLogger(OssFileUploadServiceImpl.class);
|
||||||
|
|
||||||
private String env = "prd";
|
public static String env = "prd";
|
||||||
|
|
||||||
private String oss_buccket = "heyuimage";
|
private String oss_buccket = "heyuimage";
|
||||||
|
|
||||||
private String oss_url = "http://heyuimage.ihzhy.com/";
|
private String oss_url = "http://heyuimage.ihzhy.com/";
|
||||||
|
|
||||||
|
|
||||||
|
static {
|
||||||
|
env = "prd/" + DateUtils.formatDate(new Date(), "yyyyMM");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OSSClient ossClient;
|
private OSSClient ossClient;
|
||||||
|
|
||||||
|
|||||||
@ -5,11 +5,14 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.heyu.api.alibaba.request.vv.AppOrderRequest;
|
import com.heyu.api.alibaba.request.vv.AppOrderRequest;
|
||||||
import com.heyu.api.common.annotation.Describe;
|
import com.heyu.api.common.annotation.Describe;
|
||||||
import com.heyu.api.data.dao.vv.VvAllDataDao;
|
import com.heyu.api.data.dao.vv.VvAllDataDao;
|
||||||
|
import com.heyu.api.data.dao.vv.VvChartConfigDao;
|
||||||
import com.heyu.api.data.dao.vv.VvCreateDataConfigDao;
|
import com.heyu.api.data.dao.vv.VvCreateDataConfigDao;
|
||||||
import com.heyu.api.data.entity.vv.VvAllDataEntity;
|
import com.heyu.api.data.entity.vv.VvAllDataEntity;
|
||||||
|
import com.heyu.api.data.entity.vv.VvChartConfigEntity;
|
||||||
import com.heyu.api.data.entity.vv.VvCreateDataConfigEntity;
|
import com.heyu.api.data.entity.vv.VvCreateDataConfigEntity;
|
||||||
import com.heyu.api.data.utils.ExpressionParse;
|
import com.heyu.api.data.utils.*;
|
||||||
import com.heyu.api.data.utils.R;
|
import com.heyu.api.oss.OssFileUploadService;
|
||||||
|
import com.heyu.api.oss.OssUploadResult;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
import org.apache.commons.lang3.text.StrSubstitutor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -18,6 +21,10 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -33,8 +40,19 @@ public class AppTestController {
|
|||||||
private VvAllDataDao vvAllDataDao;
|
private VvAllDataDao vvAllDataDao;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ChartUtil chartUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OssFileUploadService ossFileUploadService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private VvCreateDataConfigDao vvCreateDataConfigDao;
|
private VvCreateDataConfigDao vvCreateDataConfigDao;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VvChartConfigDao vvChartConfigDao;
|
||||||
|
|
||||||
// /app/test/insert
|
// /app/test/insert
|
||||||
@Describe("测试数据插入")
|
@Describe("测试数据插入")
|
||||||
@RequestMapping("/insert")
|
@RequestMapping("/insert")
|
||||||
@ -67,5 +85,76 @@ public class AppTestController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /app/test/insert
|
||||||
|
@Describe("测试图表")
|
||||||
|
@RequestMapping("/chart")
|
||||||
|
public R chart(@RequestBody AppOrderRequest vvOrderRequest) throws Exception {
|
||||||
|
|
||||||
|
VvChartConfigEntity vvChartConfigEntity = vvChartConfigDao.selectVvChartConfigById(1L);
|
||||||
|
|
||||||
|
String configSql = vvChartConfigEntity.getSqlConfig();
|
||||||
|
String paramsConfig = vvChartConfigEntity.getParamsConfig();
|
||||||
|
|
||||||
|
Map valuesMap = new HashMap();
|
||||||
|
Map<String, Object> paramMap = JSONObject.parseObject(paramsConfig, Map.class);
|
||||||
|
for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
|
||||||
|
valuesMap.put(entry.getKey(), ExpressionParse.getValue(entry.getValue() + ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
StrSubstitutor sub = new StrSubstitutor(valuesMap);
|
||||||
|
String resolvedString = sub.replace(configSql);
|
||||||
|
|
||||||
|
|
||||||
|
String headerName = "";
|
||||||
|
String xName = "";
|
||||||
|
String yName = "";
|
||||||
|
|
||||||
|
List<LineChartDTO> list = new ArrayList<>();
|
||||||
|
|
||||||
|
List<Map<String, Object>> mapList = vvAllDataDao.selectSQL(resolvedString);
|
||||||
|
if (!CollectionUtils.isEmpty(mapList)) {
|
||||||
|
for (Map<String, Object> objectMap : mapList) {
|
||||||
|
VvAllDataEntity vvAllDataEntity = JSONObject.parseObject(JSON.toJSONString(objectMap), VvAllDataEntity.class);
|
||||||
|
|
||||||
|
LineChartDTO lineChartDTO = new LineChartDTO();
|
||||||
|
lineChartDTO.setName(vvAllDataEntity.getName());
|
||||||
|
lineChartDTO.setX(vvAllDataEntity.getX());
|
||||||
|
lineChartDTO.setY(vvAllDataEntity.getY());
|
||||||
|
|
||||||
|
headerName = vvAllDataEntity.getHeaderTitle();
|
||||||
|
xName = vvAllDataEntity.getXTitle();
|
||||||
|
yName = vvAllDataEntity.getYTitle();
|
||||||
|
|
||||||
|
list.add(lineChartDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String chartPic = chartUtil.makeLineAndShapeChart2(headerName, xName, yName, list);
|
||||||
|
|
||||||
|
File file1 = new File(chartPic);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String picUrl = "repayPic/repayChart" +System.currentTimeMillis()+ ".jpg";
|
||||||
|
|
||||||
|
InputStream inputStream = new FileInputStream(file1);
|
||||||
|
|
||||||
|
OssUploadResult ossUploadResult = ossFileUploadService.uploadImageToOss(inputStream, picUrl, Integer.parseInt(String.valueOf(file1.length())));
|
||||||
|
|
||||||
|
// file1.delete();
|
||||||
|
|
||||||
|
String url = ossUploadResult.getUrl();
|
||||||
|
log.info("chartPic :{} url:{}",chartPic,url);
|
||||||
|
|
||||||
|
GouDeZhaoDDUtils.sendMarkDownOrder(headerName,url);
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println(System.currentTimeMillis() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,122 @@
|
|||||||
|
package com.heyu.api.listener;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.heyu.api.data.dao.vv.VvAllDataDao;
|
||||||
|
import com.heyu.api.data.entity.vv.VvAllDataEntity;
|
||||||
|
import com.heyu.api.data.entity.vv.VvChartConfigEntity;
|
||||||
|
import com.heyu.api.data.utils.ChartUtil;
|
||||||
|
import com.heyu.api.data.utils.ExpressionParse;
|
||||||
|
import com.heyu.api.data.utils.GouDeZhaoDDUtils;
|
||||||
|
import com.heyu.api.data.utils.LineChartDTO;
|
||||||
|
import com.heyu.api.oss.OssFileUploadService;
|
||||||
|
import com.heyu.api.oss.OssUploadResult;
|
||||||
|
import com.rabbitmq.client.Channel;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.text.StrSubstitutor;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.amqp.support.AmqpHeaders;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.messaging.handler.annotation.Header;
|
||||||
|
import org.springframework.messaging.handler.annotation.Payload;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class SendDingDingQueueSimpleRabbitListener {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VvAllDataDao vvAllDataDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ChartUtil chartUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OssFileUploadService ossFileUploadService;
|
||||||
|
|
||||||
|
@RabbitHandler
|
||||||
|
@RabbitListener(queues = "#{sendDingDingQueue.name}", containerFactory = "accountAmountQueueSimpleRabbitListenerContainerFactory")
|
||||||
|
public void consumeMessage(@Payload String message, @Header(AmqpHeaders.DELIVERY_TAG) long delivertTag, Channel channel) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
VvChartConfigEntity vvChartConfigEntity = JSONObject.parseObject(message, VvChartConfigEntity.class);
|
||||||
|
|
||||||
|
String configSql = vvChartConfigEntity.getSqlConfig();
|
||||||
|
String paramsConfig = vvChartConfigEntity.getParamsConfig();
|
||||||
|
|
||||||
|
Map valuesMap = new HashMap();
|
||||||
|
Map<String, Object> paramMap = JSONObject.parseObject(paramsConfig, Map.class);
|
||||||
|
for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
|
||||||
|
valuesMap.put(entry.getKey(), ExpressionParse.getValue(entry.getValue() + ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
StrSubstitutor sub = new StrSubstitutor(valuesMap);
|
||||||
|
String resolvedString = sub.replace(configSql);
|
||||||
|
|
||||||
|
|
||||||
|
String headerName = "";
|
||||||
|
String xName = "";
|
||||||
|
String yName = "";
|
||||||
|
|
||||||
|
List<LineChartDTO> list = new ArrayList<>();
|
||||||
|
|
||||||
|
List<Map<String, Object>> mapList = vvAllDataDao.selectSQL(resolvedString);
|
||||||
|
if (!CollectionUtils.isEmpty(mapList)) {
|
||||||
|
for (Map<String, Object> objectMap : mapList) {
|
||||||
|
VvAllDataEntity vvAllDataEntity = JSONObject.parseObject(JSON.toJSONString(objectMap), VvAllDataEntity.class);
|
||||||
|
|
||||||
|
LineChartDTO lineChartDTO = new LineChartDTO();
|
||||||
|
lineChartDTO.setName(vvAllDataEntity.getName());
|
||||||
|
lineChartDTO.setX(vvAllDataEntity.getX());
|
||||||
|
lineChartDTO.setY(vvAllDataEntity.getY());
|
||||||
|
|
||||||
|
headerName = vvAllDataEntity.getHeaderTitle();
|
||||||
|
xName = vvAllDataEntity.getXTitle();
|
||||||
|
yName = vvAllDataEntity.getYTitle();
|
||||||
|
|
||||||
|
list.add(lineChartDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String chartPic = chartUtil.makeLineAndShapeChart2(headerName, xName, yName, list);
|
||||||
|
|
||||||
|
File file1 = new File(chartPic);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String picUrl = "repayPic/repayChart" +System.currentTimeMillis()+ ".jpg";
|
||||||
|
|
||||||
|
InputStream inputStream = new FileInputStream(file1);
|
||||||
|
|
||||||
|
OssUploadResult ossUploadResult = ossFileUploadService.uploadImageToOss(inputStream, picUrl, Integer.parseInt(String.valueOf(file1.length())));
|
||||||
|
|
||||||
|
// file1.delete();
|
||||||
|
|
||||||
|
String url = ossUploadResult.getUrl();
|
||||||
|
log.info("chartPic :{} url:{}",chartPic,url);
|
||||||
|
|
||||||
|
GouDeZhaoDDUtils.sendMarkDownOrder(headerName,url);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("urlStatisticQueue handle", e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
log.info("urlStatisticQueue消息{},消息确认完成", message);
|
||||||
|
channel.basicAck(delivertTag, true);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("urlStatisticQueue消息确认异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,8 +2,10 @@ package com.heyu.api.schedule.impl;
|
|||||||
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.heyu.api.data.dao.vv.VvChartConfigDao;
|
||||||
import com.heyu.api.data.dao.vv.VvCreateDataConfigDao;
|
import com.heyu.api.data.dao.vv.VvCreateDataConfigDao;
|
||||||
import com.heyu.api.data.dto.VvCreateDataConfigDTO;
|
import com.heyu.api.data.dto.VvCreateDataConfigDTO;
|
||||||
|
import com.heyu.api.data.entity.vv.VvChartConfigEntity;
|
||||||
import com.heyu.api.data.entity.vv.VvCreateDataConfigEntity;
|
import com.heyu.api.data.entity.vv.VvCreateDataConfigEntity;
|
||||||
import com.heyu.api.schedule.CronTriggerUtils;
|
import com.heyu.api.schedule.CronTriggerUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -23,14 +25,21 @@ public class TestJob {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private VvCreateDataConfigDao createDataConfigDao;
|
private VvCreateDataConfigDao createDataConfigDao;
|
||||||
|
|
||||||
|
|
||||||
@Value("${eb.config.rabbitQueue.createDataQueue}")
|
@Value("${eb.config.rabbitQueue.createDataQueue}")
|
||||||
private String createDataQueue;
|
private String createDataQueue;
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${eb.config.rabbitQueue.sendDingDingQueue}")
|
||||||
|
private String sendDingDingQueue;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RabbitTemplate rabbitTemplate;
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VvChartConfigDao vvChartConfigDao;
|
||||||
|
|
||||||
|
|
||||||
public void test() {
|
public void test() {
|
||||||
List<VvCreateDataConfigEntity> vvCreateDataConfigEntityList = createDataConfigDao.selectVvCreateDataConfigByAll();
|
List<VvCreateDataConfigEntity> vvCreateDataConfigEntityList = createDataConfigDao.selectVvCreateDataConfigByAll();
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
@ -42,5 +51,12 @@ public class TestJob {
|
|||||||
rabbitTemplate.convertAndSend(createDataQueue, JSON.toJSONString(dto));
|
rabbitTemplate.convertAndSend(createDataQueue, JSON.toJSONString(dto));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<VvChartConfigEntity> vvChartConfigEntities = vvChartConfigDao.selectVvChartConfigByAll();
|
||||||
|
for (VvChartConfigEntity vvChartConfigEntity : vvChartConfigEntities) {
|
||||||
|
if (CronTriggerUtils.isRun(now, vvChartConfigEntity.getCronExp())) {
|
||||||
|
rabbitTemplate.convertAndSend(sendDingDingQueue, JSON.toJSONString(vvChartConfigEntity));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,6 +59,7 @@ eb:
|
|||||||
postCodeData: post_code_data
|
postCodeData: post_code_data
|
||||||
urlStatisticQueue: URL_STATISTIC_QUEUE
|
urlStatisticQueue: URL_STATISTIC_QUEUE
|
||||||
createDataQueue: CREATE_DATA_QUEUE
|
createDataQueue: CREATE_DATA_QUEUE
|
||||||
|
sendDingDingQueue: SEND_DING_DING_QUEUE
|
||||||
|
|
||||||
|
|
||||||
tencent:
|
tencent:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user